refactored with winapi. windows forms is crap

This commit is contained in:
cypherpunk 2014-03-13 03:16:54 +01:00
parent 1a716c70f7
commit b461e843f0
16 changed files with 180 additions and 568 deletions

View File

@ -5,7 +5,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TitanEngine", "TitanEngine\
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TitanUnitTest", "TitanUnitTest\TitanUnitTest.vcxproj", "{5B5AB3CD-4D32-43B0-8840-E05C9483381D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TitanUnitTest", "TitanUnitTest\TitanUnitTest.vcxproj", "{5B5AB3CD-4D32-43B0-8840-E05C9483381D}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TitanScriptGui", "TitanScriptGui\TitanScriptGui.vcxproj", "{864AC964-6CC4-4738-A811-61C216C1A36D}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TitanScriptGui", "TitanScriptGui\TitanScriptGui.vcxproj", "{49C88677-C374-4AE2-B431-8F3B424BF245}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -29,12 +29,12 @@ Global
{5B5AB3CD-4D32-43B0-8840-E05C9483381D}.Release|Win32.ActiveCfg = Release|Win32 {5B5AB3CD-4D32-43B0-8840-E05C9483381D}.Release|Win32.ActiveCfg = Release|Win32
{5B5AB3CD-4D32-43B0-8840-E05C9483381D}.Release|Win32.Build.0 = Release|Win32 {5B5AB3CD-4D32-43B0-8840-E05C9483381D}.Release|Win32.Build.0 = Release|Win32
{5B5AB3CD-4D32-43B0-8840-E05C9483381D}.Release|x64.ActiveCfg = Release|Win32 {5B5AB3CD-4D32-43B0-8840-E05C9483381D}.Release|x64.ActiveCfg = Release|Win32
{864AC964-6CC4-4738-A811-61C216C1A36D}.Debug|Win32.ActiveCfg = Debug|Win32 {49C88677-C374-4AE2-B431-8F3B424BF245}.Debug|Win32.ActiveCfg = Debug|Win32
{864AC964-6CC4-4738-A811-61C216C1A36D}.Debug|Win32.Build.0 = Debug|Win32 {49C88677-C374-4AE2-B431-8F3B424BF245}.Debug|Win32.Build.0 = Debug|Win32
{864AC964-6CC4-4738-A811-61C216C1A36D}.Debug|x64.ActiveCfg = Debug|Win32 {49C88677-C374-4AE2-B431-8F3B424BF245}.Debug|x64.ActiveCfg = Debug|Win32
{864AC964-6CC4-4738-A811-61C216C1A36D}.Release|Win32.ActiveCfg = Release|Win32 {49C88677-C374-4AE2-B431-8F3B424BF245}.Release|Win32.ActiveCfg = Release|Win32
{864AC964-6CC4-4738-A811-61C216C1A36D}.Release|Win32.Build.0 = Release|Win32 {49C88677-C374-4AE2-B431-8F3B424BF245}.Release|Win32.Build.0 = Release|Win32
{864AC964-6CC4-4738-A811-61C216C1A36D}.Release|x64.ActiveCfg = Release|Win32 {49C88677-C374-4AE2-B431-8F3B424BF245}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,40 +0,0 @@
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
//
[assembly:AssemblyTitleAttribute("TitanScriptGui")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("TitanScriptGui")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2014")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder für die Revisions- und Buildnummer den Standard
// übernehmen, indem Sie "*" eingeben:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

View File

@ -1,268 +0,0 @@
#pragma once
#include "TitanEngine.h"
#include "TitanScript.h"
namespace TitanScriptGui {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::InteropServices;
public delegate void log_callback_delegate( const char* str, eLogType log_type );
/// <summary>
/// Zusammenfassung für Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
InitializeTitanScript();
}
protected:
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private:
System::Windows::Forms::TextBox^ textBox_targetPath;
protected:
private:
protected:
private:
System::Windows::Forms::Label^ label1;
private:
System::Windows::Forms::Button^ openTarget;
private:
private:
private:
System::Windows::Forms::Label^ label2;
private:
System::Windows::Forms::TextBox^ textBox_scriptPath;
private:
System::Windows::Forms::Button^ openScript;
private:
private:
private:
private:
System::Windows::Forms::GroupBox^ groupBox1;
private:
System::Windows::Forms::TextBox^ logBox;
private:
private:
System::Windows::Forms::Button^ run;
private:
private:
System::Windows::Forms::OpenFileDialog^ openFileDialog1;
private:
tScripterLoadFileA load_file;
tScripterExecuteWithTitanMistA exec;
tScripterSetLogCallback set_log_callback;
log_callback_delegate^ logdelegate;
private:
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
void InitializeComponent(void)
{
this->textBox_targetPath = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->openTarget = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->textBox_scriptPath = (gcnew System::Windows::Forms::TextBox());
this->openScript = (gcnew System::Windows::Forms::Button());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->logBox = (gcnew System::Windows::Forms::TextBox());
this->run = (gcnew System::Windows::Forms::Button());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// textBox_targetPath
//
this->textBox_targetPath->Location = System::Drawing::Point(60, 12);
this->textBox_targetPath->Name = L"textBox_targetPath";
this->textBox_targetPath->Size = System::Drawing::Size(168, 20);
this->textBox_targetPath->TabIndex = 0;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(10, 12);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(44, 13);
this->label1->TabIndex = 1;
this->label1->Text = L"[Target]";
//
// openTarget
//
this->openTarget->Location = System::Drawing::Point(234, 12);
this->openTarget->Name = L"openTarget";
this->openTarget->Size = System::Drawing::Size(75, 23);
this->openTarget->TabIndex = 2;
this->openTarget->Text = L"[Open...]";
this->openTarget->UseVisualStyleBackColor = true;
this->openTarget->Click += gcnew System::EventHandler(this, &Form1::openTarget_Click);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(10, 44);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(40, 13);
this->label2->TabIndex = 3;
this->label2->Text = L"[Script]";
//
// textBox_scriptPath
//
this->textBox_scriptPath->Location = System::Drawing::Point(60, 44);
this->textBox_scriptPath->Name = L"textBox_scriptPath";
this->textBox_scriptPath->Size = System::Drawing::Size(168, 20);
this->textBox_scriptPath->TabIndex = 4;
//
// openScript
//
this->openScript->Location = System::Drawing::Point(234, 44);
this->openScript->Name = L"openScript";
this->openScript->Size = System::Drawing::Size(75, 23);
this->openScript->TabIndex = 5;
this->openScript->Text = L"[Open...]";
this->openScript->UseVisualStyleBackColor = true;
this->openScript->Click += gcnew System::EventHandler(this, &Form1::openScript_Click);
//
// groupBox1
//
this->groupBox1->Controls->Add(this->logBox);
this->groupBox1->Location = System::Drawing::Point(13, 70);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(294, 285);
this->groupBox1->TabIndex = 6;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"[Log]";
//
// logBox
//
this->logBox->Location = System::Drawing::Point(6, 19);
this->logBox->Multiline = true;
this->logBox->Name = L"logBox";
this->logBox->Size = System::Drawing::Size(282, 260);
this->logBox->TabIndex = 0;
//
// run
//
this->run->Location = System::Drawing::Point(122, 361);
this->run->Name = L"run";
this->run->Size = System::Drawing::Size(75, 23);
this->run->TabIndex = 7;
this->run->Text = L"[Run]";
this->run->UseVisualStyleBackColor = true;
this->run->Click += gcnew System::EventHandler(this, &Form1::run_Click);
//
// openFileDialog1
//
this->openFileDialog1->FileName = L"openFileDialog1";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(319, 389);
this->Controls->Add(this->run);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->openScript);
this->Controls->Add(this->textBox_scriptPath);
this->Controls->Add(this->label2);
this->Controls->Add(this->openTarget);
this->Controls->Add(this->label1);
this->Controls->Add(this->textBox_targetPath);
this->Name = L"Form1";
this->Text = L"TitanScriptGUI";
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
void InitializeTitanScript(void) {
load_file = GetTSFunctionPointer( LoadFileA );
exec = GetTSFunctionPointer( ExecuteWithTitanMistA );
set_log_callback = GetTSFunctionPointer( SetLogCallback );
//register log callback
logdelegate = gcnew log_callback_delegate(this, &Form1::log_callback);
IntPtr thunk = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(logdelegate);
set_log_callback((fLogCallback)(void*)thunk);
}
private:
System::Void openTarget_Click(System::Object^ sender, System::EventArgs^ e) {
if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK) {
textBox_targetPath->Text = openFileDialog1->FileName;
}
}
private:
System::Void openScript_Click(System::Object^ sender, System::EventArgs^ e) {
if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK) {
textBox_scriptPath->Text = openFileDialog1->FileName;
}
}
private:
System::Void run_Click(System::Object^ sender, System::EventArgs^ e) {
logBox->Clear();
const char* scriptPath = (const char*)(void*) Marshal::StringToHGlobalAnsi(textBox_scriptPath->Text);
const char* targetPath = (const char*)(void*) Marshal::StringToHGlobalAnsi(textBox_targetPath->Text);
if(!load_file(scriptPath)) {
logBox->AppendText("[Error] Couldnt load the script");
}
bool ret = exec(targetPath, "dump.exe");
Marshal::FreeHGlobal(IntPtr((void*)scriptPath));
Marshal::FreeHGlobal(IntPtr((void*)targetPath));
}
private:
void log_callback( const char* str, eLogType log_type ) {
logBox->AppendText(gcnew String(str));
}
};
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>7, 12</value>
</metadata>
</root>

