Update src
This commit is contained in:
parent
d3164bac33
commit
421c65e822
|
@ -1,11 +1,10 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMDEC
|
||||
{
|
||||
|
@ -15,11 +14,15 @@ namespace RMDEC
|
|||
|
||||
//Private internal variables
|
||||
private byte[] encryptionKey = new byte[0x10];
|
||||
|
||||
private bool isKeySet = false;
|
||||
private bool encryptedImages = false;
|
||||
private bool encryptedAudio = false;
|
||||
|
||||
private string gameTitle;
|
||||
private string filePath;
|
||||
|
||||
private string systemJsonFile;
|
||||
private dynamic jsonData;
|
||||
|
||||
//Public readable variables
|
||||
public Boolean IsEncrypted
|
||||
|
@ -41,7 +44,16 @@ namespace RMDEC
|
|||
{
|
||||
get
|
||||
{
|
||||
return encryptionKey;
|
||||
if(isKeySet)
|
||||
{
|
||||
return encryptionKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
genEncryptionKey();
|
||||
return encryptionKey;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public String GameTitle
|
||||
|
@ -57,6 +69,12 @@ namespace RMDEC
|
|||
{
|
||||
return encryptedImages;
|
||||
}
|
||||
set
|
||||
{
|
||||
jsonData.hasEncryptedImages = value;
|
||||
File.WriteAllText(systemJsonFile, jsonData.ToString(Formatting.None));
|
||||
encryptedImages = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean EncryptedAudio
|
||||
|
@ -65,6 +83,12 @@ namespace RMDEC
|
|||
{
|
||||
return encryptedAudio;
|
||||
}
|
||||
set
|
||||
{
|
||||
jsonData.hasEncryptedAudio = value;
|
||||
File.WriteAllText(systemJsonFile, jsonData.ToString(Formatting.None));
|
||||
encryptedAudio = value;
|
||||
}
|
||||
}
|
||||
|
||||
public String FilePath
|
||||
|
@ -111,6 +135,17 @@ namespace RMDEC
|
|||
return output;
|
||||
}
|
||||
|
||||
private void genEncryptionKey()
|
||||
{
|
||||
byte[] keyData = new byte[0x10];
|
||||
Random rng = new Random((int)DateTime.Now.Ticks);
|
||||
rng.NextBytes(keyData);
|
||||
encryptionKey = keyData;
|
||||
jsonData.encryptionKey = BitConverter.ToString(keyData, 0x00, keyData.Length).Replace("-", "");
|
||||
File.WriteAllText(systemJsonFile, jsonData.ToString(Formatting.None));
|
||||
isKeySet = true;
|
||||
}
|
||||
|
||||
//Public functions
|
||||
public static MVProject ParseSystemJson(string path)
|
||||
{
|
||||
|
@ -145,10 +180,12 @@ namespace RMDEC
|
|||
{
|
||||
string encKey = systemJson.encryptionKey;
|
||||
mvp.encryptionKey = hexStr2Bytes(encKey);
|
||||
mvp.isKeySet = true;
|
||||
}
|
||||
|
||||
mvp.filePath = Path.GetDirectoryName(Path.GetDirectoryName(path));
|
||||
|
||||
mvp.systemJsonFile = path;
|
||||
mvp.jsonData = systemJson;
|
||||
return mvp;
|
||||
|
||||
}
|
||||
|
@ -177,14 +214,12 @@ namespace RMDEC
|
|||
byte[] plaintextHeader = new byte[0x10];
|
||||
inStream.Read(plaintextHeader, 0x00, 0x10);
|
||||
|
||||
byte[] encryptedHeader = xor(plaintextHeader, encryptionKey);
|
||||
byte[] encryptedHeader = xor(plaintextHeader, EncryptionKey);
|
||||
outStream.Write(encryptedHeader, 0x00, encryptedHeader.Length);
|
||||
inStream.CopyTo(outStream);
|
||||
}
|
||||
public void DecryptFile(Stream inStream, Stream outStream)
|
||||
{
|
||||
|
||||
|
||||
inStream.Seek(0x00, SeekOrigin.Begin);
|
||||
|
||||
byte[] magic = new byte[0x05];
|
||||
|
@ -200,7 +235,7 @@ namespace RMDEC
|
|||
byte[] encryptedHeader = new byte[0x10];
|
||||
inStream.Read(encryptedHeader, 0x00, 0x10);
|
||||
|
||||
byte[] plaintextHeader = xor(encryptedHeader, encryptionKey);
|
||||
byte[] plaintextHeader = xor(encryptedHeader, EncryptionKey);
|
||||
|
||||
outStream.Seek(0x00, SeekOrigin.Begin);
|
||||
outStream.SetLength(0);
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
this.encryptedFileList.Name = "encryptedFileList";
|
||||
this.layout1.SetRowSpan(this.encryptedFileList, 4);
|
||||
this.encryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.encryptedFileList.Size = new System.Drawing.Size(266, 327);
|
||||
this.encryptedFileList.Size = new System.Drawing.Size(334, 357);
|
||||
this.encryptedFileList.TabIndex = 3;
|
||||
//
|
||||
// decryptSelected
|
||||
|
@ -63,7 +63,7 @@
|
|||
this.decryptSelected.Enabled = false;
|
||||
this.decryptSelected.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.decryptSelected.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.decryptSelected.Location = new System.Drawing.Point(310, 106);
|
||||
this.decryptSelected.Location = new System.Drawing.Point(387, 102);
|
||||
this.decryptSelected.Name = "decryptSelected";
|
||||
this.decryptSelected.Size = new System.Drawing.Size(48, 48);
|
||||
this.decryptSelected.TabIndex = 4;
|
||||
|
@ -78,11 +78,11 @@
|
|||
this.decryptedFileList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.decryptedFileList.FormattingEnabled = true;
|
||||
this.decryptedFileList.HorizontalScrollbar = true;
|
||||
this.decryptedFileList.Location = new System.Drawing.Point(400, 3);
|
||||
this.decryptedFileList.Location = new System.Drawing.Point(486, 3);
|
||||
this.decryptedFileList.Name = "decryptedFileList";
|
||||
this.layout1.SetRowSpan(this.decryptedFileList, 4);
|
||||
this.decryptedFileList.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.decryptedFileList.Size = new System.Drawing.Size(269, 327);
|
||||
this.decryptedFileList.Size = new System.Drawing.Size(337, 357);
|
||||
this.decryptedFileList.TabIndex = 5;
|
||||
//
|
||||
// encryptSelected
|
||||
|
@ -92,7 +92,7 @@
|
|||
this.encryptSelected.Enabled = false;
|
||||
this.encryptSelected.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.encryptSelected.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.encryptSelected.Location = new System.Drawing.Point(310, 193);
|
||||
this.encryptSelected.Location = new System.Drawing.Point(387, 216);
|
||||
this.encryptSelected.Name = "encryptSelected";
|
||||
this.encryptSelected.Size = new System.Drawing.Size(48, 48);
|
||||
this.encryptSelected.TabIndex = 6;
|
||||
|
@ -105,9 +105,9 @@
|
|||
this.processingBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.processingBar.BackColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
this.processingBar.Location = new System.Drawing.Point(154, 385);
|
||||
this.processingBar.Location = new System.Drawing.Point(154, 415);
|
||||
this.processingBar.Name = "processingBar";
|
||||
this.processingBar.Size = new System.Drawing.Size(530, 22);
|
||||
this.processingBar.Size = new System.Drawing.Size(684, 22);
|
||||
this.processingBar.TabIndex = 7;
|
||||
//
|
||||
// processingText
|
||||
|
@ -116,7 +116,7 @@
|
|||
this.processingText.BackColor = System.Drawing.Color.Red;
|
||||
this.processingText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.processingText.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.processingText.Location = new System.Drawing.Point(12, 385);
|
||||
this.processingText.Location = new System.Drawing.Point(12, 415);
|
||||
this.processingText.Name = "processingText";
|
||||
this.processingText.Size = new System.Drawing.Size(136, 22);
|
||||
this.processingText.TabIndex = 8;
|
||||
|
@ -131,10 +131,11 @@
|
|||
this.makeMV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.makeMV.Location = new System.Drawing.Point(3, 3);
|
||||
this.makeMV.Name = "makeMV";
|
||||
this.makeMV.Size = new System.Drawing.Size(331, 24);
|
||||
this.makeMV.Size = new System.Drawing.Size(408, 24);
|
||||
this.makeMV.TabIndex = 9;
|
||||
this.makeMV.Text = "Make MV Project";
|
||||
this.makeMV.Text = "Un-Deploy MV Project";
|
||||
this.makeMV.UseVisualStyleBackColor = false;
|
||||
this.makeMV.Click += new System.EventHandler(this.makeMV_Click);
|
||||
//
|
||||
// unmakeMV
|
||||
//
|
||||
|
@ -143,12 +144,13 @@
|
|||
this.unmakeMV.Enabled = false;
|
||||
this.unmakeMV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.unmakeMV.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
|
||||
this.unmakeMV.Location = new System.Drawing.Point(340, 3);
|
||||
this.unmakeMV.Location = new System.Drawing.Point(417, 3);
|
||||
this.unmakeMV.Name = "unmakeMV";
|
||||
this.unmakeMV.Size = new System.Drawing.Size(332, 24);
|
||||
this.unmakeMV.Size = new System.Drawing.Size(409, 24);
|
||||
this.unmakeMV.TabIndex = 10;
|
||||
this.unmakeMV.Text = "Unmake MV Project";
|
||||
this.unmakeMV.Text = "Deploy MV Project";
|
||||
this.unmakeMV.UseVisualStyleBackColor = false;
|
||||
this.unmakeMV.Click += new System.EventHandler(this.unmakeMV_Click);
|
||||
//
|
||||
// layout1
|
||||
//
|
||||
|
@ -168,11 +170,11 @@
|
|||
this.layout1.Location = new System.Drawing.Point(15, 12);
|
||||
this.layout1.Name = "layout1";
|
||||
this.layout1.RowCount = 4;
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 70F));
|
||||
this.layout1.Size = new System.Drawing.Size(672, 333);
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 22.89562F));
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 39.05724F));
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38.04714F));
|
||||
this.layout1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 65F));
|
||||
this.layout1.Size = new System.Drawing.Size(826, 363);
|
||||
this.layout1.TabIndex = 7;
|
||||
//
|
||||
// layout2
|
||||
|
@ -184,12 +186,12 @@
|
|||
this.layout2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout2.Controls.Add(this.unmakeMV, 1, 0);
|
||||
this.layout2.Controls.Add(this.makeMV, 0, 0);
|
||||
this.layout2.Location = new System.Drawing.Point(12, 350);
|
||||
this.layout2.Location = new System.Drawing.Point(12, 380);
|
||||
this.layout2.Name = "layout2";
|
||||
this.layout2.RowCount = 1;
|
||||
this.layout2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout2.Size = new System.Drawing.Size(675, 30);
|
||||
this.layout2.Size = new System.Drawing.Size(829, 30);
|
||||
this.layout2.TabIndex = 11;
|
||||
//
|
||||
// MVProjectToolset
|
||||
|
@ -197,13 +199,14 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||
this.ClientSize = new System.Drawing.Size(699, 412);
|
||||
this.ClientSize = new System.Drawing.Size(853, 442);
|
||||
this.Controls.Add(this.processingText);
|
||||
this.Controls.Add(this.processingBar);
|
||||
this.Controls.Add(this.layout1);
|
||||
this.Controls.Add(this.layout2);
|
||||
this.Name = "MVProjectToolset";
|
||||
this.Text = "RMDec - RPG Maker MV";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MVProjectToolset_FormClosing);
|
||||
this.Load += new System.EventHandler(this.MVProjectToolset_Load);
|
||||
this.layout1.ResumeLayout(false);
|
||||
this.layout2.ResumeLayout(false);
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.ListBox;
|
||||
|
||||
|
@ -22,14 +18,82 @@ namespace RMDEC
|
|||
mvProject = proj;
|
||||
InitializeComponent();
|
||||
}
|
||||
internal long _encryptedImageCount = 0;
|
||||
internal long _encryptedMusicCount = 0;
|
||||
|
||||
private long unencryptedImageCount = 0;
|
||||
private long unencryptedMusicCount = 0;
|
||||
|
||||
private List<string> encFileList = new List<string>();
|
||||
private List<string> decFileList = new List<string>();
|
||||
|
||||
private string[] blacklistedFiles = { Path.Combine("icon","icon.png"), Path.Combine("img","system","Window.png"), Path.Combine("img","system","Loading.png") };
|
||||
private string[] blacklistedFiles = { Path.Combine("icon", "icon.png"), Path.Combine("img", "system", "Window.png"), Path.Combine("img", "system", "Loading.png") };
|
||||
|
||||
private bool encryptedIndexingComplete = false;
|
||||
private bool unencryptedIndexingComplete = false;
|
||||
|
||||
|
||||
|
||||
private long encryptedImageCount {
|
||||
get
|
||||
{
|
||||
return _encryptedImageCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
_encryptedImageCount = value;
|
||||
|
||||
bool curent = mvProject.EncryptedImages;
|
||||
if(value <=0)
|
||||
{
|
||||
if(curent != false)
|
||||
{
|
||||
mvProject.EncryptedImages = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curent != true)
|
||||
{
|
||||
mvProject.EncryptedImages = true;
|
||||
}
|
||||
}
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private long encryptedMusicCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _encryptedMusicCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
_encryptedMusicCount = value;
|
||||
|
||||
bool curent = mvProject.EncryptedAudio;
|
||||
if (value <= 0)
|
||||
{
|
||||
if(curent != false)
|
||||
{
|
||||
mvProject.EncryptedAudio = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(curent != true)
|
||||
{
|
||||
mvProject.EncryptedAudio = true;
|
||||
}
|
||||
}
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onIndexThreadComplete()
|
||||
{
|
||||
if(encryptedIndexingComplete && unencryptedIndexingComplete)
|
||||
|
@ -82,9 +146,9 @@ namespace RMDEC
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//add PNG
|
||||
foreach (string png in pngList)
|
||||
{
|
||||
|
@ -120,6 +184,9 @@ namespace RMDEC
|
|||
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedImageCount = pngList.Count;
|
||||
encryptedMusicCount = oggList.Count + m4aList.Count;
|
||||
|
||||
encryptedIndexingComplete = true;
|
||||
onIndexThreadComplete();
|
||||
});
|
||||
|
@ -200,6 +267,9 @@ namespace RMDEC
|
|||
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
unencryptedImageCount = pngList.Count;
|
||||
unencryptedMusicCount = oggList.Count + m4aList.Count;
|
||||
|
||||
unencryptedIndexingComplete = true;
|
||||
onIndexThreadComplete();
|
||||
});
|
||||
|
@ -210,10 +280,49 @@ namespace RMDEC
|
|||
}
|
||||
private void MVProjectToolset_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.Text = "RMDec - RPG Maker MV - " + mvProject.GameTitle + " - " + mvProject.FilePath;
|
||||
updateTitle();
|
||||
indexFiles();
|
||||
}
|
||||
|
||||
private void updateTitle()
|
||||
{
|
||||
this.Text = "RMDec - [RMMV] " + mvProject.GameTitle + " - " + mvProject.FilePath + " - encryptedImages: "+mvProject.EncryptedImages.ToString()+" - encrypedAudio: "+mvProject.EncryptedAudio.ToString();
|
||||
}
|
||||
private string encodeFileExtension(string fileName)
|
||||
{
|
||||
string extension = Path.GetExtension(fileName).ToLower();
|
||||
string newExtension = "";
|
||||
|
||||
switch (extension)
|
||||
{
|
||||
case ".png":
|
||||
newExtension = ".rpgmvp";
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedImageCount += 1;
|
||||
unencryptedImageCount -= 1;
|
||||
});
|
||||
break;
|
||||
case ".ogg":
|
||||
newExtension = ".rpgmvo";
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedMusicCount += 1;
|
||||
unencryptedMusicCount -= 1;
|
||||
});
|
||||
break;
|
||||
case ".m4a":
|
||||
newExtension = ".rpgmvm";
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedMusicCount += 1;
|
||||
unencryptedMusicCount -= 1;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
return newExtension;
|
||||
}
|
||||
private void encryptSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndexCollection itemList = decryptedFileList.SelectedIndices;
|
||||
|
@ -254,23 +363,7 @@ namespace RMDEC
|
|||
|
||||
|
||||
string decryptedFile = decFileList[item];
|
||||
string extension = Path.GetExtension(decryptedFile).ToLower();
|
||||
string newExtension = "";
|
||||
|
||||
switch (extension)
|
||||
{
|
||||
case ".png":
|
||||
newExtension = ".rpgmvp";
|
||||
break;
|
||||
case ".ogg":
|
||||
newExtension = ".rpgmvo";
|
||||
break;
|
||||
case ".m4a":
|
||||
newExtension = ".rpgmvm";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
string newExtension = encodeFileExtension(decryptedFile);
|
||||
string encryptedFile = Path.ChangeExtension(decryptedFile, newExtension);
|
||||
|
||||
FileStream Decrypted = File.OpenRead(decryptedFile);
|
||||
|
@ -311,6 +404,44 @@ namespace RMDEC
|
|||
decryptFilesThread.Start();
|
||||
}
|
||||
|
||||
|
||||
private string decodeFileExtension(string fileName)
|
||||
{
|
||||
string extension = Path.GetExtension(fileName).ToLower();
|
||||
string newExtension = "";
|
||||
|
||||
switch (extension)
|
||||
{
|
||||
case ".rpgmvp":
|
||||
newExtension = ".png";
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedImageCount -= 1;
|
||||
unencryptedImageCount += 1;
|
||||
});
|
||||
break;
|
||||
case ".rpgmvo":
|
||||
newExtension = "ogg";
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedMusicCount -= 1;
|
||||
unencryptedMusicCount += 1;
|
||||
});
|
||||
break;
|
||||
case ".rpgmvm":
|
||||
newExtension = ".m4a";
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
encryptedMusicCount -= 1;
|
||||
unencryptedMusicCount += 1;
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return newExtension;
|
||||
}
|
||||
|
||||
private void decryptSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndexCollection itemList = encryptedFileList.SelectedIndices;
|
||||
|
@ -331,6 +462,9 @@ namespace RMDEC
|
|||
encryptSelected.Enabled = false;
|
||||
decryptSelected.Enabled = false;
|
||||
|
||||
makeMV.Enabled = false;
|
||||
unmakeMV.Enabled = false;
|
||||
|
||||
Thread decryptFilesThread = new Thread(() =>
|
||||
{
|
||||
int i = 1;
|
||||
|
@ -350,23 +484,7 @@ namespace RMDEC
|
|||
|
||||
|
||||
string encryptedFile = encFileList[item];
|
||||
string extension = Path.GetExtension(encryptedFile).ToLower();
|
||||
string newExtension = "";
|
||||
|
||||
switch (extension)
|
||||
{
|
||||
case ".rpgmvp":
|
||||
newExtension = ".png";
|
||||
break;
|
||||
case ".rpgmvo":
|
||||
newExtension = "ogg";
|
||||
break;
|
||||
case ".rpgmvm":
|
||||
newExtension = ".m4a";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
string newExtension = decodeFileExtension(encryptedFile);
|
||||
string decryptedFile = Path.ChangeExtension(encryptedFile, newExtension);
|
||||
|
||||
FileStream Encrypted = File.OpenRead(encryptedFile);
|
||||
|
@ -399,6 +517,8 @@ namespace RMDEC
|
|||
{
|
||||
encryptSelected.Enabled = true;
|
||||
decryptSelected.Enabled = true;
|
||||
makeMV.Enabled = true;
|
||||
unmakeMV.Enabled = true;
|
||||
processingText.BackColor = Color.Green;
|
||||
processingText.Text = "Decrypted " + total.ToString() + " files!";
|
||||
});
|
||||
|
@ -407,6 +527,205 @@ namespace RMDEC
|
|||
decryptFilesThread.Start();
|
||||
}
|
||||
|
||||
private void onMakeMvComplete()
|
||||
{
|
||||
string rpgProject = Path.Combine(mvProject.FilePath, "Game.rpgproject");
|
||||
File.WriteAllText(rpgProject, "RPGMV 1.0.0");
|
||||
|
||||
processingText.BackColor = Color.Green;
|
||||
processingText.Text = "Game Un-Deployed!";
|
||||
|
||||
encryptSelected.Enabled = true;
|
||||
decryptSelected.Enabled = true;
|
||||
makeMV.Enabled = true;
|
||||
unmakeMV.Enabled = true;
|
||||
|
||||
Process.Start(mvProject.FilePath);
|
||||
}
|
||||
private void makeMV_Click(object sender, EventArgs e)
|
||||
{
|
||||
int itemCount = encFileList.Count;
|
||||
|
||||
//Decrypt Everything
|
||||
if (itemCount > 0)
|
||||
{
|
||||
processingBar.Style = ProgressBarStyle.Continuous;
|
||||
processingBar.Maximum = itemCount;
|
||||
|
||||
processingText.BackColor = Color.Yellow;
|
||||
|
||||
encryptSelected.Enabled = false;
|
||||
decryptSelected.Enabled = false;
|
||||
|
||||
makeMV.Enabled = false;
|
||||
unmakeMV.Enabled = false;
|
||||
|
||||
Thread decryptFilesThread = new Thread(() =>
|
||||
{
|
||||
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
processingText.Text = "Decrypting " + i.ToString() + "/" + itemCount.ToString();
|
||||
});
|
||||
|
||||
|
||||
string encryptedFile = encFileList[0];
|
||||
string newExtension = decodeFileExtension(encryptedFile);
|
||||
string decryptedFile = Path.ChangeExtension(encryptedFile, newExtension);
|
||||
|
||||
FileStream Encrypted = File.OpenRead(encryptedFile);
|
||||
FileStream Decrypted = File.OpenWrite(decryptedFile);
|
||||
|
||||
mvProject.DecryptFile(Encrypted, Decrypted);
|
||||
|
||||
Encrypted.Close();
|
||||
Decrypted.Close();
|
||||
|
||||
File.Delete(encryptedFile);
|
||||
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
string entry = encryptedFileList.Items[0].ToString();
|
||||
string decryptedEntry = Path.ChangeExtension(entry, newExtension);
|
||||
decryptedFileList.Items.Add(decryptedEntry);
|
||||
decFileList.Add(decryptedFile);
|
||||
|
||||
encryptedFileList.Items.RemoveAt(0);
|
||||
encFileList.RemoveAt(0);
|
||||
|
||||
processingBar.Value = i;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
onMakeMvComplete();
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
decryptFilesThread.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
onMakeMvComplete();
|
||||
}
|
||||
}
|
||||
|
||||
private void onUnMakeMvComplete()
|
||||
{
|
||||
string rpgProject = Path.Combine(mvProject.FilePath, "Game.rpgproject");
|
||||
File.Delete(rpgProject);
|
||||
|
||||
processingText.BackColor = Color.Green;
|
||||
processingText.Text = "Game Deployed!";
|
||||
|
||||
encryptSelected.Enabled = true;
|
||||
decryptSelected.Enabled = true;
|
||||
makeMV.Enabled = true;
|
||||
unmakeMV.Enabled = true;
|
||||
|
||||
}
|
||||
private void unmakeMV_Click(object sender, EventArgs e)
|
||||
{
|
||||
int itemCount = decFileList.Count;
|
||||
|
||||
//Encrypt Everything
|
||||
if (itemCount > 0)
|
||||
{
|
||||
processingBar.Style = ProgressBarStyle.Continuous;
|
||||
processingBar.Maximum = itemCount;
|
||||
|
||||
processingText.BackColor = Color.Yellow;
|
||||
|
||||
encryptSelected.Enabled = false;
|
||||
decryptSelected.Enabled = false;
|
||||
|
||||
makeMV.Enabled = false;
|
||||
unmakeMV.Enabled = false;
|
||||
|
||||
Thread encryptFilesThread = new Thread(() =>
|
||||
{
|
||||
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
processingText.Text = "Encrypting " + i.ToString() + "/" + itemCount.ToString();
|
||||
});
|
||||
|
||||
|
||||
string decryptedFile = decFileList[0];
|
||||
string newExtension = encodeFileExtension(decryptedFile);
|
||||
string encryptedFile = Path.ChangeExtension(decryptedFile, newExtension);
|
||||
|
||||
FileStream Encrypted = File.OpenWrite(encryptedFile);
|
||||
FileStream Decrypted = File.OpenRead(decryptedFile);
|
||||
|
||||
mvProject.EncryptFile(Decrypted,Encrypted);
|
||||
|
||||
Encrypted.Close();
|
||||
Decrypted.Close();
|
||||
|
||||
File.Delete(decryptedFile);
|
||||
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
string entry = decryptedFileList.Items[0].ToString();
|
||||
string encryptedEntry = Path.ChangeExtension(entry, newExtension);
|
||||
encryptedFileList.Items.Add(encryptedEntry);
|
||||
encFileList.Add(encryptedFile);
|
||||
|
||||
decryptedFileList.Items.RemoveAt(0);
|
||||
decFileList.RemoveAt(0);
|
||||
|
||||
processingBar.Value = i;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
onUnMakeMvComplete();
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
encryptFilesThread.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
onUnMakeMvComplete();
|
||||
}
|
||||
}
|
||||
|
||||
private void MVProjectToolset_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if(mvProject.EncryptedAudio == true && unencryptedMusicCount > 0)
|
||||
{
|
||||
DialogResult res = MessageBox.Show("Warning: You have mixed unencrypted/encrypted Audio files!\n\nMV Requires ALL Decrypted or ALL Encrypted\nThe game WILL CRASH when attemping to load these files\nPlease Encrypt ALL Audio Files or Decrypt ALL Audio Files.", "Mixed Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||
if(res == DialogResult.OK)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
if (mvProject.EncryptedImages == true && unencryptedImageCount > 0)
|
||||
{
|
||||
DialogResult res = MessageBox.Show("Warning: You have mixed unencrypted/encrypted Image files!\n\nMV Requires ALL Decrypted or ALL Encrypted\nThe game WILL CRASH when attemping to load these files\nPlease Encrypt ALL Images or Decrypt ALL Images.", "Mixed Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||
if (res == DialogResult.OK)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
this.projectList.FormattingEnabled = true;
|
||||
this.projectList.Location = new System.Drawing.Point(12, 34);
|
||||
this.projectList.Name = "projectList";
|
||||
this.projectList.Size = new System.Drawing.Size(487, 262);
|
||||
this.projectList.Size = new System.Drawing.Size(637, 366);
|
||||
this.projectList.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
|
@ -67,7 +67,7 @@
|
|||
this.projectDir.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
|
||||
this.projectDir.Location = new System.Drawing.Point(98, 8);
|
||||
this.projectDir.Name = "projectDir";
|
||||
this.projectDir.Size = new System.Drawing.Size(314, 20);
|
||||
this.projectDir.Size = new System.Drawing.Size(464, 20);
|
||||
this.projectDir.TabIndex = 2;
|
||||
this.projectDir.TextChanged += new System.EventHandler(this.projectDir_TextChanged);
|
||||
//
|
||||
|
@ -77,7 +77,7 @@
|
|||
this.browseButton.BackColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
this.browseButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.browseButton.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.browseButton.Location = new System.Drawing.Point(418, 8);
|
||||
this.browseButton.Location = new System.Drawing.Point(568, 8);
|
||||
this.browseButton.Name = "browseButton";
|
||||
this.browseButton.Size = new System.Drawing.Size(81, 20);
|
||||
this.browseButton.TabIndex = 3;
|
||||
|
@ -92,9 +92,9 @@
|
|||
this.selectButton.BackColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
this.selectButton.Enabled = false;
|
||||
this.selectButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.selectButton.Location = new System.Drawing.Point(12, 302);
|
||||
this.selectButton.Location = new System.Drawing.Point(12, 407);
|
||||
this.selectButton.Name = "selectButton";
|
||||
this.selectButton.Size = new System.Drawing.Size(487, 23);
|
||||
this.selectButton.Size = new System.Drawing.Size(637, 23);
|
||||
this.selectButton.TabIndex = 4;
|
||||
this.selectButton.Text = "Select RPG Maker Project";
|
||||
this.selectButton.UseVisualStyleBackColor = false;
|
||||
|
@ -105,7 +105,7 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||
this.ClientSize = new System.Drawing.Size(511, 332);
|
||||
this.ClientSize = new System.Drawing.Size(661, 437);
|
||||
this.Controls.Add(this.projectList);
|
||||
this.Controls.Add(this.selectButton);
|
||||
this.Controls.Add(this.browseButton);
|
||||
|
|
Loading…
Reference in New Issue