├── PakTool.suo
├── PakTool
├── q.ico
├── obj
│ └── x86
│ │ ├── Release
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ ├── PakTool.exe
│ │ ├── PakTool.pdb
│ │ ├── PakTool.frmMain.resources
│ │ ├── PakTool.AboutBox1.resources
│ │ ├── GenerateResource.read.1.tlog
│ │ ├── GenerateResource.write.1.tlog
│ │ ├── PakTool.frmCreating.resources
│ │ ├── PakTool.frmExtracting.resources
│ │ ├── PakTool.csproj.GenerateResource.Cache
│ │ ├── PakTool.Properties.Resources.resources
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── TempPE
│ │ │ └── Properties.Resources.Designer.cs.dll
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── PakTool.csproj.FileListAbsolute.txt
│ │ └── Debug
│ │ ├── PakTool.frmMain.resources
│ │ ├── GenerateResource.read.1.tlog
│ │ ├── GenerateResource.write.1.tlog
│ │ ├── PakTool.frmCreating.resources
│ │ ├── PakTool.frmExtracting.resources
│ │ ├── ResolveAssemblyReference.cache
│ │ ├── PakTool.Properties.Resources.resources
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── TempPE
│ │ └── Properties.Resources.Designer.cs.dll
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── PakTool.csproj.FileListAbsolute.txt
├── bin
│ ├── Debug
│ │ ├── PakTool.exe
│ │ ├── PakTool.pdb
│ │ ├── PakTool.vshost.exe
│ │ ├── PakTool.vshost.exe.config
│ │ ├── PakTool.vshost.application
│ │ └── PakTool.vshost.exe.manifest
│ └── Release
│ │ ├── PakTool.exe
│ │ ├── PakTool.pdb
│ │ └── PakTool.exe.config
├── app.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── app.manifest
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── PakTool.csproj.user
├── frmCreating.cs
├── frmExtracting.cs
├── frmCreating.Designer.cs
├── frmExtracting.Designer.cs
├── AboutBox1.cs
├── AboutBox1.resx
├── frmCreating.resx
├── frmExtracting.resx
├── PakTool.csproj
├── frmMain.Designer.cs
├── AboutBox1.Designer.cs
├── frmMain.cs
└── Pack.cs
├── PakTool.sln
├── README.md
└── LICENSE
/PakTool.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool.suo
--------------------------------------------------------------------------------
/PakTool/q.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/q.ico
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/PakTool/bin/Debug/PakTool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/bin/Debug/PakTool.exe
--------------------------------------------------------------------------------
/PakTool/bin/Debug/PakTool.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/bin/Debug/PakTool.pdb
--------------------------------------------------------------------------------
/PakTool/bin/Release/PakTool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/bin/Release/PakTool.exe
--------------------------------------------------------------------------------
/PakTool/bin/Release/PakTool.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/bin/Release/PakTool.pdb
--------------------------------------------------------------------------------
/PakTool/bin/Debug/PakTool.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/bin/Debug/PakTool.vshost.exe
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.exe
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.pdb
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/PakTool.frmMain.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/PakTool.frmMain.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.frmMain.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.frmMain.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/GenerateResource.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/GenerateResource.read.1.tlog
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/GenerateResource.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/GenerateResource.write.1.tlog
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/PakTool.frmCreating.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/PakTool.frmCreating.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.AboutBox1.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.AboutBox1.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/PakTool.frmExtracting.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/PakTool.frmExtracting.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/ResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/ResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/GenerateResource.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/GenerateResource.read.1.tlog
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/GenerateResource.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/GenerateResource.write.1.tlog
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.frmCreating.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.frmCreating.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.frmExtracting.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.frmExtracting.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/PakTool.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/PakTool.Properties.Resources.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/PakTool.Properties.Resources.resources
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/PakTool/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/E-werd/PakTool/HEAD/PakTool/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/PakTool/bin/Release/PakTool.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/PakTool/bin/Debug/PakTool.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/PakTool/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PakTool/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace PakTool
5 | {
6 | static class Program
7 | {
8 | ///
9 | /// The main entry point for the application.
10 | ///
11 | [STAThread]
12 | static void Main(string[] args)
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new frmMain(args));
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/PakTool/PakTool.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | E:\GitHub\PakTool\Release\|F:\Edward\Desktop\paktool\|\\ncstfs\stafffiles%24\ewymer\Desktop\paktool\
5 |
6 |
7 |
8 |
9 |
10 | en-US
11 | false
12 |
13 |
--------------------------------------------------------------------------------
/PakTool.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual C# Express 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PakTool", "PakTool\PakTool.csproj", "{8D6C7097-059C-4689-A69D-243A151056F0}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|x86 = Debug|x86
9 | Release|x86 = Release|x86
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {8D6C7097-059C-4689-A69D-243A151056F0}.Debug|x86.ActiveCfg = Debug|x86
13 | {8D6C7097-059C-4689-A69D-243A151056F0}.Debug|x86.Build.0 = Debug|x86
14 | {8D6C7097-059C-4689-A69D-243A151056F0}.Release|x86.ActiveCfg = Release|x86
15 | {8D6C7097-059C-4689-A69D-243A151056F0}.Release|x86.Build.0 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PakTool
2 | Tool for opening, extracting, and creating Quake PAK files.
3 |
4 | This was originally just a project that I started to learn C#. I found the specification and went to work.
5 | The GUI isn't feature-packed but it's functional. Beyond the buttons...
6 |
7 | - Double-clicking a file will instantly extract it to a temporary folder and execute it in Windows. This temp folder is cleared on exit.
8 | - This tool can put ANY files into a PAK. This was a limitation with PAK Explorer.
9 |
10 | The project is in C# and the project is built for .NET Client Profile 4. In order to drop that down, which I don't really see a reason to at this point, there would be some work involved.
11 |
12 | I'm open to continue working on this if the demand is there, but I just haven't had a reason to continue. It does what I set out to do, simply and efficiently.
13 |
14 | The library for this is 'Pack.cs' which can easily be grabbed and used, it's one file.
--------------------------------------------------------------------------------
/PakTool/frmCreating.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Threading;
4 |
5 | namespace PakTool
6 | {
7 | public partial class frmCreating : Form
8 | {
9 | private static frmCreating mInstance;
10 |
11 | public static void Create()
12 | {
13 | var t = new Thread(() =>
14 | {
15 | mInstance = new frmCreating();
16 | mInstance.FormClosed += (s, e) => mInstance = null;
17 | Application.Run(mInstance);
18 | });
19 | t.SetApartmentState(ApartmentState.STA);
20 | t.IsBackground = true;
21 | t.Start();
22 | }
23 |
24 | public static void Destroy()
25 | {
26 | try { if (mInstance != null) mInstance.Invoke(new Action(() => mInstance.Close())); }
27 | catch (Exception) { }
28 | }
29 |
30 | public frmCreating()
31 | {
32 | InitializeComponent();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/PakTool/frmExtracting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Threading;
4 |
5 | namespace PakTool
6 | {
7 | public partial class frmExtracting : Form
8 | {
9 | private static frmExtracting mInstance;
10 |
11 | public static void Create()
12 | {
13 | var t = new Thread(() =>
14 | {
15 | mInstance = new frmExtracting();
16 | mInstance.FormClosed += (s, e) => mInstance = null;
17 | Application.Run(mInstance);
18 | });
19 | t.SetApartmentState(ApartmentState.STA);
20 | t.IsBackground = true;
21 | t.Start();
22 | }
23 |
24 | public static void Destroy()
25 | {
26 | try { if (mInstance != null) mInstance.Invoke(new Action(() => mInstance.Close())); }
27 | catch (Exception) { }
28 | }
29 |
30 | public frmExtracting()
31 | {
32 | InitializeComponent();
33 | }
34 |
35 | private void frmExtracting_Load(object sender, EventArgs e)
36 | {
37 |
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/PakTool/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34014
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PakTool.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/PakTool/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Resources;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PakTool")]
9 | [assembly: AssemblyDescription("Tool for opening, extracting, and creating Quake PAK files.")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Created by E-werd")]
12 | [assembly: AssemblyProduct("PakTool")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(true)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("41e00f06-229c-4d4a-8bf1-6df0c002f773")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0")]
36 | [assembly: AssemblyFileVersion("1.0")]
37 | [assembly: NeutralResourcesLanguageAttribute("en-US")]
38 |
--------------------------------------------------------------------------------
/PakTool/bin/Debug/PakTool.vshost.application:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | EKHDkcNPsY9EAr9GNCfPrS0+kVg=
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/PakTool/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
47 |
--------------------------------------------------------------------------------
/PakTool/bin/Debug/PakTool.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
47 |
--------------------------------------------------------------------------------
/PakTool/frmCreating.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PakTool
2 | {
3 | partial class frmCreating
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // label1
35 | //
36 | this.label1.AutoSize = true;
37 | this.label1.Location = new System.Drawing.Point(27, 15);
38 | this.label1.Name = "label1";
39 | this.label1.Size = new System.Drawing.Size(138, 13);
40 | this.label1.TabIndex = 1;
41 | this.label1.Text = "Creating PAK, please wait...";
42 | this.label1.UseWaitCursor = true;
43 | //
44 | // frmCreating
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.ClientSize = new System.Drawing.Size(200, 43);
49 | this.Controls.Add(this.label1);
50 | this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
51 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
52 | this.MaximizeBox = false;
53 | this.MaximumSize = new System.Drawing.Size(206, 71);
54 | this.MinimizeBox = false;
55 | this.MinimumSize = new System.Drawing.Size(206, 71);
56 | this.Name = "frmCreating";
57 | this.ShowIcon = false;
58 | this.ShowInTaskbar = false;
59 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
60 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
61 | this.Text = "Creating...";
62 | this.UseWaitCursor = true;
63 | this.ResumeLayout(false);
64 | this.PerformLayout();
65 |
66 | }
67 |
68 | #endregion
69 |
70 | private System.Windows.Forms.Label label1;
71 | }
72 | }
--------------------------------------------------------------------------------
/PakTool/frmExtracting.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PakTool
2 | {
3 | partial class frmExtracting
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // label1
35 | //
36 | this.label1.AutoSize = true;
37 | this.label1.Location = new System.Drawing.Point(21, 11);
38 | this.label1.Name = "label1";
39 | this.label1.Size = new System.Drawing.Size(146, 13);
40 | this.label1.TabIndex = 0;
41 | this.label1.Text = "Extracting PAK, please wait...";
42 | this.label1.UseWaitCursor = true;
43 | //
44 | // frmExtracting
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.ClientSize = new System.Drawing.Size(200, 42);
49 | this.Controls.Add(this.label1);
50 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
51 | this.MaximizeBox = false;
52 | this.MaximumSize = new System.Drawing.Size(206, 71);
53 | this.MinimizeBox = false;
54 | this.MinimumSize = new System.Drawing.Size(206, 71);
55 | this.Name = "frmExtracting";
56 | this.ShowIcon = false;
57 | this.ShowInTaskbar = false;
58 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
59 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
60 | this.Text = "Extracting...";
61 | this.TopMost = true;
62 | this.UseWaitCursor = true;
63 | this.Load += new System.EventHandler(this.frmExtracting_Load);
64 | this.ResumeLayout(false);
65 | this.PerformLayout();
66 |
67 | }
68 |
69 | #endregion
70 |
71 | private System.Windows.Forms.Label label1;
72 | }
73 | }
--------------------------------------------------------------------------------
/PakTool/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34014
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PakTool.Properties {
12 |
13 |
14 | ///
15 | /// A strongly-typed resource class, for looking up localized strings, etc.
16 | ///
17 | // This class was auto-generated by the StronglyTypedResourceBuilder
18 | // class via a tool like ResGen or Visual Studio.
19 | // To add or remove a member, edit your .ResX file then rerun ResGen
20 | // with the /str option, or rebuild your VS project.
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources {
25 |
26 | private static global::System.Resources.ResourceManager resourceMan;
27 |
28 | private static global::System.Globalization.CultureInfo resourceCulture;
29 |
30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
31 | internal Resources() {
32 | }
33 |
34 | ///
35 | /// Returns the cached ResourceManager instance used by this class.
36 | ///
37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
38 | internal static global::System.Resources.ResourceManager ResourceManager {
39 | get {
40 | if (object.ReferenceEquals(resourceMan, null)) {
41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PakTool.Properties.Resources", typeof(Resources).Assembly);
42 | resourceMan = temp;
43 | }
44 | return resourceMan;
45 | }
46 | }
47 |
48 | ///
49 | /// Overrides the current thread's CurrentUICulture property for all
50 | /// resource lookups using this strongly typed resource class.
51 | ///
52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
53 | internal static global::System.Globalization.CultureInfo Culture {
54 | get {
55 | return resourceCulture;
56 | }
57 | set {
58 | resourceCulture = value;
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/PakTool/obj/x86/Debug/PakTool.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\bin\Debug\PakTool.exe
2 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\bin\Debug\PakTool.pdb
3 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\ResolveAssemblyReference.cache
4 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\PakTool.Form1.resources
5 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\PakTool.Properties.Resources.resources
6 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\GenerateResource.read.1.tlog
7 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\GenerateResource.write.1.tlog
8 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\PakTool.exe
9 | C:\Users\ewymer\AppData\Local\Temporary Projects\PakTool\obj\x86\Debug\PakTool.pdb
10 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.exe
11 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.pdb
12 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\bin\Debug\PakTool.exe
13 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\bin\Debug\PakTool.pdb
14 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\ResolveAssemblyReference.cache
15 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.Properties.Resources.resources
16 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\GenerateResource.read.1.tlog
17 | C:\Users\ewymer\documents\visual studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\GenerateResource.write.1.tlog
18 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.exe
19 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.pdb
20 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Debug\PakTool.exe
21 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Debug\PakTool.pdb
22 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\ResolveAssemblyReference.cache
23 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.Properties.Resources.resources
24 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\GenerateResource.read.1.tlog
25 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\GenerateResource.write.1.tlog
26 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.frmExtracting.resources
27 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.frmMain.resources
28 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.frmCreating.resources
29 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.frmCreating.resources
30 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.frmExtracting.resources
31 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Debug\PakTool.frmMain.resources
32 |
--------------------------------------------------------------------------------
/PakTool/obj/x86/Release/PakTool.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.exe
2 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.pdb
3 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\ResolveAssemblyReference.cache
4 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmCreating.resources
5 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmExtracting.resources
6 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmMain.resources
7 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.Properties.Resources.resources
8 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\GenerateResource.read.1.tlog
9 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\GenerateResource.write.1.tlog
10 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.exe
11 | C:\Users\ewymer\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.pdb
12 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.exe
13 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.pdb
14 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\ResolveAssemblyReference.cache
15 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmCreating.resources
16 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmExtracting.resources
17 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmMain.resources
18 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.Properties.Resources.resources
19 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\GenerateResource.read.1.tlog
20 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\GenerateResource.write.1.tlog
21 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.exe
22 | C:\Users\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.pdb
23 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.exe.config
24 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.exe
25 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\bin\Release\PakTool.pdb
26 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmCreating.resources
27 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmExtracting.resources
28 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.frmMain.resources
29 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.Properties.Resources.resources
30 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.csproj.GenerateResource.Cache
31 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.exe
32 | F:\Edward\Documents\Visual Studio 2010\Projects\PakTool\PakTool\obj\x86\Release\PakTool.pdb
33 | E:\GitHub\PakTool\PakTool\bin\Release\PakTool.exe.config
34 | E:\GitHub\PakTool\PakTool\bin\Release\PakTool.exe
35 | E:\GitHub\PakTool\PakTool\bin\Release\PakTool.pdb
36 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.AboutBox1.resources
37 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.frmCreating.resources
38 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.frmExtracting.resources
39 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.frmMain.resources
40 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.Properties.Resources.resources
41 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.csproj.GenerateResource.Cache
42 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.exe
43 | E:\GitHub\PakTool\PakTool\obj\x86\Release\PakTool.pdb
44 |
--------------------------------------------------------------------------------
/PakTool/AboutBox1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Reflection;
7 | using System.Windows.Forms;
8 | using System.Threading;
9 |
10 | namespace PakTool
11 | {
12 | partial class AboutBox1 : Form
13 | {
14 | private static AboutBox1 mInstance;
15 |
16 | public static void Create()
17 | {
18 | var t = new Thread(() =>
19 | {
20 | mInstance = new AboutBox1();
21 | mInstance.FormClosed += (s, e) => mInstance = null;
22 | Application.Run(mInstance);
23 | });
24 | t.SetApartmentState(ApartmentState.STA);
25 | t.IsBackground = true;
26 | t.Start();
27 | }
28 |
29 | public static void Destroy()
30 | {
31 | try { if (mInstance != null) mInstance.Invoke(new Action(() => mInstance.Close())); }
32 | catch (Exception) { }
33 | }
34 |
35 | public AboutBox1()
36 | {
37 | InitializeComponent();
38 | this.Text = String.Format("About {0}", AssemblyTitle);
39 | this.labelProductName.Text = AssemblyProduct;
40 | this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
41 | this.labelCopyright.Text = AssemblyCopyright;
42 | this.labelCompanyName.Text = AssemblyCompany;
43 | this.textBoxDescription.Text = AssemblyDescription;
44 | }
45 |
46 | #region Assembly Attribute Accessors
47 |
48 | public string AssemblyTitle
49 | {
50 | get
51 | {
52 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
53 | if (attributes.Length > 0)
54 | {
55 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
56 | if (titleAttribute.Title != "")
57 | {
58 | return titleAttribute.Title;
59 | }
60 | }
61 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
62 | }
63 | }
64 |
65 | public string AssemblyVersion
66 | {
67 | get
68 | {
69 | return Assembly.GetExecutingAssembly().GetName().Version.ToString();
70 | }
71 | }
72 |
73 | public string AssemblyDescription
74 | {
75 | get
76 | {
77 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
78 | if (attributes.Length == 0)
79 | {
80 | return "";
81 | }
82 | return ((AssemblyDescriptionAttribute)attributes[0]).Description;
83 | }
84 | }
85 |
86 | public string AssemblyProduct
87 | {
88 | get
89 | {
90 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
91 | if (attributes.Length == 0)
92 | {
93 | return "";
94 | }
95 | return ((AssemblyProductAttribute)attributes[0]).Product;
96 | }
97 | }
98 |
99 | public string AssemblyCopyright
100 | {
101 | get
102 | {
103 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
104 | if (attributes.Length == 0)
105 | {
106 | return "";
107 | }
108 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
109 | }
110 | }
111 |
112 | public string AssemblyCompany
113 | {
114 | get
115 | {
116 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
117 | if (attributes.Length == 0)
118 | {
119 | return "";
120 | }
121 | return ((AssemblyCompanyAttribute)attributes[0]).Company;
122 | }
123 | }
124 | #endregion
125 |
126 | private void okButton_Click(object sender, EventArgs e)
127 | {
128 | AboutBox1.Destroy();
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/PakTool/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/PakTool/AboutBox1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/PakTool/frmCreating.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
--------------------------------------------------------------------------------
/PakTool/frmExtracting.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
--------------------------------------------------------------------------------
/PakTool/PakTool.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {8D6C7097-059C-4689-A69D-243A151056F0}
9 | WinExe
10 | Properties
11 | PakTool
12 | PakTool
13 | v4.0
14 | Client
15 | 512
16 | false
17 | E:\GitHub\PakTool\Release\
18 | true
19 | Disk
20 | false
21 | Foreground
22 | 7
23 | Days
24 | false
25 | false
26 | true
27 | publish.htm
28 | true
29 | 0
30 | 1.0.0.%2a
31 | false
32 | true
33 | false
34 |
35 |
36 | x86
37 | true
38 | full
39 | false
40 | bin\Debug\
41 | DEBUG;TRACE
42 | prompt
43 | 4
44 | false
45 |
46 |
47 | x86
48 | pdbonly
49 | true
50 | bin\Release\
51 | TRACE
52 | prompt
53 | 4
54 | false
55 | true
56 |
57 |
58 | q.ico
59 |
60 |
61 | 035CF3EABBC90B82C6DD61A60271ED0A842AC23E
62 |
63 |
64 | PakTool_TemporaryKey.pfx
65 |
66 |
67 | false
68 |
69 |
70 | false
71 |
72 |
73 | LocalIntranet
74 |
75 |
76 | Properties\app.manifest
77 |
78 |
79 | PakTool.Program
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | Form
96 |
97 |
98 | AboutBox1.cs
99 |
100 |
101 | Form
102 |
103 |
104 | frmCreating.cs
105 |
106 |
107 | Form
108 |
109 |
110 | frmMain.cs
111 |
112 |
113 | Form
114 |
115 |
116 | frmExtracting.cs
117 |
118 |
119 |
120 |
121 |
122 | AboutBox1.cs
123 |
124 |
125 | frmCreating.cs
126 |
127 |
128 | frmExtracting.cs
129 |
130 |
131 | frmMain.cs
132 |
133 |
134 | ResXFileCodeGenerator
135 | Resources.Designer.cs
136 | Designer
137 |
138 |
139 | True
140 | Resources.resx
141 | True
142 |
143 |
144 |
145 |
146 | SettingsSingleFileGenerator
147 | Settings.Designer.cs
148 |
149 |
150 | True
151 | Settings.settings
152 | True
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | False
161 | Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
162 | true
163 |
164 |
165 | False
166 | .NET Framework 3.5 SP1 Client Profile
167 | false
168 |
169 |
170 | False
171 | .NET Framework 3.5 SP1
172 | false
173 |
174 |
175 | False
176 | Windows Installer 3.1
177 | true
178 |
179 |
180 |
181 |
188 |
--------------------------------------------------------------------------------
/PakTool/frmMain.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PakTool
2 | {
3 | partial class frmMain
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
32 | this.treeView1 = new System.Windows.Forms.TreeView();
33 | this.btnOpen = new System.Windows.Forms.Button();
34 | this.btnExtractAll = new System.Windows.Forms.Button();
35 | this.btnCreateFromFolder = new System.Windows.Forms.Button();
36 | this.btnExtractSelected = new System.Windows.Forms.Button();
37 | this.chkMaintainDir = new System.Windows.Forms.CheckBox();
38 | this.btnAbout = new System.Windows.Forms.Button();
39 | this.SuspendLayout();
40 | //
41 | // treeView1
42 | //
43 | this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
44 | | System.Windows.Forms.AnchorStyles.Left)
45 | | System.Windows.Forms.AnchorStyles.Right)));
46 | this.treeView1.CheckBoxes = true;
47 | this.treeView1.Location = new System.Drawing.Point(12, 41);
48 | this.treeView1.Name = "treeView1";
49 | this.treeView1.PathSeparator = "/";
50 | this.treeView1.Size = new System.Drawing.Size(310, 247);
51 | this.treeView1.TabIndex = 0;
52 | this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
53 | this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick);
54 | //
55 | // btnOpen
56 | //
57 | this.btnOpen.Location = new System.Drawing.Point(12, 12);
58 | this.btnOpen.Name = "btnOpen";
59 | this.btnOpen.Size = new System.Drawing.Size(75, 23);
60 | this.btnOpen.TabIndex = 1;
61 | this.btnOpen.Text = "Open PAK...";
62 | this.btnOpen.UseVisualStyleBackColor = true;
63 | this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click);
64 | //
65 | // btnExtractAll
66 | //
67 | this.btnExtractAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
68 | this.btnExtractAll.Location = new System.Drawing.Point(247, 294);
69 | this.btnExtractAll.Name = "btnExtractAll";
70 | this.btnExtractAll.Size = new System.Drawing.Size(75, 23);
71 | this.btnExtractAll.TabIndex = 2;
72 | this.btnExtractAll.Text = "Extract All...";
73 | this.btnExtractAll.UseVisualStyleBackColor = true;
74 | this.btnExtractAll.Click += new System.EventHandler(this.btnExtractAll_Click);
75 | //
76 | // btnCreateFromFolder
77 | //
78 | this.btnCreateFromFolder.Location = new System.Drawing.Point(93, 12);
79 | this.btnCreateFromFolder.Name = "btnCreateFromFolder";
80 | this.btnCreateFromFolder.Size = new System.Drawing.Size(134, 23);
81 | this.btnCreateFromFolder.TabIndex = 3;
82 | this.btnCreateFromFolder.Text = "Create PAK from folder...";
83 | this.btnCreateFromFolder.UseVisualStyleBackColor = true;
84 | this.btnCreateFromFolder.Click += new System.EventHandler(this.btnCreateFromFolder_Click);
85 | //
86 | // btnExtractSelected
87 | //
88 | this.btnExtractSelected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
89 | this.btnExtractSelected.Location = new System.Drawing.Point(139, 294);
90 | this.btnExtractSelected.Name = "btnExtractSelected";
91 | this.btnExtractSelected.Size = new System.Drawing.Size(102, 23);
92 | this.btnExtractSelected.TabIndex = 6;
93 | this.btnExtractSelected.Text = "Extract Selected...";
94 | this.btnExtractSelected.UseVisualStyleBackColor = true;
95 | this.btnExtractSelected.Click += new System.EventHandler(this.btnExtractSelected_Click);
96 | //
97 | // chkMaintainDir
98 | //
99 | this.chkMaintainDir.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
100 | this.chkMaintainDir.AutoSize = true;
101 | this.chkMaintainDir.Checked = true;
102 | this.chkMaintainDir.CheckState = System.Windows.Forms.CheckState.Checked;
103 | this.chkMaintainDir.Location = new System.Drawing.Point(139, 323);
104 | this.chkMaintainDir.Name = "chkMaintainDir";
105 | this.chkMaintainDir.Size = new System.Drawing.Size(153, 17);
106 | this.chkMaintainDir.TabIndex = 7;
107 | this.chkMaintainDir.Text = "Maintain directory structure";
108 | this.chkMaintainDir.UseVisualStyleBackColor = true;
109 | //
110 | // btnAbout
111 | //
112 | this.btnAbout.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
113 | this.btnAbout.AutoSize = true;
114 | this.btnAbout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
115 | this.btnAbout.Location = new System.Drawing.Point(277, 12);
116 | this.btnAbout.Name = "btnAbout";
117 | this.btnAbout.Size = new System.Drawing.Size(45, 23);
118 | this.btnAbout.TabIndex = 8;
119 | this.btnAbout.Text = "About";
120 | this.btnAbout.UseVisualStyleBackColor = true;
121 | this.btnAbout.Click += new System.EventHandler(this.btnAbout_Click);
122 | //
123 | // frmMain
124 | //
125 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
126 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
127 | this.ClientSize = new System.Drawing.Size(334, 352);
128 | this.Controls.Add(this.btnAbout);
129 | this.Controls.Add(this.btnOpen);
130 | this.Controls.Add(this.btnCreateFromFolder);
131 | this.Controls.Add(this.chkMaintainDir);
132 | this.Controls.Add(this.btnExtractSelected);
133 | this.Controls.Add(this.btnExtractAll);
134 | this.Controls.Add(this.treeView1);
135 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
136 | this.MinimumSize = new System.Drawing.Size(350, 390);
137 | this.Name = "frmMain";
138 | this.Text = "PakTool";
139 | this.ResumeLayout(false);
140 | this.PerformLayout();
141 |
142 | }
143 |
144 | #endregion
145 |
146 | private System.Windows.Forms.TreeView treeView1;
147 | private System.Windows.Forms.Button btnOpen;
148 | private System.Windows.Forms.Button btnExtractAll;
149 | private System.Windows.Forms.Button btnCreateFromFolder;
150 | private System.Windows.Forms.Button btnExtractSelected;
151 | private System.Windows.Forms.CheckBox chkMaintainDir;
152 | private System.Windows.Forms.Button btnAbout;
153 |
154 |
155 | }
156 | }
157 |
158 |
--------------------------------------------------------------------------------
/PakTool/AboutBox1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PakTool
2 | {
3 | partial class AboutBox1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | protected override void Dispose(bool disposing)
14 | {
15 | if (disposing && (components != null))
16 | {
17 | components.Dispose();
18 | }
19 | base.Dispose(disposing);
20 | }
21 |
22 | #region Windows Form Designer generated code
23 |
24 | ///
25 | /// Required method for Designer support - do not modify
26 | /// the contents of this method with the code editor.
27 | ///
28 | private void InitializeComponent()
29 | {
30 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
31 | this.labelProductName = new System.Windows.Forms.Label();
32 | this.labelVersion = new System.Windows.Forms.Label();
33 | this.labelCopyright = new System.Windows.Forms.Label();
34 | this.labelCompanyName = new System.Windows.Forms.Label();
35 | this.textBoxDescription = new System.Windows.Forms.TextBox();
36 | this.okButton = new System.Windows.Forms.Button();
37 | this.tableLayoutPanel.SuspendLayout();
38 | this.SuspendLayout();
39 | //
40 | // tableLayoutPanel
41 | //
42 | this.tableLayoutPanel.ColumnCount = 1;
43 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
44 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
45 | this.tableLayoutPanel.Controls.Add(this.labelProductName, 0, 0);
46 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 0, 1);
47 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 0, 2);
48 | this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 0, 3);
49 | this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 0, 4);
50 | this.tableLayoutPanel.Controls.Add(this.okButton, 0, 5);
51 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
52 | this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9);
53 | this.tableLayoutPanel.Name = "tableLayoutPanel";
54 | this.tableLayoutPanel.RowCount = 6;
55 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.941234F));
56 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.941234F));
57 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.941234F));
58 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.941234F));
59 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 41.13614F));
60 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 19.09892F));
61 | this.tableLayoutPanel.Size = new System.Drawing.Size(226, 203);
62 | this.tableLayoutPanel.TabIndex = 0;
63 | //
64 | // labelProductName
65 | //
66 | this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
67 | this.labelProductName.Location = new System.Drawing.Point(6, 0);
68 | this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
69 | this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17);
70 | this.labelProductName.Name = "labelProductName";
71 | this.labelProductName.Size = new System.Drawing.Size(217, 17);
72 | this.labelProductName.TabIndex = 19;
73 | this.labelProductName.Text = "Product Name";
74 | this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
75 | //
76 | // labelVersion
77 | //
78 | this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
79 | this.labelVersion.Location = new System.Drawing.Point(6, 20);
80 | this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
81 | this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
82 | this.labelVersion.Name = "labelVersion";
83 | this.labelVersion.Size = new System.Drawing.Size(217, 17);
84 | this.labelVersion.TabIndex = 0;
85 | this.labelVersion.Text = "Version";
86 | this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
87 | //
88 | // labelCopyright
89 | //
90 | this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
91 | this.labelCopyright.Location = new System.Drawing.Point(6, 40);
92 | this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
93 | this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17);
94 | this.labelCopyright.Name = "labelCopyright";
95 | this.labelCopyright.Size = new System.Drawing.Size(217, 17);
96 | this.labelCopyright.TabIndex = 21;
97 | this.labelCopyright.Text = "Copyright";
98 | this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
99 | //
100 | // labelCompanyName
101 | //
102 | this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
103 | this.labelCompanyName.Location = new System.Drawing.Point(6, 60);
104 | this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
105 | this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17);
106 | this.labelCompanyName.Name = "labelCompanyName";
107 | this.labelCompanyName.Size = new System.Drawing.Size(217, 17);
108 | this.labelCompanyName.TabIndex = 22;
109 | this.labelCompanyName.Text = "Author";
110 | this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
111 | //
112 | // textBoxDescription
113 | //
114 | this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
115 | this.textBoxDescription.Location = new System.Drawing.Point(6, 83);
116 | this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
117 | this.textBoxDescription.Multiline = true;
118 | this.textBoxDescription.Name = "textBoxDescription";
119 | this.textBoxDescription.ReadOnly = true;
120 | this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
121 | this.textBoxDescription.Size = new System.Drawing.Size(217, 77);
122 | this.textBoxDescription.TabIndex = 23;
123 | this.textBoxDescription.TabStop = false;
124 | this.textBoxDescription.Text = "Description";
125 | //
126 | // okButton
127 | //
128 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
129 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
130 | this.okButton.Location = new System.Drawing.Point(148, 177);
131 | this.okButton.Name = "okButton";
132 | this.okButton.Size = new System.Drawing.Size(75, 23);
133 | this.okButton.TabIndex = 24;
134 | this.okButton.Text = "&OK";
135 | this.okButton.Click += new System.EventHandler(this.okButton_Click);
136 | //
137 | // AboutBox1
138 | //
139 | this.AcceptButton = this.okButton;
140 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
141 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
142 | this.ClientSize = new System.Drawing.Size(244, 221);
143 | this.Controls.Add(this.tableLayoutPanel);
144 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
145 | this.MaximizeBox = false;
146 | this.MinimizeBox = false;
147 | this.Name = "AboutBox1";
148 | this.Padding = new System.Windows.Forms.Padding(9);
149 | this.ShowIcon = false;
150 | this.ShowInTaskbar = false;
151 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
152 | this.Text = "About PakTool";
153 | this.tableLayoutPanel.ResumeLayout(false);
154 | this.tableLayoutPanel.PerformLayout();
155 | this.ResumeLayout(false);
156 |
157 | }
158 |
159 | #endregion
160 |
161 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
162 | private System.Windows.Forms.Label labelProductName;
163 | private System.Windows.Forms.Label labelVersion;
164 | private System.Windows.Forms.Label labelCopyright;
165 | private System.Windows.Forms.Label labelCompanyName;
166 | private System.Windows.Forms.TextBox textBoxDescription;
167 | private System.Windows.Forms.Button okButton;
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/PakTool/frmMain.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 | using PakLib;
5 | using System.IO;
6 | using System.Diagnostics;
7 |
8 | namespace PakTool
9 | {
10 | public partial class frmMain : Form
11 | {
12 | private string[] pakfile;
13 | List selectedFiles = new List();
14 |
15 | public frmMain() : this(null) { }
16 | public frmMain(string[] args)
17 | {
18 | InitializeComponent();
19 |
20 | chkMaintainDir.Enabled = false;
21 | btnExtractSelected.Enabled = false;
22 | btnExtractAll.Enabled = false;
23 |
24 | pakfile = args;
25 | if (pakfile.Length > 0) loadPakTree();
26 |
27 | this.AllowDrop = true;
28 | this.DragEnter += new DragEventHandler(frmMain_DragEnter);
29 | this.DragDrop += new DragEventHandler(frmMain_DragDrop);
30 | this.FormClosing += new FormClosingEventHandler(frmMain_FormClosing);
31 | }
32 |
33 | void frmMain_FormClosing(object sender, FormClosingEventArgs e)
34 | {
35 | try { if (Directory.Exists("temp")) Directory.Delete("temp", true); }
36 | catch (Exception) { }
37 | }
38 |
39 | void frmMain_DragDrop(object sender, DragEventArgs e)
40 | {
41 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
42 |
43 | pakfile = files;
44 |
45 | treeView1.Nodes.Clear();
46 |
47 | int f = 0;
48 | for (int i = 0; i < pakfile.Length; i++)
49 | {
50 | if (!pakfile[i].ToLower().EndsWith(".pak"))
51 | {
52 | MessageBox.Show(pakfile[i] + "\n\nThis is not a PAK file.", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
53 | pakfile[i] = "";
54 | }
55 | else f += 1;
56 | }
57 |
58 | if (f > 0)
59 | loadPakTree();
60 | }
61 |
62 | void frmMain_DragEnter(object sender, DragEventArgs e)
63 | {
64 | if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Link;
65 | }
66 |
67 | void loadPakTree()
68 | {
69 | treeView1.BeginUpdate();
70 | Cursor.Current = Cursors.WaitCursor;
71 |
72 | for (int i = 0; i < pakfile.Length; i++)
73 | {
74 | using (Pack pak = new Pack(pakfile[i]))
75 | {
76 | if (pak.IsValid)
77 | {
78 | TreeNode root = treeView1.Nodes.Add(pak.PackName, pak.PackName);
79 | for (int j = 0; j < pak.Files.Length; j++)
80 | {
81 | PackFile file = pak.Files[j];
82 | if (pak.Files[j].PathNodes.Count != 0) populateTree(root, file.PathNodes, file);
83 | else root.Nodes.Add(file.FileName, file.FileName);
84 | }
85 |
86 | root.Expand();
87 | btnExtractAll.Enabled = true;
88 | }
89 | else
90 | {
91 | MessageBox.Show(pakfile[i] + "\n\nThis file cannot be opened or is invalid.\nTip: Make sure the file is not Read-Only.",
92 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
93 | btnExtractAll.Enabled = false;
94 | }
95 | }
96 | }
97 |
98 | Cursor.Current = Cursors.Default;
99 |
100 | if (treeView1.Nodes.Count == 0)
101 | {
102 | btnExtractSelected.Enabled = false;
103 | btnExtractAll.Enabled = false;
104 | chkMaintainDir.Enabled = false;
105 | }
106 |
107 | treeView1.EndUpdate();
108 | }
109 |
110 | void populateTree(TreeNode parent, List nodes, PackFile file)
111 | {
112 | if (nodes.Count == 0) // Done?
113 | {
114 | parent.Nodes.Add(file.FileName, file.FileName); // Add filename to tree
115 | return;
116 | }
117 | else // Not done yet...
118 | {
119 | TreeNode tnAdd;
120 | if (parent.Nodes[nodes[0]] == null) tnAdd = parent.Nodes.Add(nodes[0], nodes[0]);
121 | else tnAdd = parent.Nodes[nodes[0]];
122 |
123 | List nn = nodes;
124 | nn.Remove(nodes[0]); // Remove what we just added
125 | populateTree(tnAdd, nn, file); // Recurse
126 | }
127 | }
128 |
129 | private void btnOpen_Click(object sender, EventArgs e)
130 | {
131 | OpenFileDialog openFile = new OpenFileDialog();
132 | openFile.Filter = "PAK files (*.pak)|*.pak";
133 | openFile.Multiselect = true;
134 | DialogResult result = openFile.ShowDialog();
135 | if (result == DialogResult.OK)
136 | {
137 | treeView1.Nodes.Clear();
138 | pakfile = openFile.FileNames;
139 | loadPakTree();
140 | }
141 | }
142 |
143 | private void btnExtractAll_Click(object sender, EventArgs e)
144 | {
145 | FolderBrowserDialog dialog = new FolderBrowserDialog();
146 | DialogResult result = dialog.ShowDialog();
147 | if (result == DialogResult.OK)
148 | {
149 | frmExtracting.Create();
150 |
151 | for (int i = 0; i < pakfile.Length; i++)
152 | {
153 | using (Pack pak = new Pack(pakfile[i]))
154 | {
155 | pak.ExtractAll(dialog.SelectedPath);
156 | }
157 | }
158 |
159 | frmExtracting.Destroy();
160 | }
161 | }
162 |
163 | private void btnCreateFromFolder_Click(object sender, EventArgs e)
164 | {
165 | FolderBrowserDialog dFolder = new FolderBrowserDialog();
166 | DialogResult dFolderResult = dFolder.ShowDialog();
167 |
168 | if (dFolderResult == DialogResult.OK)
169 | {
170 | SaveFileDialog dFile = new SaveFileDialog();
171 | dFile.Filter = "PAK files (*.pak)|*.pak";
172 | DialogResult dFileResult = dFile.ShowDialog();
173 | if (dFileResult == DialogResult.OK)
174 | {
175 | frmCreating.Create();
176 | var frmTemp = new frmCreating();
177 |
178 | using (Pack pak = new Pack(dFile.FileName)) pak.InsertFolder(dFolder.SelectedPath);
179 |
180 | frmCreating.Destroy();
181 |
182 | pakfile = new string[1] { dFile.FileName };
183 | treeView1.Nodes.Clear();
184 | loadPakTree();
185 | }
186 | }
187 | }
188 |
189 | private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
190 | {
191 | if (e.Node.Checked == true)
192 | {
193 | if (e.Node.Nodes.Count > 0)
194 | {
195 | for (int i = 0; i < e.Node.Nodes.Count; i++) e.Node.Nodes[i].Checked = true;
196 | e.Node.ExpandAll();
197 | }
198 | }
199 | else if (e.Node.Checked == false)
200 | {
201 | if (e.Node.Nodes.Count > 0)
202 | {
203 | for (int i = 0; i < e.Node.Nodes.Count; i++) e.Node.Nodes[i].Checked = false;
204 | }
205 | }
206 |
207 | selectedFiles.Clear();
208 | loadChecked(treeView1.Nodes, selectedFiles);
209 | if (selectedFiles.Count > 0)
210 | {
211 | btnExtractSelected.Enabled = true;
212 | chkMaintainDir.Enabled = true;
213 | }
214 | else
215 | {
216 | btnExtractSelected.Enabled = false;
217 | chkMaintainDir.Enabled = false;
218 | }
219 | }
220 |
221 | private void loadChecked(TreeNodeCollection nodeList, List list)
222 | {
223 | for (int i = 0; i < nodeList.Count; i++)
224 | {
225 | if (nodeList[i].Checked && nodeList[i].Nodes.Count == 0) list.Add(nodeList[i].FullPath);
226 | if (nodeList[i].Nodes.Count > 0) loadChecked(nodeList[i].Nodes, list);
227 | }
228 | }
229 |
230 | private string[] getPakfileInfo(string fullpath)
231 | {
232 | string[] info = new string[2];
233 |
234 | for (int i = 0; i < pakfile.Length; i++)
235 | {
236 | if (fullpath.Contains(pakfile[i]))
237 | {
238 | info[0] = pakfile[i];
239 | info[1] = fullpath.Replace(info[0] + "/", "");
240 | break;
241 | }
242 | }
243 |
244 | return info;
245 | }
246 |
247 | private void btnExtractSelected_Click(object sender, EventArgs e)
248 | {
249 | loadChecked(treeView1.Nodes, selectedFiles);
250 |
251 | FolderBrowserDialog dialog = new FolderBrowserDialog();
252 | DialogResult result = dialog.ShowDialog();
253 | if (result == DialogResult.OK)
254 | {
255 | frmExtracting.Create();
256 |
257 | List> fileList = new List>(); // List of Lists
258 |
259 | for (int i = 0; i < selectedFiles.Count; i++)
260 | {
261 | string[] fileInfo = getPakfileInfo(selectedFiles[i]);
262 | bool added = false;
263 |
264 | for (int j = 0; j < fileList.Count; j++)
265 | {
266 | if (fileList[j][0] == fileInfo[0])
267 | {
268 | fileList[j].Add(fileInfo[1]);
269 | added = true;
270 | }
271 | }
272 |
273 | if (!added)
274 | {
275 | fileList.Add(new List());
276 | fileList[fileList.Count - 1].Add(fileInfo[0]);
277 | fileList[fileList.Count - 1].Add(fileInfo[1]);
278 | }
279 | }
280 |
281 | for (int i = 0; i < fileList.Count; i++)
282 | {
283 | using (Pack pak = new Pack(fileList[i][0]))
284 | {
285 | for (int j = 1; j < fileList[i].Count; j++)
286 | {
287 | if (chkMaintainDir.Checked)
288 | pak.ExtractFile(fileList[i][j], dialog.SelectedPath, true);
289 | else
290 | pak.ExtractFile(fileList[i][j], dialog.SelectedPath, false);
291 | }
292 | }
293 | }
294 |
295 | frmExtracting.Destroy();
296 | }
297 | }
298 |
299 | private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
300 | {
301 |
302 | if (e.Node.Nodes.Count == 0)
303 | {
304 | treeView1.Enabled = false;
305 |
306 | string tempFile = "temp\\" + e.Node.Text;
307 |
308 | if (!Directory.Exists("temp"))
309 | {
310 | Directory.CreateDirectory("temp");
311 | DirectoryInfo tempDir = new DirectoryInfo("temp");
312 | tempDir.Attributes |= FileAttributes.Hidden;
313 | }
314 |
315 | string[] tempFileInfo = getPakfileInfo(e.Node.FullPath);
316 |
317 | using (Pack pak = new Pack(tempFileInfo[0]))
318 | {
319 | byte[] buffer;
320 | buffer = pak.GetFileBytes(tempFileInfo[1]);
321 |
322 | try
323 | {
324 | File.WriteAllBytes(tempFile, buffer);
325 | Process.Start(tempFile);
326 | }
327 | catch (IOException)
328 | {
329 | MessageBox.Show(e.Node.Text + "\n\nThis file is open or in use. If you opened this file once before, make sure it's not currently open.",
330 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
331 | }
332 | }
333 |
334 | treeView1.Enabled = true;
335 | }
336 | else return;
337 | }
338 |
339 | private void btnAbout_Click(object sender, EventArgs e)
340 | {
341 | AboutBox1.Create();
342 | }
343 |
344 |
345 | }
346 | }
347 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/PakTool/Pack.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 | using System.Collections.Generic;
5 |
6 | namespace PakLib
7 | {
8 | ///
9 | /// Secondary struct for the header of a PAK archive.
10 | ///
11 | struct PackHeader
12 | {
13 | #region Member Variables
14 |
15 | public byte[] Head;
16 | public byte[] IndexOffset;
17 | public byte[] IndexLength;
18 |
19 | #endregion
20 |
21 | #region Constructor
22 |
23 | ///
24 | /// Pack header constructor. Creates object
25 | /// for pack header information.
26 | ///
27 | public PackHeader(string dummy)
28 | {
29 | Head = new byte[4];
30 | IndexOffset = new byte[4];
31 | IndexLength = new byte[4];
32 | }
33 |
34 | #endregion
35 | }
36 |
37 | ///
38 | /// Secondary class for information about individual files
39 | /// in a PAK archive.
40 | ///
41 | public class PackFile
42 | {
43 | #region Member Variables
44 |
45 | public byte[] FileField;
46 | public string FileName;
47 | public string FilePath;
48 | public Int32 FilePosition;
49 | public Int32 FileLength;
50 | public List PathNodes;
51 |
52 | #endregion
53 |
54 | #region Constructor
55 |
56 | ///
57 | /// Pack file constructor. Creates objects
58 | /// that hold file index information.
59 | ///
60 | public PackFile()
61 | {
62 | /* Initialization */
63 | FileField = new byte[56];
64 | PathNodes = new List();
65 | }
66 |
67 | #endregion
68 | }
69 |
70 | ///
71 | /// Primary class for handling PAK archives.
72 | ///
73 | public class Pack : IDisposable
74 | {
75 | #region Member Variables
76 |
77 | private FileStream packStream;
78 | private PackHeader header;
79 | public PackFile[] Files;
80 | public string PackName;
81 | public bool IsValid;
82 | public int NumFiles;
83 |
84 | #endregion
85 |
86 | #region Constructor
87 |
88 | ///
89 | /// Creates Pack object.
90 | ///
91 | /// Filename of PAK
92 | public Pack(string pakName)
93 | {
94 | /* Initialization */
95 | PackName = pakName;
96 | header = new PackHeader(null);
97 | try { packStream = new FileStream(PackName, FileMode.OpenOrCreate); }
98 | catch (UnauthorizedAccessException) { IsValid = false; return; }
99 |
100 | /* Initialize */
101 | init();
102 | }
103 |
104 | #endregion
105 |
106 | #region Private methods
107 |
108 | ///
109 | /// Initialization of Pack object.
110 | /// Checks specified file.
111 | ///
112 | private void init()
113 | {
114 | /* Initialization */
115 | byte[] raw = new byte[12];
116 |
117 | /* Check for empty file */
118 | if (packStream.Length == 0) createPack();
119 |
120 | /* Read in first 12 bytes and assign */
121 | packStream.Seek(0, SeekOrigin.Begin);
122 | packStream.Read(raw, 0, 12);
123 | for (int i = 0; i < 4; i++) { header.Head[i] = raw[i]; }
124 | for (int i = 4; i < 8; i++) { header.IndexOffset[i - 4] = raw[i]; }
125 | for (int i = 8; i < 12; i++) { header.IndexLength[i - 8] = raw[i]; }
126 |
127 | /* Continuity check */
128 | if (header.Head[0] != 80 || header.Head[1] != 65 || header.Head[2] != 67 || header.Head[3] != 75)
129 | { IsValid = false; return; } // Header wrong, not a PAK file. Must be 'P' 'A' 'C' 'K'.
130 | if (BitConverter.ToInt32(header.IndexLength, 0) % 64 != 0) { IsValid = false; return; } // Corrupt index.
131 |
132 | /* Finish up */
133 | IsValid = true;
134 | NumFiles = BitConverter.ToInt32(header.IndexLength, 0) / 64;
135 | readPack();
136 |
137 | /* Reset packStream */
138 | packStream.Flush();
139 | }
140 |
141 | ///
142 | /// Creates an empty PAK file.
143 | ///
144 | private void createPack()
145 | {
146 | /* Prepare header */
147 | header.Head[0] = 80; // 'P' 80
148 | header.Head[1] = 65; // 'A' 65
149 | header.Head[2] = 67; // 'C' 67
150 | header.Head[3] = 75; // 'K' 75
151 | header.IndexOffset = BitConverter.GetBytes(12);
152 | header.IndexLength = BitConverter.GetBytes(0);
153 |
154 | /* Write header */
155 | packStream.Seek(0, SeekOrigin.Begin);
156 | packStream.Write(header.Head, 0, 4);
157 | packStream.Write(header.IndexOffset, 0, 4);
158 | packStream.Write(header.IndexLength, 0, 4);
159 |
160 | /* Reset packStream */
161 | packStream.Flush();
162 | }
163 |
164 | ///
165 | /// Reads PAK file, creates file
166 | /// objects and populates fields.
167 | ///
168 | private void readPack()
169 | {
170 | /* Initialization */
171 | int seekPosition = BitConverter.ToInt32(header.IndexOffset, 0); // start position for file indices, will be incremented later
172 | byte[] indexData = new byte[64]; // file index data (56 filename, 4 length, 4 offset)
173 | double totalSize = 0;
174 |
175 | /* Creating file objects */
176 | Files = new PackFile[NumFiles];
177 | for (int i = 0; i < NumFiles; i++) { Files[i] = new PackFile(); }
178 |
179 | /* Populating file objects */
180 | for (int i = 0; i < NumFiles; i++)
181 | {
182 | /* Read index data from next position */
183 | packStream.Seek(seekPosition, SeekOrigin.Begin); // Go to beginning of next index
184 | packStream.Read(indexData, 0, 64); // Get the entire file entry
185 |
186 | /* Assigning index data */
187 | for (int j = 0; j < 56; j++) { Files[i].FileField[j] = indexData[j]; }
188 | Files[i].FilePosition = BitConverter.ToInt32(indexData, 56);
189 | Files[i].FileLength = BitConverter.ToInt32(indexData, 60);
190 | totalSize += Files[i].FileLength;
191 |
192 | /* Decoding the FileField to FileName */
193 | StringBuilder sbFileName = new StringBuilder(56);
194 | StringBuilder sbFilePath = new StringBuilder(56);
195 | for (int k = 0; k < 56; k++)
196 | {
197 | try
198 | {
199 | if ((char)Files[i].FileField[k] == '\0') { break; } // We don't support spaces in names, must be end of filename.
200 | else if ((char)Files[i].FileField[k] == '/') // Found a directory
201 | {
202 | Files[i].PathNodes.Add(sbFileName.ToString());
203 | sbFilePath.Append(sbFileName + "/"); // Add new directory to filepath
204 | sbFileName.Clear(); // Clear filename, contents were a directory
205 | }
206 | else sbFileName.Append((char)Files[i].FileField[k]); // Add char-casted-byte to filename string
207 | }
208 | catch (IndexOutOfRangeException) { break; } // Went too far, assume done.
209 | }
210 | Files[i].FileName = sbFileName.ToString();
211 | Files[i].FilePath = sbFilePath.ToString();
212 |
213 | seekPosition += 64; // Increment to next file index
214 | }
215 |
216 | /* Reset packStream */
217 | packStream.Flush();
218 | }
219 |
220 | ///
221 | /// Returns the filename from a path
222 | ///
223 | /// File path to process
224 | /// string containing filename
225 | private string getFileName(string newfilename)
226 | {
227 | StringBuilder sbNewFileName = new StringBuilder();
228 |
229 | for (int i = 0; i < 56; i++)
230 | {
231 | try
232 | {
233 | if (newfilename[i] == '/') sbNewFileName.Clear(); // Found directory, clear filename
234 | else sbNewFileName.Append(newfilename[i]); // Add char to filename string
235 | }
236 | catch (IndexOutOfRangeException) { break; }
237 | }
238 |
239 | return sbNewFileName.ToString();
240 | }
241 |
242 | ///
243 | /// Once a PackFile's FileName property is filled with a full path,
244 | /// populates properties FileName, FilePath, FileField.
245 | ///
246 | /// a PackFile instance
247 | private void translateFileName(PackFile pfile)
248 | {
249 | /* Decoding the FileField to FileName */
250 | StringBuilder sbFileName = new StringBuilder(56);
251 | StringBuilder sbFilePath = new StringBuilder(56);
252 | for (int i = 0; i < 56; i++)
253 | {
254 | try
255 | {
256 | if ((char)pfile.FileName[i] == '\0') { break; } // We don't support spaces in names, must be end of filename.
257 | else if ((char)pfile.FileName[i] == '/') // Found a directory
258 | {
259 | pfile.PathNodes.Add(sbFileName.ToString());
260 | sbFilePath.Append(sbFileName + "/"); // Add new directory to filepath
261 | sbFileName.Clear(); // Clear filename, contents were a directory
262 | }
263 | else sbFileName.Append((char)pfile.FileName[i]); // Add char-casted-byte to filename string
264 | }
265 | catch (IndexOutOfRangeException) { break; } // Went too far, assume done.
266 | }
267 | pfile.FileName = sbFileName.ToString();
268 | pfile.FilePath = sbFilePath.ToString();
269 |
270 | string fullpath = pfile.FilePath + pfile.FileName;
271 | for (int i = 0; i < fullpath.Length; i++) pfile.FileField[i] = (byte)fullpath[i];
272 | }
273 |
274 | ///
275 | /// Extends a given array by a given number.
276 | ///
277 | /// Array to extend
278 | /// Number to extend by
279 | /// Extended array
280 | private PackFile[] extendPackArray(PackFile[] array, int extend)
281 | {
282 | int newarraysize = array.Length + extend;
283 | PackFile[] newarray = new PackFile[newarraysize];
284 |
285 | for (int i = 0; i < newarraysize; i++)
286 | {
287 | if (newarraysize == 1)
288 | {
289 | newarray[i] = new PackFile();
290 | break; // Will cause error otherwise, empty base array
291 | }
292 | else if (i > array.Length - 1) newarray[i] = new PackFile();
293 | else
294 | {
295 | newarray[i] = new PackFile();
296 | newarray[i].FileField = array[i].FileField;
297 | newarray[i].FileName = array[i].FileName;
298 | newarray[i].FilePath = array[i].FilePath;
299 | newarray[i].FilePosition = array[i].FilePosition;
300 | newarray[i].FileLength = array[i].FileLength;
301 | }
302 | }
303 |
304 | return newarray;
305 | }
306 |
307 | ///
308 | /// Walk a directory tree and create a List(PackFile)
309 | ///
310 | /// directory to walk
311 | /// Uri of current directory
312 | private void walkDirectoryTree(DirectoryInfo target, Uri currentDir, List newFiles)
313 | {
314 | FileInfo[] _files = null;
315 | DirectoryInfo[] subDirs = null;
316 | Uri tempUri;
317 |
318 | // First, process all the files directly under this folder
319 | try { _files = target.GetFiles("*.*"); }
320 | catch (UnauthorizedAccessException) { }
321 | catch (DirectoryNotFoundException) { }
322 |
323 | if (_files != null)
324 | {
325 | for (int i = 0; i < _files.Length; i++)
326 | {
327 | newFiles.Add(new PackFile());
328 | int indexNum = newFiles.Count - 1;
329 | tempUri = new Uri(_files[i].FullName);
330 | newFiles[indexNum].FileName = currentDir.MakeRelativeUri(tempUri).ToString();
331 | translateFileName(newFiles[indexNum]);
332 | }
333 |
334 | // Now find all the subdirectories under this directory.
335 | subDirs = target.GetDirectories();
336 | foreach (DirectoryInfo dirInfo in subDirs) { walkDirectoryTree(dirInfo, currentDir, newFiles); }
337 | }
338 | }
339 |
340 | #endregion
341 |
342 | #region Public methods
343 |
344 | ///
345 | /// Extracts all files from the PAK
346 | /// archive.
347 | ///
348 | /// Folder to extract to
349 | /// 1 if good, -1 if not a PAK file, -2 if corrupt index
350 | public int ExtractAll(string destination)
351 | {
352 | /* Preliminary continuity check */
353 | if (IsValid != true) return -1;
354 | else if (NumFiles == 0) return -2;
355 |
356 | /* Create directories and files */
357 | byte[] buffer;
358 | for (int i = 0; i < NumFiles; i++)
359 | {
360 | if (!Directory.Exists(destination + "/" + Files[i].FilePath))
361 | Directory.CreateDirectory(destination + "/" + Files[i].FilePath);
362 |
363 | packStream.Seek(Files[i].FilePosition, SeekOrigin.Begin);
364 | buffer = new byte[Files[i].FileLength];
365 | packStream.Read(buffer, 0, Files[i].FileLength);
366 | File.WriteAllBytes(destination + "/" + Files[i].FilePath + Files[i].FileName, buffer);
367 | }
368 |
369 | /* Reset packStream */
370 | packStream.Flush();
371 |
372 | return 1;
373 | }
374 |
375 | ///
376 | /// Extracts specific file from PAK archive, extracts first match.
377 | ///
378 | /// File to extract
379 | /// Folder to extract to
380 | /// 1 if good, -1 if not a PAK file, -2 if corrupt index, -3 if file not found
381 | public int ExtractFile(string filename, string destination)
382 | {
383 | int output;
384 | output = ExtractFile(filename, destination, true);
385 | return output;
386 | }
387 |
388 | ///
389 | /// Extracts specific file from PAK archive, extracts first match.
390 | ///
391 | /// File to extract
392 | /// Folder to extract to
393 | /// Maintain directory structure in destination
394 | /// 1 if good, -1 if not a PAK file, -2 if corrupt index, -3 if file not found
395 | public int ExtractFile(string filename, string destination, bool keepDirStructure)
396 | {
397 | /* Preliminary continuity check */
398 | if (!IsValid) return -1;
399 | else if (NumFiles == 0) return -2;
400 |
401 | /* Check for null or empty destination string */
402 | if (string.IsNullOrEmpty(destination)) destination = Directory.GetCurrentDirectory().ToString();
403 |
404 | /* Create directories and files */
405 | bool success = false;
406 | byte[] buffer;
407 |
408 | for (int i = 0; i < NumFiles; i++)
409 | {
410 | if (Files[i].FileName == filename || Files[i].FilePath + Files[i].FileName == filename)
411 | {
412 | packStream.Seek(Files[i].FilePosition, SeekOrigin.Begin);
413 | buffer = new byte[Files[i].FileLength];
414 | packStream.Read(buffer, 0, Files[i].FileLength);
415 |
416 | if (keepDirStructure)
417 | {
418 | if (!Directory.Exists(destination + "/" + Files[i].FilePath))
419 | Directory.CreateDirectory(destination + "/" + Files[i].FilePath);
420 | File.WriteAllBytes(destination + "/" + Files[i].FilePath + Files[i].FileName, buffer);
421 | }
422 | else
423 | {
424 | if (!Directory.Exists(destination)) Directory.CreateDirectory(destination);
425 | File.WriteAllBytes(destination + "/" + Files[i].FileName, buffer);
426 | }
427 |
428 | success = true;
429 | break;
430 | }
431 | else continue;
432 | }
433 |
434 | /* Reset packStream */
435 | packStream.Flush();
436 |
437 | if (!success) return -3;
438 | return 1;
439 | }
440 |
441 | ///
442 | /// Inserts specified file into PAK file.
443 | ///
444 | /// File to insert
445 | /// 1 if good, -1 if not a PAK file, -2 if fullpath (destination + filename) is too long,
446 | /// -3 if file not found, -4 file already exists
447 | public int InsertFile(string filename)
448 | {
449 | int output;
450 | output = InsertFile(filename, null);
451 | return output;
452 | }
453 |
454 | ///
455 | /// Inserts specified file into PAK file.
456 | ///
457 | /// File to insert
458 | /// Folder to insert into
459 | /// 1 if good, -1 if not a PAK file, -2 if fullpath (destination + filename) is too long,
460 | /// -3 if file not found, -4 if file already exists, -5 if file cannot be opened
461 | public int InsertFile(string filename, string destination)
462 | {
463 | /* Preliminary continuity check */
464 | if (!IsValid) return -1;
465 |
466 | /* Local var/object creation */
467 | string actualfilename = getFileName(filename);
468 | if (!string.IsNullOrEmpty(destination) && destination[destination.Length - 1] != '/') destination += "/";
469 | string fullpath = destination + actualfilename;
470 |
471 | if (fullpath.Length > 56) return -2; // Too big! Q1/Q2 Limitation
472 |
473 | /* Make sure file doesn't already exist */
474 | for (int i = 0; i < NumFiles; i++)
475 | if (Files[i].FilePath + Files[i].FileName == fullpath) return -4; // Already exists!
476 |
477 | /* Open file to be added */
478 | FileStream newFile;
479 | try { newFile = new FileStream(filename, FileMode.Open); }
480 | catch (FileNotFoundException) { return -3; }
481 | catch (IOException) { return -5; }
482 |
483 | /* Populating file object information */
484 | Files = extendPackArray(Files, 1);
485 | int indexNum = Files.Length - 1;
486 | for (int i = 0; i < fullpath.Length; i++) Files[indexNum].FileField[i] = (byte)fullpath[i]; // Write in name
487 | Files[indexNum].FileName = actualfilename;
488 | Files[indexNum].FilePath = destination;
489 | Files[indexNum].FileLength = (Int32)newFile.Length;
490 | Files[indexNum].FilePosition = BitConverter.ToInt32(header.IndexOffset, 0);
491 |
492 | header.IndexOffset = BitConverter.GetBytes(BitConverter.ToInt32(header.IndexOffset, 0) + (Int32)newFile.Length);
493 | header.IndexLength = BitConverter.GetBytes(BitConverter.ToInt32(header.IndexLength, 0) + 64);
494 |
495 | /* Read file into buffer */
496 | byte[] buffer = new byte[Files[indexNum].FileLength];
497 | newFile.Read(buffer, 0, Files[indexNum].FileLength);
498 | newFile.Dispose();
499 |
500 | /* Write buffer to PAK file */
501 | packStream.Seek(Files[indexNum].FilePosition, SeekOrigin.Begin);
502 | packStream.Write(buffer, 0, Files[indexNum].FileLength);
503 |
504 | /* Update header information */
505 | packStream.Seek(4, SeekOrigin.Begin);
506 | packStream.Write(header.IndexOffset, 0, 4);
507 | packStream.Write(header.IndexLength, 0, 4);
508 |
509 | /* Rewrite Index */
510 | int indexOffset = BitConverter.ToInt32(header.IndexOffset, 0);
511 | for (int i = 0; i < Files.Length; i++)
512 | {
513 | packStream.Seek(indexOffset, SeekOrigin.Begin);
514 | packStream.Write(Files[i].FileField, 0, 56);
515 | packStream.Write(BitConverter.GetBytes(Files[i].FilePosition), 0, 4);
516 | packStream.Write(BitConverter.GetBytes(Files[i].FileLength), 0, 4);
517 | indexOffset += 64;
518 | }
519 |
520 | NumFiles += 1;
521 |
522 | /* Reset packStream */
523 | packStream.Flush();
524 |
525 | return 1;
526 | }
527 |
528 | ///
529 | /// Search through a folder and add all files, retaining folder structure.
530 | ///
531 | /// Directory to search for files
532 | /// 1 if good, -1 if not a PAK file, -2 if sourceDir null
533 | public int InsertFolder(string sourceDir)
534 | {
535 | /* Preliminary continuity check */
536 | if (!IsValid) return -1;
537 | if (string.IsNullOrEmpty(sourceDir)) return -2;
538 |
539 | /* Save current directory and set to source */
540 | string curDir = Directory.GetCurrentDirectory();
541 | Environment.CurrentDirectory = sourceDir;
542 |
543 | /* Local var/object creation */
544 | DirectoryInfo di = new DirectoryInfo("./");
545 | Uri currentDir = new Uri(di.FullName);
546 | List newFiles = new List();
547 |
548 | /* Walk the specified directory tree */
549 | walkDirectoryTree(di, currentDir, newFiles);
550 |
551 | /* Insert all the new files */
552 | for (int i = 0; i < newFiles.Count; i++)
553 | InsertFile(newFiles[i].FilePath + newFiles[i].FileName, newFiles[i].FilePath);
554 |
555 | /* Change back to original directory */
556 | Environment.CurrentDirectory = curDir;
557 |
558 | return 1;
559 | }
560 |
561 | ///
562 | /// Buffers a specified file from a PAK.
563 | ///
564 | /// File to buffer
565 | /// byte[] if successful, null if not
566 | public byte[] GetFileBytes(string filename)
567 | {
568 | /* Preliminary continuity check */
569 | if (!IsValid) return null; // Not a valid PAK
570 | else if (NumFiles == 0) return null; // No files to work with
571 | else if (string.IsNullOrEmpty(filename)) return null; // No file specified
572 |
573 | /* Initialization */
574 | byte[] filebytes = new byte[1];
575 |
576 | /* Find file, get bytes */
577 | bool success = false;
578 |
579 | for (int i = 0; i < NumFiles; i++)
580 | {
581 | if (Files[i].FileName == filename || Files[i].FilePath + Files[i].FileName == filename)
582 | {
583 | filebytes = new byte[Files[i].FileLength];
584 | packStream.Seek(Files[i].FilePosition, SeekOrigin.Begin);
585 | packStream.Read(filebytes, 0, Files[i].FileLength);
586 | success = true;
587 | break;
588 | }
589 | else continue;
590 | }
591 |
592 | /* Reset packStream*/
593 | packStream.Flush();
594 |
595 | if (!success) return null;
596 |
597 | return filebytes;
598 | }
599 |
600 | #endregion
601 |
602 | #region IDisposable members
603 |
604 | /* For disposal */
605 | private bool disposed = false;
606 |
607 | ///
608 | /// Dispose of resources
609 | ///
610 | public void Dispose()
611 | {
612 | Dispose(true);
613 | GC.SuppressFinalize(this);
614 | }
615 |
616 | ///
617 | /// Dispose of resources
618 | ///
619 | /// true if manually disposing, false by finalizer
620 | private void Dispose(bool disposing)
621 | {
622 | if (!this.disposed) // if not already disposed
623 | if (disposing)
624 | {
625 | try { packStream.Dispose(); }
626 | catch (Exception) { }
627 | }
628 |
629 | disposed = true;
630 | }
631 |
632 | ///
633 | /// Finalizer
634 | ///
635 | ~Pack() { Dispose(false); }
636 |
637 | #endregion
638 | }
639 | }
--------------------------------------------------------------------------------