add error window for materializer

This commit is contained in:
yyc12345 2020-08-22 15:34:07 +08:00
parent 2588e3fb41
commit 7b31e3576b
5 changed files with 114 additions and 115 deletions

View File

@ -23,7 +23,7 @@ The inspiration came from:
* This project does not give ability to edit hidden scripts within the file. It simply exports and views.
* The latest commit may not be stable to use, please visit the Release page to get a stable version.
* The development cycle of this program is very long. If you use a version before the first official version, you need to rebuild all the data because the previous version is not compatible with the official version.
* If you change the version (including the version before the first stable version), then you need to rebuild all the data, because the data between the various versions may not be compatible with each other.
## Requirements

View File

@ -17,18 +17,18 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.ActiveCfg = VT5|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.Build.0 = VT5|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x64.ActiveCfg = VT5|x64
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x64.Build.0 = VT5|x64
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.ActiveCfg = VT35|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.Build.0 = VT35|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.ActiveCfg = VT5|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.Build.0 = VT5|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x64.ActiveCfg = VT5|x64
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x64.Build.0 = VT5|x64
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.ActiveCfg = VT5|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.Build.0 = VT5|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.ActiveCfg = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.Build.0 = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x64.ActiveCfg = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x64.Build.0 = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.ActiveCfg = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.Build.0 = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.ActiveCfg = VT5Release|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.Build.0 = VT5Release|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x64.ActiveCfg = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x64.Build.0 = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.ActiveCfg = VT5Debug|Win32
{4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.Build.0 = VT5Debug|Win32
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|x64.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|x86.ActiveCfg = Debug|Any CPU

View File

@ -1,30 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="VT35|Win32">
<Configuration>VT35</Configuration>
<ProjectConfiguration Include="VT5Debug|Win32">
<Configuration>VT5Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="VT35|x64">
<Configuration>VT35</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="VT4|Win32">
<Configuration>VT4</Configuration>
<ProjectConfiguration Include="VT5Release|Win32">
<Configuration>VT5Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="VT4|x64">
<Configuration>VT4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="VT5|Win32">
<Configuration>VT5</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="VT5|x64">
<Configuration>VT5</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
@ -33,29 +17,19 @@
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT35|Win32'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT35|x64'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT5Debug|Win32'">
<PlatformToolset>v142</PlatformToolset>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'" Label="Configuration">
<PlatformToolset>v142</PlatformToolset>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT5Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='VT5|x64'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT4|x64'" Label="Configuration">
<PlatformToolset>v142</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -63,33 +37,28 @@
<ImportGroup Label="Shared">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT5Debug|Win32'">
<OutDir>E:\Virtools\Virtools Dev 5.0\InterfacePlugins\</OutDir>
<LinkIncremental>true</LinkIncremental>
<IntDir>Temp\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'">
<OutDir>E:\Virtools\Virtools Dev 4.0\InterfacePlugins\</OutDir>
<LinkIncremental>true</LinkIncremental>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VT5Release|Win32'">
<OutDir>E:\Virtools\Virtools Dev 5.0\InterfacePlugins\</OutDir>
<IntDir>Temp\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5Debug|Win32'">
<ClCompile>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'">
<ClCompile>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>D:\CppLib\SQLite\sqlite-amalgamation-3310100;E:\Virtools\Virtools Dev 5.0\Sdk\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;VIRTOOLS_5;VX_MEM_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<OutputFile>E:\Virtools\Virtools Dev 5.0\InterfacePlugins\$(ProjectName).dll</OutputFile>
@ -103,47 +72,31 @@
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT4|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>D:\CppLib\SQLite\sqlite-amalgamation-3310100;E:\Virtools\Virtools Dev 4.0\Sdk\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;VIRTOOLS_4;VX_MEM_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>
</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<ConformanceMode>false</ConformanceMode>
<LanguageStandard>Default</LanguageStandard>
<AdditionalIncludeDirectories>D:\CppLib\SQLite\sqlite-amalgamation-3310100;E:\Virtools\Virtools Dev 5.0\Sdk\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;VIRTOOLS_5;VX_MEM_RELEASE;_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Link>
<OutputFile>E:\Virtools\Virtools Dev 4.0\InterfacePlugins\$(ProjectName).dll</OutputFile>
</Link>
<Link>
<AdditionalLibraryDirectories>D:\CppLib\SQLite\sqlite-dll-win32-x86-3310100;E:\Virtools\Virtools Dev 4.0\Sdk\Lib\Win32\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>E:\Virtools\Virtools Dev 4.0\InterfacePlugins\$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT5|x64'">
<Link>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT4|x64'">
<Link>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT35|Win32'">
<Link>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
</Link>
<ClCompile>
<PreprocessorDefinitions>VIRTOOLS_35;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VT35|x64'">
<Link>
<ModuleDefinitionFile>SuperScriptMaterializer.def</ModuleDefinitionFile>
<OutputFile>E:\Virtools\Virtools Dev 5.0\InterfacePlugins\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>D:\CppLib\SQLite\sqlite-dll-win32-x86-3310100;E:\Virtools\Virtools Dev 5.0\Sdk\Lib\Win32\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>E:\Virtools\Virtools Dev 5.0\InterfacePlugins\$(ProjectName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -48,6 +48,9 @@ void UpdateMenu() {
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 0, "Export all scripts");
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 1, "Export environment");
s_Plugininterface->AddPluginMenuItem(s_MainMenu, -1, NULL, TRUE);
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 2, "Report bug");
s_Plugininterface->AddPluginMenuItem(s_MainMenu, 3, "Plugin homepage");
//===========================freeze chirs241097 code for future expand
//s_Plugininterface->AddPluginMenuItem(s_MainMenu, -1, NULL, TRUE);
@ -68,31 +71,24 @@ void PluginMenuCallback(int commandID) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CKContext* ctx = s_Plugininterface->GetCKContext();
OPENFILENAME ofn;
char* file = (char*)malloc(1024 * sizeof(char));
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrFile = file;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = 1024;
ofn.lpstrFilter = "Database file(*.db)\0*.db\0";
ofn.lpstrDefExt = "db";
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_EXPLORER;
if (GetSaveFileName(&ofn)) {
//make sure file is not exist
DeleteFile(file);
//switch mode
//switch mode
#if defined(_RELEASE)
try {
#endif
switch (commandID) {
case 0:
{
//init file
std::string file;
OpenFileDialog(&file);
if (file.empty())
break;
DeleteFile(file.c_str());
//init resources
scriptDatabase* _db = new scriptDatabase();
dbScriptDataStructHelper* _helper = new dbScriptDataStructHelper();
_db->open(file);
_db->open(file.c_str());
_helper->init(ctx->GetParameterManager());
//iterate item
@ -103,14 +99,23 @@ void PluginMenuCallback(int commandID) {
_db->close();
delete _helper;
delete _db;
ctx->OutputToConsole("[Super Script Materializer] Done");
}
break;
case 1:
{
//init file
std::string file;
OpenFileDialog(&file);
if (file.empty())
break;
DeleteFile(file.c_str());
//init
envDatabase* _db = new envDatabase();
dbEnvDataStructHelper* _helper = new dbEnvDataStructHelper();
_db->open(file);
_db->open(file.c_str());
_helper->init();
//iterate parameter operation/param
@ -126,10 +131,49 @@ void PluginMenuCallback(int commandID) {
_db->close();
delete _helper;
delete _db;
ctx->OutputToConsole("[Super Script Materializer] Done");
}
break;
case 2:
ShellExecute(NULL, "open", "https://github.com/yyc12345/SuperScriptMaterializer/issues", NULL, NULL, SW_SHOWNORMAL);
break;
case 3:
ShellExecute(NULL, "open", "https://github.com/yyc12345/SuperScriptMaterializer", NULL, NULL, SW_SHOWNORMAL);
break;
}
ctx->OutputToConsole("[Super Script Materializer] Done");
#if defined(_RELEASE)
} catch (const std::exception & e) {
std::string errstr;
errstr = "An error occurs, application will exit. Please report to developer with this window and reproduce step.\nError message: ";
errstr += e.what();
AfxMessageBox(errstr.c_str(), MB_OK | MB_ICONSTOP);
exit(1);
}
free(file);
#endif
}
BOOL OpenFileDialog(std::string* returned_file) {
returned_file->clear();
char* file = (char*)malloc(1024 * sizeof(char));
BOOL status;
OPENFILENAME OpenFileStruct;
ZeroMemory(&OpenFileStruct, sizeof(OPENFILENAME));
OpenFileStruct.lStructSize = sizeof(OPENFILENAME);
OpenFileStruct.lpstrFile = file;
OpenFileStruct.lpstrFile[0] = '\0';
OpenFileStruct.nMaxFile = 1024;
OpenFileStruct.lpstrFilter = "Database file(*.db)\0*.db\0";
OpenFileStruct.lpstrDefExt = "db";
OpenFileStruct.lpstrFileTitle = NULL;
OpenFileStruct.nMaxFileTitle = 0;
OpenFileStruct.lpstrInitialDir = NULL;
OpenFileStruct.Flags = OFN_EXPLORER;
if (status = GetSaveFileName(&OpenFileStruct))
*returned_file = file;
free(file);
return status;
}

View File

@ -11,4 +11,6 @@ void RemoveMenu();
void UpdateMenu();
void PluginMenuCallback(int commandID);
BOOL OpenFileDialog(std::string* returned_file);
#endif