Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a612ea5cfd | |||
|
|
5a93500001 | ||
|
|
905574d120 | ||
|
|
063254ccb6 | ||
|
|
8a908bf60c | ||
|
|
239b001daa | ||
|
|
03141ff8f0 | ||
|
|
e6e0c73dcd | ||
|
|
7d25bd8519 | ||
|
|
c61eead2ba | ||
|
|
2d6c5a7e26 | ||
|
|
b6be1a9ec1 | ||
|
|
5107b5b850 | ||
|
|
33f204fc37 | ||
|
|
dc99d2328d | ||
|
|
0817f01538 | ||
|
|
1b4caa8e34 | ||
|
|
6981a16a67 | ||
|
|
14054dc06f | ||
|
|
c04bb9d070 | ||
|
|
32f67308fa | ||
| efaba1f3d9 | |||
|
|
b368f33351 | ||
|
|
48ea11ab2e | ||
|
|
3e261ee077 | ||
|
|
a4939e5bf4 | ||
|
|
1c588291b7 | ||
|
|
39e4a6114f | ||
|
|
b54610c2f6 |
@@ -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("<", "<");
|
s = s.Replace("<", "<");
|
||||||
s = s.Replace(">", ">");
|
s = s.Replace(">", ">");
|
||||||
s = s.Replace("&", "&");
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ namespace ROMVault2.DatReaders
|
|||||||
}
|
}
|
||||||
|
|
||||||
thisFileType = forceZipping.ToLower() != "no" ? FileType.ZipFile : FileType.File;
|
thisFileType = forceZipping.ToLower() != "no" ? FileType.ZipFile : FileType.File;
|
||||||
|
if (Settings.FixLevel == eFixLevel.Uncompressed)
|
||||||
|
thisFileType = FileType.File;
|
||||||
tDir.Dat = tDat;
|
tDir.Dat = tDat;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace ROMVault2.DatReaders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thisFileType = FileType.ZipFile;
|
thisFileType = Settings.FixLevel == eFixLevel.Uncompressed ? FileType.File : FileType.ZipFile;
|
||||||
tDir.Dat = tDat;
|
tDir.Dat = tDat;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ namespace ROMVault2.DatReaders
|
|||||||
|
|
||||||
public static bool ReadDat(ref RvDir tDat, XmlDocument doc)
|
public static bool ReadDat(ref RvDir tDat, XmlDocument doc)
|
||||||
{
|
{
|
||||||
if (!LoadHeaderFromDat(ref tDat, ref doc))
|
FileType thisFileType = FileType.Unknown;
|
||||||
|
|
||||||
|
if (!LoadHeaderFromDat(ref tDat, ref doc, ref thisFileType))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (doc.DocumentElement == null)
|
if (doc.DocumentElement == null)
|
||||||
@@ -27,13 +29,13 @@ namespace ROMVault2.DatReaders
|
|||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < gameNodeList.Count; i++)
|
for (int i = 0; i < gameNodeList.Count; i++)
|
||||||
{
|
{
|
||||||
LoadGameFromDat(ref tDat, gameNodeList[i]);
|
LoadGameFromDat(ref tDat, gameNodeList[i], thisFileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool LoadHeaderFromDat(ref RvDir tDir, ref XmlDocument doc)
|
private static bool LoadHeaderFromDat(ref RvDir tDir, ref XmlDocument doc, ref FileType thisFileType)
|
||||||
{
|
{
|
||||||
XmlNodeList head = doc.SelectNodes("softwarelist");
|
XmlNodeList head = doc.SelectNodes("softwarelist");
|
||||||
if (head == null)
|
if (head == null)
|
||||||
@@ -63,20 +65,37 @@ namespace ROMVault2.DatReaders
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val = VarFix.String(head[0].Attributes.GetNamedItem("forcepacking")).ToLower();
|
||||||
|
switch (val.ToLower())
|
||||||
|
{
|
||||||
|
case "zip":
|
||||||
|
tDat.AddData(RvDat.DatData.FileType, "zip");
|
||||||
|
thisFileType = FileType.ZipFile;
|
||||||
|
break;
|
||||||
|
case "unzip":
|
||||||
|
case "file":
|
||||||
|
tDat.AddData(RvDat.DatData.FileType, "file");
|
||||||
|
thisFileType = FileType.File;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
thisFileType = FileType.ZipFile;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Settings.FixLevel == eFixLevel.Uncompressed)
|
||||||
|
thisFileType = FileType.File;
|
||||||
|
|
||||||
tDir.Dat = tDat;
|
tDir.Dat = tDat;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadGameFromDat(ref RvDir tDat, XmlNode gameNode)
|
private static void LoadGameFromDat(ref RvDir tDat, XmlNode gameNode, FileType thisFileType)
|
||||||
{
|
{
|
||||||
if (gameNode.Attributes == null)
|
if (gameNode.Attributes == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RvDir parent = tDat;
|
RvDir parent = tDat;
|
||||||
|
|
||||||
RvDir tDir = new RvDir(FileType.Zip)
|
RvDir tDir = new RvDir(DBTypeGet.DirFromFile(thisFileType))
|
||||||
{
|
{
|
||||||
Name = VarFix.CleanFileName(gameNode.Attributes.GetNamedItem("name")),
|
Name = VarFix.CleanFileName(gameNode.Attributes.GetNamedItem("name")),
|
||||||
Game = new RvGame(),
|
Game = new RvGame(),
|
||||||
@@ -137,7 +156,7 @@ namespace ROMVault2.DatReaders
|
|||||||
if (romNodeList != null)
|
if (romNodeList != null)
|
||||||
for (int iR = 0; iR < romNodeList.Count; iR++)
|
for (int iR = 0; iR < romNodeList.Count; iR++)
|
||||||
{
|
{
|
||||||
LoadRomFromDat(ref tDir, romNodeList[iR]);
|
LoadRomFromDat(ref tDir, romNodeList[iR], thisFileType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +183,7 @@ namespace ROMVault2.DatReaders
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadRomFromDat(ref RvDir tGame, XmlNode romNode)
|
private static void LoadRomFromDat(ref RvDir tGame, XmlNode romNode, FileType thisFileType)
|
||||||
{
|
{
|
||||||
if (romNode.Attributes == null)
|
if (romNode.Attributes == null)
|
||||||
return;
|
return;
|
||||||
@@ -173,7 +192,7 @@ namespace ROMVault2.DatReaders
|
|||||||
string loadflag = VarFix.String(romNode.Attributes.GetNamedItem("loadflag"));
|
string loadflag = VarFix.String(romNode.Attributes.GetNamedItem("loadflag"));
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
RvFile tRom = new RvFile(FileType.ZipFile)
|
RvFile tRom = new RvFile(thisFileType) // changed
|
||||||
{
|
{
|
||||||
Name = VarFix.CleanFullFileName(name),
|
Name = VarFix.CleanFullFileName(name),
|
||||||
Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")),
|
Size = VarFix.ULong(romNode.Attributes.GetNamedItem("size")),
|
||||||
|
|||||||
@@ -270,6 +270,10 @@ namespace ROMVault2.DatReaders
|
|||||||
// loop the ROMs in the parent sets
|
// loop the ROMs in the parent sets
|
||||||
for (int r1 = 0; r1 < romofGame.ChildCount; r1++)
|
for (int r1 = 0; r1 < romofGame.ChildCount; r1++)
|
||||||
{
|
{
|
||||||
|
// don't search fixes for files marked as nodump
|
||||||
|
if (((RvFile)mGame.Child(r)).Status == "nodump" || ((RvFile)romofGame.Child(r1)).Status == "nodump")
|
||||||
|
continue;
|
||||||
|
|
||||||
// only find fixes if the Name and the Size of the ROMs are the same
|
// only find fixes if the Name and the Size of the ROMs are the same
|
||||||
if (mGame.Child(r).Name != romofGame.Child(r1).Name || ((RvFile)mGame.Child(r)).Size != ((RvFile)romofGame.Child(r1)).Size)
|
if (mGame.Child(r).Name != romofGame.Child(r1).Name || ((RvFile)mGame.Child(r)).Size != ((RvFile)romofGame.Child(r1)).Size)
|
||||||
continue;
|
continue;
|
||||||
@@ -285,11 +289,13 @@ namespace ROMVault2.DatReaders
|
|||||||
if (b1)
|
if (b1)
|
||||||
{
|
{
|
||||||
((RvFile)mGame.Child(r)).CRC = ((RvFile)romofGame.Child(r1)).CRC;
|
((RvFile)mGame.Child(r)).CRC = ((RvFile)romofGame.Child(r1)).CRC;
|
||||||
|
((RvFile)mGame.Child(r)).FileStatusSet(FileStatus.CRCFromDAT);
|
||||||
((RvFile)mGame.Child(r)).Status = "(CRCFound)";
|
((RvFile)mGame.Child(r)).Status = "(CRCFound)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((RvFile)romofGame.Child(r1)).CRC = ((RvFile)mGame.Child(r)).CRC;
|
((RvFile)romofGame.Child(r1)).CRC = ((RvFile)mGame.Child(r)).CRC;
|
||||||
|
((RvFile)romofGame.Child(r1)).FileStatusSet(FileStatus.CRCFromDAT);
|
||||||
((RvFile)romofGame.Child(r1)).Status = "(CRCFound)";
|
((RvFile)romofGame.Child(r1)).Status = "(CRCFound)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,6 +434,8 @@ namespace ROMVault2.DatReaders
|
|||||||
byte[] chdMD51 = ((RvFile)romofGame.Child(r1)).MD5CHD;
|
byte[] chdMD51 = ((RvFile)romofGame.Child(r1)).MD5CHD;
|
||||||
if (chdMD50 != null && chdMD51 != null && !ArrByte.bCompare(chdMD50, chdMD51)) continue;
|
if (chdMD50 != null && chdMD51 != null && !ArrByte.bCompare(chdMD50, chdMD51)) continue;
|
||||||
|
|
||||||
|
// don't merge if only one of the ROM is nodump
|
||||||
|
if ((((RvFile)romofGame.Child(r1)).Status == "nodump") != (((RvFile)mGame.Child(r)).Status == "nodump")) continue;
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@@ -446,9 +454,9 @@ namespace ROMVault2.DatReaders
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
string parentName = searchGame.Game.GetData(RvGame.GameData.RomOf);
|
string parentName = searchGame.Game.GetData(RvGame.GameData.RomOf);
|
||||||
if (String.IsNullOrEmpty(parentName) || parentName==searchGame.Name)
|
if (String.IsNullOrEmpty(parentName) || parentName == searchGame.Name)
|
||||||
parentName = searchGame.Game.GetData(RvGame.GameData.CloneOf);
|
parentName = searchGame.Game.GetData(RvGame.GameData.CloneOf);
|
||||||
if (String.IsNullOrEmpty(parentName) || parentName==searchGame.Name)
|
if (String.IsNullOrEmpty(parentName) || parentName == searchGame.Name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int intIndex;
|
int intIndex;
|
||||||
|
|||||||
@@ -28,20 +28,24 @@ namespace ROMVault2.DatReaders
|
|||||||
XmlNodeList dirNodeList = doc.DocumentElement.SelectNodes("dir");
|
XmlNodeList dirNodeList = doc.DocumentElement.SelectNodes("dir");
|
||||||
if (dirNodeList != null)
|
if (dirNodeList != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dirNodeList.Count; i++)
|
foreach (XmlNode dirNode in dirNodeList)
|
||||||
{
|
LoadDirFromDat(ref tDat, dirNode, thisFileType);
|
||||||
LoadDirFromDat(ref tDat, dirNodeList[i], thisFileType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("game");
|
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("game");
|
||||||
|
|
||||||
if (gameNodeList != null)
|
if (gameNodeList != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gameNodeList.Count; i++)
|
foreach (XmlNode gameNode in gameNodeList)
|
||||||
{
|
LoadGameFromDat(ref tDat, gameNode, thisFileType);
|
||||||
LoadGameFromDat(ref tDat, gameNodeList[i], thisFileType);
|
}
|
||||||
}
|
|
||||||
|
XmlNodeList machineNodeList = doc.DocumentElement.SelectNodes("machine");
|
||||||
|
|
||||||
|
if (machineNodeList != null)
|
||||||
|
{
|
||||||
|
foreach (XmlNode machineNode in machineNodeList)
|
||||||
|
LoadGameFromDat(ref tDat, machineNode, thisFileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -60,22 +64,27 @@ namespace ROMVault2.DatReaders
|
|||||||
XmlNodeList dirNodeList = doc.DocumentElement.SelectNodes("dir");
|
XmlNodeList dirNodeList = doc.DocumentElement.SelectNodes("dir");
|
||||||
if (dirNodeList != null)
|
if (dirNodeList != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dirNodeList.Count; i++)
|
foreach (XmlNode dirNode in dirNodeList)
|
||||||
{
|
LoadDirFromDat(ref tDat, dirNode, thisFileType);
|
||||||
LoadDirFromDat(ref tDat, dirNodeList[i], thisFileType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("game");
|
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("game");
|
||||||
|
|
||||||
if (gameNodeList != null)
|
if (gameNodeList != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gameNodeList.Count; i++)
|
foreach (XmlNode gameNode in gameNodeList)
|
||||||
{
|
LoadGameFromDat(ref tDat, gameNode, thisFileType);
|
||||||
LoadGameFromDat(ref tDat, gameNodeList[i], thisFileType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XmlNodeList machineNodeList = doc.DocumentElement.SelectNodes("machine");
|
||||||
|
|
||||||
|
if (machineNodeList != null)
|
||||||
|
{
|
||||||
|
foreach (XmlNode machineNode in machineNodeList)
|
||||||
|
LoadGameFromDat(ref tDat, machineNode, thisFileType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,13 +158,15 @@ namespace ROMVault2.DatReaders
|
|||||||
}
|
}
|
||||||
val = VarFix.String(packingNode.Attributes.GetNamedItem("dir")).ToLower(); // noautodir , nogame
|
val = VarFix.String(packingNode.Attributes.GetNamedItem("dir")).ToLower(); // noautodir , nogame
|
||||||
if (!String.IsNullOrEmpty(val))
|
if (!String.IsNullOrEmpty(val))
|
||||||
tDat.AddData(RvDat.DatData.DirSetup,val);
|
tDat.AddData(RvDat.DatData.DirSetup, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for: <notzipped>true</notzipped>
|
// Look for: <notzipped>true</notzipped>
|
||||||
string notzipped = VarFix.String(head.SelectSingleNode("notzipped"));
|
string notzipped = VarFix.String(head.SelectSingleNode("notzipped"));
|
||||||
if (notzipped.ToLower() == "true" || notzipped.ToLower() == "yes") thisFileType = FileType.File;
|
if (notzipped.ToLower() == "true" || notzipped.ToLower() == "yes") thisFileType = FileType.File;
|
||||||
|
if (Settings.FixLevel == eFixLevel.Uncompressed)
|
||||||
|
thisFileType = FileType.File;
|
||||||
|
|
||||||
tDir.Dat = tDat;
|
tDir.Dat = tDat;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
8
ROMVault2/FrmMain.Designer.cs
generated
8
ROMVault2/FrmMain.Designer.cs
generated
@@ -656,6 +656,7 @@
|
|||||||
this.GameGrid.SelectionChanged += new System.EventHandler(this.GameGridSelectionChanged);
|
this.GameGrid.SelectionChanged += new System.EventHandler(this.GameGridSelectionChanged);
|
||||||
this.GameGrid.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.GameGridMouseDoubleClick);
|
this.GameGrid.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.GameGridMouseDoubleClick);
|
||||||
this.GameGrid.MouseUp += new System.Windows.Forms.MouseEventHandler(this.GameGrid_MouseUp);
|
this.GameGrid.MouseUp += new System.Windows.Forms.MouseEventHandler(this.GameGrid_MouseUp);
|
||||||
|
this.GameGrid.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.GameGridColumnHeaderMouseClick);
|
||||||
//
|
//
|
||||||
// Type
|
// Type
|
||||||
//
|
//
|
||||||
@@ -664,7 +665,7 @@
|
|||||||
this.Type.Name = "Type";
|
this.Type.Name = "Type";
|
||||||
this.Type.ReadOnly = true;
|
this.Type.ReadOnly = true;
|
||||||
this.Type.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
this.Type.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||||
this.Type.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
this.Type.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||||
this.Type.Width = 40;
|
this.Type.Width = 40;
|
||||||
//
|
//
|
||||||
// CGame
|
// CGame
|
||||||
@@ -672,6 +673,7 @@
|
|||||||
this.CGame.HeaderText = "Game (Directory / Zip)";
|
this.CGame.HeaderText = "Game (Directory / Zip)";
|
||||||
this.CGame.Name = "CGame";
|
this.CGame.Name = "CGame";
|
||||||
this.CGame.ReadOnly = true;
|
this.CGame.ReadOnly = true;
|
||||||
|
this.CGame.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
|
||||||
this.CGame.Width = 220;
|
this.CGame.Width = 220;
|
||||||
//
|
//
|
||||||
// CDescription
|
// CDescription
|
||||||
@@ -679,6 +681,7 @@
|
|||||||
this.CDescription.HeaderText = "Description";
|
this.CDescription.HeaderText = "Description";
|
||||||
this.CDescription.Name = "CDescription";
|
this.CDescription.Name = "CDescription";
|
||||||
this.CDescription.ReadOnly = true;
|
this.CDescription.ReadOnly = true;
|
||||||
|
this.CDescription.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
|
||||||
this.CDescription.Width = 220;
|
this.CDescription.Width = 220;
|
||||||
//
|
//
|
||||||
// CCorrect
|
// CCorrect
|
||||||
@@ -687,6 +690,7 @@
|
|||||||
this.CCorrect.Name = "CCorrect";
|
this.CCorrect.Name = "CCorrect";
|
||||||
this.CCorrect.ReadOnly = true;
|
this.CCorrect.ReadOnly = true;
|
||||||
this.CCorrect.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
this.CCorrect.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||||
|
this.CCorrect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||||
this.CCorrect.Width = 500;
|
this.CCorrect.Width = 500;
|
||||||
//
|
//
|
||||||
// RomGrid
|
// RomGrid
|
||||||
@@ -756,7 +760,7 @@
|
|||||||
this.CGot.Name = "CGot";
|
this.CGot.Name = "CGot";
|
||||||
this.CGot.ReadOnly = true;
|
this.CGot.ReadOnly = true;
|
||||||
this.CGot.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
this.CGot.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||||
this.CGot.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
this.CGot.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||||
this.CGot.Width = 65;
|
this.CGot.Width = 65;
|
||||||
//
|
//
|
||||||
// CRom
|
// CRom
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.ServiceModel;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ROMVault2.Properties;
|
using ROMVault2.Properties;
|
||||||
using ROMVault2.RvDB;
|
using ROMVault2.RvDB;
|
||||||
@@ -18,7 +17,6 @@ namespace ROMVault2
|
|||||||
{
|
{
|
||||||
public partial class FrmMain : Form
|
public partial class FrmMain : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
private static readonly Color CBlue = Color.FromArgb(214, 214, 255);
|
private static readonly Color CBlue = Color.FromArgb(214, 214, 255);
|
||||||
private static readonly Color CGreyBlue = Color.FromArgb(214, 224, 255);
|
private static readonly Color CGreyBlue = Color.FromArgb(214, 224, 255);
|
||||||
private static readonly Color CRed = Color.FromArgb(255, 214, 214);
|
private static readonly Color CRed = Color.FromArgb(255, 214, 214);
|
||||||
@@ -35,10 +33,13 @@ namespace ROMVault2
|
|||||||
private static readonly Color CWhite = Color.FromArgb(255, 255, 255);
|
private static readonly Color CWhite = Color.FromArgb(255, 255, 255);
|
||||||
|
|
||||||
private readonly Color[] _displayColor;
|
private readonly Color[] _displayColor;
|
||||||
|
private readonly Color[] _fontColor;
|
||||||
|
|
||||||
private bool _updatingGameGrid;
|
private bool _updatingGameGrid;
|
||||||
|
|
||||||
public static int[] GameGridColumnXPositions;
|
private int _gameGridSortColumnIndex;
|
||||||
|
private SortOrder _gameGridSortOrder = SortOrder.Descending;
|
||||||
|
private static int[] _gameGridColumnXPositions;
|
||||||
|
|
||||||
private FrmKey _fk;
|
private FrmKey _fk;
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ namespace ROMVault2
|
|||||||
|
|
||||||
|
|
||||||
_displayColor = new Color[(int)RepStatus.EndValue];
|
_displayColor = new Color[(int)RepStatus.EndValue];
|
||||||
|
_fontColor = new Color[(int)RepStatus.EndValue];
|
||||||
|
|
||||||
// RepStatus.UnSet
|
// RepStatus.UnSet
|
||||||
|
|
||||||
@@ -101,7 +103,10 @@ namespace ROMVault2
|
|||||||
|
|
||||||
_displayColor[(int)RepStatus.Deleted] = CWhite;
|
_displayColor[(int)RepStatus.Deleted] = CWhite;
|
||||||
|
|
||||||
GameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
for (int i = 0; i < (int)RepStatus.EndValue; i++)
|
||||||
|
_fontColor[i] = contrasty(_displayColor[i]);
|
||||||
|
|
||||||
|
_gameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
||||||
|
|
||||||
DirTree.Setup(ref DB.DirTree);
|
DirTree.Setup(ref DB.DirTree);
|
||||||
|
|
||||||
@@ -410,33 +415,33 @@ namespace ROMVault2
|
|||||||
if (cf != DirTree.GetSelected())
|
if (cf != DirTree.GetSelected())
|
||||||
DatSetSelected(cf);
|
DatSetSelected(cf);
|
||||||
|
|
||||||
if (e.Button == MouseButtons.Right)
|
if (e.Button != MouseButtons.Right)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
RvDir tn = (RvDir)sender;
|
||||||
|
|
||||||
|
ContextMenu mnuContext = new ContextMenu();
|
||||||
|
|
||||||
|
MenuItem mnuFile = new MenuItem
|
||||||
{
|
{
|
||||||
RvDir tn = (RvDir)sender;
|
Index = 0,
|
||||||
|
Text = Resources.FrmMain_DirTreeRvSelected_Set_ROM_DIR,
|
||||||
|
Tag = tn.TreeFullName
|
||||||
|
};
|
||||||
|
mnuFile.Click += MnuFileClick;
|
||||||
|
mnuContext.MenuItems.Add(mnuFile);
|
||||||
|
|
||||||
ContextMenu mnuContext = new ContextMenu();
|
MenuItem mnuMakeDat = new MenuItem
|
||||||
|
{
|
||||||
|
Index = 1,
|
||||||
|
Text = @"Make Dat",
|
||||||
|
Tag = tn
|
||||||
|
};
|
||||||
|
mnuMakeDat.Click += MnuMakeDatClick;
|
||||||
|
mnuContext.MenuItems.Add(mnuMakeDat);
|
||||||
|
|
||||||
MenuItem mnuFile = new MenuItem
|
mnuContext.Show(DirTree, e.Location);
|
||||||
{
|
|
||||||
Index = 0,
|
|
||||||
Text = Resources.FrmMain_DirTreeRvSelected_Set_ROM_DIR,
|
|
||||||
Tag = tn.TreeFullName
|
|
||||||
};
|
|
||||||
mnuFile.Click += MnuFileClick;
|
|
||||||
mnuContext.MenuItems.Add(mnuFile);
|
|
||||||
|
|
||||||
MenuItem mnuMakeDat = new MenuItem
|
|
||||||
{
|
|
||||||
Index = 1,
|
|
||||||
Text = @"Make Dat",
|
|
||||||
Tag = tn
|
|
||||||
};
|
|
||||||
mnuMakeDat.Click += MnuMakeDatClick;
|
|
||||||
mnuContext.MenuItems.Add(mnuMakeDat);
|
|
||||||
|
|
||||||
|
|
||||||
mnuContext.Show(DirTree, e.Location);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region "DAT display code"
|
#region "DAT display code"
|
||||||
@@ -444,9 +449,23 @@ namespace ROMVault2
|
|||||||
private void DatSetSelected(RvBase cf)
|
private void DatSetSelected(RvBase cf)
|
||||||
{
|
{
|
||||||
DirTree.Refresh();
|
DirTree.Refresh();
|
||||||
|
|
||||||
|
if (Settings.IsMono)
|
||||||
|
{
|
||||||
|
if (GameGrid.RowCount > 0)
|
||||||
|
GameGrid.CurrentCell = GameGrid[0,0];
|
||||||
|
if (RomGrid.RowCount > 0)
|
||||||
|
RomGrid.CurrentCell = RomGrid[0,0];
|
||||||
|
}
|
||||||
|
|
||||||
GameGrid.Rows.Clear();
|
GameGrid.Rows.Clear();
|
||||||
RomGrid.Rows.Clear();
|
RomGrid.Rows.Clear();
|
||||||
|
|
||||||
|
// clear sorting
|
||||||
|
GameGrid.Columns[_gameGridSortColumnIndex].HeaderCell.SortGlyphDirection = SortOrder.None;
|
||||||
|
_gameGridSortColumnIndex = 0;
|
||||||
|
_gameGridSortOrder = SortOrder.Descending;
|
||||||
|
|
||||||
if (cf == null)
|
if (cf == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -579,12 +598,27 @@ namespace ROMVault2
|
|||||||
lblDITRomsUnknown.Text = (tDir.DirStatus.CountUnknown() + tDir.DirStatus.CountInToSort()).ToString(CultureInfo.InvariantCulture);
|
lblDITRomsUnknown.Text = (tDir.DirStatus.CountUnknown() + tDir.DirStatus.CountInToSort()).ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
_updatingGameGrid = true;
|
_updatingGameGrid = true;
|
||||||
|
|
||||||
|
if (Settings.IsMono)
|
||||||
|
{
|
||||||
|
if (GameGrid.RowCount > 0)
|
||||||
|
GameGrid.CurrentCell = GameGrid[0,0];
|
||||||
|
if (RomGrid.RowCount > 0)
|
||||||
|
RomGrid.CurrentCell = RomGrid[0,0];
|
||||||
|
}
|
||||||
|
|
||||||
GameGrid.Rows.Clear();
|
GameGrid.Rows.Clear();
|
||||||
RomGrid.Rows.Clear();
|
RomGrid.Rows.Clear();
|
||||||
|
|
||||||
|
// clear sorting
|
||||||
|
GameGrid.Columns[_gameGridSortColumnIndex].HeaderCell.SortGlyphDirection = SortOrder.None;
|
||||||
|
_gameGridSortColumnIndex = 0;
|
||||||
|
_gameGridSortOrder = SortOrder.Descending;
|
||||||
|
|
||||||
|
|
||||||
ReportStatus tDirStat;
|
ReportStatus tDirStat;
|
||||||
|
|
||||||
GameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
_gameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
||||||
|
|
||||||
int rowCount = 0;
|
int rowCount = 0;
|
||||||
for (int j = 0; j < tDir.ChildCount; j++)
|
for (int j = 0; j < tDir.ChildCount; j++)
|
||||||
@@ -621,8 +655,8 @@ namespace ROMVault2
|
|||||||
if (tDirStat.Get(RepairStatus.DisplayOrder[l]) <= 0) continue;
|
if (tDirStat.Get(RepairStatus.DisplayOrder[l]) <= 0) continue;
|
||||||
|
|
||||||
int len = DigitLength(tDirStat.Get(RepairStatus.DisplayOrder[l])) * 7 + 26;
|
int len = DigitLength(tDirStat.Get(RepairStatus.DisplayOrder[l])) * 7 + 26;
|
||||||
if (len > GameGridColumnXPositions[columnIndex])
|
if (len > _gameGridColumnXPositions[columnIndex])
|
||||||
GameGridColumnXPositions[columnIndex] = len;
|
_gameGridColumnXPositions[columnIndex] = len;
|
||||||
columnIndex++;
|
columnIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,8 +665,8 @@ namespace ROMVault2
|
|||||||
int t = 0;
|
int t = 0;
|
||||||
for (int l = 0; l < (int)RepStatus.EndValue; l++)
|
for (int l = 0; l < (int)RepStatus.EndValue; l++)
|
||||||
{
|
{
|
||||||
int colWidth = GameGridColumnXPositions[l];
|
int colWidth = _gameGridColumnXPositions[l];
|
||||||
GameGridColumnXPositions[l] = t;
|
_gameGridColumnXPositions[l] = t;
|
||||||
t += colWidth;
|
t += colWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,16 +740,17 @@ namespace ROMVault2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GameGrid_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
|
private void GameGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_updatingGameGrid)
|
if (_updatingGameGrid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Rectangle cellBounds = GameGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
|
Rectangle cellBounds = GameGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
|
||||||
RvDir tRvDir = (ROMVault2.RvDB.RvDir)GameGrid.Rows[e.RowIndex].Tag;
|
RvDir tRvDir = (RvDir)GameGrid.Rows[e.RowIndex].Tag;
|
||||||
ReportStatus tDirStat = tRvDir.DirStatus;
|
ReportStatus tDirStat = tRvDir.DirStatus;
|
||||||
Color bgCol = Color.FromArgb(255, 255, 255);
|
Color bgCol = Color.FromArgb(255, 255, 255);
|
||||||
|
Color fgCol = Color.FromArgb(0, 0, 0);
|
||||||
|
|
||||||
if (cellBounds.Width == 0 || cellBounds.Height == 0)
|
if (cellBounds.Width == 0 || cellBounds.Height == 0)
|
||||||
return;
|
return;
|
||||||
@@ -725,6 +760,7 @@ namespace ROMVault2
|
|||||||
if (tDirStat.Get(t1) <= 0) continue;
|
if (tDirStat.Get(t1) <= 0) continue;
|
||||||
|
|
||||||
bgCol = _displayColor[(int)t1];
|
bgCol = _displayColor[(int)t1];
|
||||||
|
fgCol = _fontColor[(int)t1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,6 +768,7 @@ namespace ROMVault2
|
|||||||
{
|
{
|
||||||
e.CellStyle.BackColor = bgCol;
|
e.CellStyle.BackColor = bgCol;
|
||||||
e.CellStyle.SelectionBackColor = bgCol;
|
e.CellStyle.SelectionBackColor = bgCol;
|
||||||
|
e.CellStyle.ForeColor = fgCol;
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(cellBounds.Width, cellBounds.Height);
|
Bitmap bmp = new Bitmap(cellBounds.Width, cellBounds.Height);
|
||||||
Graphics g = Graphics.FromImage(bmp);
|
Graphics g = Graphics.FromImage(bmp);
|
||||||
@@ -770,6 +807,7 @@ namespace ROMVault2
|
|||||||
else if (GameGrid.Columns[e.ColumnIndex].Name == "CGame")
|
else if (GameGrid.Columns[e.ColumnIndex].Name == "CGame")
|
||||||
{
|
{
|
||||||
e.CellStyle.BackColor = bgCol;
|
e.CellStyle.BackColor = bgCol;
|
||||||
|
e.CellStyle.ForeColor = fgCol;
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(tRvDir.FileName))
|
if (String.IsNullOrEmpty(tRvDir.FileName))
|
||||||
e.Value = tRvDir.Name;
|
e.Value = tRvDir.Name;
|
||||||
@@ -779,6 +817,7 @@ namespace ROMVault2
|
|||||||
else if (GameGrid.Columns[e.ColumnIndex].Name == "CDescription")
|
else if (GameGrid.Columns[e.ColumnIndex].Name == "CDescription")
|
||||||
{
|
{
|
||||||
e.CellStyle.BackColor = bgCol;
|
e.CellStyle.BackColor = bgCol;
|
||||||
|
e.CellStyle.ForeColor = fgCol;
|
||||||
|
|
||||||
if (tRvDir.Game != null)
|
if (tRvDir.Game != null)
|
||||||
e.Value = tRvDir.Game.GetData(RvGame.GameData.Description);
|
e.Value = tRvDir.Game.GetData(RvGame.GameData.Description);
|
||||||
@@ -802,7 +841,7 @@ namespace ROMVault2
|
|||||||
|
|
||||||
if (tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]) <= 0) continue;
|
if (tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]) <= 0) continue;
|
||||||
|
|
||||||
gOff = FrmMain.GameGridColumnXPositions[columnIndex];
|
gOff = _gameGridColumnXPositions[columnIndex];
|
||||||
Bitmap bm = rvImages.GetBitmap(@"G_" + RepairStatus.DisplayOrder[l]);
|
Bitmap bm = rvImages.GetBitmap(@"G_" + RepairStatus.DisplayOrder[l]);
|
||||||
if (bm != null)
|
if (bm != null)
|
||||||
{
|
{
|
||||||
@@ -823,7 +862,7 @@ namespace ROMVault2
|
|||||||
|
|
||||||
if (tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]) > 0)
|
if (tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]) > 0)
|
||||||
{
|
{
|
||||||
gOff = FrmMain.GameGridColumnXPositions[columnIndex];
|
gOff = _gameGridColumnXPositions[columnIndex];
|
||||||
g.DrawString(tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]).ToString(CultureInfo.InvariantCulture), drawFont, drawBrushBlack, new PointF(gOff + 20, 3));
|
g.DrawString(tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]).ToString(CultureInfo.InvariantCulture), drawFont, drawBrushBlack, new PointF(gOff + 20, 3));
|
||||||
columnIndex++;
|
columnIndex++;
|
||||||
}
|
}
|
||||||
@@ -833,9 +872,83 @@ namespace ROMVault2
|
|||||||
e.Value = bmp;
|
e.Value = bmp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Console.WriteLine("WARN: GameGrid_CellFormatting() unknown column: {0}", GameGrid.Columns[e.ColumnIndex].Name);
|
Console.WriteLine("WARN: GameGrid_CellFormatting() unknown column: {0}", GameGrid.Columns[e.ColumnIndex].Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GameGridColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
// only allow sort on CGame/CDescription
|
||||||
|
if (e.ColumnIndex != 1 && e.ColumnIndex != 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DataGridViewColumn newColumn = GameGrid.Columns[e.ColumnIndex];
|
||||||
|
DataGridViewColumn oldColumn = GameGrid.Columns[_gameGridSortColumnIndex];
|
||||||
|
|
||||||
|
if (newColumn == oldColumn)
|
||||||
|
{
|
||||||
|
_gameGridSortOrder = _gameGridSortOrder == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldColumn.HeaderCell.SortGlyphDirection = SortOrder.None;
|
||||||
|
_gameGridSortOrder = SortOrder.Ascending;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameGrid.Sort(new GameGridRowComparer(_gameGridSortOrder, e.ColumnIndex));
|
||||||
|
newColumn.HeaderCell.SortGlyphDirection = _gameGridSortOrder;
|
||||||
|
_gameGridSortColumnIndex = e.ColumnIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GameGridRowComparer : System.Collections.IComparer
|
||||||
|
{
|
||||||
|
private readonly int _sortMod = 1;
|
||||||
|
private readonly int _columnIndex;
|
||||||
|
|
||||||
|
public GameGridRowComparer(SortOrder sortOrder, int index)
|
||||||
|
{
|
||||||
|
_columnIndex = index;
|
||||||
|
|
||||||
|
if (sortOrder == SortOrder.Descending)
|
||||||
|
_sortMod = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Compare(object a, object b)
|
||||||
|
{
|
||||||
|
DataGridViewRow aRow = (DataGridViewRow)a;
|
||||||
|
DataGridViewRow bRow = (DataGridViewRow)b;
|
||||||
|
|
||||||
|
RvDir aRvDir = (RvDir)aRow.Tag;
|
||||||
|
RvDir bRvDir = (RvDir)bRow.Tag;
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
switch (_columnIndex)
|
||||||
|
{
|
||||||
|
case 1: // CGame
|
||||||
|
result = String.CompareOrdinal(aRvDir.Name, bRvDir.Name);
|
||||||
|
break;
|
||||||
|
case 2: // CDescription
|
||||||
|
String aDes = "";
|
||||||
|
String bDes = "";
|
||||||
|
if (aRvDir.Game != null)
|
||||||
|
aDes = aRvDir.Game.GetData(RvGame.GameData.Description);
|
||||||
|
if (bRvDir.Game != null)
|
||||||
|
bDes = bRvDir.Game.GetData(RvGame.GameData.Description);
|
||||||
|
|
||||||
|
result = String.CompareOrdinal(aDes, bDes);
|
||||||
|
|
||||||
|
// if desciptions match, fall through to sorting by name
|
||||||
|
if (result == 0)
|
||||||
|
result = String.CompareOrdinal(aRvDir.Name, bRvDir.Name);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("WARN: GameGridRowComparer::Compare() Invalid columnIndex: {0}", _columnIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return _sortMod * result;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "Rom Grid Code"
|
#region "Rom Grid Code"
|
||||||
@@ -860,7 +973,7 @@ namespace ROMVault2
|
|||||||
|
|
||||||
private void gbSetInfo_Resize(object sender, EventArgs e)
|
private void gbSetInfo_Resize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int leftPos = 84;
|
const int leftPos = 84;
|
||||||
int rightPos = gbSetInfo.Width - 15;
|
int rightPos = gbSetInfo.Width - 15;
|
||||||
if (rightPos > 750) rightPos = 750;
|
if (rightPos > 750) rightPos = 750;
|
||||||
int width = rightPos - leftPos;
|
int width = rightPos - leftPos;
|
||||||
@@ -890,14 +1003,14 @@ namespace ROMVault2
|
|||||||
lblSITDeveloper.Width = width;
|
lblSITDeveloper.Width = width;
|
||||||
|
|
||||||
int width3 = (int)((double)width * 0.24);
|
int width3 = (int)((double)width * 0.24);
|
||||||
int P2 = (int)((double)width * 0.38);
|
int p2 = (int)((double)width * 0.38);
|
||||||
|
|
||||||
int width4 = (int) ((double) width*0.24);
|
int width4 = (int) ((double) width*0.24);
|
||||||
|
|
||||||
lblSITEdition.Width = width3;
|
lblSITEdition.Width = width3;
|
||||||
|
|
||||||
lblSIVersion.Left = leftPos + P2 - 78;
|
lblSIVersion.Left = leftPos + p2 - 78;
|
||||||
lblSITVersion.Left = leftPos + P2;
|
lblSITVersion.Left = leftPos + p2;
|
||||||
lblSITVersion.Width = width3;
|
lblSITVersion.Width = width3;
|
||||||
|
|
||||||
lblSIType.Left = leftPos + width - width3 - 78;
|
lblSIType.Left = leftPos + width - width3 - 78;
|
||||||
@@ -907,8 +1020,8 @@ namespace ROMVault2
|
|||||||
|
|
||||||
lblSITMedia.Width = width3;
|
lblSITMedia.Width = width3;
|
||||||
|
|
||||||
lblSILanguage.Left = leftPos + P2 - 78;
|
lblSILanguage.Left = leftPos + p2 - 78;
|
||||||
lblSITLanguage.Left = leftPos + P2;
|
lblSITLanguage.Left = leftPos + p2;
|
||||||
lblSITLanguage.Width = width3;
|
lblSITLanguage.Width = width3;
|
||||||
|
|
||||||
lblSIPlayers.Left = leftPos + width - width3 - 78;
|
lblSIPlayers.Left = leftPos + width - width3 - 78;
|
||||||
@@ -917,8 +1030,8 @@ namespace ROMVault2
|
|||||||
|
|
||||||
lblSITRatings.Width = width3;
|
lblSITRatings.Width = width3;
|
||||||
|
|
||||||
lblSIGenre.Left = leftPos + P2 - 78;
|
lblSIGenre.Left = leftPos + p2 - 78;
|
||||||
lblSITGenre.Left = leftPos + P2;
|
lblSITGenre.Left = leftPos + p2;
|
||||||
lblSITGenre.Width = width3;
|
lblSITGenre.Width = width3;
|
||||||
|
|
||||||
lblSIPeripheral.Left = leftPos + width - width3 - 78;
|
lblSIPeripheral.Left = leftPos + width - width3 - 78;
|
||||||
@@ -1160,6 +1273,9 @@ namespace ROMVault2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings.IsMono && RomGrid.RowCount > 0)
|
||||||
|
RomGrid.CurrentCell = RomGrid[0,0];
|
||||||
|
|
||||||
RomGrid.Rows.Clear();
|
RomGrid.Rows.Clear();
|
||||||
AddDir(tGame, "");
|
AddDir(tGame, "");
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
@@ -1186,6 +1302,13 @@ namespace ROMVault2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns either white or black, depending of quick luminance of the Color " a "
|
||||||
|
// called when the _displayColor is finished, in order to populate the _fontColor table.
|
||||||
|
private Color contrasty(Color a)
|
||||||
|
{
|
||||||
|
return (a.R << 1) + a.B + a.G + (a.G << 2) < 1024 ? Color.White : Color.Black;
|
||||||
|
}
|
||||||
|
|
||||||
private void AddRom(RvFile tRomTable, string pathAdd)
|
private void AddRom(RvFile tRomTable, string pathAdd)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1196,8 +1319,11 @@ namespace ROMVault2
|
|||||||
RomGrid.Rows[row].Tag = tRomTable;
|
RomGrid.Rows[row].Tag = tRomTable;
|
||||||
|
|
||||||
for (int i = 0; i < RomGrid.Rows[row].Cells.Count; i++)
|
for (int i = 0; i < RomGrid.Rows[row].Cells.Count; i++)
|
||||||
RomGrid.Rows[row].Cells[i].Style.BackColor = _displayColor[(int)tRomTable.RepStatus];
|
{
|
||||||
|
DataGridViewCellStyle cs = RomGrid.Rows[row].Cells[i].Style;
|
||||||
|
cs.BackColor = _displayColor[(int)tRomTable.RepStatus];
|
||||||
|
cs.ForeColor = _fontColor[(int)tRomTable.RepStatus];
|
||||||
|
}
|
||||||
string fname = pathAdd + tRomTable.Name;
|
string fname = pathAdd + tRomTable.Name;
|
||||||
if (!string.IsNullOrEmpty(tRomTable.FileName))
|
if (!string.IsNullOrEmpty(tRomTable.FileName))
|
||||||
fname += " (Found: " + tRomTable.FileName + ")";
|
fname += " (Found: " + tRomTable.FileName + ")";
|
||||||
@@ -1275,14 +1401,14 @@ namespace ROMVault2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RomGrid_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
|
private void RomGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_updatingGameGrid)
|
if (_updatingGameGrid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Rectangle cellBounds = RomGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
|
Rectangle cellBounds = RomGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
|
||||||
RvFile tRvFile = (ROMVault2.RvDB.RvFile)RomGrid.Rows[e.RowIndex].Tag;
|
RvFile tRvFile = (RvFile)RomGrid.Rows[e.RowIndex].Tag;
|
||||||
|
|
||||||
if (cellBounds.Width == 0 || cellBounds.Height == 0)
|
if (cellBounds.Width == 0 || cellBounds.Height == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1335,6 +1461,7 @@ namespace ROMVault2
|
|||||||
private void SettingsToolStripMenuItemClick(object sender, EventArgs e)
|
private void SettingsToolStripMenuItemClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FrmSettings fcfg = new FrmSettings();
|
FrmSettings fcfg = new FrmSettings();
|
||||||
|
fcfg.UpdateDats += UpdateDats;
|
||||||
fcfg.ShowDialog(this);
|
fcfg.ShowDialog(this);
|
||||||
fcfg.Dispose();
|
fcfg.Dispose();
|
||||||
}
|
}
|
||||||
@@ -1404,27 +1531,26 @@ namespace ROMVault2
|
|||||||
|
|
||||||
private void GameGrid_MouseUp(object sender, MouseEventArgs e)
|
private void GameGrid_MouseUp(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Button == MouseButtons.Right)
|
if (e.Button != MouseButtons.Right)
|
||||||
{
|
return;
|
||||||
int currentMouseOverRow = GameGrid.HitTest(e.X, e.Y).RowIndex;
|
|
||||||
if (currentMouseOverRow >= 0)
|
|
||||||
{
|
|
||||||
object r1 = GameGrid.Rows[currentMouseOverRow].Cells[1].Value;
|
|
||||||
string filename = r1 != null ? r1.ToString() : "";
|
|
||||||
object r2 = GameGrid.Rows[currentMouseOverRow].Cells[2].Value;
|
|
||||||
string description = r2 != null ? r2.ToString() : "";
|
|
||||||
|
|
||||||
try
|
int currentMouseOverRow = GameGrid.HitTest(e.X, e.Y).RowIndex;
|
||||||
{
|
if (currentMouseOverRow >= 0)
|
||||||
Clipboard.Clear();
|
{
|
||||||
Clipboard.SetText("Name : " + filename + Environment.NewLine + "Desc : " + description + Environment.NewLine);
|
object r1 = GameGrid.Rows[currentMouseOverRow].Cells[1].Value;
|
||||||
}
|
string filename = r1 != null ? r1.ToString() : "";
|
||||||
catch
|
object r2 = GameGrid.Rows[currentMouseOverRow].Cells[2].Value;
|
||||||
{
|
string description = r2 != null ? r2.ToString() : "";
|
||||||
}
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Clipboard.Clear();
|
||||||
|
Clipboard.SetText("Name : " + filename + Environment.NewLine + "Desc : " + description + Environment.NewLine);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ namespace ROMVault2
|
|||||||
|
|
||||||
private void UpdateGrid()
|
private void UpdateGrid()
|
||||||
{
|
{
|
||||||
|
if (Settings.IsMono && DataGridGames.RowCount > 0)
|
||||||
|
DataGridGames.CurrentCell = DataGridGames[0,0];
|
||||||
|
|
||||||
DataGridGames.Rows.Clear();
|
DataGridGames.Rows.Clear();
|
||||||
foreach (DirMap t in Settings.DirPathMap)
|
foreach (DirMap t in Settings.DirPathMap)
|
||||||
{
|
{
|
||||||
@@ -77,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 = 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)
|
||||||
|
|||||||
@@ -8,11 +8,17 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ROMVault2.Properties;
|
using ROMVault2.Properties;
|
||||||
|
using System.IO;
|
||||||
|
using ROMVault2.RvDB;
|
||||||
|
|
||||||
namespace ROMVault2
|
namespace ROMVault2
|
||||||
{
|
{
|
||||||
public partial class FrmSettings : Form
|
public partial class FrmSettings : Form
|
||||||
{
|
{
|
||||||
|
public delegate void UpdateDatsDelegate();
|
||||||
|
|
||||||
|
public event UpdateDatsDelegate UpdateDats;
|
||||||
|
|
||||||
public FrmSettings()
|
public FrmSettings()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -29,6 +35,7 @@ namespace ROMVault2
|
|||||||
cboFixLevel.Items.Add("Level1");
|
cboFixLevel.Items.Add("Level1");
|
||||||
cboFixLevel.Items.Add("Level2");
|
cboFixLevel.Items.Add("Level2");
|
||||||
cboFixLevel.Items.Add("Level3");
|
cboFixLevel.Items.Add("Level3");
|
||||||
|
cboFixLevel.Items.Add("Uncompressed");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FrmConfigLoad(object sender, EventArgs e)
|
private void FrmConfigLoad(object sender, EventArgs e)
|
||||||
@@ -54,6 +61,26 @@ namespace ROMVault2
|
|||||||
|
|
||||||
private void BtnOkClick(object sender, EventArgs e)
|
private void BtnOkClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (Settings.FixLevel != (eFixLevel)cboFixLevel.SelectedIndex)
|
||||||
|
{
|
||||||
|
if (Settings.FixLevel == eFixLevel.Uncompressed ||
|
||||||
|
(eFixLevel)cboFixLevel.SelectedIndex == eFixLevel.Uncompressed)
|
||||||
|
{
|
||||||
|
DialogResult dlg = MessageBox.Show("Changing from/to uncompressed requires the cache file to be deleted.\nDo you want to proceed?", "Settings", MessageBoxButtons.YesNoCancel);
|
||||||
|
|
||||||
|
if (dlg == DialogResult.Cancel)
|
||||||
|
Close();
|
||||||
|
|
||||||
|
if (dlg != DialogResult.Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
File.Delete(Settings.CacheFile);
|
||||||
|
DB.Read(sender, new System.ComponentModel.DoWorkEventArgs(null));
|
||||||
|
Settings.FixLevel = (eFixLevel)cboFixLevel.SelectedIndex;
|
||||||
|
UpdateDats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Settings.DatRoot = lblDATRoot.Text;
|
Settings.DatRoot = lblDATRoot.Text;
|
||||||
Settings.ScanLevel = (eScanLevel)cboScanLevel.SelectedIndex;
|
Settings.ScanLevel = (eScanLevel)cboScanLevel.SelectedIndex;
|
||||||
Settings.FixLevel = (eFixLevel)cboFixLevel.SelectedIndex;
|
Settings.FixLevel = (eFixLevel)cboFixLevel.SelectedIndex;
|
||||||
@@ -88,7 +115,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 = Environment.SpecialFolder.DesktopDirectory,
|
RootFolder = Environment.SpecialFolder.MyComputer,
|
||||||
SelectedPath = Settings.DatRoot
|
SelectedPath = Settings.DatRoot
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace ROMVault2.IO
|
|||||||
FullName = path;
|
FullName = path;
|
||||||
Name = Path.GetFileName(path);
|
Name = Path.GetFileName(path);
|
||||||
|
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.FileInfo fi = new System.IO.FileInfo(path);
|
System.IO.FileInfo fi = new System.IO.FileInfo(path);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ namespace ROMVault2.IO
|
|||||||
FullName = path;
|
FullName = path;
|
||||||
Name = Path.GetFileName(path);
|
Name = Path.GetFileName(path);
|
||||||
|
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.DirectoryInfo fi = new System.IO.DirectoryInfo(path);
|
System.IO.DirectoryInfo fi = new System.IO.DirectoryInfo(path);
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ namespace ROMVault2.IO
|
|||||||
{
|
{
|
||||||
List<DirectoryInfo> dirs = new List<DirectoryInfo>();
|
List<DirectoryInfo> dirs = new List<DirectoryInfo>();
|
||||||
|
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FullName);
|
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FullName);
|
||||||
System.IO.DirectoryInfo[] arrDi = di.GetDirectories(SearchPattern);
|
System.IO.DirectoryInfo[] arrDi = di.GetDirectories(SearchPattern);
|
||||||
@@ -183,7 +183,7 @@ namespace ROMVault2.IO
|
|||||||
{
|
{
|
||||||
List<FileInfo> files = new List<FileInfo>();
|
List<FileInfo> files = new List<FileInfo>();
|
||||||
|
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FullName);
|
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FullName);
|
||||||
System.IO.FileInfo[] arrDi = di.GetFiles(SearchPattern);
|
System.IO.FileInfo[] arrDi = di.GetFiles(SearchPattern);
|
||||||
@@ -239,7 +239,7 @@ namespace ROMVault2.IO
|
|||||||
{
|
{
|
||||||
public static bool Exists(string path)
|
public static bool Exists(string path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
return System.IO.Directory.Exists(path);
|
return System.IO.Directory.Exists(path);
|
||||||
|
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static void Move(String sourceDirName, String destDirName)
|
public static void Move(String sourceDirName, String destDirName)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.Directory.Move(sourceDirName, destDirName);
|
System.IO.Directory.Move(sourceDirName, destDirName);
|
||||||
return;
|
return;
|
||||||
@@ -288,7 +288,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static void Delete(String path)
|
public static void Delete(String path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.Directory.Delete(path);
|
System.IO.Directory.Delete(path);
|
||||||
return;
|
return;
|
||||||
@@ -301,7 +301,7 @@ namespace ROMVault2.IO
|
|||||||
|
|
||||||
public static void CreateDirectory(String path)
|
public static void CreateDirectory(String path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.Directory.CreateDirectory(path);
|
System.IO.Directory.CreateDirectory(path);
|
||||||
return;
|
return;
|
||||||
@@ -323,7 +323,7 @@ namespace ROMVault2.IO
|
|||||||
{
|
{
|
||||||
public static bool Exists(string path)
|
public static bool Exists(string path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
return System.IO.File.Exists(path);
|
return System.IO.File.Exists(path);
|
||||||
|
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static void Copy(String sourceFileName, String destFileName, bool overwrite)
|
public static void Copy(String sourceFileName, String destFileName, bool overwrite)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.File.Copy(sourceFileName, destFileName, overwrite);
|
System.IO.File.Copy(sourceFileName, destFileName, overwrite);
|
||||||
return;
|
return;
|
||||||
@@ -387,7 +387,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static void Move(String sourceFileName, String destFileName)
|
public static void Move(String sourceFileName, String destFileName)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.File.Move(sourceFileName, destFileName);
|
System.IO.File.Move(sourceFileName, destFileName);
|
||||||
return;
|
return;
|
||||||
@@ -412,7 +412,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static void Delete(String path)
|
public static void Delete(String path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
System.IO.File.Delete(path);
|
System.IO.File.Delete(path);
|
||||||
return;
|
return;
|
||||||
@@ -431,7 +431,7 @@ namespace ROMVault2.IO
|
|||||||
|
|
||||||
public static bool SetAttributes(String path, FileAttributes fileAttributes)
|
public static bool SetAttributes(String path, FileAttributes fileAttributes)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -466,7 +466,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static string Combine(string path1, string path2)
|
public static string Combine(string path1, string path2)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
return System.IO.Path.Combine(path1, path2);
|
return System.IO.Path.Combine(path1, path2);
|
||||||
|
|
||||||
if (path1 == null || path2 == null)
|
if (path1 == null || path2 == null)
|
||||||
@@ -538,7 +538,7 @@ namespace ROMVault2.IO
|
|||||||
}
|
}
|
||||||
public static String GetDirectoryName(String path)
|
public static String GetDirectoryName(String path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
return System.IO.Path.GetDirectoryName(path);
|
return System.IO.Path.GetDirectoryName(path);
|
||||||
|
|
||||||
|
|
||||||
@@ -600,7 +600,7 @@ namespace ROMVault2.IO
|
|||||||
|
|
||||||
public static int OpenFileRead(string path, out System.IO.Stream stream)
|
public static int OpenFileRead(string path, out System.IO.Stream stream)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -634,7 +634,7 @@ namespace ROMVault2.IO
|
|||||||
|
|
||||||
public static int OpenFileWrite(string path, out System.IO.Stream stream)
|
public static int OpenFileWrite(string path, out System.IO.Stream stream)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -675,7 +675,7 @@ namespace ROMVault2.IO
|
|||||||
{
|
{
|
||||||
public static string GetShortPath(string path)
|
public static string GetShortPath(string path)
|
||||||
{
|
{
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
int remove = 0;
|
int remove = 0;
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ 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 = 0;
|
public const int SubVersion = 5;
|
||||||
|
|
||||||
public static string ErrorMessage;
|
|
||||||
public static string URL;
|
|
||||||
|
|
||||||
public static SynchronizationContext SyncCont;
|
public static SynchronizationContext SyncCont;
|
||||||
|
|
||||||
@@ -40,14 +37,6 @@ namespace ROMVault2
|
|||||||
|
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ROMVault2</RootNamespace>
|
<RootNamespace>ROMVault2</RootNamespace>
|
||||||
<AssemblyName>ROMVault21</AssemblyName>
|
<AssemblyName>ROMVault225</AssemblyName>
|
||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<TargetFrameworkProfile>
|
<TargetFrameworkProfile>
|
||||||
</TargetFrameworkProfile>
|
</TargetFrameworkProfile>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>Stage\</OutputPath>
|
<OutputPath>..\..\Stage\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;UNMANAGED;COMPRESS;LZMA_STREAM;DOTNET20</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;UNMANAGED;COMPRESS;LZMA_STREAM;DOTNET20</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
|||||||
@@ -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 = 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
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace ROMVault2
|
|||||||
TrrntZipLevel3,
|
TrrntZipLevel3,
|
||||||
Level1,
|
Level1,
|
||||||
Level2,
|
Level2,
|
||||||
Level3
|
Level3,
|
||||||
|
Uncompressed
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Settings
|
public static class Settings
|
||||||
@@ -48,7 +49,7 @@ namespace ROMVault2
|
|||||||
public static bool CacheSaveTimerEnabled = true;
|
public static bool CacheSaveTimerEnabled = true;
|
||||||
public static int CacheSaveTimePeriod = 10;
|
public static int CacheSaveTimePeriod = 10;
|
||||||
|
|
||||||
public static bool MonoFileIO
|
public static bool IsUnix
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -57,6 +58,8 @@ namespace ROMVault2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsMono { get { return (Type.GetType ("Mono.Runtime") != null); } }
|
||||||
|
|
||||||
public static void SetDefaults()
|
public static void SetDefaults()
|
||||||
{
|
{
|
||||||
CacheFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RomVault2_" + DBVersion.Version + ".Cache");
|
CacheFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RomVault2_" + DBVersion.Version + ".Cache");
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ namespace ROMVault2.SupportedFiles.CHD
|
|||||||
_resultType = CHDManCheck.Unset;
|
_resultType = CHDManCheck.Unset;
|
||||||
|
|
||||||
string chdExe = "chdman.exe";
|
string chdExe = "chdman.exe";
|
||||||
if (Settings.MonoFileIO)
|
if (Settings.IsUnix)
|
||||||
chdExe = "chdman";
|
chdExe = "chdman";
|
||||||
|
|
||||||
string chdPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, chdExe);
|
string chdPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, chdExe);
|
||||||
|
|||||||
@@ -6,18 +6,21 @@
|
|||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Threading;
|
||||||
using ROMVault2.SupportedFiles.Zip.ZLib;
|
using ROMVault2.SupportedFiles.Zip.ZLib;
|
||||||
|
|
||||||
namespace ROMVault2.SupportedFiles.Files
|
namespace ROMVault2.SupportedFiles.Files
|
||||||
{
|
{
|
||||||
public static class UnCompFiles
|
public static class UnCompFiles
|
||||||
{
|
{
|
||||||
private const int Buffersize = 4096;
|
private const int Buffersize = 4096 * 1024;
|
||||||
private static readonly byte[] Buffer;
|
private static readonly byte[] Buffer0;
|
||||||
|
private static readonly byte[] Buffer1;
|
||||||
|
|
||||||
static UnCompFiles()
|
static UnCompFiles()
|
||||||
{
|
{
|
||||||
Buffer = new byte[Buffersize];
|
Buffer0 = new byte[Buffersize];
|
||||||
|
Buffer1 = new byte[Buffersize];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CheckSumRead(string filename, bool testDeep, out byte[] crc, out byte[] bMD5, out byte[] bSHA1)
|
public static int CheckSumRead(string filename, bool testDeep, out byte[] crc, out byte[] bMD5, out byte[] bSHA1)
|
||||||
@@ -26,11 +29,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 +37,66 @@ 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);
|
// Pre load the first buffer0
|
||||||
if (testDeep) sha1.TransformBlock(Buffer, 0, sizenow, null, 0);
|
int sizeNext = sizetogo > Buffersize ? Buffersize : (int)sizetogo;
|
||||||
sizetogo -= sizenow;
|
ds.Read(Buffer0, 0, sizeNext);
|
||||||
|
int sizebuffer = sizeNext;
|
||||||
|
sizetogo -= sizeNext;
|
||||||
|
bool whichBuffer = true;
|
||||||
|
|
||||||
|
while (sizebuffer > 0)
|
||||||
|
{
|
||||||
|
sizeNext = sizetogo > Buffersize ? Buffersize : (int)sizetogo;
|
||||||
|
|
||||||
|
Thread t0 = null;
|
||||||
|
if (sizeNext > 0)
|
||||||
|
{
|
||||||
|
t0 = new Thread(() => { ds.Read(whichBuffer ? Buffer1 : Buffer0, 0, sizeNext); });
|
||||||
|
t0.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = whichBuffer ? Buffer0 : Buffer1;
|
||||||
|
Thread t1 = new Thread(() => { crc32.TransformBlock(buffer, 0, sizebuffer, null, 0); });
|
||||||
|
t1.Start();
|
||||||
|
if (testDeep)
|
||||||
|
{
|
||||||
|
Thread t2 = new Thread(() => { md5.TransformBlock(buffer, 0, sizebuffer, null, 0); });
|
||||||
|
Thread t3 = new Thread(() => { sha1.TransformBlock(buffer, 0, sizebuffer, null, 0); });
|
||||||
|
t2.Start();
|
||||||
|
t3.Start();
|
||||||
|
t2.Join();
|
||||||
|
t3.Join();
|
||||||
|
}
|
||||||
|
if (t0 != null)
|
||||||
|
t0.Join();
|
||||||
|
t1.Join();
|
||||||
|
|
||||||
|
sizebuffer = sizeNext;
|
||||||
|
sizetogo -= sizeNext;
|
||||||
|
whichBuffer = !whichBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
crc32.TransformFinalBlock(Buffer0, 0, 0);
|
||||||
|
if (testDeep) md5.TransformFinalBlock(Buffer0, 0, 0);
|
||||||
|
if (testDeep) sha1.TransformFinalBlock(Buffer0, 0, 0);
|
||||||
|
|
||||||
|
ds.Close();
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
if (ds != null)
|
||||||
|
ds.Close();
|
||||||
|
|
||||||
crc32.TransformFinalBlock(Buffer, 0, 0);
|
return 0x17;
|
||||||
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;
|
||||||
@@ -63,8 +104,5 @@ namespace ROMVault2.SupportedFiles.Files
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using ROMVault2.SupportedFiles.Zip.ZLib;
|
using ROMVault2.SupportedFiles.Zip.ZLib;
|
||||||
|
|
||||||
// UInt16 = ushort
|
// UInt16 = ushort
|
||||||
@@ -20,8 +21,9 @@ namespace ROMVault2.SupportedFiles.Zip
|
|||||||
|
|
||||||
public class ZipFile
|
public class ZipFile
|
||||||
{
|
{
|
||||||
const int Buffersize = 4096 * 128;
|
const int Buffersize = 4096 * 1024;
|
||||||
private static byte[] _buffer;
|
private static byte[] _buffer0;
|
||||||
|
private static byte[] _buffer1;
|
||||||
|
|
||||||
private const uint LocalFileHeaderSignature = 0x04034b50;
|
private const uint LocalFileHeaderSignature = 0x04034b50;
|
||||||
private const uint CentralDirectoryHeaderSigniature = 0x02014b50;
|
private const uint CentralDirectoryHeaderSigniature = 0x02014b50;
|
||||||
@@ -717,25 +719,53 @@ namespace ROMVault2.SupportedFiles.Zip
|
|||||||
MD5 lmd5 = System.Security.Cryptography.MD5.Create();
|
MD5 lmd5 = System.Security.Cryptography.MD5.Create();
|
||||||
SHA1 lsha1 = System.Security.Cryptography.SHA1.Create();
|
SHA1 lsha1 = System.Security.Cryptography.SHA1.Create();
|
||||||
|
|
||||||
ulong sizetogo = UncompressedSize;
|
if (_buffer0 == null)
|
||||||
if (_buffer == null)
|
|
||||||
_buffer = new byte[Buffersize];
|
|
||||||
|
|
||||||
while (sizetogo > 0)
|
|
||||||
{
|
{
|
||||||
int sizenow = sizetogo > Buffersize ? Buffersize : (int)sizetogo;
|
_buffer0 = new byte[Buffersize];
|
||||||
sInput.Read(_buffer, 0, sizenow);
|
_buffer1 = new byte[Buffersize];
|
||||||
|
|
||||||
crc32.TransformBlock(_buffer, 0, sizenow, null, 0);
|
|
||||||
lmd5.TransformBlock(_buffer, 0, sizenow, null, 0);
|
|
||||||
lsha1.TransformBlock(_buffer, 0, sizenow, null, 0);
|
|
||||||
|
|
||||||
sizetogo = sizetogo - (ulong)sizenow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
crc32.TransformFinalBlock(_buffer, 0, 0);
|
ulong sizetogo = UncompressedSize;
|
||||||
lmd5.TransformFinalBlock(_buffer, 0, 0);
|
|
||||||
lsha1.TransformFinalBlock(_buffer, 0, 0);
|
// Pre load the first buffer0
|
||||||
|
int sizeNext = sizetogo > Buffersize ? Buffersize : (int)sizetogo;
|
||||||
|
sInput.Read(_buffer0, 0, sizeNext);
|
||||||
|
int sizebuffer = sizeNext;
|
||||||
|
sizetogo -= (ulong)sizeNext;
|
||||||
|
bool whichBuffer = true;
|
||||||
|
|
||||||
|
while (sizebuffer > 0)
|
||||||
|
{
|
||||||
|
sizeNext = sizetogo > Buffersize ? Buffersize : (int)sizetogo;
|
||||||
|
|
||||||
|
Thread t0 = null;
|
||||||
|
if (sizeNext > 0)
|
||||||
|
{
|
||||||
|
t0 = new Thread(() => { sInput.Read(whichBuffer ? _buffer1 : _buffer0, 0, sizeNext); });
|
||||||
|
t0.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = whichBuffer ? _buffer0 : _buffer1;
|
||||||
|
Thread t1 = new Thread(() => { crc32.TransformBlock(buffer, 0, sizebuffer, null, 0); });
|
||||||
|
Thread t2 = new Thread(() => { lmd5.TransformBlock(buffer, 0, sizebuffer, null, 0); });
|
||||||
|
Thread t3 = new Thread(() => { lsha1.TransformBlock(buffer, 0, sizebuffer, null, 0); });
|
||||||
|
t1.Start();
|
||||||
|
t2.Start();
|
||||||
|
t3.Start();
|
||||||
|
if (t0 != null)
|
||||||
|
t0.Join();
|
||||||
|
t1.Join();
|
||||||
|
t2.Join();
|
||||||
|
t3.Join();
|
||||||
|
|
||||||
|
sizebuffer = sizeNext;
|
||||||
|
sizetogo -= (ulong)sizeNext;
|
||||||
|
whichBuffer = !whichBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
crc32.TransformFinalBlock(_buffer0, 0, 0);
|
||||||
|
lmd5.TransformFinalBlock(_buffer0, 0, 0);
|
||||||
|
lsha1.TransformFinalBlock(_buffer0, 0, 0);
|
||||||
|
|
||||||
byte[] testcrc = crc32.Hash;
|
byte[] testcrc = crc32.Hash;
|
||||||
md5 = lmd5.Hash;
|
md5 = lmd5.Hash;
|
||||||
@@ -1525,7 +1555,7 @@ namespace ROMVault2.SupportedFiles.Zip
|
|||||||
int pos1 = 0;
|
int pos1 = 0;
|
||||||
int pos2 = 0;
|
int pos2 = 0;
|
||||||
|
|
||||||
for (; ; )
|
for (;;)
|
||||||
{
|
{
|
||||||
if (pos1 == bytes1.Length)
|
if (pos1 == bytes1.Length)
|
||||||
return ((pos2 == bytes2.Length) ? 0 : -1);
|
return ((pos2 == bytes2.Length) ? 0 : -1);
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ 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)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user