Merge pull request #10 from jwestfall69/mono-fixes
Work around mono crashing on Rows.Clear()
This commit is contained in:
@@ -444,6 +444,15 @@ 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();
|
||||||
|
|
||||||
@@ -579,6 +588,15 @@ 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();
|
||||||
|
|
||||||
@@ -1160,6 +1178,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();
|
||||||
|
|||||||
@@ -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 = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory),
|
||||||
SelectedPath = DBHelper.GetRealPath(_datLocation)
|
SelectedPath = DBHelper.GetRealPath(_datLocation)
|
||||||
};
|
};
|
||||||
if (browse.ShowDialog() == DialogResult.OK)
|
if (browse.ShowDialog() == DialogResult.OK)
|
||||||
|
|||||||
@@ -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 = Environment.SpecialFolder.DesktopDirectory,
|
RootFolder = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory),
|
||||||
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;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ 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 = (Settings.IsMono ? Environment.SpecialFolder.MyComputer : Environment.SpecialFolder.DesktopDirectory),
|
||||||
SelectedPath = @"apps"
|
SelectedPath = @"apps"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,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
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,9 @@ namespace ROMVault2
|
|||||||
return ((p == 4) || (p == 6) || (p == 128));
|
return ((p == 4) || (p == 6) || (p == 128));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user