Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed
// Creator.cpp : main project file.#include "stdafx.h"#include "Forms/Form1.h"using namespace Creator;using namespace System::IO;[STAThreadAttribute]int main(array<System::String ^> ^args){System::String ^temp = IO::Path::GetTempPath();Threading::Mutex ^mutex = nullptr;try {bool autoClose = Form1::CheckCommandArguments(args);mutex = (autoClose) ? nullptr : gcnew Threading::Mutex(false, "SpkCreator");if ( !mutex || mutex->WaitOne(0, false)){// Enabling Windows XP visual effects before any controls are createdApplication::EnableVisualStyles();Application::SetCompatibleTextRenderingDefault(false);if ( File::Exists(temp + "\\creator_load.dat") ){try { File::Delete(temp + "\\creator_load.dat"); }catch (System::IO::IOException ^) {}catch (System::Exception ^) {}}// Create the main window and run itApplication::Run(gcnew Form1(args));}else{if ( args->Length ){if ( File::Exists(temp + "\\creator_load.dat") ){StreamWriter ^sw = File::AppendText(temp + "\\creator_load.dat");try{for ( int i = 0; i < args->Length; i++ )sw->WriteLine("File: " + args[i]);}finally{if ( sw )delete (IDisposable ^)sw;}}else{StreamWriter ^sw = File::CreateText(temp + "\\creator_load.dat");try{for ( int i = 0; i < args->Length; i++ )sw->WriteLine("File: " + args[i]);}finally{if ( sw )delete (IDisposable ^)sw;}}}elseMessageBox::Show("There is already another instance of the Package Creator Running", "Already Running", MessageBoxButtons::OK, MessageBoxIcon::Error);}}catch (Threading::AbandonedMutexException ^){}finally{if ( mutex ) mutex->Close();}return 0;}