mirror of
https://github.com/WB3000/nusdownloader.git
synced 2024-11-17 07:09:21 +01:00
"FolderFix" working for the most part
This commit is contained in:
parent
a2e4475bbe
commit
534b2a502c
@ -47,7 +47,7 @@ namespace NUS_Downloader
|
|||||||
private static string version = String.Format("SVN r{0}", ((int.Parse(svnversion.Replace("$"+"R"+"e"+"v"+": ","").Replace(" "+"$","")))+1));
|
private static string version = String.Format("SVN r{0}", ((int.Parse(svnversion.Replace("$"+"R"+"e"+"v"+": ","").Replace(" "+"$","")))+1));
|
||||||
#else
|
#else
|
||||||
// TODO: Always remember to change version!
|
// TODO: Always remember to change version!
|
||||||
private string version = "v2.0 Beta";
|
private string version = "v2.0";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private static bool dsidecrypt = false;
|
private static bool dsidecrypt = false;
|
||||||
@ -88,8 +88,52 @@ namespace NUS_Downloader
|
|||||||
// This is the standard entry to the GUI
|
// This is the standard entry to the GUI
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
this.Font = new System.Drawing.Font("Tahoma", 8);
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
GUISetup();
|
||||||
|
|
||||||
|
BootChecks();
|
||||||
|
}
|
||||||
|
|
||||||
|
// CLI Mode
|
||||||
|
public Form1(string[] args)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
//Application.DoEvents();
|
||||||
|
Debug.WriteLine("CLI Parameters passed");
|
||||||
|
|
||||||
|
GUISetup();
|
||||||
|
|
||||||
|
BootChecks();
|
||||||
|
|
||||||
|
/* Fix proxy entry.
|
||||||
|
if (!(String.IsNullOrEmpty(proxy_url)))
|
||||||
|
while (String.IsNullOrEmpty(proxy_pwd))
|
||||||
|
Thread.Sleep(1000);*/
|
||||||
|
|
||||||
|
if ((args.Length == 1) && (args[0] == "folderfix"))
|
||||||
|
{
|
||||||
|
// Organizing folders from past NUSD releases...
|
||||||
|
BackgroundWorker folder_fixer = new BackgroundWorker();
|
||||||
|
folder_fixer.DoWork += new DoWorkEventHandler(ReorganizePreviousFolderStructure);
|
||||||
|
folder_fixer.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ReorganizePreviousFolderStructure_Completed);
|
||||||
|
Debug.WriteLine("folderfix active");
|
||||||
|
WriteStatus("Organizing your old folder structure...");
|
||||||
|
folder_fixer.RunWorkerAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((args.Length == 1) && (File.Exists(args[0])))
|
||||||
|
{
|
||||||
|
script_filename = args[0];
|
||||||
|
BackgroundWorker scripter = new BackgroundWorker();
|
||||||
|
scripter.DoWork += new DoWorkEventHandler(RunScript);
|
||||||
|
scripter.RunWorkerAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GUISetup()
|
||||||
|
{
|
||||||
|
this.Font = new System.Drawing.Font("Tahoma", 8);
|
||||||
this.MaximumSize = this.MinimumSize = this.Size; // Lock size down PATCHOW :D
|
this.MaximumSize = this.MinimumSize = this.Size; // Lock size down PATCHOW :D
|
||||||
if (Type.GetType("Mono.Runtime") != null)
|
if (Type.GetType("Mono.Runtime") != null)
|
||||||
{
|
{
|
||||||
@ -125,44 +169,8 @@ namespace NUS_Downloader
|
|||||||
this.scriptsWorker.DoWork += new DoWorkEventHandler(OrganizeScripts);
|
this.scriptsWorker.DoWork += new DoWorkEventHandler(OrganizeScripts);
|
||||||
this.scriptsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(scriptsWorker_RunWorkerCompleted);
|
this.scriptsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(scriptsWorker_RunWorkerCompleted);
|
||||||
RunScriptOrganizer();
|
RunScriptOrganizer();
|
||||||
|
|
||||||
BootChecks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLI Mode
|
|
||||||
public Form1(string[] args)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
Application.DoEvents();
|
|
||||||
|
|
||||||
BootChecks();
|
|
||||||
|
|
||||||
// Fix proxy entry.
|
|
||||||
if (!(String.IsNullOrEmpty(proxy_url)))
|
|
||||||
while (String.IsNullOrEmpty(proxy_pwd))
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
|
|
||||||
if ((args.Length == 1) && (args[0] == "folderfix"))
|
|
||||||
{
|
|
||||||
// Organizing folders from past NUSD releases...
|
|
||||||
BackgroundWorker folder_fixer = new BackgroundWorker();
|
|
||||||
folder_fixer.DoWork += new DoWorkEventHandler(ReorganizePreviousFolderStructure);
|
|
||||||
folder_fixer.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ReorganizePreviousFolderStructure_Completed);
|
|
||||||
WriteStatus("Organizing your old folder structure...");
|
|
||||||
folder_fixer.RunWorkerAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((args.Length == 1) && (File.Exists(args[0])))
|
|
||||||
{
|
|
||||||
script_filename = args[0];
|
|
||||||
BackgroundWorker scripter = new BackgroundWorker();
|
|
||||||
scripter.DoWork += new DoWorkEventHandler(RunScript);
|
|
||||||
scripter.RunWorkerAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Form1_Load(object sender, EventArgs e)
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.Text = String.Format("NUSD - {0}", version); ;
|
this.Text = String.Format("NUSD - {0}", version); ;
|
||||||
@ -2437,18 +2445,18 @@ namespace NUS_Downloader
|
|||||||
Directory.CreateDirectory(Path.Combine(CURRENT_DIR, "titles"));
|
Directory.CreateDirectory(Path.Combine(CURRENT_DIR, "titles"));
|
||||||
|
|
||||||
string[] directories = Directory.GetDirectories(CURRENT_DIR, "*", SearchOption.TopDirectoryOnly);
|
string[] directories = Directory.GetDirectories(CURRENT_DIR, "*", SearchOption.TopDirectoryOnly);
|
||||||
|
Debug.WriteLine("Dirs: " + directories.Length);
|
||||||
foreach (string directory in directories)
|
foreach (string directory in directories)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("ff: " + directory);
|
||||||
DirectoryInfo dinfo = new DirectoryInfo(directory);
|
DirectoryInfo dinfo = new DirectoryInfo(directory);
|
||||||
if (TitleDirectoryRegex.IsMatch(dinfo.Name.ToString()) == false)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// name is XXXXXXXXXXXXXXXXvYYYY
|
// name is XXXXXXXXXXXXXXXXvYYYY
|
||||||
if (TitleDirectoryRegex.IsMatch(dinfo.Name.ToString()) && dinfo.Name.Contains("v"))
|
if (TitleDirectoryRegex.IsMatch(dinfo.Name.ToString()) && dinfo.Name.Contains("v"))
|
||||||
{
|
{
|
||||||
string[] title_info = dinfo.Name.Split('v');
|
string[] title_info = dinfo.Name.Split('v');
|
||||||
string titleid_dir = Path.Combine(Path.Combine(CURRENT_DIR, "titles"), title_info[0]);
|
string titleid_dir = Path.Combine(Path.Combine(CURRENT_DIR, "titles"), title_info[0]);
|
||||||
string newfull_dir = Path.Combine(titleid_dir, String.Format("v{0}", title_info[1]));
|
string newfull_dir = Path.Combine(titleid_dir, String.Format("{0}", title_info[1]));
|
||||||
|
|
||||||
if (Directory.Exists(titleid_dir) == false)
|
if (Directory.Exists(titleid_dir) == false)
|
||||||
Directory.CreateDirectory(titleid_dir);
|
Directory.CreateDirectory(titleid_dir);
|
||||||
@ -2460,15 +2468,16 @@ namespace NUS_Downloader
|
|||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
FileInfo titlefile = new FileInfo(file);
|
FileInfo titlefile = new FileInfo(file);
|
||||||
|
if (File.Exists(Path.Combine(newfull_dir, titlefile.Name)) == false)
|
||||||
titlefile.MoveTo(Path.Combine(newfull_dir, titlefile.Name));
|
titlefile.MoveTo(Path.Combine(newfull_dir, titlefile.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dinfo.GetFiles().Length <= 0 || dinfo.GetDirectories().Length < 0)
|
if (dinfo.GetFiles().Length <= 0 && dinfo.GetDirectories().Length <= 0)
|
||||||
Directory.Delete(directory);
|
Directory.Delete(directory);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else // name is XXXXXXXXXXXXXXXX
|
else if (TitleDirectoryRegex.IsMatch(dinfo.Name.ToString()))
|
||||||
{
|
{
|
||||||
string titleid_dir = Path.Combine(Path.Combine(CURRENT_DIR, "titles"), dinfo.Name.ToString());
|
string titleid_dir = Path.Combine(Path.Combine(CURRENT_DIR, "titles"), dinfo.Name.ToString());
|
||||||
|
|
||||||
@ -2477,7 +2486,7 @@ namespace NUS_Downloader
|
|||||||
|
|
||||||
string[] tmdfiles = Directory.GetFiles(directory, "*tmd*", SearchOption.TopDirectoryOnly);
|
string[] tmdfiles = Directory.GetFiles(directory, "*tmd*", SearchOption.TopDirectoryOnly);
|
||||||
if (tmdfiles.Length > 1)
|
if (tmdfiles.Length > 1)
|
||||||
break; //Too many TMD files ?
|
continue; //Too many TMD files ?
|
||||||
|
|
||||||
foreach (string file in tmdfiles)
|
foreach (string file in tmdfiles)
|
||||||
{
|
{
|
||||||
@ -2488,10 +2497,10 @@ namespace NUS_Downloader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
string version = tmdfile.TitleVersion.ToString();
|
string version = tmdfile.TitleVersion.ToString();
|
||||||
string newfull_dir = Path.Combine(titleid_dir, String.Format("v{0}", version));
|
string newfull_dir = Path.Combine(titleid_dir, String.Format("{0}", version));
|
||||||
|
|
||||||
if (Directory.Exists(titleid_dir) == false)
|
if (Directory.Exists(titleid_dir) == false)
|
||||||
Directory.CreateDirectory(titleid_dir);
|
Directory.CreateDirectory(titleid_dir);
|
||||||
@ -2503,10 +2512,11 @@ namespace NUS_Downloader
|
|||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
FileInfo titlefile = new FileInfo(file);
|
FileInfo titlefile = new FileInfo(file);
|
||||||
|
if (File.Exists(Path.Combine(newfull_dir, titlefile.Name)) == false)
|
||||||
titlefile.MoveTo(Path.Combine(newfull_dir, titlefile.Name));
|
titlefile.MoveTo(Path.Combine(newfull_dir, titlefile.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dinfo.GetFiles().Length <= 0 || dinfo.GetDirectories().Length < 0)
|
if (dinfo.GetFiles().Length <= 0 && dinfo.GetDirectories().Length <= 0)
|
||||||
Directory.Delete(directory);
|
Directory.Delete(directory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -16,7 +16,7 @@
|
|||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<ManifestCertificateThumbprint>5828AACDBD1A48E3768B7E0465E90D0E96E2BE4C</ManifestCertificateThumbprint>
|
<ManifestCertificateThumbprint>5828AACDBD1A48E3768B7E0465E90D0E96E2BE4C</ManifestCertificateThumbprint>
|
||||||
<ManifestKeyFile>NUS Downloader_TemporaryKey.pfx</ManifestKeyFile>
|
<ManifestKeyFile>NUS Downloader_TemporaryKey.pfx</ManifestKeyFile>
|
||||||
<GenerateManifests>true</GenerateManifests>
|
<GenerateManifests>false</GenerateManifests>
|
||||||
<SignManifests>false</SignManifests>
|
<SignManifests>false</SignManifests>
|
||||||
<TargetZone>LocalIntranet</TargetZone>
|
<TargetZone>LocalIntranet</TargetZone>
|
||||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</requestedPrivileges>
|
</requestedPrivileges>
|
||||||
<applicationRequestMinimum>
|
<applicationRequestMinimum>
|
||||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
|
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
|
||||||
</applicationRequestMinimum>
|
</applicationRequestMinimum>
|
||||||
</security>
|
</security>
|
||||||
</trustInfo>
|
</trustInfo>
|
||||||
|
Loading…
Reference in New Issue
Block a user