mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Zip up and organize generate-all files.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
@@ -471,6 +472,9 @@ Make a selection:
|
|||||||
/// <param name="old">True if the output file should be in RomVault format (default false)</param>
|
/// <param name="old">True if the output file should be in RomVault format (default false)</param>
|
||||||
private static void InitGenerateAll(string outdir, bool norename, bool old)
|
private static void InitGenerateAll(string outdir, bool norename, bool old)
|
||||||
{
|
{
|
||||||
|
string actualdir = outdir + "/";
|
||||||
|
outdir = outdir + "/temp/";
|
||||||
|
|
||||||
// Generate system-merged
|
// Generate system-merged
|
||||||
string query = @"SELECT DISTINCT systems.id
|
string query = @"SELECT DISTINCT systems.id
|
||||||
FROM systems
|
FROM systems
|
||||||
@@ -554,6 +558,24 @@ Make a selection:
|
|||||||
|
|
||||||
// Generate MEGAMERGED
|
// Generate MEGAMERGED
|
||||||
InitGenerate("", "", outdir, norename, old);
|
InitGenerate("", "", outdir, norename, old);
|
||||||
|
|
||||||
|
// Zip up all of the files that were generated
|
||||||
|
ZipArchive zip = ZipFile.Open(actualdir + "dats-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip", ZipArchiveMode.Create);
|
||||||
|
foreach (String filename in Directory.EnumerateFiles(outdir))
|
||||||
|
{
|
||||||
|
if (filename.EndsWith(".xml") || filename.EndsWith(".dat"))
|
||||||
|
{
|
||||||
|
string internalFolder = (filename.Contains("ALL (merged") ? "" :
|
||||||
|
filename.Contains("merged") ? "merged-system/" :
|
||||||
|
filename.Contains("ALL") ? "merged-source/" : "custom/");
|
||||||
|
zip.CreateEntryFromFile(filename, internalFolder + filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zip.Dispose();
|
||||||
|
|
||||||
|
// Remove all of the DATs from the folder
|
||||||
|
Directory.Delete(outdir, true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,8 @@
|
|||||||
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.99.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath>
|
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.99.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
|||||||
Reference in New Issue
Block a user