diff --git a/ROMVault2/DatMaker.cs b/ROMVault2/DatMaker.cs index 06c1a14..365a321 100644 --- a/ROMVault2/DatMaker.cs +++ b/ROMVault2/DatMaker.cs @@ -57,11 +57,11 @@ namespace ROMVault2 private static string clean(string s) { + s = s.Replace("&", "&"); s = s.Replace("\"", """); s = s.Replace("'", "'"); s = s.Replace("<", "<"); s = s.Replace(">", ">"); - s = s.Replace("&", "&"); return s; } diff --git a/ROMVault2/FrmSetDir.cs b/ROMVault2/FrmSetDir.cs index b646f2a..ff72870 100644 --- a/ROMVault2/FrmSetDir.cs +++ b/ROMVault2/FrmSetDir.cs @@ -80,7 +80,7 @@ namespace ROMVault2 { ShowNewFolderButton = true, Description = Resources.FrmSetDir_BtnSetRomLocationClick_Please_select_a_folder_for_This_Rom_Set, - RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory), + RootFolder = Environment.SpecialFolder.MyComputer, SelectedPath = DBHelper.GetRealPath(_datLocation) }; if (browse.ShowDialog() == DialogResult.OK) diff --git a/ROMVault2/FrmSettings.cs b/ROMVault2/FrmSettings.cs index 371e042..37ed2f4 100644 --- a/ROMVault2/FrmSettings.cs +++ b/ROMVault2/FrmSettings.cs @@ -88,7 +88,7 @@ namespace ROMVault2 { ShowNewFolderButton = true, Description = Resources.FrmSettings_BtnDatClick_Please_select_a_folder_for_DAT_Root, - RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory), + RootFolder = Environment.SpecialFolder.MyComputer, SelectedPath = Settings.DatRoot }; diff --git a/ROMVault2/Program.cs b/ROMVault2/Program.cs index 90505e3..d47b0df 100644 --- a/ROMVault2/Program.cs +++ b/ROMVault2/Program.cs @@ -15,11 +15,8 @@ namespace ROMVault2 //public static UsernamePassword Up; public static readonly Encoding Enc = Encoding.GetEncoding(28591); public const string Version = "2.2"; - public const int SubVersion = 3; - - public static string ErrorMessage; - public static string URL; - + public const int SubVersion = 4; + public static SynchronizationContext SyncCont; /// @@ -39,15 +36,7 @@ namespace ROMVault2 progress.ShowDialog(); progress.Dispose(); - - if (!String.IsNullOrEmpty(ErrorMessage)) - { - MessageBox.Show(ErrorMessage); - if (!String.IsNullOrEmpty(URL)) - System.Diagnostics.Process.Start(URL); - return; - } - + Application.Run(new FrmMain()); } } diff --git a/ROMVault2/Report.cs b/ROMVault2/Report.cs index d801e8d..afe1300 100644 --- a/ROMVault2/Report.cs +++ b/ROMVault2/Report.cs @@ -40,8 +40,8 @@ namespace ROMVault2 { ShowNewFolderButton = true, Description = @"Please select a folder for Dats", - RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory), - SelectedPath = @"apps" + RootFolder = Environment.SpecialFolder.MyComputer, + SelectedPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Reports") }; if (browse.ShowDialog() != DialogResult.OK) return; @@ -195,7 +195,7 @@ namespace ROMVault2 SaveFileDialog saveFileDialog1 = new SaveFileDialog { Title = @"Generate Full Report", - FileName = @"RVFullReport"+CleanTime()+".txt", + FileName = @"RVFullReport" + CleanTime() + ".txt", Filter = @"Rom Vault Report (*.txt)|*.txt|All Files (*.*)|*.*", FilterIndex = 1 }; @@ -226,7 +226,7 @@ namespace ROMVault2 SaveFileDialog saveFileDialog1 = new SaveFileDialog { Title = @"Generate Fix Report", - FileName = @"RVFixReport"+CleanTime()+".txt", + FileName = @"RVFixReport" + CleanTime() + ".txt", Filter = @"Rom Vault Fixing Report (*.txt)|*.txt|All Files (*.*)|*.*", FilterIndex = 1 }; diff --git a/ROMVault2/SupportedFiles/Files/UnCompFiles.cs b/ROMVault2/SupportedFiles/Files/UnCompFiles.cs index 11bc1fb..c0f157b 100644 --- a/ROMVault2/SupportedFiles/Files/UnCompFiles.cs +++ b/ROMVault2/SupportedFiles/Files/UnCompFiles.cs @@ -26,11 +26,7 @@ namespace ROMVault2.SupportedFiles.Files bSHA1 = null; crc = null; - Stream ds; - int errorCode = IO.FileStream.OpenFileRead(filename, out ds); - if (errorCode != 0) - return errorCode; - + Stream ds=null; CRC32Hash crc32 = new CRC32Hash(); MD5 md5 = null; @@ -38,24 +34,39 @@ namespace ROMVault2.SupportedFiles.Files SHA1 sha1 = null; if (testDeep) sha1 = SHA1.Create(); - long sizetogo = ds.Length; - - while (sizetogo > 0) + try { - int sizenow = sizetogo > Buffersize ? Buffersize : (int)sizetogo; + int errorCode = IO.FileStream.OpenFileRead(filename, out ds); + if (errorCode != 0) + return errorCode; - ds.Read(Buffer, 0, sizenow); - crc32.TransformBlock(Buffer, 0, sizenow, null, 0); - if (testDeep) md5.TransformBlock(Buffer, 0, sizenow, null, 0); - if (testDeep) sha1.TransformBlock(Buffer, 0, sizenow, null, 0); - sizetogo -= sizenow; + long sizetogo = ds.Length; + + while (sizetogo > 0) + { + int sizenow = sizetogo > Buffersize ? Buffersize : (int)sizetogo; + + ds.Read(Buffer, 0, sizenow); + crc32.TransformBlock(Buffer, 0, sizenow, null, 0); + if (testDeep) md5.TransformBlock(Buffer, 0, sizenow, null, 0); + if (testDeep) sha1.TransformBlock(Buffer, 0, sizenow, null, 0); + sizetogo -= sizenow; + } + + crc32.TransformFinalBlock(Buffer, 0, 0); + if (testDeep) md5.TransformFinalBlock(Buffer, 0, 0); + if (testDeep) sha1.TransformFinalBlock(Buffer, 0, 0); + + ds.Close(); + } + catch + { + if (ds != null) + ds.Close(); + + return 0x17; } - crc32.TransformFinalBlock(Buffer, 0, 0); - if (testDeep) md5.TransformFinalBlock(Buffer, 0, 0); - if (testDeep) sha1.TransformFinalBlock(Buffer, 0, 0); - - ds.Close(); crc = crc32.Hash; if (testDeep) bMD5 = md5.Hash; diff --git a/ROMVault2/rvImages.cs b/ROMVault2/rvImages.cs index c867a9b..2ffd128 100644 --- a/ROMVault2/rvImages.cs +++ b/ROMVault2/rvImages.cs @@ -11,10 +11,7 @@ namespace ROMVault2 { public static class rvImages { - private static List names; - private static List images; - - + public static Bitmap GetBitmap(string bitmapName) { object bmObj = rvImages1.ResourceManager.GetObject(bitmapName);