private void CheckFileExists() { string filename = mSaveFileNameTextBox.Text; int result = ARMaxNativeMethods.InitMaxSave(); if (result != 0) { throw new Exception("Could not load initialize ARMax DLL!"); } result = ARMaxNativeMethods.LoadSave(filename); if (result != 0) { throw new Exception("Could not load file:" + filename); } result = ARMaxNativeMethods.FileExistsInSavePos(mFileExistsTextBox.Text); if (result > 0) { mFileExistsLabel.Text = "File Exists"; } else { mFileExistsLabel.Text = "File Does Not Exist"; } ARMaxNativeMethods.FreeMaxSave(); }
private void ExtractFileContents() { string filename = mSaveFileNameTextBox.Text; int result = ARMaxNativeMethods.InitMaxSave(); if (result != 0) { throw new Exception("Could not load initialize ARMax DLL!"); } result = ARMaxNativeMethods.LoadSave(filename); if (result != 0) { throw new Exception("Could not load file:" + filename); } StringBuilder rootDirName = new StringBuilder(256); ARMaxNativeMethods.GetRootDir(rootDirName, 256); rootDirName.Append("\\"); string dirName = ".\\UnpackFolder_" + rootDirName.ToString(); if (Directory.Exists(dirName)) { Directory.Delete(dirName, true); } Directory.CreateDirectory(dirName); int numFiles = ARMaxNativeMethods.NumberOfFiles(); // show the files in the list box for (int i = 1; i < numFiles + 1; i++) // there is no '0'th file { try { result = ARMaxNativeMethods.ExtractAFile(i, dirName); if (result != 0) { Console.Error.Write("'ARMaxNativeMethods.ExtractAFile' Failed; code = {0}", result); } } catch (Exception exc) { Console.Error.WriteLine("Error calling 'ARMaxNativeMethods.GetRootDir()' LastError:{0}\n{1}", System.Runtime.InteropServices.Marshal.GetLastWin32Error() , exc.Message ); } } ARMaxNativeMethods.FreeMaxSave(); }
private void PackContents(string resultFileName, string folderName) { string filename = mSaveFileNameTextBox.Text; int result = ARMaxNativeMethods.InitMaxSave(); if (result != 0) { throw new Exception("Could not load initialize ARMax DLL!"); } result = ARMaxNativeMethods.LoadSave(filename); if (result != 0) { throw new Exception("Could not load file:" + filename); } }
private static int LoadARMaxFile(string filename) { int result = ARMaxNativeMethods.InitMaxSave(); Console.WriteLine("#DLL version: ", ARMaxNativeMethods.DLLVersion()); if (result != 0) { throw new Exception("Could not load initialize ARMax DLL!"); } result = ARMaxNativeMethods.LoadSave(filename); if (result != 0) { throw new Exception("Could not load file:" + filename); } return(result); }
public PS2FileHelper(string filename) { this.Filename = filename; int result = ARMaxNativeMethods.InitMaxSave(); if (result == 0) { result = ARMaxNativeMethods.LoadSave(filename); Console.WriteLine("#ARMax version: {0}, Number of files:{1}; RootDir: {2}", ARMaxNativeMethods.DLLVersion(), ARMaxNativeMethods.NumberOfFiles() , this.RootDir ); } else { Console.Error.WriteLine("#Error calling 'ARMaxNativeMethods.InitMaxSave()' result:{0}", result); } }