Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
ccd96bb4
Commit
ccd96bb4
authored
Feb 15, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added --export command line flag for using export templates, --export-image now export images
parent
57ea6d26
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
67 deletions
+112
-67
src/cli/cli_main.cpp
src/cli/cli_main.cpp
+2
-10
src/cli/cli_main.hpp
src/cli/cli_main.hpp
+0
-1
src/cli/text_io_handler.cpp
src/cli/text_io_handler.cpp
+20
-5
src/cli/text_io_handler.hpp
src/cli/text_io_handler.hpp
+1
-0
src/cli/win32_cli_wrapper.cpp
src/cli/win32_cli_wrapper.cpp
+20
-2
src/main.cpp
src/main.cpp
+69
-49
No files found.
src/cli/cli_main.cpp
View file @
ccd96bb4
...
@@ -34,7 +34,7 @@ CLISetInterface::CLISetInterface(const SetP& set, bool quiet)
...
@@ -34,7 +34,7 @@ CLISetInterface::CLISetInterface(const SetP& set, bool quiet)
setSet
(
set
);
setSet
(
set
);
// show welcome logo
// show welcome logo
if
(
!
quiet
)
showWelcome
();
if
(
!
quiet
)
showWelcome
();
print_pending_errors
();
cli
.
print_pending_errors
();
}
}
CLISetInterface
::~
CLISetInterface
()
{
CLISetInterface
::~
CLISetInterface
()
{
...
@@ -90,7 +90,7 @@ void CLISetInterface::run_interactive() {
...
@@ -90,7 +90,7 @@ void CLISetInterface::run_interactive() {
String
command
=
cli
.
getLine
();
String
command
=
cli
.
getLine
();
if
(
command
.
empty
()
&&
!
cli
.
canGetLine
())
break
;
if
(
command
.
empty
()
&&
!
cli
.
canGetLine
())
break
;
handleCommand
(
command
);
handleCommand
(
command
);
print_pending_errors
();
cli
.
print_pending_errors
();
cli
.
flush
();
cli
.
flush
();
cli
.
flushRaw
();
cli
.
flushRaw
();
}
}
...
@@ -272,11 +272,3 @@ void CLISetInterface::handleCommand(const String& command) {
...
@@ -272,11 +272,3 @@ void CLISetInterface::handleCommand(const String& command) {
}
}
}
}
#endif
#endif
void
CLISetInterface
::
print_pending_errors
()
{
MessageType
type
;
String
msg
;
while
(
get_queued_message
(
type
,
msg
))
{
cli
.
show_message
(
type
,
msg
);
}
}
src/cli/cli_main.hpp
View file @
ccd96bb4
...
@@ -40,7 +40,6 @@ class CLISetInterface : public SetView {
...
@@ -40,7 +40,6 @@ class CLISetInterface : public SetView {
#if USE_SCRIPT_PROFILING
#if USE_SCRIPT_PROFILING
void
showProfilingStats
(
const
FunctionProfile
&
parent
,
int
level
=
0
);
void
showProfilingStats
(
const
FunctionProfile
&
parent
,
int
level
=
0
);
#endif
#endif
void
print_pending_errors
();
/// our own context, when no set is loaded
/// our own context, when no set is loaded
Context
&
getContext
();
Context
&
getContext
();
...
...
src/cli/text_io_handler.cpp
View file @
ccd96bb4
...
@@ -55,7 +55,7 @@ void TextIOHandler::init() {
...
@@ -55,7 +55,7 @@ void TextIOHandler::init() {
have_console
=
false
;
have_console
=
false
;
have_stderr
=
false
;
have_stderr
=
false
;
// Use console mode if one of the cli flags is passed
// Use console mode if one of the cli flags is passed
static
const
Char
*
redirect_flags
[]
=
{
_
(
"-?"
),
_
(
"--help"
),
_
(
"-v"
),
_
(
"--version"
),
_
(
"--cli"
),
_
(
"-c"
),
_
(
"--export"
),
_
(
"--create-installer"
)};
static
const
Char
*
redirect_flags
[]
=
{
_
(
"-?"
),
_
(
"--help"
),
_
(
"-v"
),
_
(
"--version"
),
_
(
"--cli"
),
_
(
"-c"
),
_
(
"--export"
),
_
(
"--
export-images"
),
_
(
"--
create-installer"
)};
for
(
int
i
=
1
;
i
<
wxTheApp
->
argc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
wxTheApp
->
argc
;
++
i
)
{
for
(
int
j
=
0
;
j
<
sizeof
(
redirect_flags
)
/
sizeof
(
redirect_flags
[
0
])
;
++
j
)
{
for
(
int
j
=
0
;
j
<
sizeof
(
redirect_flags
)
/
sizeof
(
redirect_flags
[
0
])
;
++
j
)
{
if
(
String
(
wxTheApp
->
argv
[
i
])
==
redirect_flags
[
j
])
{
if
(
String
(
wxTheApp
->
argv
[
i
])
==
redirect_flags
[
j
])
{
...
@@ -152,12 +152,12 @@ void TextIOHandler::flushRaw() {
...
@@ -152,12 +152,12 @@ void TextIOHandler::flushRaw() {
if
(
!
buffer
.
empty
())
{
if
(
!
buffer
.
empty
())
{
#ifdef UNICODE
#ifdef UNICODE
wxCharBuffer
buf
=
buffer
.
mb_str
(
wxConvUTF8
);
wxCharBuffer
buf
=
buffer
.
mb_str
(
wxConvUTF8
);
fputs
(
buf
,
st
dout
);
fputs
(
buf
,
st
ream
);
#else
#else
fputs
(
buffer
.
c_str
(),
st
dout
);
fputs
(
buffer
.
c_str
(),
st
ream
);
#endif
#endif
}
}
fflush
(
st
dout
);
fflush
(
st
ream
);
// clear
// clear
buffer
.
clear
();
buffer
.
clear
();
raw_mode_status
=
0
;
raw_mode_status
=
0
;
...
@@ -166,7 +166,8 @@ void TextIOHandler::flushRaw() {
...
@@ -166,7 +166,8 @@ void TextIOHandler::flushRaw() {
// ----------------------------------------------------------------------------- : Errors
// ----------------------------------------------------------------------------- : Errors
void
TextIOHandler
::
show_message
(
MessageType
type
,
String
const
&
message
)
{
void
TextIOHandler
::
show_message
(
MessageType
type
,
String
const
&
message
)
{
stream
=
stdout
;
flush
();
stream
=
stderr
;
if
(
type
==
MESSAGE_WARNING
)
{
if
(
type
==
MESSAGE_WARNING
)
{
*
this
<<
YELLOW
<<
_
(
"WARNING: "
)
<<
NORMAL
<<
replace_all
(
message
,
_
(
"
\n
"
),
_
(
"
\n
"
))
<<
ENDL
;
*
this
<<
YELLOW
<<
_
(
"WARNING: "
)
<<
NORMAL
<<
replace_all
(
message
,
_
(
"
\n
"
),
_
(
"
\n
"
))
<<
ENDL
;
}
else
{
}
else
{
...
@@ -176,3 +177,17 @@ void TextIOHandler::show_message(MessageType type, String const& message) {
...
@@ -176,3 +177,17 @@ void TextIOHandler::show_message(MessageType type, String const& message) {
stream
=
stdout
;
stream
=
stdout
;
if
(
raw_mode
)
raw_mode_status
=
max
(
raw_mode_status
,
type
==
MESSAGE_WARNING
?
1
:
2
);
if
(
raw_mode
)
raw_mode_status
=
max
(
raw_mode_status
,
type
==
MESSAGE_WARNING
?
1
:
2
);
}
}
void
TextIOHandler
::
print_pending_errors
()
{
MessageType
type
;
String
msg
;
while
(
get_queued_message
(
type
,
msg
))
{
if
(
haveConsole
())
{
cli
.
show_message
(
type
,
msg
);
cli
.
flush
();
}
else
{
// no console, use a messagebox instead
wxMessageBox
(
msg
,
wxMessageBoxCaptionStr
,
type
==
MESSAGE_INFO
?
wxICON_INFORMATION
:
type
==
MESSAGE_WARNING
?
wxICON_WARNING
:
wxICON_ERROR
);
}
}
}
src/cli/text_io_handler.hpp
View file @
ccd96bb4
...
@@ -38,6 +38,7 @@ class TextIOHandler {
...
@@ -38,6 +38,7 @@ class TextIOHandler {
/// Show an error or warning message
/// Show an error or warning message
void
show_message
(
MessageType
type
,
String
const
&
message
);
void
show_message
(
MessageType
type
,
String
const
&
message
);
void
print_pending_errors
();
/// Enable raw mode
/// Enable raw mode
void
enableRaw
();
void
enableRaw
();
...
...
src/cli/win32_cli_wrapper.cpp
View file @
ccd96bb4
...
@@ -45,6 +45,7 @@ DWORD WINAPI TransferThread(Transfer*);
...
@@ -45,6 +45,7 @@ DWORD WINAPI TransferThread(Transfer*);
BOOL
WINAPI
HandleCtrlEvent
(
DWORD
type
);
BOOL
WINAPI
HandleCtrlEvent
(
DWORD
type
);
void
CopyFileBuffer
(
HANDLE
output
,
char
*
buffer
,
DWORD
size
);
void
CopyFileBuffer
(
HANDLE
output
,
char
*
buffer
,
DWORD
size
);
void
InitEscapeTranslation
(
HANDLE
console
);
void
InitEscapeTranslation
(
HANDLE
console
);
void
FinishEscapeTranslation
(
HANDLE
console
);
void
PerformEscapeCode
(
HANDLE
console
,
char
command
,
int
argc
,
int
argv
[]);
void
PerformEscapeCode
(
HANDLE
console
,
char
command
,
int
argc
,
int
argv
[]);
/// The child process
/// The child process
...
@@ -54,14 +55,15 @@ PROCESS_INFORMATION child_process_info;
...
@@ -54,14 +55,15 @@ PROCESS_INFORMATION child_process_info;
HANDLE
in_mine
,
in_theirs
,
in_real
;
HANDLE
in_mine
,
in_theirs
,
in_real
;
HANDLE
out_mine
,
out_theirs
,
out_real
;
HANDLE
out_mine
,
out_theirs
,
out_real
;
HANDLE
err_mine
,
err_theirs
,
err_real
;
HANDLE
err_mine
,
err_theirs
,
err_real
;
bool
need_redirection
;
// ----------------------------------------------------------------------------- : Main function
// ----------------------------------------------------------------------------- : Main function
const
char
*
redirect_flags
[]
=
{
"-?"
,
"
--help"
,
"-v"
,
"--version"
,
"--cli"
,
"-c"
,
"--export
"
,
"--create-installer"
};
const
char
*
redirect_flags
[]
=
{
"-?"
,
"
/?"
,
"--help"
,
"-v"
,
"--version"
,
"--cli"
,
"-c"
,
"--export"
,
"--export-images
"
,
"--create-installer"
};
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
// determine whether we need to wrap console i/o
// determine whether we need to wrap console i/o
bool
need_redirection
=
false
;
need_redirection
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
for
(
int
j
=
0
;
j
<
sizeof
(
redirect_flags
)
/
sizeof
(
redirect_flags
[
0
])
;
++
j
)
{
for
(
int
j
=
0
;
j
<
sizeof
(
redirect_flags
)
/
sizeof
(
redirect_flags
[
0
])
;
++
j
)
{
if
(
strcmp
(
argv
[
i
],
redirect_flags
[
j
])
==
0
)
{
if
(
strcmp
(
argv
[
i
],
redirect_flags
[
j
])
==
0
)
{
...
@@ -115,6 +117,7 @@ int main(int argc, char** argv) {
...
@@ -115,6 +117,7 @@ int main(int argc, char** argv) {
out_real
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
out_real
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
err_real
=
GetStdHandle
(
STD_ERROR_HANDLE
);
err_real
=
GetStdHandle
(
STD_ERROR_HANDLE
);
InitEscapeTranslation
(
out_real
);
InitEscapeTranslation
(
out_real
);
InitEscapeTranslation
(
err_real
);
// start threads
// start threads
Transfer
tranfer_in
=
{
in_real
,
in_mine
,
false
};
Transfer
tranfer_in
=
{
in_real
,
in_mine
,
false
};
...
@@ -134,6 +137,7 @@ int main(int argc, char** argv) {
...
@@ -134,6 +137,7 @@ int main(int argc, char** argv) {
// start the child program
// start the child program
if
(
!
CreateProcess
(
app_path
,
command_line
,
NULL
,
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
child_startup_info
,
&
child_process_info
))
{
if
(
!
CreateProcess
(
app_path
,
command_line
,
NULL
,
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
child_startup_info
,
&
child_process_info
))
{
fprintf
(
stderr
,
"Unable to start child process.
\n
"
);
ExitProcess
(
1
);
ExitProcess
(
1
);
}
}
...
@@ -146,6 +150,10 @@ int main(int argc, char** argv) {
...
@@ -146,6 +150,10 @@ int main(int argc, char** argv) {
}
}
// That's all folks!
// That's all folks!
if
(
need_redirection
)
{
FinishEscapeTranslation
(
out_real
);
FinishEscapeTranslation
(
err_real
);
}
return
exit_code
;
return
exit_code
;
}
}
...
@@ -168,6 +176,10 @@ BOOL WINAPI HandleCtrlEvent(DWORD type) {
...
@@ -168,6 +176,10 @@ BOOL WINAPI HandleCtrlEvent(DWORD type) {
TerminateProcess
(
child_process_info
.
hProcess
,
1
);
TerminateProcess
(
child_process_info
.
hProcess
,
1
);
}
}
// exit this process
// exit this process
if
(
need_redirection
)
{
FinishEscapeTranslation
(
out_real
);
FinishEscapeTranslation
(
err_real
);
}
ExitProcess
(
exit_code
);
ExitProcess
(
exit_code
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -251,6 +263,12 @@ void InitEscapeTranslation(HANDLE console) {
...
@@ -251,6 +263,12 @@ void InitEscapeTranslation(HANDLE console) {
original_attributes
=
screen_buffer
.
wAttributes
;
original_attributes
=
screen_buffer
.
wAttributes
;
}
}
/// Cleanup for escape translation: put things back to normal
void
FinishEscapeTranslation
(
HANDLE
console
)
{
CONSOLE_SCREEN_BUFFER_INFO
screen_buffer
;
SetConsoleTextAttribute
(
console
,
original_attributes
);
}
/// Perform an escape code
/// Perform an escape code
void
PerformEscapeCode
(
HANDLE
console
,
char
command
,
int
argc
,
int
argv
[])
{
void
PerformEscapeCode
(
HANDLE
console
,
char
command
,
int
argc
,
int
argv
[])
{
switch
(
command
)
{
switch
(
command
)
{
...
...
src/main.cpp
View file @
ccd96bb4
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
#include <wx/txtstrm.h>
#include <wx/txtstrm.h>
#include <wx/socket.h>
#include <wx/socket.h>
ScriptValueP
export_set
(
SetP
const
&
set
,
vector
<
CardP
>
const
&
cards
,
ExportTemplateP
const
&
exp
,
String
const
&
outname
);
DECLARE_TYPEOF_COLLECTION
(
String
);
DECLARE_TYPEOF_COLLECTION
(
String
);
// ----------------------------------------------------------------------------- : Main function/class
// ----------------------------------------------------------------------------- : Main function/class
...
@@ -98,44 +100,47 @@ int MSE::OnRun() {
...
@@ -98,44 +100,47 @@ int MSE::OnRun() {
nag_about_ascii_version
();
nag_about_ascii_version
();
// interpret command line
// interpret command line
if
(
argc
>
1
)
{
{
try
{
vector
<
String
>
args
;
String
arg
=
argv
[
1
];
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
args
.
push_back
(
argv
[
i
]);
if
(
args
.
back
()
==
_
(
"--color"
))
args
.
pop_back
();
// ingnore the --color argument, it is handled by cli.init()
}
if
(
!
args
.
empty
())
{
// Find the extension
// Find the extension
wxFileName
f
(
arg
.
Mid
(
0
,
arg
.
find_last_not_of
(
_
(
"
\\
/"
))
+
1
));
wxFileName
f
(
arg
s
[
0
].
Mid
(
0
,
args
[
0
]
.
find_last_not_of
(
_
(
"
\\
/"
))
+
1
));
if
(
f
.
GetExt
()
==
_
(
"mse-symbol"
))
{
if
(
f
.
GetExt
()
==
_
(
"mse-symbol"
))
{
// Show the symbol editor
// Show the symbol editor
Window
*
wnd
=
new
SymbolWindow
(
nullptr
,
arg
v
[
1
]);
Window
*
wnd
=
new
SymbolWindow
(
nullptr
,
arg
s
[
0
]);
wnd
->
Show
();
wnd
->
Show
();
return
runGUI
();
return
runGUI
();
}
else
if
(
f
.
GetExt
()
==
_
(
"mse-set"
)
||
f
.
GetExt
()
==
_
(
"mse"
)
||
f
.
GetExt
()
==
_
(
"set"
))
{
}
else
if
(
f
.
GetExt
()
==
_
(
"mse-set"
)
||
f
.
GetExt
()
==
_
(
"mse"
)
||
f
.
GetExt
()
==
_
(
"set"
))
{
// Show the set window
// Show the set window
Window
*
wnd
=
new
SetWindow
(
nullptr
,
import_set
(
arg
v
[
1
]));
Window
*
wnd
=
new
SetWindow
(
nullptr
,
import_set
(
arg
s
[
0
]));
wnd
->
Show
();
wnd
->
Show
();
return
runGUI
();
return
runGUI
();
}
else
if
(
f
.
GetExt
()
==
_
(
"mse-installer"
))
{
}
else
if
(
f
.
GetExt
()
==
_
(
"mse-installer"
))
{
// Installer; install it
// Installer; install it
InstallType
type
=
settings
.
install_type
;
InstallType
type
=
settings
.
install_type
;
if
(
argc
>
2
)
{
if
(
args
.
size
()
>=
2
)
{
String
arg
=
argv
[
2
];
if
(
starts_with
(
args
[
1
],
_
(
"--"
)))
{
if
(
starts_with
(
argv
[
2
],
_
(
"--"
))
&&
arg
!=
_
(
"--color"
))
{
parse_enum
(
String
(
args
[
1
]).
substr
(
2
),
type
);
parse_enum
(
String
(
argv
[
2
]).
substr
(
2
),
type
);
}
}
}
}
InstallerP
installer
=
open_package
<
Installer
>
(
arg
v
[
1
]);
InstallerP
installer
=
open_package
<
Installer
>
(
arg
s
[
0
]);
PackagesWindow
wnd
(
nullptr
,
installer
);
PackagesWindow
wnd
(
nullptr
,
installer
);
wnd
.
ShowModal
();
wnd
.
ShowModal
();
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--symbol-editor"
))
{
}
else
if
(
arg
s
[
0
]
==
_
(
"--symbol-editor"
))
{
Window
*
wnd
=
new
SymbolWindow
(
nullptr
);
Window
*
wnd
=
new
SymbolWindow
(
nullptr
);
wnd
->
Show
();
wnd
->
Show
();
return
runGUI
();
return
runGUI
();
}
else
if
(
arg
==
_
(
"--create-installer"
))
{
}
else
if
(
arg
s
[
0
]
==
_
(
"--create-installer"
))
{
// create an installer
// create an installer
Installer
inst
;
Installer
inst
;
for
(
int
i
=
2
;
i
<
argc
;
++
i
)
{
FOR_EACH
(
arg
,
args
)
{
if
(
!
starts_with
(
arg
v
[
i
]
,
_
(
"--"
)))
{
if
(
!
starts_with
(
arg
,
_
(
"--"
)))
{
inst
.
addPackage
(
arg
v
[
i
]
);
inst
.
addPackage
(
arg
);
}
}
}
}
if
(
inst
.
prefered_filename
.
empty
())
{
if
(
inst
.
prefered_filename
.
empty
())
{
...
@@ -144,43 +149,46 @@ int MSE::OnRun() {
...
@@ -144,43 +149,46 @@ int MSE::OnRun() {
inst
.
saveAs
(
inst
.
prefered_filename
,
false
);
inst
.
saveAs
(
inst
.
prefered_filename
,
false
);
}
}
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--help"
)
||
arg
==
_
(
"-
?"
))
{
}
else
if
(
arg
s
[
0
]
==
_
(
"--help"
)
||
args
[
0
]
==
_
(
"-?"
)
||
args
[
0
]
==
_
(
"/
?"
))
{
// command line help
// command line help
cli
<<
_
(
"Magic Set Editor
\n\n
"
);
cli
<<
_
(
"Magic Set Editor
\n\n
"
);
cli
<<
_
(
"Usage: "
)
<<
BRIGHT
<<
argv
[
0
]
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"OPTIONS"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"Usage: "
)
<<
BRIGHT
<<
argv
[
0
]
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"OPTIONS"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"
\n\n
no options"
);
cli
<<
_
(
"
\n\n
no options"
);
cli
<<
_
(
"
\n
\t
Start the MSE user interface showing the welcome window."
);
cli
<<
_
(
"
\n
\t
Start the MSE user interface showing the welcome window."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"-?"
)
<<
NORMAL
<<
_
(
", "
)
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"-?"
)
<<
NORMAL
<<
_
(
", "
)
<<
BRIGHT
<<
_
(
"--help"
)
<<
NORMAL
;
<<
BRIGHT
<<
_
(
"--help"
)
<<
NORMAL
;
cli
<<
_
(
"
\n
\t
Shows this help screen."
);
cli
<<
_
(
"
\n
\t
Shows this help screen."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"-v"
)
<<
NORMAL
<<
_
(
", "
)
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"-v"
)
<<
NORMAL
<<
_
(
", "
)
<<
BRIGHT
<<
_
(
"--version"
)
<<
NORMAL
;
<<
BRIGHT
<<
_
(
"--version"
)
<<
NORMAL
;
cli
<<
_
(
"
\n
\t
Show version information."
);
cli
<<
_
(
"
\n
\t
Show version information."
);
cli
<<
_
(
"
\n\n
"
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse-set"
)
<<
NORMAL
<<
_
(
", "
)
cli
<<
_
(
"
\n\n
"
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse-set"
)
<<
NORMAL
<<
_
(
", "
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".set"
)
<<
NORMAL
<<
_
(
", "
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".set"
)
<<
NORMAL
<<
_
(
", "
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse"
)
<<
NORMAL
;
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse"
)
<<
NORMAL
;
cli
<<
_
(
"
\n
\t
Load the set file in the MSE user interface."
);
cli
<<
_
(
"
\n
\t
Load the set file in the MSE user interface."
);
cli
<<
_
(
"
\n\n
"
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse-symbol"
)
<<
NORMAL
;
cli
<<
_
(
"
\n\n
"
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse-symbol"
)
<<
NORMAL
;
cli
<<
_
(
"
\n
\t
Load the symbol into the MSE symbol editor."
);
cli
<<
_
(
"
\n
\t
Load the symbol into the MSE symbol editor."
);
cli
<<
_
(
"
\n\n
"
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse-installer"
)
cli
<<
_
(
"
\n\n
"
)
<<
PARAM
<<
_
(
"FILE"
)
<<
FILE_EXT
<<
_
(
".mse-installer"
)
<<
NORMAL
<<
_
(
" ["
)
<<
BRIGHT
<<
_
(
"--local"
)
<<
NORMAL
<<
_
(
"]"
);
<<
NORMAL
<<
_
(
" ["
)
<<
BRIGHT
<<
_
(
"--local"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"
\n
\t
Install the packages from the installer."
);
cli
<<
_
(
"
\n
\t
Install the packages from the installer."
);
cli
<<
_
(
"
\n
\t
If the "
)
<<
BRIGHT
<<
_
(
"--local"
)
<<
NORMAL
<<
_
(
" flag is passed, install packages for this user only."
);
cli
<<
_
(
"
\n
\t
If the "
)
<<
BRIGHT
<<
_
(
"--local"
)
<<
NORMAL
<<
_
(
" flag is passed, install packages for this user only."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--symbol-editor"
)
<<
NORMAL
;
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--symbol-editor"
)
<<
NORMAL
;
cli
<<
_
(
"
\n
\t
Show the symbol editor instead of the welcome window."
);
cli
<<
_
(
"
\n
\t
Show the symbol editor instead of the welcome window."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--create-installer"
)
<<
NORMAL
<<
_
(
" ["
)
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--create-installer"
)
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"OUTFILE"
)
<<
FILE_EXT
<<
_
(
".mse-installer"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
PARAM
<<
_
(
"OUTFILE"
)
<<
FILE_EXT
<<
_
(
".mse-installer"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
PARAM
<<
_
(
"PACKAGE"
)
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"PACKAGE"
)
<<
NORMAL
<<
_
(
" ...]]"
);
<<
PARAM
<<
_
(
"PACKAGE"
)
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"PACKAGE"
)
<<
NORMAL
<<
_
(
" ...]]"
);
cli
<<
_
(
"
\n
\t
Create an instaler, containing the listed packages."
);
cli
<<
_
(
"
\n
\t
Create an instaler, containing the listed packages."
);
cli
<<
_
(
"
\n
\t
If no output filename is specified, the name of the first package is used."
);
cli
<<
_
(
"
\n
\t
If no output filename is specified, the name of the first package is used."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--export"
)
<<
NORMAL
<<
PARAM
<<
_
(
" FILE"
)
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"IMAGE"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--export"
)
<<
NORMAL
<<
PARAM
<<
_
(
" TEMPLATE SETFILE "
)
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"OUTFILE"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"
\n
\t
Export a set using an export template."
);
cli
<<
_
(
"
\n
\t
If no output filename is specified, the result is written to stdout."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--export-images"
)
<<
NORMAL
<<
PARAM
<<
_
(
" SETFILE"
)
<<
NORMAL
<<
_
(
" ["
)
<<
PARAM
<<
_
(
"IMAGE"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"
\n
\t
Export the cards in a set to image files,"
);
cli
<<
_
(
"
\n
\t
Export the cards in a set to image files,"
);
cli
<<
_
(
"
\n
\t
IMAGE is the same format as for 'export all card images'."
);
cli
<<
_
(
"
\n
\t
IMAGE is the same format as for 'export all card images'."
);
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--cli"
)
<<
NORMAL
<<
_
(
" ["
)
cli
<<
_
(
"
\n\n
"
)
<<
BRIGHT
<<
_
(
"--cli"
)
<<
NORMAL
<<
_
(
" ["
)
<<
BRIGHT
<<
_
(
"--quiet"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
BRIGHT
<<
_
(
"--quiet"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
BRIGHT
<<
_
(
"--raw"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
BRIGHT
<<
_
(
"--raw"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
BRIGHT
<<
_
(
"--script "
)
<<
NORMAL
<<
PARAM
<<
_
(
"FILE"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
BRIGHT
<<
_
(
"--script "
)
<<
NORMAL
<<
PARAM
<<
_
(
"FILE"
)
<<
NORMAL
<<
_
(
"] ["
)
<<
PARAM
<<
_
(
"SETFILE"
)
<<
NORMAL
<<
_
(
"]"
);
<<
PARAM
<<
_
(
"SETFILE"
)
<<
NORMAL
<<
_
(
"]"
);
cli
<<
_
(
"
\n
\t
Start the command line interface for performing commands on the set file."
);
cli
<<
_
(
"
\n
\t
Start the command line interface for performing commands on the set file."
);
cli
<<
_
(
"
\n
\t
Use "
)
<<
BRIGHT
<<
_
(
"-q"
)
<<
NORMAL
<<
_
(
" or "
)
<<
BRIGHT
<<
_
(
"--quiet"
)
<<
NORMAL
<<
_
(
" to supress the startup banner and prompts."
);
cli
<<
_
(
"
\n
\t
Use "
)
<<
BRIGHT
<<
_
(
"-q"
)
<<
NORMAL
<<
_
(
" or "
)
<<
BRIGHT
<<
_
(
"--quiet"
)
<<
NORMAL
<<
_
(
" to supress the startup banner and prompts."
);
cli
<<
_
(
"
\n
\t
Use "
)
<<
BRIGHT
<<
_
(
"--raw"
)
<<
NORMAL
<<
_
(
" for raw output mode."
);
cli
<<
_
(
"
\n
\t
Use "
)
<<
BRIGHT
<<
_
(
"--raw"
)
<<
NORMAL
<<
_
(
" for raw output mode."
);
...
@@ -195,20 +203,20 @@ int MSE::OnRun() {
...
@@ -195,20 +203,20 @@ int MSE::OnRun() {
cli
<<
ENDL
;
cli
<<
ENDL
;
cli
.
flush
();
cli
.
flush
();
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--version"
)
||
arg
==
_
(
"-v
"
))
{
}
else
if
(
arg
s
[
0
]
==
_
(
"--version"
)
||
args
[
0
]
==
_
(
"-v"
)
||
args
[
0
]
==
_
(
"-V
"
))
{
// dump version
// dump version
cli
<<
_
(
"Magic Set Editor
\n
"
);
cli
<<
_
(
"Magic Set Editor
\n
"
);
cli
<<
_
(
"Version "
)
<<
app_version
.
toString
()
<<
version_suffix
<<
ENDL
;
cli
<<
_
(
"Version "
)
<<
app_version
.
toString
()
<<
version_suffix
<<
ENDL
;
cli
.
flush
();
cli
.
flush
();
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--cli"
))
{
}
else
if
(
arg
s
[
0
]
==
_
(
"--cli"
))
{
// command line interface
// command line interface
SetP
set
;
SetP
set
;
vector
<
String
>
scripts
;
vector
<
String
>
scripts
;
bool
quiet
=
false
;
bool
quiet
=
false
;
for
(
int
i
=
2
;
i
<
argc
;
++
i
)
{
for
(
size_t
i
=
1
;
i
<
args
.
size
()
;
++
i
)
{
String
arg
=
argv
[
i
];
String
const
&
arg
=
args
[
i
];
wxFileName
f
(
arg
v
[
i
]
);
wxFileName
f
(
arg
);
if
(
f
.
GetExt
()
==
_
(
"mse-set"
)
||
f
.
GetExt
()
==
_
(
"mse"
)
||
f
.
GetExt
()
==
_
(
"set"
))
{
if
(
f
.
GetExt
()
==
_
(
"mse-set"
)
||
f
.
GetExt
()
==
_
(
"mse"
)
||
f
.
GetExt
()
==
_
(
"set"
))
{
set
=
import_set
(
arg
);
set
=
import_set
(
arg
);
}
else
if
(
arg
==
_
(
"-q"
)
||
arg
==
_
(
"--quiet"
)
||
arg
==
_
(
"--silent"
))
{
}
else
if
(
arg
==
_
(
"-q"
)
||
arg
==
_
(
"--quiet"
)
||
arg
==
_
(
"--silent"
))
{
...
@@ -216,13 +224,13 @@ int MSE::OnRun() {
...
@@ -216,13 +224,13 @@ int MSE::OnRun() {
}
else
if
(
arg
==
_
(
"-r"
)
||
arg
==
_
(
"--raw"
))
{
}
else
if
(
arg
==
_
(
"-r"
)
||
arg
==
_
(
"--raw"
))
{
quiet
=
true
;
quiet
=
true
;
cli
.
enableRaw
();
cli
.
enableRaw
();
}
else
if
((
arg
==
_
(
"-s"
)
||
arg
==
_
(
"--script"
))
&&
i
+
1
<
arg
c
)
{
}
else
if
((
arg
==
_
(
"-s"
)
||
arg
==
_
(
"--script"
))
&&
i
+
1
<
arg
s
.
size
()
)
{
scripts
.
push_back
(
arg
v
[
i
+
1
]);
scripts
.
push_back
(
arg
s
[
i
+
1
]);
++
i
;
++
i
;
}
else
if
(
arg
==
_
(
"--color"
))
{
}
else
if
(
arg
==
_
(
"--color"
))
{
// ignore
// ignore
}
else
{
}
else
{
handle_error
(
_
(
"Invalid command line argument: "
)
+
String
(
argv
[
i
])
);
throw
Error
(
_
(
"Invalid command line argument: "
)
+
arg
);
}
}
}
}
CLISetInterface
cli_interface
(
set
,
quiet
);
CLISetInterface
cli_interface
(
set
,
quiet
);
...
@@ -234,16 +242,15 @@ int MSE::OnRun() {
...
@@ -234,16 +242,15 @@ int MSE::OnRun() {
}
}
}
}
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
else
if
(
arg
==
_
(
"--export"
))
{
}
else
if
(
args
[
0
]
==
_
(
"--export-images"
))
{
if
(
argc
<=
2
||
(
argc
<=
3
&&
starts_with
(
argv
[
2
],
_
(
"--"
))))
{
if
(
args
.
size
()
<
2
)
{
handle_error
(
Error
(
_
(
"No input file specified for --export"
)));
throw
Error
(
_
(
"No input file specified for --export-images"
));
return
EXIT_FAILURE
;
}
}
SetP
set
=
import_set
(
arg
v
[
2
]);
SetP
set
=
import_set
(
arg
s
[
1
]);
// path
// path
String
out
=
arg
c
>=
3
&&
!
starts_with
(
argv
[
3
],
_
(
"--"
))
String
out
=
arg
s
.
size
()
>=
3
?
argv
[
3
]
?
args
[
2
]
:
settings
.
gameSettingsFor
(
*
set
->
game
).
images_export_filename
;
:
settings
.
gameSettingsFor
(
*
set
->
game
).
images_export_filename
;
String
path
=
_
(
"."
);
String
path
=
_
(
"."
);
size_t
pos
=
out
.
find_last_of
(
_
(
"/
\\
"
));
size_t
pos
=
out
.
find_last_of
(
_
(
"/
\\
"
));
if
(
pos
!=
String
::
npos
)
{
if
(
pos
!=
String
::
npos
)
{
...
@@ -255,12 +262,24 @@ int MSE::OnRun() {
...
@@ -255,12 +262,24 @@ int MSE::OnRun() {
// export
// export
export_images
(
set
,
set
->
cards
,
path
,
out
,
CONFLICT_NUMBER_OVERWRITE
);
export_images
(
set
,
set
->
cards
,
path
,
out
,
CONFLICT_NUMBER_OVERWRITE
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
else
if
(
args
[
0
]
==
_
(
"--export"
))
{
if
(
args
.
size
()
<
2
)
{
throw
Error
(
_
(
"No export template specified for --export"
));
}
else
if
(
args
.
size
()
<
3
)
{
throw
Error
(
_
(
"No input set file specified for --export"
));
}
String
export_template
=
args
[
1
];
ExportTemplateP
exp
=
package_manager
.
open
<
ExportTemplate
>
(
export_template
);
SetP
set
=
import_set
(
args
[
2
]);
String
out
=
args
.
size
()
>=
4
?
args
[
3
]
:
wxEmptyString
;
ScriptValueP
result
=
export_set
(
set
,
set
->
cards
,
exp
,
out
);
if
(
out
.
empty
())
{
cli
<<
result
->
toString
();
}
return
EXIT_SUCCESS
;
}
else
{
}
else
{
handle_error
(
_
(
"Invalid command line argument: "
)
+
String
(
argv
[
1
])
);
throw
Error
(
_
(
"Invalid command line argument: "
)
+
args
[
0
]
);
}
}
}
catch
(
const
Error
&
e
)
{
handle_error
(
e
);
return
EXIT_FAILURE
;
}
}
}
}
...
@@ -269,6 +288,7 @@ int MSE::OnRun() {
...
@@ -269,6 +288,7 @@ int MSE::OnRun() {
return
runGUI
();
return
runGUI
();
}
CATCH_ALL_ERRORS
(
true
);
}
CATCH_ALL_ERRORS
(
true
);
cli
.
print_pending_errors
();
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment