Fix GimConv downloader
This commit is contained in:
parent
308edb6c3c
commit
6d72f4b5b0
|
@ -1,20 +1,20 @@
|
||||||
using Ionic.Zip;
|
using Ionic.Zip;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace CXMLDecompiler
|
namespace CXMLDecompiler
|
||||||
{
|
{
|
||||||
class GimConv
|
class GimConv
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string GIMCONV_FOLDER = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "GimConv");
|
public static string GIMCONV_FOLDER = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "GimConv");
|
||||||
|
|
||||||
static WebClient wc = new WebClient();
|
static WebClient wc = new WebClient();
|
||||||
static bool DownloadCompleted = true;
|
static bool DownloadCompleted = true;
|
||||||
|
|
||||||
public static void ConvertGimToPng(string inputGim, string outputGim)
|
public static void ConvertGimToPng(string inputGim, string outputGim)
|
||||||
{
|
{
|
||||||
if (HasGimConv())
|
if (HasGimConv())
|
||||||
|
@ -36,63 +36,65 @@ namespace CXMLDecompiler
|
||||||
Proc.WaitForExit();
|
Proc.WaitForExit();
|
||||||
Console.Write(Proc.StandardOutput.ReadToEnd());
|
Console.Write(Proc.StandardOutput.ReadToEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static bool HasGimConv()
|
public static bool HasGimConv()
|
||||||
{
|
{
|
||||||
return File.Exists(Path.Combine(GIMCONV_FOLDER, "GimConv.exe"));
|
return File.Exists(Path.Combine(GIMCONV_FOLDER, "GimConv.exe"));
|
||||||
}
|
}
|
||||||
public static void DownloadGimConv()
|
public static void DownloadGimConv()
|
||||||
{
|
{
|
||||||
wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
|
wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
|
||||||
wc.DownloadDataCompleted += Wc_DownloadDataCompleted;
|
wc.DownloadDataCompleted += Wc_DownloadDataCompleted;
|
||||||
wc.DownloadDataAsync(new Uri("http://e1.dl.playstation.net/e1/downloads/ps3/themes/370/PS3_Custom_Theme_v200.zip")); // Thanks Sony :3
|
wc.DownloadDataAsync(new Uri("http://e1.dl.playstation.net/e1/downloads/ps3/themes/370/PS3_Custom_Theme_v200.zip")); // Thanks Sony :3
|
||||||
while (wc.IsBusy || !DownloadCompleted) { };
|
while (wc.IsBusy || !DownloadCompleted) { };
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
|
private static void Wc_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Error != null)
|
if (e.Error != null)
|
||||||
return;
|
return;
|
||||||
Console.Write("\r\n");
|
Console.Write("\r\n");
|
||||||
MemoryStream zipStream = new MemoryStream(e.Result);
|
MemoryStream zipStream = new MemoryStream(e.Result);
|
||||||
ZipFile zip = ZipFile.Read(zipStream);
|
ZipFile zip = ZipFile.Read(zipStream);
|
||||||
foreach(ZipEntry zEntry in zip.Entries) // Read downloaded zip and extract stuff relating to GimConv .
|
foreach(ZipEntry zEntry in zip.Entries) // Read downloaded zip and extract stuff relating to GimConv .
|
||||||
{
|
{
|
||||||
string filename = Path.GetFileName(zEntry.FileName);
|
string filename = Path.GetFileName(zEntry.FileName);
|
||||||
if (filename == "msvcp71.dll" || filename == "msvcr71.dll" || zEntry.FileName.Contains("GimConv")) // if it is a required DLL or inside the GimConv folder
|
if (filename == "msvcp71.dll" || filename == "msvcr71.dll" || zEntry.FileName.Contains("GimConv")) // if it is a required DLL or inside the GimConv folder
|
||||||
{
|
{
|
||||||
string outputFilename = zEntry.FileName;
|
string outputFilename = zEntry.FileName;
|
||||||
if (outputFilename.Contains("GimConv")) // if the filename is inside the GimConv folder
|
if (outputFilename.Contains("GimConv")) // if the filename is inside the GimConv folder
|
||||||
outputFilename = outputFilename.Substring(outputFilename.IndexOf("GimConv") + "GimConv".Length); // Extract filename after the "GimConv/" part
|
outputFilename = outputFilename.Substring(outputFilename.IndexOf("GimConv") + "GimConv".Length + 1); // Extract filename after the "GimConv/" part
|
||||||
|
else
|
||||||
outputFilename = outputFilename.Replace("/", "\\");
|
outputFilename = Path.GetFileName(outputFilename);
|
||||||
outputFilename = Path.Combine(GIMCONV_FOLDER, outputFilename); // set output path to GimConv folder
|
|
||||||
Console.WriteLine("Extracting: " + outputFilename);
|
outputFilename = outputFilename.Replace("/", "\\");
|
||||||
|
outputFilename = Path.Combine(GIMCONV_FOLDER, outputFilename); // set output path to GimConv folder
|
||||||
// If folder is directory, create it
|
Console.WriteLine("Extracting: " + outputFilename);
|
||||||
if (zEntry.IsDirectory)
|
|
||||||
{
|
// If folder is directory, create it
|
||||||
Directory.CreateDirectory(outputFilename);
|
if (zEntry.IsDirectory)
|
||||||
continue;
|
{
|
||||||
}
|
Directory.CreateDirectory(outputFilename);
|
||||||
|
continue;
|
||||||
// Extract the file to output path
|
}
|
||||||
FileStream fs = File.Open(outputFilename, FileMode.CreateNew, FileAccess.ReadWrite);
|
|
||||||
zEntry.Extract(fs);
|
// Extract the file to output path
|
||||||
fs.Close();
|
FileStream fs = File.Open(outputFilename, FileMode.CreateNew, FileAccess.ReadWrite);
|
||||||
}
|
zEntry.Extract(fs);
|
||||||
}
|
fs.Close();
|
||||||
zip.Dispose();
|
}
|
||||||
zipStream.Dispose();
|
}
|
||||||
|
zip.Dispose();
|
||||||
File.AppendAllText(Path.Combine(GIMCONV_FOLDER, "GimConv.cfg"), "option -psvrgba8888 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = rgba8888\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}\r\noption -psvindex4 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index4\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}\r\noption -psvindex8 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index8\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}");
|
zipStream.Dispose();
|
||||||
DownloadCompleted = true;
|
|
||||||
}
|
File.AppendAllText(Path.Combine(GIMCONV_FOLDER, "GimConv.cfg"), "option -psvrgba8888 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = rgba8888\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}\r\noption -psvindex4 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index4\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}\r\noption -psvindex8 {\r\n format_endian = little\r\n format_style = psp\r\n image_format = index8\r\n pixel_order = normal\r\n pixel_channel = rgba\r\n limit_image_width = 4096\r\n limit_image_height = 4096\r\n}");
|
||||||
|
DownloadCompleted = true;
|
||||||
private static void Wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
}
|
||||||
{
|
|
||||||
DownloadCompleted = false;
|
private static void Wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
||||||
Console.Write("\rDownloading GimConv Directly from Sony " + e.BytesReceived + "/" + e.TotalBytesToReceive + " - " + e.ProgressPercentage.ToString() + "%");
|
{
|
||||||
}
|
DownloadCompleted = false;
|
||||||
}
|
Console.Write("\rDownloading GimConv Directly from Sony " + e.BytesReceived + "/" + e.TotalBytesToReceive + " - " + e.ProgressPercentage.ToString() + "%");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyTitle("CXML Decompiler")]
|
[assembly: AssemblyTitle("CXML Decompiler")]
|
||||||
[assembly: AssemblyDescription("CXML Decompiler & Compiler")]
|
[assembly: AssemblyDescription("CXML Decompiler & Compiler")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("SilicaAndPina Inc")]
|
[assembly: AssemblyCompany("Li")]
|
||||||
[assembly: AssemblyProduct("CXML Decompiler")]
|
[assembly: AssemblyProduct("CXML Decompiler")]
|
||||||
[assembly: AssemblyCopyright("Public Domain © 2021")]
|
[assembly: AssemblyCopyright("Public Domain © 2022")]
|
||||||
[assembly: AssemblyTrademark("CXML Decompiler is not a trademark of SilicaAndPina Inc")]
|
[assembly: AssemblyTrademark("CXML Decompiler is not a trademark of Li Inc")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||||
|
|
Loading…
Reference in New Issue