View File

@ -1,45 +0,0 @@
========================================================================
ANWENDUNG: TitanScriptGui-Projektübersicht
========================================================================
Diese TitanScriptGui-Anwendung wurde vom Anwendungs-Assistenten
für Sie erstellt.
Diese Datei bietet eine Übersicht über den Inhalt der einzelnen Dateien,
aus denen Ihre TitanScriptGui-Anwendung besteht.
TitanScriptGui.vcxproj
Dies ist die Hauptprojektdatei für VC++-Projekte, die mit dem
Anwendungs-Assistenten generiert werden.
Sie enthält Informationen über die Version von Visual C++, mit der die
Datei generiert wurde, sowie über die Plattformen, Konfigurationen und
Projektfunktionen, die im Anwendungs-Assistenten ausgewählt wurden.
TitanScriptGui.vcxproj.filters
Dies ist die Filterdatei für VC++-Projekte, die mithilfe eines
Anwendungs-Assistenten erstellt werden.
Sie enthält Informationen über die Zuordnung zwischen den Dateien im
Projekt und den Filtern. Diese Zuordnung wird in der IDE zur Darstellung
der Gruppierung von Dateien mit ähnlichen Erweiterungen unter einem
bestimmten Knoten verwendet (z. B. sind CPP-Dateien dem Filter
"Quelldateien" zugeordnet).
TitanScriptGui.cpp
Dies ist die Hauptquelldatei der Anwendung.
Enthält den Code zum Anzeigen des Formulars.
Form1.h
Enthält die Implementierung der Formularklasse und der InitializeComponent()-Funktion.
AssemblyInfo.cpp
Enthält benutzerdefinierte Attribute zum Ändern von Assemblymetadaten.
/////////////////////////////////////////////////////////////////////////////
Andere Standarddateien:
StdAfx.h, StdAfx.cpp
Diese Dateien werden verwendet, um eine vorkompilierte Headerdatei
(PCH-Datei) mit dem Namen "TitanScriptGui.pch und eine
vorkompilierte Typendatei mit dem Namen "StdAfx.obj" zu erstellen.
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,22 +1,122 @@
#include "stdafx.h" #include "stdafx.h"
#include "Form1.h" #include "TitanScriptGui.h"
#include "TitanEngine.h"
#include "TitanScript.h"
using namespace TitanScriptGui; HINSTANCE hInst;
HWND hLogBox;
TCHAR FileNameTarget[MAX_PATH] = {};
TCHAR FileNameScript[MAX_PATH] = {};
[STAThreadAttribute] INT_PTR CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int main(array<System::String ^> ^args) bool GetFileDialog(TCHAR[MAX_PATH]);
void AddLogMessage(const char* szLogMessage, eLogType Type);
tScripterLoadFileA load_file = NULL;
tScripterExecuteWithTitanMistA exec = NULL;
tScripterSetLogCallback set_log_callback = NULL;
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{ {
if ( !ExtensionManagerIsPluginLoaded( "TitanScript" ) || !ExtensionManagerIsPluginEnabled( "TitanScript" ) ) { UNREFERENCED_PARAMETER(hPrevInstance);
System::Windows::Forms::MessageBox::Show("TitanScript failed to load!", "[ERROR]", MessageBoxButtons::OK, MessageBoxIcon::Error); UNREFERENCED_PARAMETER(lpCmdLine);
return -1;
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAINWINDOW), NULL, &WndProc);
ExitProcess(NULL);
}
INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG: {
hLogBox = GetDlgItem(hWnd, IDC_LOG);
//make sure TitanScript is available
if ( !ExtensionManagerIsPluginLoaded( "TitanScript" ) || !ExtensionManagerIsPluginEnabled( "TitanScript" ) ) {
AddLogMessage("TitanScript failed to load", TS_LOG_ERROR);
AddLogMessage("Ensure plugins\\x86\\TitanScript.dll exists !", TS_LOG_ERROR);
EnableWindow(GetDlgItem(hWnd, IDC_RUN ), FALSE);
} else {
load_file = GetTSFunctionPointer( LoadFileA );
exec = GetTSFunctionPointer( ExecuteWithTitanMistA );
set_log_callback = GetTSFunctionPointer( SetLogCallback );
set_log_callback(&AddLogMessage);
}
break;
} }
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BROWSETARGET: {
if(GetFileDialog(FileNameTarget))
{
SetDlgItemText(hWnd, IDC_TARGETPATH, FileNameTarget);
}
break;
}
case IDC_BROWSESCRIPT: {
if(GetFileDialog(FileNameScript))
{
SetDlgItemText(hWnd, IDC_SCRIPTPATH, FileNameScript);
}
break;
}
case IDC_RUN: {
char buf[MAX_PATH] = {0};
// Aktivieren visueller Effekte von Windows XP, bevor Steuerelemente erstellt werden wcstombs(buf, FileNameScript, sizeof(buf));
Application::EnableVisualStyles(); if(!load_file(buf)) {
Application::SetCompatibleTextRenderingDefault(false); AddLogMessage("Script failed to load", TS_LOG_ERROR);
break;
}
// Hauptfenster erstellen und ausführen wcstombs(buf, FileNameTarget, sizeof(buf));
Application::Run(gcnew Form1()); if(!exec(buf, "dump.exe")) {
AddLogMessage("Failed to execute", TS_LOG_ERROR);
break;
}
break;
}
}
break;
case WM_CLOSE:
EndDialog(hWnd, NULL);
break;
default:
return false;
}
return 0; return 0;
} }
bool GetFileDialog(TCHAR Buffer[MAX_PATH])
{
OPENFILENAME sOpenFileName = {0};
const TCHAR szFilterString[] = _T("All Files \0*.*\0\0");
const TCHAR szDialogTitle[] = _T("TitanScriptGUI");
Buffer[0] = 0;
sOpenFileName.lStructSize = sizeof(sOpenFileName);
sOpenFileName.lpstrFilter = szFilterString;
sOpenFileName.lpstrFile = Buffer;
sOpenFileName.nMaxFile = MAX_PATH;
sOpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_HIDEREADONLY;
sOpenFileName.lpstrTitle = szDialogTitle;
return (TRUE == GetOpenFileName(&sOpenFileName));
}
void AddLogMessage(const char* szLogMessage, eLogType Type)
{
TCHAR buf[100] = {0};
mbstowcs(buf, szLogMessage, sizeof(buf));
LRESULT cSelect = SendMessage(hLogBox, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)buf);
SendMessage(hLogBox, LB_SETCURSEL, cSelect, NULL);
}

