Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b368f33351 | ||
|
|
48ea11ab2e | ||
|
|
3e261ee077 | ||
|
|
a4939e5bf4 | ||
|
|
1c588291b7 | ||
|
|
39e4a6114f | ||
|
|
b54610c2f6 |
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.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.GameGridMouseDoubleClick);
|
||||
this.GameGrid.MouseUp += new System.Windows.Forms.MouseEventHandler(this.GameGrid_MouseUp);
|
||||
this.GameGrid.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.GameGridColumnHeaderMouseClick);
|
||||
//
|
||||
// Type
|
||||
//
|
||||
@@ -664,7 +665,7 @@
|
||||
this.Type.Name = "Type";
|
||||
this.Type.ReadOnly = 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;
|
||||
//
|
||||
// CGame
|
||||
@@ -672,6 +673,7 @@
|
||||
this.CGame.HeaderText = "Game (Directory / Zip)";
|
||||
this.CGame.Name = "CGame";
|
||||
this.CGame.ReadOnly = true;
|
||||
this.CGame.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
|
||||
this.CGame.Width = 220;
|
||||
//
|
||||
// CDescription
|
||||
@@ -679,6 +681,7 @@
|
||||
this.CDescription.HeaderText = "Description";
|
||||
this.CDescription.Name = "CDescription";
|
||||
this.CDescription.ReadOnly = true;
|
||||
this.CDescription.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Programmatic;
|
||||
this.CDescription.Width = 220;
|
||||
//
|
||||
// CCorrect
|
||||
@@ -687,6 +690,7 @@
|
||||
this.CCorrect.Name = "CCorrect";
|
||||
this.CCorrect.ReadOnly = true;
|
||||
this.CCorrect.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.CCorrect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.CCorrect.Width = 500;
|
||||
//
|
||||
// RomGrid
|
||||
@@ -756,7 +760,7 @@
|
||||
this.CGot.Name = "CGot";
|
||||
this.CGot.ReadOnly = 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;
|
||||
//
|
||||
// CRom
|
||||
|
||||
@@ -7,7 +7,6 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.ServiceModel;
|
||||
using System.Windows.Forms;
|
||||
using ROMVault2.Properties;
|
||||
using ROMVault2.RvDB;
|
||||
@@ -18,7 +17,6 @@ namespace ROMVault2
|
||||
{
|
||||
public partial class FrmMain : Form
|
||||
{
|
||||
|
||||
private static readonly Color CBlue = Color.FromArgb(214, 214, 255);
|
||||
private static readonly Color CGreyBlue = Color.FromArgb(214, 224, 255);
|
||||
private static readonly Color CRed = Color.FromArgb(255, 214, 214);
|
||||
@@ -37,8 +35,10 @@ namespace ROMVault2
|
||||
private readonly Color[] _displayColor;
|
||||
|
||||
private bool _updatingGameGrid;
|
||||
|
||||
public static int[] GameGridColumnXPositions;
|
||||
|
||||
private int _gameGridSortColumnIndex;
|
||||
private SortOrder _gameGridSortOrder = SortOrder.Descending;
|
||||
private static int[] _gameGridColumnXPositions;
|
||||
|
||||
private FrmKey _fk;
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace ROMVault2
|
||||
|
||||
_displayColor[(int)RepStatus.Deleted] = CWhite;
|
||||
|
||||
GameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
||||
_gameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
||||
|
||||
DirTree.Setup(ref DB.DirTree);
|
||||
|
||||
@@ -410,33 +410,33 @@ namespace ROMVault2
|
||||
if (cf != DirTree.GetSelected())
|
||||
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 mnuFile = new MenuItem
|
||||
{
|
||||
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);
|
||||
}
|
||||
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"
|
||||
@@ -444,9 +444,23 @@ namespace ROMVault2
|
||||
private void DatSetSelected(RvBase cf)
|
||||
{
|
||||
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();
|
||||
RomGrid.Rows.Clear();
|
||||
|
||||
// clear sorting
|
||||
GameGrid.Columns[_gameGridSortColumnIndex].HeaderCell.SortGlyphDirection = SortOrder.None;
|
||||
_gameGridSortColumnIndex = 0;
|
||||
_gameGridSortOrder = SortOrder.Descending;
|
||||
|
||||
if (cf == null)
|
||||
return;
|
||||
|
||||
@@ -579,12 +593,27 @@ namespace ROMVault2
|
||||
lblDITRomsUnknown.Text = (tDir.DirStatus.CountUnknown() + tDir.DirStatus.CountInToSort()).ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
_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();
|
||||
RomGrid.Rows.Clear();
|
||||
|
||||
// clear sorting
|
||||
GameGrid.Columns[_gameGridSortColumnIndex].HeaderCell.SortGlyphDirection = SortOrder.None;
|
||||
_gameGridSortColumnIndex = 0;
|
||||
_gameGridSortOrder = SortOrder.Descending;
|
||||
|
||||
|
||||
ReportStatus tDirStat;
|
||||
|
||||
GameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
||||
_gameGridColumnXPositions = new int[(int)RepStatus.EndValue];
|
||||
|
||||
int rowCount = 0;
|
||||
for (int j = 0; j < tDir.ChildCount; j++)
|
||||
@@ -621,8 +650,8 @@ namespace ROMVault2
|
||||
if (tDirStat.Get(RepairStatus.DisplayOrder[l]) <= 0) continue;
|
||||
|
||||
int len = DigitLength(tDirStat.Get(RepairStatus.DisplayOrder[l])) * 7 + 26;
|
||||
if (len > GameGridColumnXPositions[columnIndex])
|
||||
GameGridColumnXPositions[columnIndex] = len;
|
||||
if (len > _gameGridColumnXPositions[columnIndex])
|
||||
_gameGridColumnXPositions[columnIndex] = len;
|
||||
columnIndex++;
|
||||
}
|
||||
}
|
||||
@@ -631,8 +660,8 @@ namespace ROMVault2
|
||||
int t = 0;
|
||||
for (int l = 0; l < (int)RepStatus.EndValue; l++)
|
||||
{
|
||||
int colWidth = GameGridColumnXPositions[l];
|
||||
GameGridColumnXPositions[l] = t;
|
||||
int colWidth = _gameGridColumnXPositions[l];
|
||||
_gameGridColumnXPositions[l] = t;
|
||||
t += colWidth;
|
||||
}
|
||||
|
||||
@@ -706,14 +735,14 @@ namespace ROMVault2
|
||||
}
|
||||
}
|
||||
|
||||
private void GameGrid_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
|
||||
private void GameGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
|
||||
if (_updatingGameGrid)
|
||||
return;
|
||||
|
||||
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;
|
||||
Color bgCol = Color.FromArgb(255, 255, 255);
|
||||
|
||||
@@ -802,7 +831,7 @@ namespace ROMVault2
|
||||
|
||||
if (tRvDir.DirStatus.Get(RepairStatus.DisplayOrder[l]) <= 0) continue;
|
||||
|
||||
gOff = FrmMain.GameGridColumnXPositions[columnIndex];
|
||||
gOff = _gameGridColumnXPositions[columnIndex];
|
||||
Bitmap bm = rvImages.GetBitmap(@"G_" + RepairStatus.DisplayOrder[l]);
|
||||
if (bm != null)
|
||||
{
|
||||
@@ -823,7 +852,7 @@ namespace ROMVault2
|
||||
|
||||
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));
|
||||
columnIndex++;
|
||||
}
|
||||
@@ -833,9 +862,83 @@ namespace ROMVault2
|
||||
e.Value = bmp;
|
||||
}
|
||||
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
|
||||
|
||||
#region "Rom Grid Code"
|
||||
@@ -860,7 +963,7 @@ namespace ROMVault2
|
||||
|
||||
private void gbSetInfo_Resize(object sender, EventArgs e)
|
||||
{
|
||||
int leftPos = 84;
|
||||
const int leftPos = 84;
|
||||
int rightPos = gbSetInfo.Width - 15;
|
||||
if (rightPos > 750) rightPos = 750;
|
||||
int width = rightPos - leftPos;
|
||||
@@ -890,14 +993,14 @@ namespace ROMVault2
|
||||
lblSITDeveloper.Width = width;
|
||||
|
||||
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);
|
||||
|
||||
lblSITEdition.Width = width3;
|
||||
|
||||
lblSIVersion.Left = leftPos + P2 - 78;
|
||||
lblSITVersion.Left = leftPos + P2;
|
||||
lblSIVersion.Left = leftPos + p2 - 78;
|
||||
lblSITVersion.Left = leftPos + p2;
|
||||
lblSITVersion.Width = width3;
|
||||
|
||||
lblSIType.Left = leftPos + width - width3 - 78;
|
||||
@@ -907,8 +1010,8 @@ namespace ROMVault2
|
||||
|
||||
lblSITMedia.Width = width3;
|
||||
|
||||
lblSILanguage.Left = leftPos + P2 - 78;
|
||||
lblSITLanguage.Left = leftPos + P2;
|
||||
lblSILanguage.Left = leftPos + p2 - 78;
|
||||
lblSITLanguage.Left = leftPos + p2;
|
||||
lblSITLanguage.Width = width3;
|
||||
|
||||
lblSIPlayers.Left = leftPos + width - width3 - 78;
|
||||
@@ -917,8 +1020,8 @@ namespace ROMVault2
|
||||
|
||||
lblSITRatings.Width = width3;
|
||||
|
||||
lblSIGenre.Left = leftPos + P2 - 78;
|
||||
lblSITGenre.Left = leftPos + P2;
|
||||
lblSIGenre.Left = leftPos + p2 - 78;
|
||||
lblSITGenre.Left = leftPos + p2;
|
||||
lblSITGenre.Width = width3;
|
||||
|
||||
lblSIPeripheral.Left = leftPos + width - width3 - 78;
|
||||
@@ -1160,6 +1263,9 @@ namespace ROMVault2
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.IsMono && RomGrid.RowCount > 0)
|
||||
RomGrid.CurrentCell = RomGrid[0,0];
|
||||
|
||||
RomGrid.Rows.Clear();
|
||||
AddDir(tGame, "");
|
||||
GC.Collect();
|
||||
@@ -1275,14 +1381,14 @@ namespace ROMVault2
|
||||
}
|
||||
}
|
||||
|
||||
private void RomGrid_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
|
||||
private void RomGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
|
||||
if (_updatingGameGrid)
|
||||
return;
|
||||
|
||||
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)
|
||||
return;
|
||||
@@ -1404,27 +1510,26 @@ namespace ROMVault2
|
||||
|
||||
private void GameGrid_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
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() : "";
|
||||
if (e.Button != MouseButtons.Right)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Clipboard.Clear();
|
||||
Clipboard.SetText("Name : " + filename + Environment.NewLine + "Desc : " + description + Environment.NewLine);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
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
|
||||
{
|
||||
Clipboard.Clear();
|
||||
Clipboard.SetText("Name : " + filename + Environment.NewLine + "Desc : " + description + Environment.NewLine);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace ROMVault2
|
||||
|
||||
private void UpdateGrid()
|
||||
{
|
||||
if (Settings.IsMono && DataGridGames.RowCount > 0)
|
||||
DataGridGames.CurrentCell = DataGridGames[0,0];
|
||||
|
||||
DataGridGames.Rows.Clear();
|
||||
foreach (DirMap t in Settings.DirPathMap)
|
||||
{
|
||||
@@ -77,7 +80,7 @@ namespace ROMVault2
|
||||
{
|
||||
ShowNewFolderButton = true,
|
||||
Description = Resources.FrmSetDir_BtnSetRomLocationClick_Please_select_a_folder_for_This_Rom_Set,
|
||||
RootFolder = Environment.SpecialFolder.DesktopDirectory,
|
||||
RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory),
|
||||
SelectedPath = DBHelper.GetRealPath(_datLocation)
|
||||
};
|
||||
if (browse.ShowDialog() == DialogResult.OK)
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace ROMVault2
|
||||
{
|
||||
ShowNewFolderButton = true,
|
||||
Description = Resources.FrmSettings_BtnDatClick_Please_select_a_folder_for_DAT_Root,
|
||||
RootFolder = Environment.SpecialFolder.DesktopDirectory,
|
||||
RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory),
|
||||
SelectedPath = Settings.DatRoot
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace ROMVault2.IO
|
||||
FullName = path;
|
||||
Name = Path.GetFileName(path);
|
||||
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.FileInfo fi = new System.IO.FileInfo(path);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace ROMVault2.IO
|
||||
FullName = path;
|
||||
Name = Path.GetFileName(path);
|
||||
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.DirectoryInfo fi = new System.IO.DirectoryInfo(path);
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace ROMVault2.IO
|
||||
{
|
||||
List<DirectoryInfo> dirs = new List<DirectoryInfo>();
|
||||
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FullName);
|
||||
System.IO.DirectoryInfo[] arrDi = di.GetDirectories(SearchPattern);
|
||||
@@ -183,7 +183,7 @@ namespace ROMVault2.IO
|
||||
{
|
||||
List<FileInfo> files = new List<FileInfo>();
|
||||
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FullName);
|
||||
System.IO.FileInfo[] arrDi = di.GetFiles(SearchPattern);
|
||||
@@ -239,7 +239,7 @@ namespace ROMVault2.IO
|
||||
{
|
||||
public static bool Exists(string path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
return System.IO.Directory.Exists(path);
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static void Move(String sourceDirName, String destDirName)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.Directory.Move(sourceDirName, destDirName);
|
||||
return;
|
||||
@@ -288,7 +288,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static void Delete(String path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.Directory.Delete(path);
|
||||
return;
|
||||
@@ -301,7 +301,7 @@ namespace ROMVault2.IO
|
||||
|
||||
public static void CreateDirectory(String path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
return;
|
||||
@@ -323,7 +323,7 @@ namespace ROMVault2.IO
|
||||
{
|
||||
public static bool Exists(string path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
return System.IO.File.Exists(path);
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static void Copy(String sourceFileName, String destFileName, bool overwrite)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.File.Copy(sourceFileName, destFileName, overwrite);
|
||||
return;
|
||||
@@ -387,7 +387,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static void Move(String sourceFileName, String destFileName)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.File.Move(sourceFileName, destFileName);
|
||||
return;
|
||||
@@ -412,7 +412,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static void Delete(String path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
System.IO.File.Delete(path);
|
||||
return;
|
||||
@@ -431,7 +431,7 @@ namespace ROMVault2.IO
|
||||
|
||||
public static bool SetAttributes(String path, FileAttributes fileAttributes)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -466,7 +466,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static string Combine(string path1, string path2)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
return System.IO.Path.Combine(path1, path2);
|
||||
|
||||
if (path1 == null || path2 == null)
|
||||
@@ -538,7 +538,7 @@ namespace ROMVault2.IO
|
||||
}
|
||||
public static String GetDirectoryName(String path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
return System.IO.Path.GetDirectoryName(path);
|
||||
|
||||
|
||||
@@ -600,7 +600,7 @@ namespace ROMVault2.IO
|
||||
|
||||
public static int OpenFileRead(string path, out System.IO.Stream stream)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -634,7 +634,7 @@ namespace ROMVault2.IO
|
||||
|
||||
public static int OpenFileWrite(string path, out System.IO.Stream stream)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -675,7 +675,7 @@ namespace ROMVault2.IO
|
||||
{
|
||||
public static string GetShortPath(string path)
|
||||
{
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
return path;
|
||||
|
||||
int remove = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ROMVault2
|
||||
//public static UsernamePassword Up;
|
||||
public static readonly Encoding Enc = Encoding.GetEncoding(28591);
|
||||
public const string Version = "2.2";
|
||||
public const int SubVersion = 0;
|
||||
public const int SubVersion = 1;
|
||||
|
||||
public static string ErrorMessage;
|
||||
public static string URL;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ROMVault2</RootNamespace>
|
||||
<AssemblyName>ROMVault21</AssemblyName>
|
||||
<AssemblyName>ROMVault22</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace ROMVault2
|
||||
{
|
||||
ShowNewFolderButton = true,
|
||||
Description = @"Please select a folder for Dats",
|
||||
RootFolder = Environment.SpecialFolder.DesktopDirectory,
|
||||
RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory),
|
||||
SelectedPath = @"apps"
|
||||
};
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ROMVault2
|
||||
public static bool CacheSaveTimerEnabled = true;
|
||||
public static int CacheSaveTimePeriod = 10;
|
||||
|
||||
public static bool MonoFileIO
|
||||
public static bool IsUnix
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -56,7 +56,9 @@ namespace ROMVault2
|
||||
return ((p == 4) || (p == 6) || (p == 128));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool IsMono { get { return (Type.GetType ("Mono.Runtime") != null); } }
|
||||
|
||||
public static void SetDefaults()
|
||||
{
|
||||
CacheFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RomVault2_" + DBVersion.Version + ".Cache");
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace ROMVault2.SupportedFiles.CHD
|
||||
_resultType = CHDManCheck.Unset;
|
||||
|
||||
string chdExe = "chdman.exe";
|
||||
if (Settings.MonoFileIO)
|
||||
if (Settings.IsUnix)
|
||||
chdExe = "chdman";
|
||||
|
||||
string chdPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, chdExe);
|
||||
|
||||
Reference in New Issue
Block a user