Skip to content

Commit

Permalink
added integration of GodotPCKExplorer logs
Browse files Browse the repository at this point in the history
added more logs
added an encryption indicators
fixed a problem with drag&drop encrypted pcks
fixed incorrect flags when creating an encrypted PCK via UI
added the ability to specify encryption flags via the console
  • Loading branch information
DmitriySalnikov committed Sep 23, 2023
1 parent 97ff3e0 commit 388849d
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 125 deletions.
2 changes: 1 addition & 1 deletion GodotPCKExplorer.UI/ChangePCKVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void ShowAndOpenFile(string filePath)
}
else
{
Program.CommandLog($"Specified file does not exists! '{filePath}'", "Error", false, MessageType.Error);
Program.ShowMessage($"Specified file does not exists! '{filePath}'", "Error", MessageType.Error);
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions GodotPCKExplorer.UI/CreatePCKEncryption.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions GodotPCKExplorer.UI/CreatePCKFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ private void btn_create_Click(object sender, EventArgs e)
(uint)nud_alignment.Value,
cb_embed.Checked,
GUIConfig.Instance.EncryptionKey,
GUIConfig.Instance.EncryptPCK && cb_enable_encryption.Checked,
GUIConfig.Instance.EncryptPCK && cb_enable_encryption.Checked
GUIConfig.Instance.EncryptIndex && cb_enable_encryption.Checked,
GUIConfig.Instance.EncryptFiles && cb_enable_encryption.Checked
);

GUIConfig.Instance.PackedVersion = ver;
Expand Down
37 changes: 34 additions & 3 deletions GodotPCKExplorer.UI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,28 @@ void UpdateRecentList()
}
}

string GetEncryptionStatusString()
{
var enc_text = "";
if (pckReader.IsEncrypted)
{
if (pckReader.IsEncryptedIndex != pckReader.IsEncryptedFiles)
{
if (pckReader.IsEncryptedIndex)
enc_text = "Encrypted Index";
else
enc_text = "Encrypted Files";
}
else
{
enc_text = "Encrypted";
}
}
if (enc_text != "")
enc_text = " " + enc_text;
return enc_text;
}

public void OpenFile(string path, string encKey = null)
{
CloseFile();
Expand All @@ -207,7 +229,7 @@ public void OpenFile(string path, string encKey = null)
{
d.ShowDialog();

if (item != null)
if (item != null && !string.IsNullOrWhiteSpace(d.EncryptionKey))
{
item.EncryptionKey = d.EncryptionKey;
GUIConfig.Instance.Save();
Expand All @@ -220,7 +242,8 @@ public void OpenFile(string path, string encKey = null)
path = Path.GetFullPath(path);
if (pckReader.OpenFile(path, get_encryption_key: get_enc_key))
{
Text = $"\"{Utils.GetShortPath(pckReader.PackPath, 50)}\" Pack version: {pckReader.PCK_VersionPack}. Godot Version: {pckReader.PCK_VersionMajor}.{pckReader.PCK_VersionMinor}.{pckReader.PCK_VersionRevision}";
var enc_text = GetEncryptionStatusString();
Text = $"\"{Utils.GetShortPath(pckReader.PackPath, 50)}\" Pack version: {pckReader.PCK_VersionPack}. Godot Version: {pckReader.PCK_VersionMajor}.{pckReader.PCK_VersionMinor}.{pckReader.PCK_VersionRevision}{enc_text}";

// update recent files
var list = GUIConfig.Instance.RecentOpenedFiles;
Expand Down Expand Up @@ -315,9 +338,11 @@ void UpdateStatuStrip()
size += (long)f.Cells[2].Tag;
}

var enc_text = GetEncryptionStatusString();
tssl_version_and_stats.Text = $"Version: {pckReader.PCK_VersionPack} {pckReader.PCK_VersionMajor}.{pckReader.PCK_VersionMinor}.{pckReader.PCK_VersionRevision}" +
$" Files count: {pckReader.Files.Count}" +
$" Total size: {Utils.SizeSuffix(TotalOpenedSize)}";
$" Total size: {Utils.SizeSuffix(TotalOpenedSize)}" +
enc_text;

if (dataGridView1.SelectedRows.Count > 0)
tssl_selected_size.Text = $"Selected: {dataGridView1.SelectedRows.Count} Size: {Utils.SizeSuffix(size)}";
Expand Down Expand Up @@ -423,11 +448,17 @@ private void Form1_DragEnter(object sender, DragEventArgs e)

if (File.Exists(files[0]))
{
var old_state_cmd = Program.CMDMode;
Program.CMDMode = true;

if (pck.OpenFile(files[0], false, log_names_progress: false))
{
Program.CMDMode = old_state_cmd;

e.Effect = DragDropEffects.Copy;
return;
}
Program.CMDMode = old_state_cmd;
}
}
}
Expand Down
Loading

0 comments on commit 388849d

Please sign in to comment.