View File

@ -0,0 +1,3 @@
#pragma once
#include "resource.h"

Binary file not shown.

View File

@ -11,22 +11,20 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{864AC964-6CC4-4738-A811-61C216C1A36D}</ProjectGuid> <ProjectGuid>{49C88677-C374-4AE2-B431-8F3B424BF245}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <Keyword>Win32Proj</Keyword>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>TitanScriptGui</RootNamespace> <RootNamespace>TitanScriptGui</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>Pure</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>Pure</CLRSupport> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@ -41,55 +39,54 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(IntDir)x32\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\$(IntDir)x32\</OutDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<CallingConvention>
</CallingConvention>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>TitanEngine.lib</AdditionalDependencies>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>TitanEngine.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<CallingConvention> <Optimization>MaxSpeed</Optimization>
</CallingConvention> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>TitanEngine.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="app.ico" />
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" /> <ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="TitanEngine.h" />
<ClInclude Include="TitanScript.h" />
<ClInclude Include="TitanScriptGui.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@ -97,22 +94,7 @@
<ClCompile Include="TitanScriptGui.cpp" /> <ClCompile Include="TitanScriptGui.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Form1.h"> <ResourceCompile Include="TitanScriptGui.rc" />
<FileType>CppForm</FileType>
</ClInclude>
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="TitanEngine.h" />
<ClInclude Include="TitanScript.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Form1.resX">
<DependentUpon>Form1.h</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -16,29 +16,18 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />
<None Include="app.ico">
<Filter>Ressourcendateien</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="TitanScriptGui.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="AssemblyInfo.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Form1.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="stdafx.h"> <ClInclude Include="stdafx.h">
<Filter>Headerdateien</Filter> <Filter>Headerdateien</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h"> <ClInclude Include="targetver.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="TitanScriptGui.h">
<Filter>Headerdateien</Filter> <Filter>Headerdateien</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TitanEngine.h"> <ClInclude Include="TitanEngine.h">
@ -49,13 +38,16 @@
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="app.rc"> <ClCompile Include="stdafx.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="TitanScriptGui.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="TitanScriptGui.rc">
<Filter>Ressourcendateien</Filter> <Filter>Ressourcendateien</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Form1.resX">
<Filter>Ressourcendateien</Filter>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Binary file not shown.

View File

@ -4,4 +4,5 @@
#include "stdafx.h" #include "stdafx.h"
// TODO: Auf zusätzliche Header verweisen, die in STDAFX.H
// und nicht in dieser Datei erforderlich sind.

View File

@ -1,6 +1,13 @@
// stdafx.h : Includedatei für Standardsystem-Includedateien
// oder häufig verwendete projektspezifische Includedateien,
// die nur in unregelmäßigen Abständen geändert werden.
#pragma once #pragma once
// TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen. #include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commdlg.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

View File

@ -0,0 +1,3 @@
#pragma once
#include <SDKDDKVer.h>