Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-01-19 15:59:19 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-01-19 15:59:19 +0300
commit8d8320bbe80acf4595f98a69426bcc734273bb4e (patch)
tree710c91fee620ded1e99f91b5feee64817a7f054a
parente95d4568ed0b5d04d7190f29c89568768d347ff5 (diff)
No more xcopy
-rw-r--r--NesGame.cs2
-rw-r--r--Properties/AssemblyInfo.cs6
-rw-r--r--WorkerForm.cs47
3 files changed, 44 insertions, 11 deletions
diff --git a/NesGame.cs b/NesGame.cs
index 060a5b79..35813b81 100644
--- a/NesGame.cs
+++ b/NesGame.cs
@@ -199,7 +199,7 @@ namespace com.clusterrr.hakchi_gui
ReleaseDate = gameinfo.ReleaseDate;
if (ReleaseDate.Length == 4) ReleaseDate += "-01";
if (ReleaseDate.Length == 7) ReleaseDate += "-01";
- Publisher = gameinfo.Publisher;
+ Publisher = gameinfo.Publisher.ToUpper();
return true;
}
return false;
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 633d7eeb..2737eaff 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("hakchi2")]
-[assembly: AssemblyDescription("Based on hakchi by madmonkey.\r\n\r\nSpecial thanks:\r\nPete Batard/Akeo for Zadig.\r\npbatard for libwdi.\r\nThomas Bleeker for WinUSBNet library.\r\nMatt Wrock for nQuant library.\r\nbootgod for cartridge database\r\n\r\nNintendo for my childhood.\r\n\r\nMy site: http://clusterrr.com\r\nE-mail: clusterrr@clusterrr.com\r\nPayPal for donations: clusterrr@clusterrr.com")]
+[assembly: AssemblyDescription("Based on hakchi by madmonkey.\r\n\r\nSpecial thanks:\r\nPete Batard/Akeo for Zadig.\r\npbatard for libwdi.\r\nThomas Bleeker for WinUSBNet library.\r\nMatt Wrock for nQuant library.\r\nbootgod for cartridge database.\r\nNintendo for my childhood.\r\n\r\nMy site: http://clusterrr.com\r\nE-mail: clusterrr@clusterrr.com\r\nPayPal for donations: clusterrr@clusterrr.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Alexey 'Cluster' Avdyukhin")]
[assembly: AssemblyProduct("hakchi2")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.10.1")]
-[assembly: AssemblyFileVersion("2.0.10.1")]
+[assembly: AssemblyVersion("2.0.10.2")]
+[assembly: AssemblyFileVersion("2.0.10.2")]
diff --git a/WorkerForm.cs b/WorkerForm.cs
index dae80bd9..ec433f82 100644
--- a/WorkerForm.cs
+++ b/WorkerForm.cs
@@ -384,9 +384,7 @@ namespace com.clusterrr.hakchi_gui
if (!File.Exists(Path.Combine(ramfsDirectory, "init"))) // cpio.exe fails on Windows XP for some reason. But working!
throw new Exception("Can't unpack ramdisk 2");
if (Directory.Exists(hakchiDirectory)) Directory.Delete(hakchiDirectory, true);
- if (!ExecuteTool("xcopy", string.Format("\"{0}\" /h /y /c /r /s /q",
- Path.Combine(modsDirectory, Mod)), ramfsDirectory, true))
- throw new Exception("Can't copy mod directory");
+ DirectoryCopy(Path.Combine(modsDirectory, Mod), ramfsDirectory, true);
var ramfsFiles = Directory.GetFiles(ramfsDirectory, "*.*", SearchOption.AllDirectories);
foreach (var file in ramfsFiles)
{
@@ -408,10 +406,7 @@ namespace com.clusterrr.hakchi_gui
foreach (var game in Games)
{
var gameDir = Path.Combine(gamesDirectory, game.Code);
- Directory.CreateDirectory(gameDir);
- if (!ExecuteTool("xcopy", string.Format("\"{0}\" /h /y /c /r /e /q", game.GamePath),
- gameDir, true))
- throw new Exception("Can't copy " + game);
+ DirectoryCopy(game.GamePath, gameDir, true);
if (!string.IsNullOrEmpty(game.GameGenie))
{
var codes = game.GameGenie.Split(new char[] { ',', '\t', ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
@@ -558,6 +553,44 @@ namespace com.clusterrr.hakchi_gui
return pages * page_size;
}
+ private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs)
+ {
+ // Get the subdirectories for the specified directory.
+ DirectoryInfo dir = new DirectoryInfo(sourceDirName);
+
+ if (!dir.Exists)
+ {
+ throw new DirectoryNotFoundException(
+ "Source directory does not exist or could not be found: "
+ + sourceDirName);
+ }
+
+ DirectoryInfo[] dirs = dir.GetDirectories();
+ // If the destination directory doesn't exist, create it.
+ if (!Directory.Exists(destDirName))
+ {
+ Directory.CreateDirectory(destDirName);
+ }
+
+ // Get the files in the directory and copy them to the new location.
+ FileInfo[] files = dir.GetFiles();
+ foreach (FileInfo file in files)
+ {
+ string temppath = Path.Combine(destDirName, file.Name);
+ file.CopyTo(temppath, true);
+ }
+
+ // If copying subdirectories, copy them and their contents to new location.
+ if (copySubDirs)
+ {
+ foreach (DirectoryInfo subdir in dirs)
+ {
+ string temppath = Path.Combine(destDirName, subdir.Name);
+ DirectoryCopy(subdir.FullName, temppath, copySubDirs);
+ }
+ }
+ }
+
private void WorkerForm_FormClosing(object sender, FormClosingEventArgs e)
{
if ((thread != null) && (e.CloseReason == CloseReason.UserClosing))