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)
|
||||
{
|
||||
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();
|
||||
|
||||
@@ -579,6 +588,15 @@ 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();
|
||||
|
||||
@@ -1160,6 +1178,9 @@ namespace ROMVault2
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.IsMono && RomGrid.RowCount > 0)
|
||||
RomGrid.CurrentCell = RomGrid[0,0];
|
||||
|
||||
RomGrid.Rows.Clear();
|
||||
AddDir(tGame, "");
|
||||
GC.Collect();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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