Merge pull request #2 from gjefferyes/master

Update to changes on 9/16
This commit is contained in:
LnmVolbo
2015-09-25 12:51:18 -07:00
7 changed files with 41 additions and 44 deletions

View File

@@ -57,11 +57,11 @@ namespace ROMVault2
private static string clean(string s) private static string clean(string s)
{ {
s = s.Replace("&", "&");
s = s.Replace("\"", """); s = s.Replace("\"", """);
s = s.Replace("'", "'"); s = s.Replace("'", "'");
s = s.Replace("<", "&lt;"); s = s.Replace("<", "&lt;");
s = s.Replace(">", "&gt;"); s = s.Replace(">", "&gt;");
s = s.Replace("&", "&amp;");
return s; return s;
} }

View File

@@ -80,7 +80,7 @@ namespace ROMVault2
{ {
ShowNewFolderButton = true, ShowNewFolderButton = true,
Description = Resources.FrmSetDir_BtnSetRomLocationClick_Please_select_a_folder_for_This_Rom_Set, 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) SelectedPath = DBHelper.GetRealPath(_datLocation)
}; };
if (browse.ShowDialog() == DialogResult.OK) if (browse.ShowDialog() == DialogResult.OK)

View File

@@ -88,7 +88,7 @@ namespace ROMVault2
{ {
ShowNewFolderButton = true, ShowNewFolderButton = true,
Description = Resources.FrmSettings_BtnDatClick_Please_select_a_folder_for_DAT_Root, 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 SelectedPath = Settings.DatRoot
}; };

View File

@@ -15,11 +15,8 @@ namespace ROMVault2
//public static UsernamePassword Up; //public static UsernamePassword Up;
public static readonly Encoding Enc = Encoding.GetEncoding(28591); public static readonly Encoding Enc = Encoding.GetEncoding(28591);
public const string Version = "2.2"; public const string Version = "2.2";
public const int SubVersion = 3; public const int SubVersion = 4;
public static string ErrorMessage;
public static string URL;
public static SynchronizationContext SyncCont; public static SynchronizationContext SyncCont;
/// <summary> /// <summary>
@@ -39,15 +36,7 @@ namespace ROMVault2
progress.ShowDialog(); progress.ShowDialog();
progress.Dispose(); progress.Dispose();
if (!String.IsNullOrEmpty(ErrorMessage))
{
MessageBox.Show(ErrorMessage);
if (!String.IsNullOrEmpty(URL))
System.Diagnostics.Process.Start(URL);
return;
}
Application.Run(new FrmMain()); Application.Run(new FrmMain());
} }
} }

View File

@@ -40,8 +40,8 @@ namespace ROMVault2
{ {
ShowNewFolderButton = true, ShowNewFolderButton = true,
Description = @"Please select a folder for Dats", Description = @"Please select a folder for Dats",
RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory), RootFolder = Environment.SpecialFolder.MyComputer,
SelectedPath = @"apps" SelectedPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Reports")
}; };
if (browse.ShowDialog() != DialogResult.OK) return; if (browse.ShowDialog() != DialogResult.OK) return;
@@ -195,7 +195,7 @@ namespace ROMVault2
SaveFileDialog saveFileDialog1 = new SaveFileDialog SaveFileDialog saveFileDialog1 = new SaveFileDialog
{ {
Title = @"Generate Full Report", Title = @"Generate Full Report",
FileName = @"RVFullReport"+CleanTime()+".txt", FileName = @"RVFullReport" + CleanTime() + ".txt",
Filter = @"Rom Vault Report (*.txt)|*.txt|All Files (*.*)|*.*", Filter = @"Rom Vault Report (*.txt)|*.txt|All Files (*.*)|*.*",
FilterIndex = 1 FilterIndex = 1
}; };
@@ -226,7 +226,7 @@ namespace ROMVault2
SaveFileDialog saveFileDialog1 = new SaveFileDialog SaveFileDialog saveFileDialog1 = new SaveFileDialog
{ {
Title = @"Generate Fix Report", Title = @"Generate Fix Report",
FileName = @"RVFixReport"+CleanTime()+".txt", FileName = @"RVFixReport" + CleanTime() + ".txt",
Filter = @"Rom Vault Fixing Report (*.txt)|*.txt|All Files (*.*)|*.*", Filter = @"Rom Vault Fixing Report (*.txt)|*.txt|All Files (*.*)|*.*",
FilterIndex = 1 FilterIndex = 1
}; };

View File

@@ -26,11 +26,7 @@ namespace ROMVault2.SupportedFiles.Files
bSHA1 = null; bSHA1 = null;
crc = null; crc = null;
Stream ds; Stream ds=null;
int errorCode = IO.FileStream.OpenFileRead(filename, out ds);
if (errorCode != 0)
return errorCode;
CRC32Hash crc32 = new CRC32Hash(); CRC32Hash crc32 = new CRC32Hash();
MD5 md5 = null; MD5 md5 = null;
@@ -38,24 +34,39 @@ namespace ROMVault2.SupportedFiles.Files
SHA1 sha1 = null; SHA1 sha1 = null;
if (testDeep) sha1 = SHA1.Create(); if (testDeep) sha1 = SHA1.Create();
long sizetogo = ds.Length; try
while (sizetogo > 0)
{ {
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); long sizetogo = ds.Length;
crc32.TransformBlock(Buffer, 0, sizenow, null, 0);
if (testDeep) md5.TransformBlock(Buffer, 0, sizenow, null, 0); while (sizetogo > 0)
if (testDeep) sha1.TransformBlock(Buffer, 0, sizenow, null, 0); {
sizetogo -= sizenow; 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; crc = crc32.Hash;
if (testDeep) bMD5 = md5.Hash; if (testDeep) bMD5 = md5.Hash;

View File

@@ -11,10 +11,7 @@ namespace ROMVault2
{ {
public static class rvImages public static class rvImages
{ {
private static List<string> names;
private static List<Bitmap> images;
public static Bitmap GetBitmap(string bitmapName) public static Bitmap GetBitmap(string bitmapName)
{ {
object bmObj = rvImages1.ResourceManager.GetObject(bitmapName); object bmObj = rvImages1.ResourceManager.GetObject(bitmapName);