Imported final version of OpenPackager
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
echo Clearing cache...
|
||||
cd OpenPackager
|
||||
rmdir /S /Q obj
|
||||
rmdir /S /Q bin\Debug
|
||||
echo Existing cache has been cleared!
|
||||
pause
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenPackager", "OpenPackager\OpenPackager.csproj", "{656D7B60-8CBF-4139-A28B-443FEBA70D4E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{656D7B60-8CBF-4139-A28B-443FEBA70D4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{656D7B60-8CBF-4139-A28B-443FEBA70D4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{656D7B60-8CBF-4139-A28B-443FEBA70D4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{656D7B60-8CBF-4139-A28B-443FEBA70D4E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="OpenPackager.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Startup.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace OpenPackager
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenPackager
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides common IO functionality via Windows Forms.
|
||||
/// </summary>
|
||||
public class CommonIO
|
||||
{
|
||||
/// <summary>
|
||||
/// Browse to existing folder on the system.
|
||||
/// </summary>
|
||||
/// <param name="originalPath"></param>
|
||||
/// <returns></returns>
|
||||
public string BrowseFolder(string originalPath)
|
||||
{
|
||||
// The result of the Windows Forms dialog is passed as a
|
||||
// string to the method caller.
|
||||
var folder = new System.Windows.Forms.FolderBrowserDialog();
|
||||
System.Windows.Forms.DialogResult result = folder.ShowDialog();
|
||||
|
||||
// Only change the value if a valid path is entered.
|
||||
string newPath;
|
||||
if (folder.SelectedPath != "")
|
||||
{
|
||||
newPath = folder.SelectedPath.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
newPath = originalPath;
|
||||
}
|
||||
|
||||
return newPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Browse to an existing file on the system.
|
||||
/// </summary>
|
||||
/// <param name="fileType"></param>
|
||||
/// <returns></returns>
|
||||
public string BrowseFile(string fileType)
|
||||
{
|
||||
var file = new System.Windows.Forms.OpenFileDialog();
|
||||
file.Filter = null;
|
||||
|
||||
switch (fileType)
|
||||
{
|
||||
case "image":
|
||||
file.Filter = "PNG Image|*.png|JPG Image|*.jpg";
|
||||
break;
|
||||
case "bat":
|
||||
file.Filter = "Batch File|*.bat";
|
||||
break;
|
||||
case "txt":
|
||||
file.Filter = "Text File|*.txt";
|
||||
break;
|
||||
case "ico":
|
||||
file.Filter = "Icon File|*.ico";
|
||||
break;
|
||||
}
|
||||
|
||||
System.Windows.Forms.DialogResult result = file.ShowDialog();
|
||||
|
||||
return file.FileName.ToString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
using OpenPackager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace LMZAParser
|
||||
{
|
||||
public class Parser
|
||||
{
|
||||
public Process proc = new Process();
|
||||
bool abortProcess = false;
|
||||
|
||||
public int MakePackage(string fileName, string sourceDir, string destDir, int compressLvl, string password, bool sfx)
|
||||
{
|
||||
string argMethod = " a ";
|
||||
Func<string, string> argSourceDir = SourceDir;
|
||||
Func<string, string, string> argDestDir = DestDir;
|
||||
Func<int, string> argCompressLvl = CompressLvl;
|
||||
Func<string, string> argPassword = Password;
|
||||
Func<bool, string> argSfx = Sfx;
|
||||
|
||||
return RunProcess(argMethod +
|
||||
argSfx(sfx) +
|
||||
argDestDir(destDir, fileName) +
|
||||
argPassword(password) +
|
||||
argSourceDir(sourceDir) +
|
||||
argCompressLvl(compressLvl));
|
||||
}
|
||||
#region MakePackage
|
||||
|
||||
private string Sfx(bool arg)
|
||||
{
|
||||
// Appends SFX parameter to archive.
|
||||
string result = null;
|
||||
if (arg)
|
||||
{
|
||||
result = "-sfx";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private string CompressLvl(int arg)
|
||||
{
|
||||
return String.Format("-mx={0}", arg.ToString());
|
||||
}
|
||||
|
||||
private string DestDir(string path, string file)
|
||||
{
|
||||
// Combines the path and filename into one.
|
||||
return String.Format("\"{0}\\{1}\" ", path, file);
|
||||
}
|
||||
|
||||
private string SourceDir(string arg)
|
||||
{
|
||||
return String.Format("\"{0}\\*\" ", arg);
|
||||
}
|
||||
|
||||
private string Password(string pass)
|
||||
{
|
||||
string result = null;
|
||||
if (pass != "") { result += String.Format("-p{0} -mhe ", pass); }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public int ExtractPackage(string fileName, string inDir, string outDir, string password)
|
||||
{
|
||||
int exitCode = 0;
|
||||
|
||||
// Test archive before attempting to extract it
|
||||
exitCode += TestArchive(fileName, inDir, password);
|
||||
if (exitCode == 0)
|
||||
{
|
||||
string argMethod = " x ";
|
||||
//Func<string, string> argSourceDir = SourceDir;
|
||||
//Func<string, string, string> argDestDir = DestDir;
|
||||
Func<string, string, string> argInDir = InDir;
|
||||
Func<string, string> argOutDir = OutDir;
|
||||
Func<string, string> argOutPassword = OutPassword;
|
||||
|
||||
RunProcess(argMethod +
|
||||
argInDir(inDir, fileName) +
|
||||
argOutPassword(password) +
|
||||
argOutDir(outDir));
|
||||
}
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
#region ExtractPackage
|
||||
|
||||
private string OutDir(string path)
|
||||
{
|
||||
return String.Format("-o\"{0}\" ", path);
|
||||
}
|
||||
|
||||
private string InDir(string path, string file)
|
||||
{
|
||||
return String.Format("\"{0}\\{1}\" -aoa ", path, file);
|
||||
}
|
||||
|
||||
private string OutPassword(string pass)
|
||||
{
|
||||
return String.Format("-p{0} ", pass);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private int TestArchive(string fileName, string inDir, string password)
|
||||
{
|
||||
string argMethod = " t ";
|
||||
Func<string, string, string> argInDir = InDir;
|
||||
Func<string, string> argOutPassword = OutPassword;
|
||||
|
||||
return RunProcess(argMethod +
|
||||
argInDir(inDir, fileName) +
|
||||
argOutPassword(password));
|
||||
}
|
||||
|
||||
private int RunProcess(string args)
|
||||
{
|
||||
int exitCode = 0;
|
||||
|
||||
try
|
||||
{
|
||||
proc.StartInfo.FileName = SysEnvironment.szExe;
|
||||
proc.StartInfo.WorkingDirectory = SysEnvironment.szWorkDir;
|
||||
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
///
|
||||
proc.StartInfo.Arguments = args;
|
||||
|
||||
proc.Start();
|
||||
while (!proc.HasExited)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
Console.WriteLine("Process is alive...");
|
||||
if (abortProcess) { proc.Kill(); }
|
||||
}
|
||||
|
||||
exitCode = proc.ExitCode;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
exitCode = 1;
|
||||
proc.Dispose();
|
||||
}
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
public void Abort() { abortProcess = true; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace OpenPackager.LogWriter
|
||||
{
|
||||
public class Writer
|
||||
{
|
||||
public enum logEntries
|
||||
{
|
||||
StartPkgCreation,
|
||||
GenPkgStructure,
|
||||
ImportResources,
|
||||
PackageCancelled,
|
||||
XmlGeneration,
|
||||
CreateOPF,
|
||||
CreatedOPF,
|
||||
SevenZPkgError,
|
||||
FinalOperations,
|
||||
FinishedNoErrors,
|
||||
FinishedWithErrors,
|
||||
FinishReadXml,
|
||||
ErrorReadXml,
|
||||
InstallAborted,
|
||||
ErrorWriteToDisk,
|
||||
ExtractError,
|
||||
ExtractSizeMismatch,
|
||||
InstallFailure,
|
||||
ExternalScriptError,
|
||||
InstallSuccess
|
||||
}
|
||||
|
||||
public string Records(logEntries le, string str, int i)
|
||||
{
|
||||
string currentDateTime = Convert.ToString(DateTime.Now.ToShortDateString() + " " +
|
||||
DateTime.Now.ToLongTimeString());
|
||||
string currentRecord = currentDateTime + " - ";
|
||||
|
||||
switch (le)
|
||||
{
|
||||
case logEntries.StartPkgCreation:
|
||||
currentRecord += "Started creation of package: " + str;
|
||||
break;
|
||||
case logEntries.GenPkgStructure:
|
||||
currentRecord += "Finished generating internal structure of package";
|
||||
break;
|
||||
case logEntries.ImportResources:
|
||||
currentRecord += "Resource import complete, total resources: " + i.ToString();
|
||||
break;
|
||||
case logEntries.PackageCancelled:
|
||||
currentRecord += "ERROR: Package creation was cancelled by the user!";
|
||||
break;
|
||||
case logEntries.XmlGeneration:
|
||||
currentRecord += "Setup XML file has been created successfully";
|
||||
break;
|
||||
case logEntries.CreateOPF:
|
||||
currentRecord += "Compressing package...";
|
||||
break;
|
||||
case logEntries.CreatedOPF:
|
||||
currentRecord += "Finished compressing package";
|
||||
break;
|
||||
case logEntries.SevenZPkgError:
|
||||
currentRecord += "ERROR: There was a problem trying to compress the package";
|
||||
break;
|
||||
case logEntries.FinalOperations:
|
||||
currentRecord += "Performing post operation: " + i.ToString();
|
||||
break;
|
||||
case logEntries.FinishedNoErrors:
|
||||
currentRecord += "Finished creating OPF without any errors";
|
||||
break;
|
||||
case logEntries.FinishedWithErrors:
|
||||
currentRecord += "ERROR: An unknown problem occurred whilst finalising the package";
|
||||
break;
|
||||
case logEntries.FinishReadXml:
|
||||
currentRecord += "Successfully imported XML file without any errors.";
|
||||
break;
|
||||
case logEntries.ErrorReadXml:
|
||||
currentRecord += "ERROR: Could not parse XML: " + str;
|
||||
break;
|
||||
case logEntries.InstallAborted:
|
||||
currentRecord += "ERROR: Installation was cancelled by the user.";
|
||||
break;
|
||||
case logEntries.ErrorWriteToDisk:
|
||||
currentRecord += "ERROR: Unable to write to disk, no permission to write to specified directory/drive: " + str;
|
||||
break;
|
||||
case logEntries.ExtractError:
|
||||
currentRecord += "ERROR: The archive cannot be extracted. Verify the password is correct and 7-zip is installed.";
|
||||
break;
|
||||
case logEntries.ExtractSizeMismatch:
|
||||
currentRecord += "ERROR: There is a mismatch between the original package size and the output.";
|
||||
break;
|
||||
case logEntries.InstallFailure:
|
||||
currentRecord += "ERROR: The installation has failed with one or more errors.";
|
||||
break;
|
||||
case logEntries.ExternalScriptError:
|
||||
currentRecord += "ERROR: An external script has returned with error code: " + str;
|
||||
break;
|
||||
case logEntries.InstallSuccess:
|
||||
currentRecord += String.Format("Installation for {0} has completed successfully!", str);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return currentRecord;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write out current entry to specified log file. Recommended to run
|
||||
/// from outside main thread for performance reasons.
|
||||
/// </summary>
|
||||
/// <param name="currentEntry">Text to write</param>
|
||||
/// <param name="logLocation">Location to write log</param>
|
||||
public void WriteOutLog(string currentEntry, string logLocation)
|
||||
{
|
||||
if (!Directory.Exists(SysEnvironment.workingDir))
|
||||
{ Directory.CreateDirectory(SysEnvironment.workingDir); }
|
||||
|
||||
// Streamwriter must append all entries or it will overwrite entries with
|
||||
// the latest only.
|
||||
using (StreamWriter writer = File.AppendText(logLocation))
|
||||
{
|
||||
writer.WriteLine(currentEntry);
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace OpenPackager
|
||||
{
|
||||
public class MessageHandler
|
||||
{
|
||||
|
||||
// Call error messages by specifying an enum code
|
||||
public enum msgCodes
|
||||
{
|
||||
ERR_Test,
|
||||
ERR_PackageCreationFail,
|
||||
ERR_PackageValidation,
|
||||
INF_CreationWiz2_PkgValidated,
|
||||
INF_NotYetImplemented,
|
||||
INF_CreationWiz2_FinishedNoErr,
|
||||
ERR_ShutdownCleanupFailed,
|
||||
ERR_XMLError,
|
||||
ERR_InstallerWiz1_BadDir,
|
||||
ERR_InstallerWiz1__LicAgreementNotAccepted,
|
||||
Err_InstallerWiz2_InstallAborted,
|
||||
Err_InstallerWiz2_ExtractError,
|
||||
Err_InstallerWiz2_BadPackage,
|
||||
Err_InstallerWiz2_FSAccessError
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an error message dialogue box.
|
||||
/// </summary>
|
||||
/// <param name="mc"></param>
|
||||
/// <param name="info"></param>
|
||||
internal void errorMessage(msgCodes mc, string info)
|
||||
{
|
||||
switch (mc)
|
||||
{
|
||||
case msgCodes.ERR_Test:
|
||||
MessageBox.Show("This is a sample error message", "Sample Error Message", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case msgCodes.ERR_PackageCreationFail:
|
||||
MessageBox.Show("Package creation failed with one or more errors.",
|
||||
"Package Failed", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case msgCodes.ERR_PackageValidation:
|
||||
MessageBox.Show("One or more entries are invalid; please check the parameters specified for this package and try again. Errors detected have been highlighted to your left in yellow.",
|
||||
"Invalid Parameters", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case msgCodes.ERR_ShutdownCleanupFailed:
|
||||
MessageBox.Show("There was a problem shutting down Open Packager, please ensure you have administrative privileges.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case msgCodes.ERR_XMLError:
|
||||
MessageBox.Show("Unable to read configuration file for package. This archive may be corrupt or invalid.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
break;
|
||||
case msgCodes.ERR_InstallerWiz1_BadDir:
|
||||
MessageBox.Show("The path you've specified is invalid.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case msgCodes.ERR_InstallerWiz1__LicAgreementNotAccepted:
|
||||
MessageBox.Show("You must accept the licence agreement to continue.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
break;
|
||||
case msgCodes.Err_InstallerWiz2_InstallAborted:
|
||||
MessageBox.Show("The installation has been aborted.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
break;
|
||||
case msgCodes.Err_InstallerWiz2_ExtractError:
|
||||
MessageBox.Show("There was a problem extracting the package. If password protected, ensure the password is correct and that 7-Zip is installed.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
break;
|
||||
case msgCodes.Err_InstallerWiz2_BadPackage:
|
||||
MessageBox.Show(String.Format("There is a problem with the consistency of {0}. Please obtain a new copy.", info),
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case msgCodes.Err_InstallerWiz2_FSAccessError:
|
||||
MessageBox.Show("Unable to write to disk, ensure you are running as an Administrator.",
|
||||
"Open Packager", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an informational message dialogue box.
|
||||
/// </summary>
|
||||
/// <param name="mc"></param>
|
||||
/// <param name="info"></param>
|
||||
/// <returns></returns>
|
||||
internal int stdMessage(msgCodes mc, string info)
|
||||
{
|
||||
switch(mc)
|
||||
{
|
||||
case msgCodes.INF_CreationWiz2_PkgValidated:
|
||||
MessageBoxResult msb = MessageBox.Show("Your package is now ready to be created! Click the Create Package button to proceed.", "Package Ready",
|
||||
MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||
if (msb == MessageBoxResult.OK)
|
||||
{
|
||||
return 1; // Return non-default response
|
||||
}
|
||||
break;
|
||||
case msgCodes.INF_NotYetImplemented:
|
||||
MessageBox.Show("This feature has not yet been implemented.", "Information", MessageBoxButton.OK, MessageBoxImage.Stop);
|
||||
break;
|
||||
case msgCodes.INF_CreationWiz2_FinishedNoErr:
|
||||
MessageBox.Show("Your package was created successfully!",
|
||||
"Package Created", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
break;
|
||||
}
|
||||
return 0; // Return default response
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.IO;
|
||||
using IWshRuntimeLibrary;
|
||||
|
||||
namespace OpenPackager.Components
|
||||
{
|
||||
public partial class WinIntegration
|
||||
{
|
||||
public void CreateShortcut(string shortcutName, string shortcutFile, string shortcutDir, string targetDir, string icon)
|
||||
{
|
||||
string targetLocation = Path.Combine(shortcutDir, shortcutFile);
|
||||
string shortcutLocation = Path.Combine(targetDir, shortcutName + ".lnk");
|
||||
WshShell shell = new WshShell();
|
||||
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
|
||||
|
||||
shortcut.WorkingDirectory = shortcutDir;
|
||||
if (icon != null) shortcut.IconLocation = icon;
|
||||
shortcut.TargetPath = targetLocation;
|
||||
shortcut.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
namespace OpenPackager.Dialogs
|
||||
{
|
||||
partial class AboutBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.logoPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.labelProductName = new System.Windows.Forms.Label();
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.labelCopyright = new System.Windows.Forms.Label();
|
||||
this.labelCompanyName = new System.Windows.Forms.Label();
|
||||
this.textBoxDescription = new System.Windows.Forms.TextBox();
|
||||
this.tableLayoutPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel
|
||||
//
|
||||
this.tableLayoutPanel.ColumnCount = 2;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F));
|
||||
this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4);
|
||||
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.tableLayoutPanel.Name = "tableLayoutPanel";
|
||||
this.tableLayoutPanel.RowCount = 5;
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(417, 265);
|
||||
this.tableLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
// logoPictureBox
|
||||
//
|
||||
this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logoPictureBox.Image = global::OpenPackager.Properties.Resources.LogoV21;
|
||||
this.logoPictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.logoPictureBox.Name = "logoPictureBox";
|
||||
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 5);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(131, 259);
|
||||
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.logoPictureBox.TabIndex = 12;
|
||||
this.logoPictureBox.TabStop = false;
|
||||
//
|
||||
// labelProductName
|
||||
//
|
||||
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelProductName.Location = new System.Drawing.Point(143, 0);
|
||||
this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelProductName.Name = "labelProductName";
|
||||
this.labelProductName.Size = new System.Drawing.Size(271, 17);
|
||||
this.labelProductName.TabIndex = 19;
|
||||
this.labelProductName.Text = "Product Name";
|
||||
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelVersion.Location = new System.Drawing.Point(143, 29);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(271, 17);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
this.labelVersion.Text = "Version";
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCopyright
|
||||
//
|
||||
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCopyright.Location = new System.Drawing.Point(143, 58);
|
||||
this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelCopyright.Name = "labelCopyright";
|
||||
this.labelCopyright.Size = new System.Drawing.Size(271, 17);
|
||||
this.labelCopyright.TabIndex = 21;
|
||||
this.labelCopyright.Text = "Copyright";
|
||||
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCompanyName
|
||||
//
|
||||
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(143, 87);
|
||||
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
|
||||
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17);
|
||||
this.labelCompanyName.Name = "labelCompanyName";
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(271, 17);
|
||||
this.labelCompanyName.TabIndex = 22;
|
||||
this.labelCompanyName.Text = "Company Name";
|
||||
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// textBoxDescription
|
||||
//
|
||||
this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxDescription.Location = new System.Drawing.Point(143, 119);
|
||||
this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||
this.textBoxDescription.Multiline = true;
|
||||
this.textBoxDescription.Name = "textBoxDescription";
|
||||
this.textBoxDescription.ReadOnly = true;
|
||||
this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBoxDescription.Size = new System.Drawing.Size(271, 143);
|
||||
this.textBoxDescription.TabIndex = 23;
|
||||
this.textBoxDescription.TabStop = false;
|
||||
this.textBoxDescription.Text = "Description";
|
||||
//
|
||||
// AboutBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(435, 283);
|
||||
this.Controls.Add(this.tableLayoutPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AboutBox";
|
||||
this.Padding = new System.Windows.Forms.Padding(9);
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "About";
|
||||
this.tableLayoutPanel.ResumeLayout(false);
|
||||
this.tableLayoutPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
|
||||
private System.Windows.Forms.PictureBox logoPictureBox;
|
||||
private System.Windows.Forms.Label labelProductName;
|
||||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Label labelCopyright;
|
||||
private System.Windows.Forms.Label labelCompanyName;
|
||||
private System.Windows.Forms.TextBox textBoxDescription;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpenPackager.Dialogs
|
||||
{
|
||||
partial class AboutBox : Form
|
||||
{
|
||||
public AboutBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = String.Format("About {0}", AssemblyTitle);
|
||||
this.labelProductName.Text = AssemblyProduct;
|
||||
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
|
||||
this.labelCopyright.Text = "Free Software - GPL V3";
|
||||
this.labelCompanyName.Text = AssemblyCompany;
|
||||
this.textBoxDescription.Text = AssemblyDescription;
|
||||
}
|
||||
|
||||
#region Assembly Attribute Accessors
|
||||
|
||||
public string AssemblyTitle
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
|
||||
if (attributes.Length > 0)
|
||||
{
|
||||
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
|
||||
if (titleAttribute.Title != "")
|
||||
{
|
||||
return titleAttribute.Title;
|
||||
}
|
||||
}
|
||||
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyProduct
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyProductAttribute)attributes[0]).Product;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyCopyright
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
||||
}
|
||||
}
|
||||
|
||||
public string AssemblyCompany
|
||||
{
|
||||
get
|
||||
{
|
||||
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return ((AssemblyCompanyAttribute)attributes[0]).Company;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,19 @@
|
||||
<Window x:Class="OpenPackager.Dialogs.PasswordEntry"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:OpenPackager.Dialogs"
|
||||
mc:Ignorable="d"
|
||||
Title="Open Packager" Height="200" Width="450" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Rectangle x:Name="dockControls" Fill="#FF00B4A5" Stroke="Black" StrokeThickness="0" Height="40" VerticalAlignment="Bottom"/>
|
||||
<Button x:Name="btnConfirm" Content="Confirm" Margin="177,0,192,10" Click="btnOk_Click" Height="20" VerticalAlignment="Bottom" IsDefault="True" IsEnabled="False"/>
|
||||
<PasswordBox x:Name="passwordBox" VerticalAlignment="Top" Margin="130,49,0,0" PasswordChanged="passwordBox_PasswordChanged" Height="20" HorizontalAlignment="Left" Width="249"/>
|
||||
<Image x:Name="image" HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100" Source="/Open Packager;component/Resources/PassKey.png" Margin="15,10,0,0"/>
|
||||
<Label x:Name="labelPassword" Content="Password:" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold" Margin="125,23,0,0"/>
|
||||
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" TextWrapping="Wrap" Text="This package is password protected using 256-Bit AES Encryption. Please enter a valid password to decrypt it." VerticalAlignment="Top" Height="42" Width="291" Margin="130,74,0,0" FontStyle="Italic"/>
|
||||
<Button x:Name="btnClear" Content="Clear" Margin="384,49,0,0" VerticalAlignment="Top" Height="20" Click="btnClear_Click" IsEnabled="False" HorizontalAlignment="Left" Width="37"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenPackager.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PasswordEntry.xaml
|
||||
/// </summary>
|
||||
public partial class PasswordEntry : Window
|
||||
{
|
||||
public string password { get; set; }
|
||||
|
||||
public PasswordEntry()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
password = passwordBox.Password;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void passwordBox_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Deny zero-length passwords.
|
||||
if (passwordBox.Password.Length > 0)
|
||||
{
|
||||
btnConfirm.IsEnabled = true;
|
||||
btnClear.IsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
btnConfirm.IsEnabled = false;
|
||||
btnClear.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClear_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
passwordBox.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<Window x:Class="OpenPackager.SevenZipWarning"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="7-Zip Not Detected" Height="300" Width="600" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<RichTextBox x:Name="textDescription" Margin="0,26,28,0" IsReadOnly="True" FontSize="14" BorderThickness="0" Height="201" VerticalAlignment="Top" HorizontalAlignment="Right" Width="397">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Run Text="7-Zip "/>
|
||||
<Run Text="is not installed"/>
|
||||
<Run Text=" on this system,"/>
|
||||
<Run Text=" but is required "/>
|
||||
<Run Text="in order for Open Packager to function. It is a great open"/>
|
||||
<Run Text="-source "/>
|
||||
<Run Text="archiv"/>
|
||||
<Run Text="ing"/>
|
||||
<Run Text=" format which achieves extremely high levels of file compression compared to"/>
|
||||
<Run Text=" the more popular"/>
|
||||
<Run Text=" ZIP "/>
|
||||
<Run Text="and"/>
|
||||
<Run Text=" RAR. It's efficiency"/>
|
||||
<Run Text=" and speed"/>
|
||||
<Run Text=" on modern systems "/>
|
||||
<Run Text="remains"/>
|
||||
<Run Text=" unmatched"/>
|
||||
<Run Text=","/>
|
||||
<Run Text=" best of all it's completely free"/>
|
||||
<Run Text="!"/>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<Run/>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<Run Text="Open Packager + 7-Zip make a great team :)"/>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<Button x:Name="btnOpenSevenZipLink" Content="Get 7-Zip" Margin="245,0,252,19" Click="btnOpenSevenZipLink_Click" Height="20" VerticalAlignment="Bottom" ToolTip="http://www.7-zip.org/"/>
|
||||
<Image x:Name="imgSevenZipLogo" Margin="44,0,465,19" Stretch="UniformToFill" Height="70" VerticalAlignment="Bottom" Source="/Open Packager;component/Resources/7z_Logo.png"/>
|
||||
<Image x:Name="imgLogo" Margin="10,0,430,107" Source="/Open Packager;component/Resources/LogoV2.png" Height="154" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelPlusSymbol" Content="+" Margin="65,0,485,64" FontSize="48" FontWeight="Bold" HorizontalAlignment="Center" Width="44" Height="74" VerticalAlignment="Bottom"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenPackager
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SevenZipWarning.xaml
|
||||
/// </summary>
|
||||
public partial class SevenZipWarning : Window
|
||||
{
|
||||
public SevenZipWarning()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnOpenSevenZipLink_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Process.Start("http://www.7-zip.org/");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// Perform proper shutdown of application.
|
||||
e.Cancel = true;
|
||||
if (e.Cancel == true)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<Window x:Class="OpenPackager.CreationWizard.StartCalculation"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Open Packager" Height="120" Width="300" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Closing="Window_Closing" Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<Label Content="Processing..." Margin="75,25,83,27" FontSize="22" HorizontalAlignment="Center" Width="136" Height="39" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace OpenPackager.CreationWizard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SizeCalculator.xaml
|
||||
/// </summary>
|
||||
public partial class StartCalculation : Window
|
||||
{
|
||||
private string textSourceDir;
|
||||
public long result = 0;
|
||||
bool blockExit = true;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the size of a directory using BackgroundWorker.
|
||||
/// </summary>
|
||||
/// <param name="textSourceDir"></param>
|
||||
public StartCalculation(string textSourceDir)
|
||||
{
|
||||
// TODO: Complete member initialization
|
||||
InitializeComponent();
|
||||
this.textSourceDir = textSourceDir;
|
||||
}
|
||||
|
||||
BackgroundWorker calcWorker = new BackgroundWorker();
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
calcWorker.DoWork += new DoWorkEventHandler(SizeCalculator);
|
||||
calcWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CalcFinished);
|
||||
calcWorker.RunWorkerAsync();
|
||||
}
|
||||
|
||||
private void SizeCalculator(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
string[] allFiles = Directory.GetFiles(textSourceDir, "*.*", SearchOption.AllDirectories);
|
||||
foreach (var file in allFiles)
|
||||
{
|
||||
FileInfo info = new FileInfo(file);
|
||||
result += info.Length;
|
||||
}
|
||||
}
|
||||
|
||||
private void CalcFinished(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
blockExit = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (blockExit == false)
|
||||
{
|
||||
e.Cancel = false;
|
||||
|
||||
calcWorker.Dispose();
|
||||
GC.Collect();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<Window x:Class="OpenPackager.CreationWizard.CreationWiz1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Creation Wizard (1/2)" Width="800" Height="600" WindowStartupLocation="CenterScreen" MinWidth="800" MinHeight="600" Background="#FF0094B4" Closed="Window_Closed" ResizeMode="CanMinimize">
|
||||
<Grid>
|
||||
<Rectangle x:Name="dockControls" Fill="#FF00B4A5" Stroke="Black" StrokeThickness="0" Height="41" VerticalAlignment="Bottom"/>
|
||||
<TabControl x:Name="tabControl" Margin="150,0,0,41">
|
||||
<TabItem x:Name="tabSetup" Header="Package Setup">
|
||||
<Grid Background="White">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="315*"/>
|
||||
<ColumnDefinition Width="317*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image x:Name="imgDisplayImg" Height="236" Margin="18,84,0,0" VerticalAlignment="Top" Stretch="Fill" HorizontalAlignment="Left" Width="354" Grid.ColumnSpan="2"/>
|
||||
<Rectangle x:Name="rectDisplayImg" Height="236" Margin="18,84,0,0" Stroke="Black" VerticalAlignment="Top" HorizontalAlignment="Left" Width="354" Grid.ColumnSpan="2"/>
|
||||
<Label x:Name="labelDisplayImg" Content="Display Image:" HorizontalAlignment="Left" Margin="14,46,0,0" VerticalAlignment="Top" ToolTip="Select an image to use as the image shown on the package installation screen"/>
|
||||
<TextBox x:Name="textDisplayImg" Height="24" Margin="123,48,289,0" VerticalAlignment="Top" MaxLength="1000" TextChanged="textDisplayImg_TextChanged" Grid.ColumnSpan="2"/>
|
||||
<Button x:Name="btnBrowseDisplayImg" Content="..." Margin="0,48,264,0" VerticalAlignment="Top" Height="24" ToolTip="Browse..." Click="btnBrowseDisplayImg_Click" RenderTransformOrigin="3.083,0.5" HorizontalAlignment="Right" Width="20" Grid.Column="1"/>
|
||||
<Label x:Name="labelPkgName" Content="*Package Name:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" ToolTip="Enter the name of the package here, it may contain spaces"/>
|
||||
<TextBox x:Name="textPkgName" Height="24" Margin="123,12,264,0" VerticalAlignment="Top" MaxLength="100" TextChanged="textPkgName_TextChanged" Grid.ColumnSpan="2"/>
|
||||
<TextBox x:Name="textUpid" Height="24" Margin="0,12,16,0" VerticalAlignment="Top" MaxLength="100" IsEnabled="False" HorizontalAlignment="Right" Width="207" Grid.Column="1"/>
|
||||
<Label x:Name="labelUpid" Content="UPID:" HorizontalAlignment="Right" Margin="0,12,224,0" VerticalAlignment="Top" ToolTip="This is used to uniquely identify your package" Grid.Column="1"/>
|
||||
<Label x:Name="labelOutputDir" Content="*Output Directory:" HorizontalAlignment="Left" Margin="69,266,0,0" VerticalAlignment="Top" ToolTip="Enter a path where you want to save the finished package to" Grid.Column="1"/>
|
||||
<TextBox x:Name="textOutputDir" Height="24" Margin="72,295,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="232" MaxLength="100" Grid.Column="1"/>
|
||||
<Button x:Name="btnBrowserOutputDir" Content="Browse..." HorizontalAlignment="Left" Margin="206,267,0,0" VerticalAlignment="Top" Width="98" Height="24" Click="btnBrowserOutputDir_Click" ToolTip="Browse..." Grid.Column="1"/>
|
||||
<Label x:Name="labelLicAgreement" Content="Licence Agreement:" HorizontalAlignment="Left" Margin="10,0,0,138" Height="26" VerticalAlignment="Bottom" ToolTip="Browse to a text file to use as a licence agreement"/>
|
||||
<Label x:Name="labelMoreInfo" Content="Pre-install Notice:" HorizontalAlignment="Left" Margin="8,0,0,138" Grid.Column="1" Height="26" VerticalAlignment="Bottom" ToolTip="Select a text file to display before the installation of your package"/>
|
||||
<TextBox x:Name="textPreviewLicAgreement" HorizontalAlignment="Left" Margin="14,0,0,9" TextWrapping="Wrap" Width="295" IsReadOnly="True" Height="124" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="textPreviewMoreInfo" Margin="8,0,0,9" TextWrapping="Wrap" Grid.Column="1" IsReadOnly="True" Height="124" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="295"/>
|
||||
<Button x:Name="btnBrowserLicAgreement" Content="..." HorizontalAlignment="Left" Margin="289,0,0,138" Width="20" ToolTip="Browse..." Click="btnBrowserLicAgreement_Click" Height="24" VerticalAlignment="Bottom"/>
|
||||
<Button x:Name="btnBrowserMoreInfo" Content="..." HorizontalAlignment="Left" Margin="283,0,0,138" Width="20" ToolTip="Browse..." Grid.Column="1" Click="btnBrowserMoreInfo_Click" Height="24" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="textLicAgreement" Margin="123,0,0,138" MaxLength="100" IsEnabled="False" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="116" TextChanged="textLicAgreement_TextChanged"/>
|
||||
<TextBox x:Name="textMoreInfo" Margin="116,0,0,138" MaxLength="100" Grid.Column="1" IsEnabled="False" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="114" TextChanged="textMoreInfo_TextChanged"/>
|
||||
<Button x:Name="btnClearLicAgreement" Content="Clear" HorizontalAlignment="Left" Margin="243,0,0,138" Width="41" ToolTip="" Click="btnClearLicAgreement_Click" Height="24" VerticalAlignment="Bottom"/>
|
||||
<Button x:Name="btnClearMoreInfo" Content="Clear" HorizontalAlignment="Left" Margin="237,0,0,138" Width="41" ToolTip="" Grid.Column="1" Click="btnClearMoreInfo_Click" Height="24" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelShortcutFile" Content="Shortcut File:" HorizontalAlignment="Left" Margin="69,154,0,0" VerticalAlignment="Top" ToolTip="Select a file within the source directory to use as a shortcut for the installation process" Grid.Column="1"/>
|
||||
<TextBox x:Name="textShortcutFile" Height="24" Margin="166,156,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="113" MaxLength="100" Grid.Column="1" TextChanged="textShortcutFile_TextChanged"/>
|
||||
<Button x:Name="btnBrowseShortcutFile" Content="..." HorizontalAlignment="Left" Margin="284,156,0,0" VerticalAlignment="Top" Width="20" Height="24" ToolTip="Browse..." Grid.Column="1" Click="btnBrowseShortcutFile_Click"/>
|
||||
<Label x:Name="labelSourceDir" Content="*Source Directory:" Grid.Column="1" HorizontalAlignment="Left" Margin="69,84,0,0" VerticalAlignment="Top" ToolTip="Select where the directory you wish to create the package from is located"/>
|
||||
<Button x:Name="btnSourceDir" Content="Browse..." HorizontalAlignment="Left" Margin="205,86,0,0" VerticalAlignment="Top" Width="98" Height="24" ToolTip="Browse..." Grid.Column="1" Click="btnSourceDir_Click"/>
|
||||
<TextBox x:Name="textSourceDir" Height="24" Margin="71,115,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="232" MaxLength="100" Grid.Column="1"/>
|
||||
<TextBox x:Name="textAuthor" Height="24" Margin="0,46,16,0" VerticalAlignment="Top" MaxLength="100" HorizontalAlignment="Right" Width="186" Grid.Column="1"/>
|
||||
<Label x:Name="labelAuthor" Content="Author:" HorizontalAlignment="Right" Margin="0,46,207,0" VerticalAlignment="Top" ToolTip="Enter the name of the package here, it can contain spaces and symbols" Grid.Column="1"/>
|
||||
<Label x:Name="labelShortcutName" Content="Shortcut Name:" HorizontalAlignment="Left" Margin="69,185,0,0" VerticalAlignment="Top" ToolTip="Select a file within the source directory to use as a shortcut for the installation process" Grid.Column="1"/>
|
||||
<TextBox x:Name="textShortcutName" Height="24" Margin="166,185,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="137" MaxLength="100" Grid.Column="1" IsEnabled="False"/>
|
||||
<Label x:Name="labelShortcutIcon" Content="Shortcut Icon:" HorizontalAlignment="Left" Margin="69,216,0,0" VerticalAlignment="Top" ToolTip="Select a file within the source directory to use as a shortcut for the installation process" Grid.Column="1"/>
|
||||
<TextBox x:Name="textShortcutIcon" Height="24" Margin="166,216,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="113" MaxLength="100" Grid.Column="1" TextChanged="textShortcutFile_TextChanged"/>
|
||||
<Button x:Name="btnBrowseShortcutIcon" Content="..." HorizontalAlignment="Left" Margin="284,216,0,0" VerticalAlignment="Top" Width="20" Height="24" ToolTip="Browse..." Grid.Column="1" Click="btnBrowseShortcutIcon_Click"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem x:Name="tabAdvanced" Header="Advanced Parameters">
|
||||
<Grid Background="White">
|
||||
<Slider x:Name="sliderCompressionVal" Margin="158,14,10,0" VerticalAlignment="Top" Value="5" TickPlacement="BottomRight" Maximum="9" SmallChange="1" ValueChanged="sliderCompressionVal_ValueChanged"/>
|
||||
<Label x:Name="labelCompressionVal" Content="Level of Compression:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" ToolTip="Select the level of compression to use, level 6 is recommended"/>
|
||||
<Label x:Name="labelNoCompression" Content="None" Margin="158,36,0,0" VerticalAlignment="Top" ToolTip="Store files without any further processing" HorizontalAlignment="Left" Width="41"/>
|
||||
<Label x:Name="labelMaxCompression" Content="Maximum" Margin="0,41,10,0" VerticalAlignment="Top" ToolTip="Use the most potent compression algorithm available, dramatically increases package creation time and installation time" HorizontalAlignment="Right" Width="68"/>
|
||||
<Label x:Name="labelPassword" Content="Password:" HorizontalAlignment="Left" Margin="5,93,0,0" VerticalAlignment="Top"/>
|
||||
<PasswordBox x:Name="pwdMainPassword" Margin="87,99,335,0" VerticalAlignment="Top" IsEnabled="False"/>
|
||||
<PasswordBox x:Name="pwdVerifyPassword" Margin="87,124,335,0" VerticalAlignment="Top" IsEnabled="False"/>
|
||||
<Label x:Name="labelPasswordConfirm" Content="Confirm:" HorizontalAlignment="Left" Margin="5,119,0,0" VerticalAlignment="Top"/>
|
||||
<CheckBox x:Name="checkPasswordEnable" Content="Password Protect Package" HorizontalAlignment="Left" Margin="10,70,0,0" VerticalAlignment="Top" Checked="checkPasswordEnable_Checked" Unchecked="checkPasswordEnable_Unchecked" Height="21" ToolTip="Once password protected, it will be impossible to recover your package without the correct password"/>
|
||||
<ListBox x:Name="listBatInst" Height="173" Margin="9,189,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="287" IsEnabled="False"/>
|
||||
<ListBox x:Name="listBatRem" Height="173" Margin="301,189,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="287" IsEnabled="False"/>
|
||||
<Label x:Name="labelBatRem" Content="Batch files for Uninstallation:" HorizontalAlignment="Left" Margin="296,161,0,0" VerticalAlignment="Top" IsEnabled="False" ToolTip="Add the following batch removal files to the package"/>
|
||||
<Button x:Name="btnBrowseBatInst" Content="Browse..." VerticalAlignment="Top" Height="24" ToolTip="Browse..." RenderTransformOrigin="3.083,0.5" Margin="9,367,0,0" HorizontalAlignment="Left" Width="226" Click="btnBrowseBatInst_Click" IsEnabled="False"/>
|
||||
<Button x:Name="btnBrowseBatRem" Content="Browse..." VerticalAlignment="Top" Height="24" ToolTip="Browse..." RenderTransformOrigin="3.083,0.5" Margin="301,367,0,0" HorizontalAlignment="Left" Width="226" Click="btnBrowseBatRem_Click" IsEnabled="False"/>
|
||||
<Button x:Name="btnClearBatInst" Content="Clear" VerticalAlignment="Top" Margin="240,367,0,0" Height="24" HorizontalAlignment="Left" Width="56" Click="btnClearBatInst_Click" IsEnabled="False"/>
|
||||
<Button x:Name="btnClearBatRem" Content="Clear" HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Margin="532,367,0,0" Height="24" Click="btnClearBatRem_Click" IsEnabled="False"/>
|
||||
<RadioButton x:Name="radioCreateSfx" Content="Create SFX Package" HorizontalAlignment="Left" Margin="390,93,0,0" VerticalAlignment="Top" GroupName="1" ToolTip="Create a 7-Zip Self-Extracting executable file"/>
|
||||
<RadioButton x:Name="radioCompress" Content="Create Package ZIP Container" HorizontalAlignment="Left" Margin="390,114,0,0" VerticalAlignment="Top" GroupName="1" IsChecked="True" ToolTip="ZIP the package after completion without compression"/>
|
||||
<RadioButton x:Name="radioNone" Content="None, single folder" HorizontalAlignment="Left" Margin="390,135,0,0" VerticalAlignment="Top" GroupName="1" ToolTip="Output the package directly to the destination"/>
|
||||
<Label x:Name="labelPostOpts" Content="Post package operations:" HorizontalAlignment="Left" Margin="385,65,0,0" VerticalAlignment="Top" ToolTip="Select what to do with the package after it has been created"/>
|
||||
<CheckBox x:Name="checkBatInst" Content="Batch files for Installation:" HorizontalAlignment="Left" Margin="10,167,0,0" VerticalAlignment="Top" Checked="checkBatInst_Checked" Unchecked="checkBatInst_Unchecked" ToolTip="Add the following batch files to the package"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ListBox x:Name="listErrors" HorizontalAlignment="Left" Height="395" Margin="10,104,0,0" VerticalAlignment="Top" Width="140" Foreground="Yellow" Background="{x:Null}" BorderBrush="{x:Null}" FontWeight="Bold"/>
|
||||
<RichTextBox x:Name="labelDepend" HorizontalAlignment="Left" Height="89" VerticalAlignment="Top" Width="140" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" IsReadOnly="True" IsDocumentEnabled="True" BorderThickness="0" Margin="5,10,0,0" FontStyle="Italic">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Run Text="Please fill in all of the required options. Any potential issues will be listed below before the package is generated."/>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<Button x:Name="btnCreatePackage" Content="Create Package ->" Margin="0,0,10,10" Click="btnCreatePackage_Click" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="112"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,566 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenPackager.CreationWizard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CreationWiz1.xaml
|
||||
/// </summary>
|
||||
public partial class CreationWiz1 : Window
|
||||
{
|
||||
MessageHandler mh = new MessageHandler();
|
||||
|
||||
public CreationWiz1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region FormFunctionality
|
||||
|
||||
CommonIO cIO = new CommonIO();
|
||||
|
||||
bool userClosedForm = true;
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
// The windows close event is overridden so that the
|
||||
// cleanup class can take over when shutting down.
|
||||
if (userClosedForm == true)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowseShortcutIcon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
textShortcutIcon.Text = cIO.BrowseFile("ico");
|
||||
}
|
||||
|
||||
private void textShortcutFile_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (textShortcutFile.Text == "")
|
||||
{
|
||||
textShortcutName.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
textShortcutName.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void sliderCompressionVal_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
// Only output whole numbers - as supported by LMZA2
|
||||
sliderCompressionVal.Value = Math.Round(sliderCompressionVal.Value, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
private void checkBatInst_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBatInst.IsEnabled = true;
|
||||
btnBrowseBatInst.IsEnabled = true;
|
||||
btnClearBatInst.IsEnabled = true;
|
||||
listBatRem.IsEnabled = true;
|
||||
btnBrowseBatRem.IsEnabled = true;
|
||||
btnClearBatRem.IsEnabled = true;
|
||||
labelBatRem.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void checkBatInst_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBatInst.IsEnabled = false;
|
||||
btnBrowseBatInst.IsEnabled = false;
|
||||
btnClearBatInst.IsEnabled = false;
|
||||
listBatRem.IsEnabled = false;
|
||||
btnBrowseBatRem.IsEnabled = false;
|
||||
btnClearBatRem.IsEnabled = false;
|
||||
labelBatRem.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void btnBrowserOutputDir_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
textOutputDir.Text = cIO.BrowseFolder(textOutputDir.Text);
|
||||
}
|
||||
|
||||
private void btnBrowseDisplayImg_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Image preview is updated via the TextChanged event
|
||||
// as it can also be entered manually.
|
||||
textDisplayImg.Text = cIO.BrowseFile("image");
|
||||
}
|
||||
|
||||
private void textDisplayImg_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
// Image preview is based on the text box input.
|
||||
// Entering an invalid URI will throw an exception,
|
||||
// the image source is reset upon invalidating the source.
|
||||
try
|
||||
{
|
||||
imgDisplayImg.Source = new BitmapImage(new Uri(textDisplayImg.Text));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
imgDisplayImg.Source = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void textPkgName_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
// Convert non-empty input to UPID
|
||||
if (textUpid.Text != null)
|
||||
{
|
||||
textUpid.Text = UpidGenerator();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSourceDir_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
textSourceDir.Text = cIO.BrowseFolder(textOutputDir.Text);
|
||||
}
|
||||
|
||||
private void btnCreatePackage_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (pkgValidated == false)
|
||||
{
|
||||
FormValidator();
|
||||
}
|
||||
else
|
||||
{
|
||||
StartOpfCreation();
|
||||
}
|
||||
//mHandler.stdMessage(MessageHandler.msgCodes.INF_NotYetImplemented, null);
|
||||
}
|
||||
|
||||
private void checkPasswordEnable_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
pwdMainPassword.IsEnabled = true;
|
||||
pwdVerifyPassword.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void checkPasswordEnable_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
pwdMainPassword.IsEnabled = false;
|
||||
pwdVerifyPassword.IsEnabled = false;
|
||||
|
||||
// Entries must be cleared to prevent them from being passed onwards.
|
||||
pwdMainPassword.Clear();
|
||||
pwdVerifyPassword.Clear();
|
||||
}
|
||||
|
||||
private void btnBrowseBatInst_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string result = cIO.BrowseFile("bat");
|
||||
if (result != "") { listBatInst.Items.Add(result); }
|
||||
}
|
||||
|
||||
private void btnBrowseBatRem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string result = cIO.BrowseFile("bat");
|
||||
if (result != "") { listBatRem.Items.Add(result); }
|
||||
}
|
||||
|
||||
private void btnClearBatInst_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBatInst.Items.Clear();
|
||||
}
|
||||
|
||||
private void btnClearBatRem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBatRem.Items.Clear();
|
||||
}
|
||||
|
||||
private void btnBrowserLicAgreement_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string str = cIO.BrowseFile("txt");
|
||||
textLicAgreement.Text = str;
|
||||
if (File.Exists(str))
|
||||
{
|
||||
textPreviewLicAgreement.Text = File.ReadAllText(str);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowserMoreInfo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string str = cIO.BrowseFile("txt");
|
||||
textMoreInfo.Text = str;
|
||||
if (File.Exists(str))
|
||||
{
|
||||
textPreviewMoreInfo.Text = File.ReadAllText(str);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClearLicAgreement_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
textLicAgreement.Text = "";
|
||||
textPreviewLicAgreement.Text = "";
|
||||
}
|
||||
|
||||
private void btnClearMoreInfo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
textMoreInfo.Text = "";
|
||||
textPreviewMoreInfo.Text = "";
|
||||
}
|
||||
|
||||
private void btnBrowseShortcutFile_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
textShortcutFile.Text = cIO.BrowseFile(null);
|
||||
}
|
||||
|
||||
private void textLicAgreement_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (File.Exists(textLicAgreement.Text)) { textPreviewLicAgreement.Text = textLicAgreement.Text; }
|
||||
}
|
||||
|
||||
private void textMoreInfo_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (File.Exists(textMoreInfo.Text)) { textPreviewMoreInfo.Text = textMoreInfo.Text; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private string UpidGenerator()
|
||||
{
|
||||
// Generate UPID (Unique Package IDentifier)
|
||||
//
|
||||
// UPID is enclosed in curly braces and consists of the first 4 characters
|
||||
// of the package name followed by an "@" symbol. The current Unix-time is
|
||||
// also appended to the string represented as ticks. All spaces from the
|
||||
// Package name are also replaced with percent symbols.
|
||||
//
|
||||
// The Package name MUST consist of at least 4 characters or UID is cleared.
|
||||
string uid;
|
||||
if (textPkgName.Text.Length >= 4)
|
||||
{
|
||||
string input = textPkgName.Text.Replace(" ", "%").Substring(0, 4).ToUpper();
|
||||
long gen = DateTime.Now.Ticks;
|
||||
uid = "{" + input + "@" + gen + "}";
|
||||
}
|
||||
else
|
||||
{
|
||||
uid = "";
|
||||
}
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
||||
long sourceSize;
|
||||
private void StartValidation()
|
||||
{
|
||||
// Assuming values by default are invalid
|
||||
|
||||
listErrors.Items.Clear(); // Clear existing errors
|
||||
|
||||
#region RequiredFields
|
||||
|
||||
// Check name is at least 4 characters
|
||||
if (textPkgName.Text.Length < 4)
|
||||
{
|
||||
listErrors.Items.Add("Package Name:\nMust be at least 4\ncharacters long");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
|
||||
// Test Source directory exists and not within
|
||||
// output.
|
||||
string sourcePath = textSourceDir.Text;
|
||||
if (!Directory.Exists(textSourceDir.Text) ||
|
||||
sourcePath.Contains(textOutputDir.Text))
|
||||
{
|
||||
listErrors.Items.Add("Source Directory:\nInvalid path");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
else if (textSourceDir.Text.Length <= 3)
|
||||
{
|
||||
listErrors.Items.Add("Source Directory:\nRoots of drives\nare not supported");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
else // Count size of uncompressed package using a separate thread.
|
||||
{
|
||||
StartCalculation sc = new StartCalculation(textSourceDir.Text);
|
||||
sc.ShowDialog();
|
||||
sourceSize = sc.result;
|
||||
}
|
||||
|
||||
// Test output directory exists and not the same
|
||||
// as source.
|
||||
string outputPath = textOutputDir.Text;
|
||||
if (!Directory.Exists(textOutputDir.Text) ||
|
||||
textOutputDir.Text == textSourceDir.Text ||
|
||||
outputPath.Contains(textSourceDir.Text))
|
||||
{
|
||||
listErrors.Items.Add("Output Directory:\nInvalid path");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
else
|
||||
{
|
||||
DriveInfo di = new DriveInfo(textOutputDir.Text.Substring(0, 1));
|
||||
if (di.TotalSize < sourceSize)
|
||||
{
|
||||
listErrors.Items.Add("Output Directory:\nInsufficient space");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OptionalFields
|
||||
|
||||
// Validate display image
|
||||
if (textDisplayImg.Text != "")
|
||||
{
|
||||
if (!File.Exists(textDisplayImg.Text))
|
||||
{
|
||||
listErrors.Items.Add("Display Image:\nInvalid Path");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
|
||||
// Check text files
|
||||
if (textLicAgreement.Text != "")
|
||||
{
|
||||
if (!File.Exists(textLicAgreement.Text))
|
||||
{
|
||||
listErrors.Items.Add("License Agreement:\nInvalid path");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
if (textMoreInfo.Text != "")
|
||||
{
|
||||
if (!File.Exists(textMoreInfo.Text))
|
||||
{
|
||||
listErrors.Items.Add("Pre-Install Notice:\nInvalid path");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
|
||||
// Test shortcut path within source directory
|
||||
if (textShortcutFile.Text != "")
|
||||
{
|
||||
string shortcutPath = textShortcutFile.Text;
|
||||
if (!File.Exists(textShortcutFile.Text) ||
|
||||
!shortcutPath.Contains(textSourceDir.Text))
|
||||
{
|
||||
listErrors.Items.Add("Shortcut File:\nInvalid Path or\noutside of source\ndirectory");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
|
||||
if (textShortcutName.Text == "")
|
||||
{
|
||||
listErrors.Items.Add("Shortcut Name:\nRequired");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
|
||||
// Shortcut icon
|
||||
if (textShortcutIcon.Text != "" &&
|
||||
!File.Exists(textShortcutIcon.Text))
|
||||
{
|
||||
listErrors.Items.Add("Shortcut Icon:\nInvalid file");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
|
||||
// Test passwords
|
||||
if (checkPasswordEnable.IsChecked == true)
|
||||
{
|
||||
if (pwdMainPassword.Password != pwdVerifyPassword.Password &&
|
||||
pwdMainPassword.Password != "" && pwdVerifyPassword.Password != "")
|
||||
{
|
||||
listErrors.Items.Add("Password Protection:\nPasswords don't\nmatch");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
// Test if password is empty
|
||||
else if (pwdMainPassword.Password == ""
|
||||
|| pwdVerifyPassword.Password == "")
|
||||
{
|
||||
listErrors.Items.Add("Password Protection:\nField(s) empty");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
|
||||
// Check batch install files exist
|
||||
if (checkBatInst.IsChecked == true)
|
||||
{
|
||||
if (listBatInst.Items.Count == 0)
|
||||
{
|
||||
listErrors.Items.Add("Batch Install:\nNo install files\nspecified");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
else
|
||||
{
|
||||
int batInst = 0;
|
||||
foreach (var item in listBatInst.Items)
|
||||
{
|
||||
if (File.Exists(item.ToString()))
|
||||
{
|
||||
batInst++;
|
||||
}
|
||||
}
|
||||
|
||||
if (listBatInst.Items.Count != batInst)
|
||||
{
|
||||
listErrors.Items.Add("Batch Install:\nCannot be found");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check batch uninstall files exist
|
||||
if (checkBatInst.IsChecked == true)
|
||||
{
|
||||
if (listBatRem.Items.Count > 1)
|
||||
{
|
||||
listErrors.Items.Add("Batch Uninstall:\nNo uninstall files\nspecified");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
else
|
||||
{
|
||||
int batRem = 0;
|
||||
foreach (var item in listBatRem.Items)
|
||||
{
|
||||
if (File.Exists(item.ToString()))
|
||||
{
|
||||
batRem++;
|
||||
}
|
||||
}
|
||||
|
||||
if (listBatRem.Items.Count != batRem)
|
||||
{
|
||||
listErrors.Items.Add("Batch Unininstall:\nCannot be found");
|
||||
listErrors.Items.Add("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
private int CheckForErrors()
|
||||
{
|
||||
// Do final check
|
||||
int errors = 0;
|
||||
foreach (var error in listErrors.Items)
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
bool pkgValidated = false;
|
||||
private void FormValidator()
|
||||
{
|
||||
// Check if all fields are valid.
|
||||
StartValidation();
|
||||
|
||||
// The error list is used to check for errors.
|
||||
// Each value in the following list equates to a single error.
|
||||
int validate = CheckForErrors();
|
||||
if (validate == 0)
|
||||
{
|
||||
listErrors.Items.Clear();
|
||||
|
||||
// Display message, after the ok button is clicked enable the package creation button.
|
||||
// Otherwise disable it.
|
||||
int showMsg = mh.stdMessage(MessageHandler.msgCodes.INF_CreationWiz2_PkgValidated, null);
|
||||
if (showMsg == 1)
|
||||
{
|
||||
pkgValidated = true;
|
||||
StartOpfCreation();
|
||||
}
|
||||
else
|
||||
{
|
||||
pkgValidated = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mh.errorMessage(MessageHandler.msgCodes.ERR_PackageValidation, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartOpfCreation()
|
||||
{
|
||||
// Assuming all values passed by startValidation class
|
||||
// are all 100% valid.
|
||||
|
||||
XML.WriteToXml _writeToXml = new XML.WriteToXml();
|
||||
XML.OpfGen _opfGen = new XML.OpfGen();
|
||||
|
||||
#region WriteToXml
|
||||
_writeToXml.pkgName = textPkgName.Text;
|
||||
_writeToXml.pkgSku = "Default";
|
||||
_writeToXml.pkgVer = 1.0m;
|
||||
_writeToXml.pkgUpid = textUpid.Text;
|
||||
_writeToXml.pkgAuthor = textAuthor.Text;
|
||||
_writeToXml.pkgSize = sourceSize;
|
||||
|
||||
// Process absolute shortcut path only.
|
||||
string textShortcut = textShortcutFile.Text;
|
||||
string absoluteShortcut = textShortcut.Replace(textSourceDir.Text, "");
|
||||
if (absoluteShortcut.StartsWith(@"\"))
|
||||
{
|
||||
absoluteShortcut = absoluteShortcut.Remove(0, 1);
|
||||
}
|
||||
_writeToXml.pkgShortcutFile = absoluteShortcut;
|
||||
// Include Shortcut Name.
|
||||
_writeToXml.pkgShortcutName = textShortcutName.Text;
|
||||
|
||||
// Write password state only and not password itself into
|
||||
// WriteToXml class.
|
||||
if (checkPasswordEnable.IsChecked == true)
|
||||
{
|
||||
_writeToXml.pkgPassword = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_writeToXml.pkgPassword = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OpfGen
|
||||
_opfGen.pkgDisplayImg = textDisplayImg.Text;
|
||||
_opfGen.pkgSourceDir = textSourceDir.Text;
|
||||
_opfGen.pkgOutputDir = textOutputDir.Text;
|
||||
_opfGen.pkgLicAgreement = textLicAgreement.Text;
|
||||
_opfGen.pkgMoreInfo = textMoreInfo.Text;
|
||||
_opfGen.pkgCompressionLvl = (int)sliderCompressionVal.Value;
|
||||
_opfGen.pkgPassword = pwdMainPassword.Password;
|
||||
_opfGen.pkgIcon = textShortcutIcon.Text;
|
||||
|
||||
// Post package operations.
|
||||
if (radioCreateSfx.IsChecked == true)
|
||||
{
|
||||
_opfGen.pkgPostOps = 0;
|
||||
}
|
||||
else if (radioCompress.IsChecked == true)
|
||||
{
|
||||
_opfGen.pkgPostOps = 1;
|
||||
}
|
||||
else if (radioNone.IsChecked == true)
|
||||
{
|
||||
_opfGen.pkgPostOps = 2;
|
||||
}
|
||||
|
||||
List<string> batInst = new List<string>();
|
||||
foreach (var item in listBatInst.Items)
|
||||
{
|
||||
batInst.Add(item.ToString());
|
||||
}
|
||||
_opfGen.pkgBatInst = batInst.ToArray();
|
||||
|
||||
List<string> batRem = new List<string>();
|
||||
foreach (var item in listBatRem.Items)
|
||||
{
|
||||
batRem.Add(item.ToString());
|
||||
}
|
||||
_opfGen.pkgBatRem = batRem.ToArray();
|
||||
#endregion
|
||||
|
||||
userClosedForm = false;
|
||||
CreationWiz2 cw3 = new CreationWiz2(_writeToXml, _opfGen);
|
||||
cw3.Show();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<Window x:Class="OpenPackager.CreationWizard.CreationWiz2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Creation Wizard (2/2)" Height="600" Width="800" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Background="#FF0094B4" Closing="Window_Closing" Loaded="Window_Loaded">
|
||||
<Grid>
|
||||
<Rectangle x:Name="dockControls" Fill="#FF00B4A5" Stroke="Black" StrokeThickness="0" Height="41" VerticalAlignment="Bottom"/>
|
||||
<RichTextBox x:Name="labelProgress" HorizontalAlignment="Left" Height="128" VerticalAlignment="Top" Width="140" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" IsReadOnly="True" IsDocumentEnabled="True" BorderThickness="0" Margin="5,10,0,0" FontStyle="Italic">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Run Text="The"/>
|
||||
<Run Text=" requested package is currently being built. This may take a long time depending on the size of your data and compression settings"/>
|
||||
<Run Text=" used."/>
|
||||
<Run Text=" "/>
|
||||
<Run Text="Any potential errors are shown below."/>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<ListBox x:Name="listProgress" HorizontalAlignment="Left" Height="356" Margin="10,143,0,0" VerticalAlignment="Top" Width="140" Foreground="Yellow" Background="{x:Null}" BorderBrush="{x:Null}" FontWeight="Bold"/>
|
||||
<TabControl x:Name="tabGroup" Margin="165,0,0,41">
|
||||
<TabItem x:Name="tabProgress" Header="Progress">
|
||||
<Grid Background="White">
|
||||
<GroupBox x:Name="groupBox" Header="Detail" Margin="10,0,10,10" Height="158" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="label1" Content="Step 1: Resource Collection" Margin="20,0,0,115" HorizontalAlignment="Left" Width="154" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="label2" Content="Step 2: Generating Setup Info" Margin="20,0,0,84" HorizontalAlignment="Left" Width="166" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="label3" Content="Step 3: Compiling Package Data" Margin="20,0,0,53" HorizontalAlignment="Left" Width="183" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="label4" Content="Step 4: Post-Package Operations" Margin="20,0,0,22" HorizontalAlignment="Left" Width="183" Height="26" VerticalAlignment="Bottom"/>
|
||||
<ProgressBar x:Name="progOverall" Margin="10,0,10,211" Height="52" VerticalAlignment="Bottom"/>
|
||||
<Image x:Name="imgProg1" HorizontalAlignment="Left" Margin="536,0,0,116" Width="66" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" Height="25" VerticalAlignment="Bottom"/>
|
||||
<Image x:Name="imgProg2" HorizontalAlignment="Left" Margin="536,0,0,86" Width="66" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" Height="25" VerticalAlignment="Bottom"/>
|
||||
<Image x:Name="imgProg3" HorizontalAlignment="Left" Margin="536,0,0,56" Width="66" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" Height="25" VerticalAlignment="Bottom"/>
|
||||
<Image x:Name="imgProg4" HorizontalAlignment="Left" Margin="536,0,0,26" Width="66" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" Height="25" VerticalAlignment="Bottom"/>
|
||||
<ProgressBar x:Name="prog1" HorizontalAlignment="Left" Margin="221,0,0,123" Width="297" IsIndeterminate="True" Height="10" VerticalAlignment="Bottom"/>
|
||||
<ProgressBar x:Name="prog2" HorizontalAlignment="Left" Margin="221,0,0,92" Width="297" Height="10" VerticalAlignment="Bottom"/>
|
||||
<ProgressBar x:Name="prog3" HorizontalAlignment="Left" Margin="221,0,0,60" Width="297" Height="10" VerticalAlignment="Bottom"/>
|
||||
<ProgressBar x:Name="prog4" HorizontalAlignment="Left" Margin="221,0,0,28" Width="297" Height="10" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelOverall" Content="Overall Progress" Margin="211,0,214,216" FontSize="24" Height="42" VerticalAlignment="Bottom"/>
|
||||
<TextBlock x:Name="textPkgName" Margin="10,41,10,0" TextWrapping="Wrap" Text="Package Name Here" VerticalAlignment="Top" Height="141" FontWeight="Bold" FontSize="48"/>
|
||||
<Label x:Name="labelBuilding" Content="Building:" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem x:Name="tabPackageLog" Header="Package Log">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<ListBox x:Name="listLog" Margin="10,10,10,40" Background="Black" Foreground="White"/>
|
||||
<Label x:Name="labelLogLocation" HorizontalAlignment="Left" Margin="10,0,0,9" Height="26" VerticalAlignment="Bottom" Content="Log Location:" ToolTip="This is where the above log is automatically saved to on your system"/>
|
||||
<TextBox x:Name="textLogLocation" Margin="96,0,10,8" TextWrapping="Wrap" Text="TextBox" Height="23" VerticalAlignment="Bottom" IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Button x:Name="btnClose" Content="Close" Margin="0,0,10,10" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" IsEnabled="False" IsDefault="True" Click="btnClose_Click"/>
|
||||
<Button x:Name="btnAbort" Content="Abort" Margin="10,0,700,10" IsCancel="True" Click="btnCancel_Click" ToolTip="Cancel package creation" Height="20" VerticalAlignment="Bottom"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,487 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml;
|
||||
|
||||
namespace OpenPackager.CreationWizard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CreationWiz3.xaml
|
||||
/// </summary>
|
||||
public partial class CreationWiz2 : Window
|
||||
{
|
||||
private XML.WriteToXml writeToXml;
|
||||
private XML.OpfGen opfGen;
|
||||
private LogWriter.Writer lWriter = new LogWriter.Writer();
|
||||
private MessageHandler mh = new MessageHandler();
|
||||
private delegate void ProcessLogEntry(string entry); // Process logs.
|
||||
|
||||
LMZAParser.Parser lmza = new LMZAParser.Parser();
|
||||
|
||||
private string upid;
|
||||
private string workingDir = SysEnvironment.workingDir; // private string workingDir = SysEnvironment.workingDir + "\\";
|
||||
private string opfDirPath = PackageStructure.opfDirs[0] + "\\";
|
||||
private string cPackageDir; // Current working directory for OPF.
|
||||
private string logDir;
|
||||
private string[] OPFDirs;
|
||||
|
||||
public CreationWiz2(XML.WriteToXml _writeToXml, XML.OpfGen _opfGen)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Import package data from previous wizard.
|
||||
this.writeToXml = _writeToXml;
|
||||
this.opfGen = _opfGen;
|
||||
// Setup private variables.
|
||||
upid = _writeToXml.pkgUpid;
|
||||
cPackageDir = workingDir + upid;
|
||||
logDir = cPackageDir + "_BuildLog.txt";
|
||||
textLogLocation.Text = logDir;
|
||||
textPkgName.Text = writeToXml.pkgName;
|
||||
|
||||
// Merge the current package directory with the package
|
||||
// structure directories.
|
||||
string[] _OPFDirs =
|
||||
{
|
||||
cPackageDir,
|
||||
cPackageDir + "\\" + PackageStructure.opfDirs[0],
|
||||
cPackageDir + "\\" + PackageStructure.opfDirs[1],
|
||||
cPackageDir + "\\" + PackageStructure.opfDirs[2],
|
||||
cPackageDir + "\\" + PackageStructure.opfDirs[3],
|
||||
};
|
||||
OPFDirs = _OPFDirs;
|
||||
}
|
||||
|
||||
#region Form Functionality
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
if (worker1.IsBusy) { worker1.CancelAsync(); }
|
||||
if (worker2.IsBusy) { worker2.CancelAsync(); }
|
||||
if (worker3.IsBusy) { lmza.Abort(); worker3.CancelAsync(); }
|
||||
if (worker4.IsBusy) { worker4.CancelAsync(); }
|
||||
|
||||
btnAbort.IsEnabled = false;
|
||||
PackageGenCancelled();
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.PackageCancelled, null, 0));
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Workers
|
||||
|
||||
private BackgroundWorker worker1 = new BackgroundWorker();
|
||||
private BackgroundWorker worker2 = new BackgroundWorker();
|
||||
private BackgroundWorker worker3 = new BackgroundWorker();
|
||||
private BackgroundWorker worker4 = new BackgroundWorker();
|
||||
|
||||
private void startPackage()
|
||||
{
|
||||
worker1.WorkerSupportsCancellation = true;
|
||||
worker1.DoWork += new DoWorkEventHandler(worker1_DoWork);
|
||||
worker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker1_Finish);
|
||||
|
||||
worker1.RunWorkerAsync();
|
||||
}
|
||||
|
||||
// Collect resources required for package.
|
||||
string iconFile = "Icon.ico";
|
||||
private void worker1_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
// Initialize delegate to process logs.
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
// Create first log entry.
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.StartPkgCreation, upid, 0));
|
||||
|
||||
int errors = 0;
|
||||
int countResources = 0;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var dir in OPFDirs)
|
||||
{
|
||||
// Create directory structure
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.GenPkgStructure, null, 0));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.Write("// Cannot write to directory!");
|
||||
errors++;
|
||||
}
|
||||
|
||||
// Begin importing resources to package.
|
||||
try
|
||||
{
|
||||
if (opfGen.pkgDisplayImg != "")
|
||||
{
|
||||
// Get image file extension.
|
||||
string ext = opfGen.pkgDisplayImg.Substring(opfGen.pkgDisplayImg.Length - 4);
|
||||
File.Copy(opfGen.pkgDisplayImg,
|
||||
OPFDirs[1] + PackageStructure.displayImage + ext);
|
||||
|
||||
countResources++;
|
||||
}
|
||||
|
||||
if (opfGen.pkgLicAgreement != "")
|
||||
{
|
||||
File.Copy(opfGen.pkgLicAgreement,
|
||||
OPFDirs[1] + PackageStructure.licenceFile);
|
||||
|
||||
countResources++;
|
||||
}
|
||||
|
||||
if (opfGen.pkgMoreInfo != "")
|
||||
{
|
||||
File.Copy(opfGen.pkgMoreInfo,
|
||||
OPFDirs[1] + PackageStructure.readmeFile);
|
||||
|
||||
countResources++;
|
||||
}
|
||||
|
||||
if (opfGen.pkgBatInst != null)
|
||||
{
|
||||
int pos = 1;
|
||||
|
||||
foreach (var bat in opfGen.pkgBatInst)
|
||||
{
|
||||
File.Copy(bat,
|
||||
OPFDirs[3] + Convert.ToString(pos) + ".bat");
|
||||
pos++;
|
||||
|
||||
countResources++;
|
||||
}
|
||||
}
|
||||
if (opfGen.pkgBatRem != null)
|
||||
{
|
||||
int pos = 1;
|
||||
|
||||
foreach (var bat in opfGen.pkgBatRem)
|
||||
{
|
||||
File.Copy(bat,
|
||||
OPFDirs[4] + Convert.ToString(pos) + ".bat");
|
||||
pos++;
|
||||
|
||||
countResources++;
|
||||
}
|
||||
|
||||
if (opfGen.pkgIcon != "")
|
||||
{
|
||||
File.Copy(opfGen.pkgIcon, OPFDirs[1] + iconFile);
|
||||
|
||||
countResources++;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy current executable (Open Packager) to build path.
|
||||
File.Copy(System.Reflection.Assembly.GetEntryAssembly().Location, cPackageDir + "\\Setup.exe");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.ImportResources, null, countResources));
|
||||
|
||||
if (errors != 0) { e.Result = errors; }
|
||||
}
|
||||
private void worker1_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(25);
|
||||
|
||||
worker2.WorkerSupportsCancellation = true;
|
||||
worker2.DoWork += new DoWorkEventHandler(worker2_DoWork);
|
||||
worker2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker2_Finish);
|
||||
worker2.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// Generate Setup.xml file.
|
||||
private void worker2_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
try
|
||||
{
|
||||
using (XmlWriter xml = XmlWriter.Create(OPFDirs[1] + "Setup.xml")) //using (XmlWriter xml = XmlWriter.Create(cPackageDir + "\\OPF\\" + "Setup.xml"))
|
||||
{
|
||||
xml.WriteStartDocument();
|
||||
xml.WriteStartElement(XML.WriteToXml.xmlStartElement);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Package),
|
||||
writeToXml.pkgName);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Sku),
|
||||
writeToXml.pkgSku);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Version),
|
||||
Convert.ToString(writeToXml.pkgVer));
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Upid),
|
||||
writeToXml.pkgUpid);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Author),
|
||||
writeToXml.pkgAuthor);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.ShortcutPath),
|
||||
writeToXml.pkgShortcutFile);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.ShortcutName),
|
||||
writeToXml.pkgShortcutName);
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Password),
|
||||
Convert.ToString(writeToXml.pkgPassword));
|
||||
xml.WriteElementString(Convert.ToString(XML.WriteToXml.xmlElement.Size),
|
||||
Convert.ToString(writeToXml.pkgSize));
|
||||
|
||||
xml.WriteEndElement();
|
||||
xml.WriteEndDocument();
|
||||
}
|
||||
|
||||
|
||||
using (StreamWriter sw = new StreamWriter(OPFDirs[0] + "\\Autorun.inf"))
|
||||
{
|
||||
sw.WriteLine("[autorun]");
|
||||
sw.WriteLine("open=Setup.exe");
|
||||
// Write custom icon path if specified in setup otherwise
|
||||
// use Setup.exe's icon.
|
||||
if (opfGen.pkgIcon != "")
|
||||
{
|
||||
sw.WriteLine("icon=" + opfDirPath + iconFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
sw.WriteLine(@"icon=Setup.exe,0");
|
||||
}
|
||||
sw.WriteLine("label=" + writeToXml.pkgName);
|
||||
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
e.Result = 1;
|
||||
}
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.XmlGeneration, null, 0));
|
||||
}
|
||||
private void worker2_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(50);
|
||||
|
||||
worker3.WorkerSupportsCancellation = true;
|
||||
worker3.DoWork += new DoWorkEventHandler(worker3_DoWork);
|
||||
worker3.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker3_Finish);
|
||||
worker3.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// Create package using LMZA.
|
||||
private void worker3_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.CreateOPF, null, 0));
|
||||
|
||||
int countErrors = lmza.MakePackage("Data.7z", opfGen.pkgSourceDir, OPFDirs[1], opfGen.pkgCompressionLvl, opfGen.pkgPassword, false);
|
||||
if (countErrors != 0)
|
||||
{
|
||||
e.Result = countErrors;
|
||||
}
|
||||
}
|
||||
private void worker3_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(75);
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.CreatedOPF, null, 0));
|
||||
|
||||
worker4.WorkerSupportsCancellation = true;
|
||||
worker4.DoWork += new DoWorkEventHandler(worker4_DoWork);
|
||||
worker4.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker4_Finish);
|
||||
worker4.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.SevenZPkgError, null, 0));
|
||||
PackageGenFailed();
|
||||
}
|
||||
}
|
||||
|
||||
// Perform post package operations.
|
||||
private void worker4_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
int countErrors = 0;
|
||||
LMZAParser.Parser lmza = new LMZAParser.Parser();
|
||||
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.FinalOperations, null, opfGen.pkgPostOps));
|
||||
|
||||
switch (opfGen.pkgPostOps)
|
||||
{
|
||||
case 0:
|
||||
// Create SFX executable.
|
||||
countErrors = lmza.MakePackage(writeToXml.pkgName, cPackageDir, opfGen.pkgOutputDir, 0, "", true);
|
||||
break;
|
||||
case 1:
|
||||
// Re-zip archive with no compression.
|
||||
countErrors = lmza.MakePackage(writeToXml.pkgName, cPackageDir, opfGen.pkgOutputDir, 0, "", false);
|
||||
break;
|
||||
case 2:
|
||||
// Copy package as is without any further archiving.
|
||||
foreach (string dir in Directory.GetDirectories(cPackageDir, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
Directory.CreateDirectory(dir.Replace(cPackageDir, opfGen.pkgOutputDir));
|
||||
}
|
||||
|
||||
foreach (string item in Directory.GetFiles(cPackageDir, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
File.Copy(item, item.Replace(cPackageDir, opfGen.pkgOutputDir), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (countErrors != 0) { e.Result = countErrors; }
|
||||
}
|
||||
private void worker4_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
ProcessLogEntry ple = new ProcessLogEntry(WriteToTextFile);
|
||||
ple += new ProcessLogEntry(WriteToList);
|
||||
|
||||
if (e.Result == null)
|
||||
{
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.FinishedNoErrors, null, 0));
|
||||
UpdateProgress(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
ple(lWriter.Records(LogWriter.Writer.logEntries.FinishedWithErrors, null, 0));
|
||||
PackageGenFailed();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void WriteToList(string entry)
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new Action(() => this.listLog.Items.Add(entry)));
|
||||
}
|
||||
|
||||
private void WriteToTextFile(string entry)
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new Action(() =>
|
||||
{
|
||||
lWriter.WriteOutLog(entry, logDir);
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the current progress of the package from here.
|
||||
/// Int represents the step position.
|
||||
/// </summary>
|
||||
/// <param name="prog"></param>
|
||||
private void UpdateProgress (int prog)
|
||||
{
|
||||
switch (prog)
|
||||
{
|
||||
case 25:
|
||||
imgProg1.Visibility = Visibility.Visible;
|
||||
prog1.IsIndeterminate = false;
|
||||
prog1.Value = 100;
|
||||
prog2.IsIndeterminate = true;
|
||||
break;
|
||||
case 50:
|
||||
imgProg2.Visibility = Visibility.Visible;
|
||||
prog2.IsIndeterminate = false;
|
||||
prog2.Value = 100;
|
||||
prog3.IsIndeterminate = true;
|
||||
break;
|
||||
case 75:
|
||||
imgProg3.Visibility = Visibility.Visible;
|
||||
prog3.IsIndeterminate = false;
|
||||
prog3.Value = 100;
|
||||
prog4.IsIndeterminate = true;
|
||||
break;
|
||||
case 100:
|
||||
imgProg4.Visibility = Visibility.Visible;
|
||||
prog4.IsIndeterminate = false;
|
||||
prog4.Value = 100;
|
||||
|
||||
btnAbort.IsEnabled = false;
|
||||
btnClose.IsEnabled = true;
|
||||
listLog.Foreground = System.Windows.Media.Brushes.Green;
|
||||
break;
|
||||
}
|
||||
|
||||
progOverall.Value = prog;
|
||||
if (prog == 100) { mh.stdMessage(MessageHandler.msgCodes.INF_CreationWiz2_FinishedNoErr, null); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to method invoke a package failure.
|
||||
/// </summary>
|
||||
private void PackageGenFailed()
|
||||
{
|
||||
btnClose.IsEnabled = true;
|
||||
listLog.Foreground = System.Windows.Media.Brushes.Red;
|
||||
|
||||
tabProgress.IsEnabled = false; // Disable progress tab.
|
||||
tabGroup.SelectedIndex = 1; // Show log.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simulate cancellation of package.
|
||||
/// </summary>
|
||||
private void PackageGenCancelled()
|
||||
{
|
||||
PackageGenFailed();
|
||||
mh.errorMessage(MessageHandler.msgCodes.ERR_PackageCreationFail, null);
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Start packaging process.
|
||||
startPackage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<Window x:Class="OpenPackager.SetupWizard.InstallerForm"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="InstallerWiz1" Height="600" Width="800" WindowStartupLocation="CenterScreen" Background="#FF0094B4" Closing="Window_Closing" MinWidth="800" MinHeight="600" Visibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Auto" ResizeMode="NoResize">
|
||||
<Grid>
|
||||
<Rectangle x:Name="dockControls" Fill="#FF00B4A5" Stroke="Black" StrokeThickness="0" Height="41" VerticalAlignment="Bottom" Margin="0,0,-2,-2"/>
|
||||
<TabControl x:Name="tabControl" Margin="138,0,0,39">
|
||||
<TabItem x:Name="tabLicAgreement" Header="Licence Agreement">
|
||||
<Grid Background="White">
|
||||
<RadioButton x:Name="radioDeclineLicAgreement" Content="Decline" HorizontalAlignment="Left" Margin="10,0,0,10" GroupName="licAgreement" Height="15" VerticalAlignment="Bottom"/>
|
||||
<RadioButton x:Name="radioAcceptLicAgreement" Content="Accept" Margin="0,0,10,10" GroupName="licAgreement" HorizontalAlignment="Right" Width="55" Height="15" VerticalAlignment="Bottom"/>
|
||||
<TextBox x:Name="textLicAgreement" Margin="10,10,10,30" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem x:Name="tabReadme" Header="Readme">
|
||||
<Grid Background="White">
|
||||
<TextBox x:Name="textReadme" Margin="10" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" IsReadOnly="True"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem x:Name="tabInstallOptions" Header="Install Options" Margin="-1,0,1,0">
|
||||
<Grid Background="White">
|
||||
<CheckBox x:Name="checkCreateDesktopShortcut" Content="Create Desktop Shortcut" Height="16" Margin="10,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="222"/>
|
||||
<Label x:Name="labelInstallSize" Content="Install Size: " HorizontalAlignment="Left" Margin="10,0,0,10" Height="26" VerticalAlignment="Bottom"/>
|
||||
<ProgressBar x:Name="progFreeSpace" Margin="0,0,10,10" HorizontalAlignment="Right" Width="349" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelFreeSpace" Content="Free Space:" Margin="0,0,365,10" HorizontalAlignment="Right" Width="70" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelFreeSpaceGb" Content="0Gb" Margin="0,0,10,10" HorizontalAlignment="Right" Width="349" Height="26" VerticalAlignment="Bottom" FontWeight="Bold" HorizontalContentAlignment="Center"/>
|
||||
<Rectangle x:Name="divider" Fill="#FF00B4A5" Margin="10,0,10,48" Stroke="Black" StrokeThickness="0" Height="1" VerticalAlignment="Bottom"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Button x:Name="btnInstall" Content="Install" Margin="0,0,10,8" HorizontalAlignment="Right" Width="75" Height="22" VerticalAlignment="Bottom" Click="btnInstall_Click"/>
|
||||
<TextBox x:Name="textInstallPath" Margin="86,0,304,9" TextWrapping="Wrap" Height="22" VerticalAlignment="Bottom" TextChanged="textInstallPath_TextChanged"/>
|
||||
<Button x:Name="btnBrowsePath" Content="..." Margin="0,0,284,9" HorizontalAlignment="Right" Width="20" Height="22" VerticalAlignment="Bottom" ToolTip="Browse..." Click="btnBrowsePath_Click"/>
|
||||
<Label x:Name="labelInstallPath" Content="Install Path:" Margin="10,0,0,8" Height="26" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="76"/>
|
||||
<Label x:Name="labelVersion" Content="v0.0" HorizontalAlignment="Left" Margin="10,0,0,44" Foreground="White" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelAuthor" Content="Author" Margin="0,-1,10,0" Foreground="White" RenderTransformOrigin="0.5,0.5" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Top" HorizontalAlignment="Right" Width="197">
|
||||
<Label.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="1"/>
|
||||
<SkewTransform AngleY="0" AngleX="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</Label.LayoutTransform>
|
||||
<Label.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="1"/>
|
||||
<SkewTransform AngleY="0" AngleX="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</Label.RenderTransform>
|
||||
</Label>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,234 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using System.IO;
|
||||
using OpenPackager.XML;
|
||||
|
||||
namespace OpenPackager.SetupWizard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for InstallForm.xaml
|
||||
/// </summary>
|
||||
public partial class InstallerForm : Window
|
||||
{
|
||||
public LoadPackage loadPackage;
|
||||
|
||||
public InstallerForm(LoadPackage loadPackage)
|
||||
{
|
||||
InitializeComponent();
|
||||
// Load XML data for later use in InstallerWiz2.
|
||||
this.loadPackage = loadPackage;
|
||||
PopulateForm();
|
||||
}
|
||||
|
||||
private bool licAgreementExists = true;
|
||||
private delegate void FreeSpaceCalculator(long usedSpace, long totalSize);
|
||||
/// <summary>
|
||||
/// Load information into form using previously imported
|
||||
/// XML data.
|
||||
/// </summary>
|
||||
/// <param name="loadPackage"></param>
|
||||
private void PopulateForm()
|
||||
{
|
||||
// Set program files directory.
|
||||
bool isSysArch64 = SysEnvironment.isSysArch64;
|
||||
if (isSysArch64)
|
||||
{
|
||||
textInstallPath.Text = String.Format("{0}\\{1}", Environment.GetEnvironmentVariable("ProgramFiles(x86)"), loadPackage.pkgName);
|
||||
}
|
||||
else
|
||||
{
|
||||
textInstallPath.Text = String.Format("{0}\\{1}", Environment.GetEnvironmentVariable("ProgramFiles"), loadPackage.pkgName);
|
||||
}
|
||||
|
||||
|
||||
#region Load Directory Data
|
||||
|
||||
if (!File.Exists(PackageStructure.opfDirs[0] + PackageStructure.licenceFile))
|
||||
{
|
||||
tabControl.Items.Remove(tabLicAgreement);
|
||||
licAgreementExists = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
textLicAgreement.Text = File.ReadAllText(PackageStructure.opfDirs[0] + PackageStructure.licenceFile);
|
||||
}
|
||||
|
||||
if (!File.Exists(PackageStructure.opfDirs[0] + PackageStructure.readmeFile))
|
||||
{
|
||||
tabControl.Items.Remove(tabReadme);
|
||||
}
|
||||
else
|
||||
{
|
||||
textReadme.Text = File.ReadAllText(PackageStructure.opfDirs[0] + PackageStructure.readmeFile);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Load XML Data
|
||||
|
||||
if (loadPackage.pkgName != null)
|
||||
{
|
||||
this.Title = String.Format("{0} (1/2)", loadPackage.pkgName);
|
||||
}
|
||||
|
||||
if (loadPackage.pkgVer > 0)
|
||||
{
|
||||
labelVersion.Content = String.Format("Version: {0:0}", loadPackage.pkgVer);
|
||||
}
|
||||
|
||||
if (loadPackage.pkgAuthor != null)
|
||||
{
|
||||
labelAuthor.Content = loadPackage.pkgAuthor;
|
||||
}
|
||||
|
||||
if (loadPackage.pkgShortcutName != null)
|
||||
{
|
||||
labelInstallSize.Content = String.Format("Install Size: {0}MB", loadPackage.pkgSize / 1024 / 1024);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void btnInstall_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckInstallation(licAgreementExists,
|
||||
(bool)radioAcceptLicAgreement.IsChecked,
|
||||
loadPackage.pkgPassword);
|
||||
}
|
||||
|
||||
MessageHandler mh = new MessageHandler();
|
||||
/// <summary>
|
||||
/// Check licence agreement status and receives password if the package
|
||||
/// has been password protected.
|
||||
/// </summary>
|
||||
/// <param name="licFileExists"></param>
|
||||
/// <param name="licAcceptAgreement"></param>
|
||||
/// <param name="isPassworded"></param>
|
||||
private void CheckInstallation(bool licFileExists, bool licAcceptAgreement, bool isPassworded)
|
||||
{
|
||||
// Check whether licence agreement has been accepted if one exists.
|
||||
if (licFileExists && licAcceptAgreement ||
|
||||
!licAgreementExists)
|
||||
{
|
||||
// Show password dialog if a password is set for the current package.
|
||||
string pass = null;
|
||||
if (isPassworded)
|
||||
{
|
||||
Dialogs.PasswordEntry pe = new Dialogs.PasswordEntry();
|
||||
pe.ShowDialog();
|
||||
|
||||
pass = pe.password;
|
||||
if (pass != null)
|
||||
{
|
||||
Debug.Write("Password: " + pass);
|
||||
}
|
||||
}
|
||||
|
||||
StartInstallation(loadPackage,
|
||||
textInstallPath.Text,
|
||||
pass,
|
||||
(bool) checkCreateDesktopShortcut.IsChecked);
|
||||
}
|
||||
else
|
||||
{
|
||||
mh.errorMessage(MessageHandler.msgCodes.ERR_InstallerWiz1__LicAgreementNotAccepted, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load InstallerWiz2 with the required overloads.
|
||||
/// </summary>
|
||||
/// <param name="loadPackage"></param>
|
||||
/// <param name="installPath"></param>
|
||||
/// <param name="pass"></param>
|
||||
private void StartInstallation(XML.WriteToXml loadPackage, string installPath, string pass, bool desktopShortcut)
|
||||
{
|
||||
// Only load next form if the package isn't password protected or if
|
||||
// there has been a valid password entered.
|
||||
if (!loadPackage.pkgPassword ||
|
||||
pass != null)
|
||||
{
|
||||
userClosedForm = false;
|
||||
CreationWizard.InstallerWiz2 iw2 = new CreationWizard.InstallerWiz2(loadPackage, textInstallPath.Text, pass, desktopShortcut);
|
||||
iw2.Show();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region Form Logic
|
||||
|
||||
// Retrieve default system drive letter.
|
||||
private static string curInsDriveLetter =
|
||||
Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System));
|
||||
private void textInstallPath_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
// Ensure the path is not empty before extracting drive letter.
|
||||
if (textInstallPath.Text.Length > 0)
|
||||
{
|
||||
curInsDriveLetter = textInstallPath.Text.Substring(0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
curInsDriveLetter = null;
|
||||
}
|
||||
|
||||
// Get current drive letter from text box and determite available
|
||||
// space. Update UI.
|
||||
if (Directory.Exists(curInsDriveLetter + ":"))
|
||||
{
|
||||
DriveInfo driveInfo = new DriveInfo(curInsDriveLetter);
|
||||
FreeSpaceCalculator fsCalc = new FreeSpaceCalculator(UpdateProgressBar);
|
||||
fsCalc += new FreeSpaceCalculator(UpdateFreeSpaceLabel);
|
||||
fsCalc(driveInfo.TotalFreeSpace, driveInfo.TotalSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No drive exists
|
||||
labelFreeSpaceGb.Content = "";
|
||||
progFreeSpace.Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool userClosedForm = true;
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (userClosedForm == true)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowsePath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CommonIO cIO = new CommonIO();
|
||||
textInstallPath.Text = String.Format("{0}\\{1}", cIO.BrowseFolder(textInstallPath.Text), loadPackage.pkgName);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
|
||||
private int ConvertToGb(long value)
|
||||
{
|
||||
return Convert.ToInt16(value / 1024 / 1024 / 1024);
|
||||
}
|
||||
|
||||
private void UpdateFreeSpaceLabel(long usedSpace, long totalSize)
|
||||
{
|
||||
labelFreeSpaceGb.Content = String.Format("{0}GB/{1}GB",
|
||||
ConvertToGb(usedSpace),
|
||||
ConvertToGb(totalSize));
|
||||
}
|
||||
|
||||
private void UpdateProgressBar(long usedSpace, long totalSize)
|
||||
{
|
||||
progFreeSpace.Maximum = ConvertToGb(totalSize);
|
||||
progFreeSpace.Value = ConvertToGb(usedSpace);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<Window x:Class="OpenPackager.CreationWizard.InstallerWiz2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:OpenPackager.CreationWizard"
|
||||
mc:Ignorable="d"
|
||||
Title="InstallerWiz2" Height="600" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Closing="Window_Closing">
|
||||
<Grid Background="#FF0094B4">
|
||||
<Rectangle x:Name="dockControls" Fill="#FF00B4A5" Stroke="Black" StrokeThickness="0" Height="41" VerticalAlignment="Bottom"/>
|
||||
<TabControl x:Name="tabControl" Margin="138,0,0,41">
|
||||
<TabItem Header="Progress">
|
||||
<Grid Background="White">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="371*"/>
|
||||
<RowDefinition Height="131*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Expander x:Name="progExpander" Header="More Information" Margin="10,297,10,10" Visibility="Visible" Grid.RowSpan="2">
|
||||
<Grid Background="White" Height="185">
|
||||
<Grid HorizontalAlignment="Left" Height="160" VerticalAlignment="Top" Width="614">
|
||||
<Image x:Name="imgProg1" Height="25" Margin="538,10,0,0" VerticalAlignment="Top" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" HorizontalAlignment="Left" Width="66"/>
|
||||
<ProgressBar x:Name="prog1" Height="10" Margin="222,15,93,0" VerticalAlignment="Top" IsIndeterminate="True"/>
|
||||
<Label x:Name="label1" Content="Step 1: Generating Structure" Margin="10,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="166"/>
|
||||
<Label x:Name="label2" Content="Step 2: Extracting Data" Margin="10,41,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="166"/>
|
||||
<Label x:Name="label3" Content="Step 3: Processing Content" Margin="10,72,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="183"/>
|
||||
<Label x:Name="label4" Content="Step 4: Migrating Data Files" Margin="10,103,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="183"/>
|
||||
<Label x:Name="label5" Content="Step 5: Integrating with Windows" Margin="10,134,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="196"/>
|
||||
<ProgressBar x:Name="prog5" Height="10" Margin="222,140,93,0" VerticalAlignment="Top"/>
|
||||
<ProgressBar x:Name="prog4" Height="10" Margin="222,111,93,0" VerticalAlignment="Top"/>
|
||||
<ProgressBar x:Name="prog2" Height="10" Margin="222,49,93,0" VerticalAlignment="Top"/>
|
||||
<Image x:Name="imgProg5" Height="25" Margin="538,134,0,0" VerticalAlignment="Top" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" HorizontalAlignment="Left" Width="66"/>
|
||||
<Image x:Name="imgProg4" Height="25" Margin="538,104,0,0" VerticalAlignment="Top" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" HorizontalAlignment="Left" Width="66"/>
|
||||
<Image x:Name="imgProg3" Height="25" Margin="538,74,0,0" VerticalAlignment="Top" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" HorizontalAlignment="Left" Width="66"/>
|
||||
<Image x:Name="imgProg2" Height="25" Margin="538,41,0,0" VerticalAlignment="Top" Source="/Open Packager;component/Resources/ProgressComplete.png" Visibility="Hidden" HorizontalAlignment="Left" Width="66"/>
|
||||
<ProgressBar x:Name="prog3" Height="10" Margin="222,81,93,0" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Expander>
|
||||
<ProgressBar x:Name="progOverall" Margin="12,0,10,89.714" IsIndeterminate="True" Height="52" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelOverall" Content="Installation in Progress" Margin="179,0,196,94.714" FontSize="24" Height="42" VerticalAlignment="Bottom"/>
|
||||
<TextBlock x:Name="textPkgName" Margin="10,10,10,0" TextWrapping="Wrap" Text="Package Name Here" VerticalAlignment="Top" Height="141" FontWeight="Bold" FontSize="48"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Button x:Name="btnCancel" Content="Abort" Margin="10,0,0,11" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="75" Click="btnCancel_Click"/>
|
||||
<RichTextBox x:Name="labelProgress" HorizontalAlignment="Left" Height="251" VerticalAlignment="Top" Width="123" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" IsReadOnly="True" IsDocumentEnabled="True" BorderThickness="0" Margin="10,10,0,0" FontStyle="Italic">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Run Text="To get detailed information regarding the installation; expand the "More Information" element shown to your right."/>
|
||||
</Paragraph>
|
||||
<Paragraph>
|
||||
<Run Text="Installation time varies depending on the size of the install, please be patient."/>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<Label x:Name="labelVersion" Content="v0.0" HorizontalAlignment="Left" Margin="10,0,0,46" Foreground="White" Height="26" VerticalAlignment="Bottom"/>
|
||||
<Label x:Name="labelAuthor" Content="Author" Margin="0,-1,10,0" Foreground="White" RenderTransformOrigin="0.5,0.5" HorizontalContentAlignment="Right" Height="26" VerticalAlignment="Top" HorizontalAlignment="Right" Width="197">
|
||||
<Label.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="1"/>
|
||||
<SkewTransform AngleY="0" AngleX="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</Label.LayoutTransform>
|
||||
<Label.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleY="1" ScaleX="1"/>
|
||||
<SkewTransform AngleY="0" AngleX="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</Label.RenderTransform>
|
||||
</Label>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,513 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using OpenPackager.XML;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Threading;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenPackager.CreationWizard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for InstallerWiz2.xaml
|
||||
/// </summary>
|
||||
public partial class InstallerWiz2 : Window
|
||||
{
|
||||
private WriteToXml loadedXml;
|
||||
private string pass;
|
||||
private string installPath;
|
||||
private string setupPath;
|
||||
private string tempExtractDir = "\\Temp";
|
||||
private bool desktopShortcut;
|
||||
private LogWriter.Writer lWriter = new LogWriter.Writer();
|
||||
private MessageHandler mh = new MessageHandler();
|
||||
|
||||
BackgroundWorker bw1 = new BackgroundWorker();
|
||||
BackgroundWorker bw2 = new BackgroundWorker();
|
||||
BackgroundWorker bw3 = new BackgroundWorker();
|
||||
BackgroundWorker bw4 = new BackgroundWorker();
|
||||
BackgroundWorker bw5 = new BackgroundWorker();
|
||||
|
||||
public InstallerWiz2(WriteToXml _loadedXml, string _installPath, string _pass, bool _desktopShortcut)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.loadedXml = _loadedXml;
|
||||
this.installPath = _installPath;
|
||||
this.pass = _pass;
|
||||
this.desktopShortcut = _desktopShortcut;
|
||||
this.setupPath = String.Format("{0}\\{1}\\", installPath, loadedXml.pkgUpid);
|
||||
|
||||
PopulateForm();
|
||||
StartPackage();
|
||||
}
|
||||
|
||||
private void PopulateForm()
|
||||
{
|
||||
textPkgName.Text = loadedXml.pkgName;
|
||||
labelAuthor.Content = loadedXml.pkgAuthor;
|
||||
labelVersion.Content = String.Format("Version: {0:0}", loadedXml.pkgVer);
|
||||
}
|
||||
|
||||
#region Form Functionality
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
btnCancel.IsEnabled = false;
|
||||
|
||||
if (bw1.IsBusy) { bw1.CancelAsync(); }
|
||||
if (bw2.IsBusy) { bw2.CancelAsync(); }
|
||||
if (bw3.IsBusy) { bw3.CancelAsync(); }
|
||||
if (bw4.IsBusy) { bw4.CancelAsync(); }
|
||||
if (bw5.IsBusy) { bw5.CancelAsync(); }
|
||||
|
||||
CleanupSetupDirectory(installPath);
|
||||
InstallFailure(true);
|
||||
|
||||
mh.errorMessage(MessageHandler.msgCodes.Err_InstallerWiz2_InstallAborted, null);
|
||||
}
|
||||
|
||||
private bool userClosedForm = false;
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (userClosedForm == true)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Workers
|
||||
|
||||
private void StartPackage()
|
||||
{
|
||||
bw1.WorkerSupportsCancellation = true;
|
||||
bw1.DoWork += new DoWorkEventHandler(bw1_DoWork);
|
||||
bw1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw1_Finish);
|
||||
bw1.RunWorkerAsync();
|
||||
}
|
||||
|
||||
private void bw1_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
// Create directories
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(installPath);
|
||||
Directory.CreateDirectory(setupPath);
|
||||
Directory.CreateDirectory(setupPath + tempExtractDir);
|
||||
|
||||
DirectoryInfo setup = new DirectoryInfo(setupPath);
|
||||
setup.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
|
||||
setup.Create();
|
||||
|
||||
File.Copy(Directory.GetCurrentDirectory() + "\\Open Packager.exe", installPath + "\\Setup.exe");
|
||||
|
||||
// Copy all setup files, excluding archives to the setup's data directory.
|
||||
string currentDataDir = String.Format("{0}\\{1}", Directory.GetCurrentDirectory().ToString(), PackageStructure.opfDirs[0]);
|
||||
foreach (var file in Directory.GetFiles(currentDataDir, "*.*"))
|
||||
{
|
||||
if (!file.Contains(".7z"))
|
||||
{
|
||||
File.Copy(file, file.Replace(currentDataDir, setupPath));
|
||||
}
|
||||
}
|
||||
|
||||
// Copy all other subdirectories and files into data directory.
|
||||
foreach (var dir in Directory.GetDirectories(currentDataDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
Directory.CreateDirectory(dir.Replace(currentDataDir, setupPath));
|
||||
foreach (var file in Directory.GetFiles(dir, "*.*"))
|
||||
{
|
||||
File.Copy(file, file.Replace(currentDataDir, setupPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
errors++;
|
||||
}
|
||||
|
||||
if (errors != 0) { e.Result = errors; }
|
||||
}
|
||||
|
||||
private void bw1_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(20);
|
||||
|
||||
bw2.WorkerSupportsCancellation = true;
|
||||
bw2.DoWork += new DoWorkEventHandler(bw2_DoWork);
|
||||
bw2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw2_Finish);
|
||||
bw2.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.ErrorWriteToDisk, installPath, 0));
|
||||
mh.errorMessage(MessageHandler.msgCodes.Err_InstallerWiz2_FSAccessError, null);
|
||||
InstallFailure(false);
|
||||
}
|
||||
}
|
||||
|
||||
private LMZAParser.Parser lmza = new LMZAParser.Parser();
|
||||
private void bw2_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
int result = lmza.ExtractPackage(PackageStructure.zipName,
|
||||
Directory.GetCurrentDirectory() + "\\" + PackageStructure.opfDirs[0],
|
||||
setupPath + tempExtractDir,
|
||||
pass);
|
||||
|
||||
if (result != 0) { errors++; }
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
|
||||
if (errors != 0) { e.Result = errors; }
|
||||
}
|
||||
|
||||
private void bw2_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(40);
|
||||
|
||||
bw3.WorkerSupportsCancellation = true;
|
||||
bw3.DoWork += new DoWorkEventHandler(bw3_DoWork);
|
||||
bw3.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw3_Finish);
|
||||
bw3.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.ExtractError, null, 0));
|
||||
mh.errorMessage(MessageHandler.msgCodes.Err_InstallerWiz2_ExtractError, null);
|
||||
InstallFailure(false);
|
||||
}
|
||||
}
|
||||
|
||||
private long noOfInstallFiles = 0;
|
||||
private void bw3_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
try
|
||||
{
|
||||
long dirSize = 0;
|
||||
|
||||
string[] allFiles = Directory.GetFiles(setupPath + tempExtractDir, "*.*", SearchOption.AllDirectories);
|
||||
foreach (var file in allFiles)
|
||||
{
|
||||
FileInfo info = new FileInfo(file);
|
||||
dirSize += info.Length;
|
||||
noOfInstallFiles++;
|
||||
}
|
||||
|
||||
if (dirSize != loadedXml.pkgSize)
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
|
||||
if (errors != 0) { e.Result = errors; }
|
||||
}
|
||||
|
||||
private void bw3_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(60);
|
||||
|
||||
bw4.WorkerSupportsCancellation = true;
|
||||
bw4.DoWork += new DoWorkEventHandler(bw4_DoWork);
|
||||
bw4.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw4_Finish);
|
||||
bw4.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.ExtractSizeMismatch, null, 0));
|
||||
mh.errorMessage(MessageHandler.msgCodes.Err_InstallerWiz2_BadPackage, loadedXml.pkgName);
|
||||
InstallFailure(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void bw4_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new Action(() =>{
|
||||
this.prog4.Maximum = noOfInstallFiles;
|
||||
this.progOverall.Maximum = noOfInstallFiles;
|
||||
}));
|
||||
|
||||
try
|
||||
{
|
||||
string tempExtractPath = setupPath + tempExtractDir;
|
||||
|
||||
// Move files in temp path to installation directory.
|
||||
foreach (var file in Directory.GetFiles(tempExtractPath, "*.*"))
|
||||
{
|
||||
File.Move(file, file.Replace(tempExtractPath, installPath));
|
||||
UpdateCopyProgress();
|
||||
}
|
||||
|
||||
// Move files in subdirectories to installation directory.
|
||||
foreach (var dir in Directory.GetDirectories(tempExtractPath, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
Directory.CreateDirectory(dir.Replace(tempExtractPath, installPath));
|
||||
foreach (var file in Directory.GetFiles(dir, "*.*"))
|
||||
{
|
||||
File.Move(file, file.Replace(tempExtractPath, installPath));
|
||||
UpdateCopyProgress();
|
||||
}
|
||||
}
|
||||
|
||||
Directory.Delete(tempExtractPath, true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
if (errors != 0) { e.Result = errors; }
|
||||
}
|
||||
|
||||
private void bw4_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(80);
|
||||
|
||||
bw5.WorkerSupportsCancellation = true;
|
||||
bw5.DoWork += new DoWorkEventHandler(bw5_DoWork);
|
||||
bw5.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw5_Finish);
|
||||
bw5.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.ErrorWriteToDisk, installPath, 0));
|
||||
mh.errorMessage(MessageHandler.msgCodes.Err_InstallerWiz2_FSAccessError, null);
|
||||
InstallFailure(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void bw5_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
int errors = 0;
|
||||
|
||||
try
|
||||
{
|
||||
Process proc = new Process();
|
||||
foreach (var file in Directory.GetFiles(setupPath +
|
||||
PackageStructure.opfDirs[2].Replace("Data", "")))
|
||||
{
|
||||
proc.StartInfo.FileName = file;
|
||||
proc.StartInfo.WorkingDirectory = installPath;
|
||||
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
proc.Start();
|
||||
|
||||
while (!proc.HasExited)
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
if (proc.ExitCode != 0)
|
||||
{
|
||||
errors = proc.ExitCode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region Create Icons
|
||||
|
||||
// Desktop Shortcut
|
||||
Components.WinIntegration desktopShortcut = new Components.WinIntegration();
|
||||
if (loadedXml.pkgShortcutFile != null)
|
||||
{
|
||||
desktopShortcut.CreateShortcut(loadedXml.pkgName,
|
||||
loadedXml.pkgShortcutFile,
|
||||
installPath,
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
|
||||
"Icon.ico");
|
||||
}
|
||||
|
||||
// Start Menu
|
||||
|
||||
string programDir = @"%appdata%\Microsoft\Windows\Start Menu\Programs\" + loadedXml.pkgName;
|
||||
Directory.CreateDirectory(programDir);
|
||||
|
||||
Components.WinIntegration uninstallShortcut = new Components.WinIntegration();
|
||||
uninstallShortcut.CreateShortcut("Uninstall",
|
||||
"Setup.exe",
|
||||
installPath,
|
||||
programDir,
|
||||
"Icon.ico");
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
if (errors != 0) { e.Result = errors; }
|
||||
}
|
||||
|
||||
private void bw5_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Result == null)
|
||||
{
|
||||
UpdateProgress(100);
|
||||
InstallComplete();
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.ExternalScriptError, e.Result.ToString(), 0));
|
||||
|
||||
MessageBoxResult result = MessageBox.Show("An interal script file did not shutdown cleanly. Would you like to continue?",
|
||||
"Open Packager", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
if (result == MessageBoxResult.No)
|
||||
{
|
||||
InstallFailure(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateProgress(100);
|
||||
InstallComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void UpdateProgress(int prog)
|
||||
{
|
||||
switch (prog)
|
||||
{
|
||||
case 20:
|
||||
imgProg1.Visibility = Visibility.Visible;
|
||||
prog1.IsIndeterminate = false;
|
||||
prog1.Value = 100;
|
||||
prog2.IsIndeterminate = true;
|
||||
break;
|
||||
case 40:
|
||||
imgProg2.Visibility = Visibility.Visible;
|
||||
prog2.IsIndeterminate = false;
|
||||
prog2.Value = 100;
|
||||
prog3.IsIndeterminate = true;
|
||||
break;
|
||||
case 60:
|
||||
imgProg3.Visibility = Visibility.Visible;
|
||||
prog3.IsIndeterminate = false;
|
||||
prog3.Value = 100;
|
||||
//
|
||||
progOverall.IsIndeterminate = false;
|
||||
break;
|
||||
case 80:
|
||||
imgProg4.Visibility = Visibility.Visible;
|
||||
prog4.IsIndeterminate = false;
|
||||
prog4.Maximum = 100;
|
||||
prog4.Value = 100;
|
||||
prog5.IsIndeterminate = true;
|
||||
//
|
||||
progOverall.Maximum = 100;
|
||||
progOverall.IsIndeterminate = true;
|
||||
break;
|
||||
case 100:
|
||||
imgProg5.Visibility = Visibility.Visible;
|
||||
prog5.IsIndeterminate = false;
|
||||
prog5.Value = 100;
|
||||
//
|
||||
progOverall.IsIndeterminate = false;
|
||||
progOverall.Value = 100;
|
||||
labelOverall.Content = "Installation Complete!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCopyProgress()
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new Action(() =>
|
||||
{
|
||||
this.prog4.Value++;
|
||||
this.progOverall.Value++;
|
||||
}));
|
||||
}
|
||||
|
||||
private void CleanupSetupDirectory(string path)
|
||||
{
|
||||
lmza.Abort();
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(path, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
File.SetAttributes(file, FileAttributes.Normal);
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
foreach (var dir in Directory.GetDirectories(path))
|
||||
{
|
||||
Directory.Delete(dir, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InstallFailure(bool aborted)
|
||||
{
|
||||
CleanupSetupDirectory(installPath);
|
||||
|
||||
btnCancel.IsEnabled = false;
|
||||
progOverall.IsIndeterminate = false;
|
||||
progOverall.Value = 0;
|
||||
progExpander.IsExpanded = false;
|
||||
progExpander.IsEnabled = false;
|
||||
|
||||
if (aborted)
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.PackageCancelled, null, 0));
|
||||
labelOverall.Content = "Installation Cancelled";
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.InstallFailure, null, 0));
|
||||
labelOverall.Content = "Installation Failed";
|
||||
}
|
||||
|
||||
userClosedForm = true;
|
||||
}
|
||||
|
||||
private void InstallComplete()
|
||||
{
|
||||
WriteToTextFile(lWriter.Records(LogWriter.Writer.logEntries.InstallSuccess, loadedXml.pkgName, 0));
|
||||
btnCancel.IsEnabled = false;
|
||||
userClosedForm = true;
|
||||
}
|
||||
|
||||
private void WriteToTextFile(string entry)
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new Action(() =>
|
||||
{
|
||||
lWriter.WriteOutLog(entry, SysEnvironment.instLogFileName);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<Window x:Class="OpenPackager.SetupWizard.MainSetupForm"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Open Packager" MinWidth="800" MinHeight="600" WindowStartupLocation="CenterScreen" Width="800" Height="600" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<Image x:Name="imgSetup" Margin="10,25,10,46"/>
|
||||
<Rectangle x:Name="dockControls" Fill="#FF00B4A5" Stroke="Black" StrokeThickness="0" Height="41" VerticalAlignment="Bottom"/>
|
||||
<Button x:Name="btnInstall" Content="Install" HorizontalAlignment="Left" Margin="10,0,0,10" Width="130" Height="20" VerticalAlignment="Bottom" IsDefault="True" Click="btnInstall_Click"/>
|
||||
<Button x:Name="btnUninstall" Content="Uninstall" HorizontalAlignment="Left" Margin="145,0,0,10" Width="130" Height="20" VerticalAlignment="Bottom" Click="btnUninstall_Click"/>
|
||||
<Menu x:Name="menuBar" Height="20" VerticalAlignment="Top">
|
||||
<MenuItem x:Name="menuBar_File" Header="File">
|
||||
<MenuItem x:Name="menuCreationWiz" Header="Creation Wizard" HorizontalAlignment="Left" Width="200" Height="24" Click="menuCreationWiz_Click"/>
|
||||
<Separator/>
|
||||
<MenuItem Cursor="" Header="Exit" Click="MenuItem_Click"/>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="menuBar_Help" Header="Help">
|
||||
<MenuItem x:Name="menuHelpResources" Header="Resources" HorizontalAlignment="Left" Width="145" Click="menuHelpResources_Click"/>
|
||||
<Separator/>
|
||||
<MenuItem x:Name="menuBar_About" Header="About" Click="menuBar_About_Click"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid Margin="59,208,33,207" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Label x:Name="labelTitle" Content="Open Packager" Margin="169,0,0,0" VerticalAlignment="Top" FontSize="72" FontWeight="Bold" HorizontalAlignment="Left" Width="531" Tag="logo"/>
|
||||
<Image x:Name="logoImage" HorizontalAlignment="Center" Height="153" VerticalAlignment="Center" Width="153" Stretch="UniformToFill" Source="/Open Packager;component/Resources/LogoV2.png" Tag="logo" Margin="0,0,547,0"/>
|
||||
<Label x:Name="labelWelcome" Content="Welcome to:" HorizontalAlignment="Left" Margin="169,0,0,0" VerticalAlignment="Top" Tag="logo"/>
|
||||
<Label x:Name="labelSubtitle" Content="The Open Source Packaging Solution" Margin="0,0,79,10" FontSize="24" Tag="logo" HorizontalAlignment="Right" Width="401" Height="42" VerticalAlignment="Bottom"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenPackager.SetupWizard
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SetupForm.xaml
|
||||
/// </summary>
|
||||
public partial class MainSetupForm : Window
|
||||
{
|
||||
MessageHandler mh = new MessageHandler();
|
||||
private bool loadXmlConfig;
|
||||
|
||||
public MainSetupForm(bool loadXmlConfig)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// TODO: Complete member initialization
|
||||
this.loadXmlConfig = loadXmlConfig;
|
||||
|
||||
if (!loadXmlConfig)
|
||||
{
|
||||
// Install/Uninstall buttons are hidden if there is no XML to be loaded.
|
||||
btnInstall.Visibility = Visibility.Hidden;
|
||||
btnUninstall.Visibility = Visibility.Hidden;
|
||||
dockControls.Visibility = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Todo if a valid XML config exists.
|
||||
this.Title = Startup.loadPackage.pkgName;
|
||||
|
||||
if (PackageStructure.displayImageExt != null)
|
||||
{
|
||||
logoImage.Visibility = Visibility.Hidden;
|
||||
labelWelcome.Visibility = Visibility.Hidden;
|
||||
labelTitle.Visibility = Visibility.Hidden;
|
||||
labelSubtitle.Visibility = Visibility.Hidden;
|
||||
|
||||
imgSetup.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\" +
|
||||
PackageStructure.opfDirs[0] +
|
||||
PackageStructure.displayImage +
|
||||
PackageStructure.displayImageExt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Form Functionality
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
if (e.Cancel == true)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
|
||||
private void menuBar_About_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Dialogs.AboutBox about = new Dialogs.AboutBox();
|
||||
about.ShowDialog();
|
||||
}
|
||||
|
||||
private void menuHelpResources_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
mh.stdMessage(MessageHandler.msgCodes.INF_NotYetImplemented, null);
|
||||
}
|
||||
|
||||
private void btnInstall_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//mHandler.stdMessage(MessageHandler.msgCodes.INF_NotYetImplemented, null);
|
||||
SetupWizard.InstallerForm insF = new SetupWizard.InstallerForm(Startup.loadPackage);
|
||||
insF.Show();
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void btnUninstall_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
mh.stdMessage(MessageHandler.msgCodes.INF_NotYetImplemented, null);
|
||||
}
|
||||
|
||||
private void menuCreationWiz_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CreationWizard.CreationWiz1 cw1 = new CreationWizard.CreationWiz1();
|
||||
cw1.Show();
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -0,0 +1,276 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{656D7B60-8CBF-4139-A28B-443FEBA70D4E}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>OpenPackager</RootNamespace>
|
||||
<AssemblyName>Open Packager</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>0.6.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<CodeAnalysisRuleSet>OpenPackager.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<CodeAnalysisRuleSet>OpenPackager.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>CF62D06B3FA506E9C305CD0D380CBFF29801BD82</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>OpenPackager_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Components\CommonIO.cs" />
|
||||
<Compile Include="Components\WinIntegration.cs" />
|
||||
<Compile Include="Forms\CreationWiz1.xaml.cs">
|
||||
<DependentUpon>CreationWiz1.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\CreationWiz2.xaml.cs">
|
||||
<DependentUpon>CreationWiz2.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\SizeCalculator.xaml.cs">
|
||||
<DependentUpon>SizeCalculator.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\AboutBox.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\AboutBox.Designer.cs">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\PasswordEntry.xaml.cs">
|
||||
<DependentUpon>PasswordEntry.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Components\LMZAParser.cs" />
|
||||
<Compile Include="Components\LogWriter.cs" />
|
||||
<Compile Include="Forms\InstallerWiz2.xaml.cs">
|
||||
<DependentUpon>InstallerWiz2.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\InstallerWiz1.xaml.cs">
|
||||
<DependentUpon>InstallerWiz1.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\WelcomeForm.xaml.cs">
|
||||
<DependentUpon>WelcomeForm.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\SevenZipWarning.xaml.cs">
|
||||
<DependentUpon>SevenZipWarning.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Shutdown.cs" />
|
||||
<Compile Include="XML\CreatePackage.cs" />
|
||||
<Compile Include="XML\LoadPackage.cs" />
|
||||
<Page Include="Forms\CreationWiz1.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Forms\CreationWiz2.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\SizeCalculator.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\PasswordEntry.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Forms\InstallerWiz2.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Startup.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Startup.xaml.cs">
|
||||
<DependentUpon>Startup.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Forms\InstallerWiz1.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Forms\WelcomeForm.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\SevenZipWarning.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Components\MessageHandler.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Dialogs\AboutBox.resx">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="OpenPackager.ruleset" />
|
||||
<None Include="OpenPackager_TemporaryKey.pfx" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\7z_Logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\HelpIcon.png" />
|
||||
<Resource Include="Resources\LogoV2.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\PassKey.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\ProgressComplete.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="IWshRuntimeLibrary">
|
||||
<Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="Rules for OpenPackager" Description="Code analysis rules for OpenPackager.csproj." ToolsVersion="14.0">
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
|
||||
<Rule Id="CA1000" Action="Warning" />
|
||||
<Rule Id="CA1001" Action="Warning" />
|
||||
<Rule Id="CA1002" Action="Warning" />
|
||||
<Rule Id="CA1003" Action="Warning" />
|
||||
<Rule Id="CA1004" Action="Warning" />
|
||||
<Rule Id="CA1005" Action="Warning" />
|
||||
<Rule Id="CA1006" Action="Warning" />
|
||||
<Rule Id="CA1007" Action="Warning" />
|
||||
<Rule Id="CA1008" Action="Warning" />
|
||||
<Rule Id="CA1009" Action="Warning" />
|
||||
<Rule Id="CA1010" Action="Warning" />
|
||||
<Rule Id="CA1011" Action="Warning" />
|
||||
<Rule Id="CA1012" Action="Warning" />
|
||||
<Rule Id="CA1013" Action="Warning" />
|
||||
<Rule Id="CA1014" Action="Warning" />
|
||||
<Rule Id="CA1016" Action="Warning" />
|
||||
<Rule Id="CA1017" Action="Warning" />
|
||||
<Rule Id="CA1018" Action="Warning" />
|
||||
<Rule Id="CA1019" Action="Warning" />
|
||||
<Rule Id="CA1020" Action="Warning" />
|
||||
<Rule Id="CA1021" Action="Warning" />
|
||||
<Rule Id="CA1023" Action="Warning" />
|
||||
<Rule Id="CA1024" Action="Warning" />
|
||||
<Rule Id="CA1025" Action="Warning" />
|
||||
<Rule Id="CA1026" Action="Warning" />
|
||||
<Rule Id="CA1027" Action="Warning" />
|
||||
<Rule Id="CA1028" Action="Warning" />
|
||||
<Rule Id="CA1030" Action="Warning" />
|
||||
<Rule Id="CA1031" Action="Warning" />
|
||||
<Rule Id="CA1032" Action="Warning" />
|
||||
<Rule Id="CA1033" Action="Warning" />
|
||||
<Rule Id="CA1034" Action="Warning" />
|
||||
<Rule Id="CA1035" Action="Warning" />
|
||||
<Rule Id="CA1036" Action="Warning" />
|
||||
<Rule Id="CA1038" Action="Warning" />
|
||||
<Rule Id="CA1039" Action="Warning" />
|
||||
<Rule Id="CA1040" Action="Warning" />
|
||||
<Rule Id="CA1041" Action="Warning" />
|
||||
<Rule Id="CA1043" Action="Warning" />
|
||||
<Rule Id="CA1044" Action="Warning" />
|
||||
<Rule Id="CA1045" Action="Warning" />
|
||||
<Rule Id="CA1046" Action="Warning" />
|
||||
<Rule Id="CA1047" Action="Warning" />
|
||||
<Rule Id="CA1048" Action="Warning" />
|
||||
<Rule Id="CA1049" Action="Warning" />
|
||||
<Rule Id="CA1050" Action="Warning" />
|
||||
<Rule Id="CA1051" Action="Warning" />
|
||||
<Rule Id="CA1052" Action="Warning" />
|
||||
<Rule Id="CA1053" Action="Warning" />
|
||||
<Rule Id="CA1054" Action="Warning" />
|
||||
<Rule Id="CA1055" Action="Warning" />
|
||||
<Rule Id="CA1056" Action="Warning" />
|
||||
<Rule Id="CA1057" Action="Warning" />
|
||||
<Rule Id="CA1058" Action="Warning" />
|
||||
<Rule Id="CA1059" Action="Warning" />
|
||||
<Rule Id="CA1060" Action="Warning" />
|
||||
<Rule Id="CA1061" Action="Warning" />
|
||||
<Rule Id="CA1062" Action="Warning" />
|
||||
<Rule Id="CA1063" Action="Warning" />
|
||||
<Rule Id="CA1064" Action="Warning" />
|
||||
<Rule Id="CA1065" Action="Warning" />
|
||||
<Rule Id="CA1300" Action="Warning" />
|
||||
<Rule Id="CA1301" Action="Warning" />
|
||||
<Rule Id="CA1302" Action="Warning" />
|
||||
<Rule Id="CA1303" Action="Warning" />
|
||||
<Rule Id="CA1304" Action="Warning" />
|
||||
<Rule Id="CA1305" Action="Warning" />
|
||||
<Rule Id="CA1306" Action="Warning" />
|
||||
<Rule Id="CA1307" Action="Warning" />
|
||||
<Rule Id="CA1308" Action="Warning" />
|
||||
<Rule Id="CA1309" Action="Warning" />
|
||||
<Rule Id="CA1400" Action="Warning" />
|
||||
<Rule Id="CA1401" Action="Warning" />
|
||||
<Rule Id="CA1402" Action="Warning" />
|
||||
<Rule Id="CA1403" Action="Warning" />
|
||||
<Rule Id="CA1404" Action="Warning" />
|
||||
<Rule Id="CA1405" Action="Warning" />
|
||||
<Rule Id="CA1406" Action="Warning" />
|
||||
<Rule Id="CA1407" Action="Warning" />
|
||||
<Rule Id="CA1408" Action="Warning" />
|
||||
<Rule Id="CA1409" Action="Warning" />
|
||||
<Rule Id="CA1410" Action="Warning" />
|
||||
<Rule Id="CA1411" Action="Warning" />
|
||||
<Rule Id="CA1412" Action="Warning" />
|
||||
<Rule Id="CA1413" Action="Warning" />
|
||||
<Rule Id="CA1414" Action="Warning" />
|
||||
<Rule Id="CA1415" Action="Warning" />
|
||||
<Rule Id="CA1500" Action="Warning" />
|
||||
<Rule Id="CA1501" Action="Warning" />
|
||||
<Rule Id="CA1502" Action="Warning" />
|
||||
<Rule Id="CA1504" Action="Warning" />
|
||||
<Rule Id="CA1505" Action="Warning" />
|
||||
<Rule Id="CA1506" Action="Warning" />
|
||||
<Rule Id="CA1600" Action="Warning" />
|
||||
<Rule Id="CA1601" Action="Warning" />
|
||||
<Rule Id="CA1700" Action="Warning" />
|
||||
<Rule Id="CA1701" Action="Warning" />
|
||||
<Rule Id="CA1702" Action="Warning" />
|
||||
<Rule Id="CA1703" Action="Warning" />
|
||||
<Rule Id="CA1704" Action="Warning" />
|
||||
<Rule Id="CA1707" Action="Warning" />
|
||||
<Rule Id="CA1708" Action="Warning" />
|
||||
<Rule Id="CA1709" Action="Warning" />
|
||||
<Rule Id="CA1710" Action="Warning" />
|
||||
<Rule Id="CA1711" Action="Warning" />
|
||||
<Rule Id="CA1712" Action="Warning" />
|
||||
<Rule Id="CA1713" Action="Warning" />
|
||||
<Rule Id="CA1714" Action="Warning" />
|
||||
<Rule Id="CA1715" Action="Warning" />
|
||||
<Rule Id="CA1716" Action="Warning" />
|
||||
<Rule Id="CA1717" Action="Warning" />
|
||||
<Rule Id="CA1719" Action="Warning" />
|
||||
<Rule Id="CA1720" Action="Warning" />
|
||||
<Rule Id="CA1721" Action="Warning" />
|
||||
<Rule Id="CA1722" Action="Warning" />
|
||||
<Rule Id="CA1724" Action="Warning" />
|
||||
<Rule Id="CA1725" Action="Warning" />
|
||||
<Rule Id="CA1726" Action="Warning" />
|
||||
<Rule Id="CA1800" Action="Warning" />
|
||||
<Rule Id="CA1801" Action="Warning" />
|
||||
<Rule Id="CA1802" Action="Warning" />
|
||||
<Rule Id="CA1804" Action="Warning" />
|
||||
<Rule Id="CA1806" Action="Warning" />
|
||||
<Rule Id="CA1809" Action="Warning" />
|
||||
<Rule Id="CA1810" Action="Warning" />
|
||||
<Rule Id="CA1811" Action="Warning" />
|
||||
<Rule Id="CA1812" Action="Warning" />
|
||||
<Rule Id="CA1813" Action="Warning" />
|
||||
<Rule Id="CA1814" Action="Warning" />
|
||||
<Rule Id="CA1815" Action="Warning" />
|
||||
<Rule Id="CA1816" Action="Warning" />
|
||||
<Rule Id="CA1819" Action="Warning" />
|
||||
<Rule Id="CA1820" Action="Warning" />
|
||||
<Rule Id="CA1821" Action="Warning" />
|
||||
<Rule Id="CA1822" Action="Warning" />
|
||||
<Rule Id="CA1823" Action="Warning" />
|
||||
<Rule Id="CA1824" Action="Warning" />
|
||||
<Rule Id="CA1900" Action="Warning" />
|
||||
<Rule Id="CA1901" Action="Warning" />
|
||||
<Rule Id="CA1903" Action="Warning" />
|
||||
<Rule Id="CA2000" Action="Warning" />
|
||||
<Rule Id="CA2001" Action="Warning" />
|
||||
<Rule Id="CA2002" Action="Warning" />
|
||||
<Rule Id="CA2003" Action="Warning" />
|
||||
<Rule Id="CA2004" Action="Warning" />
|
||||
<Rule Id="CA2006" Action="Warning" />
|
||||
<Rule Id="CA2100" Action="Warning" />
|
||||
<Rule Id="CA2101" Action="Warning" />
|
||||
<Rule Id="CA2102" Action="Warning" />
|
||||
<Rule Id="CA2103" Action="Warning" />
|
||||
<Rule Id="CA2104" Action="Warning" />
|
||||
<Rule Id="CA2105" Action="Warning" />
|
||||
<Rule Id="CA2106" Action="Warning" />
|
||||
<Rule Id="CA2107" Action="Warning" />
|
||||
<Rule Id="CA2108" Action="Warning" />
|
||||
<Rule Id="CA2109" Action="Warning" />
|
||||
<Rule Id="CA2111" Action="Warning" />
|
||||
<Rule Id="CA2112" Action="Warning" />
|
||||
<Rule Id="CA2114" Action="Warning" />
|
||||
<Rule Id="CA2115" Action="Warning" />
|
||||
<Rule Id="CA2116" Action="Warning" />
|
||||
<Rule Id="CA2117" Action="Warning" />
|
||||
<Rule Id="CA2118" Action="Warning" />
|
||||
<Rule Id="CA2119" Action="Warning" />
|
||||
<Rule Id="CA2120" Action="Warning" />
|
||||
<Rule Id="CA2121" Action="Warning" />
|
||||
<Rule Id="CA2122" Action="Warning" />
|
||||
<Rule Id="CA2123" Action="Warning" />
|
||||
<Rule Id="CA2124" Action="Warning" />
|
||||
<Rule Id="CA2126" Action="Warning" />
|
||||
<Rule Id="CA2130" Action="Warning" />
|
||||
<Rule Id="CA2131" Action="Warning" />
|
||||
<Rule Id="CA2132" Action="Warning" />
|
||||
<Rule Id="CA2133" Action="Warning" />
|
||||
<Rule Id="CA2134" Action="Warning" />
|
||||
<Rule Id="CA2135" Action="Warning" />
|
||||
<Rule Id="CA2136" Action="Warning" />
|
||||
<Rule Id="CA2137" Action="Warning" />
|
||||
<Rule Id="CA2138" Action="Warning" />
|
||||
<Rule Id="CA2139" Action="Warning" />
|
||||
<Rule Id="CA2140" Action="Warning" />
|
||||
<Rule Id="CA2141" Action="Warning" />
|
||||
<Rule Id="CA2142" Action="Warning" />
|
||||
<Rule Id="CA2143" Action="Warning" />
|
||||
<Rule Id="CA2144" Action="Warning" />
|
||||
<Rule Id="CA2145" Action="Warning" />
|
||||
<Rule Id="CA2146" Action="Warning" />
|
||||
<Rule Id="CA2147" Action="Warning" />
|
||||
<Rule Id="CA2149" Action="Warning" />
|
||||
<Rule Id="CA2151" Action="Warning" />
|
||||
<Rule Id="CA2200" Action="Warning" />
|
||||
<Rule Id="CA2201" Action="Warning" />
|
||||
<Rule Id="CA2202" Action="Warning" />
|
||||
<Rule Id="CA2204" Action="Warning" />
|
||||
<Rule Id="CA2205" Action="Warning" />
|
||||
<Rule Id="CA2207" Action="Warning" />
|
||||
<Rule Id="CA2208" Action="Warning" />
|
||||
<Rule Id="CA2210" Action="Warning" />
|
||||
<Rule Id="CA2211" Action="Warning" />
|
||||
<Rule Id="CA2212" Action="Warning" />
|
||||
<Rule Id="CA2213" Action="Warning" />
|
||||
<Rule Id="CA2214" Action="Warning" />
|
||||
<Rule Id="CA2215" Action="Warning" />
|
||||
<Rule Id="CA2216" Action="Warning" />
|
||||
<Rule Id="CA2217" Action="Warning" />
|
||||
<Rule Id="CA2218" Action="Warning" />
|
||||
<Rule Id="CA2219" Action="Warning" />
|
||||
<Rule Id="CA2220" Action="Warning" />
|
||||
<Rule Id="CA2221" Action="Warning" />
|
||||
<Rule Id="CA2222" Action="Warning" />
|
||||
<Rule Id="CA2223" Action="Warning" />
|
||||
<Rule Id="CA2224" Action="Warning" />
|
||||
<Rule Id="CA2225" Action="Warning" />
|
||||
<Rule Id="CA2226" Action="Warning" />
|
||||
<Rule Id="CA2227" Action="Warning" />
|
||||
<Rule Id="CA2228" Action="Warning" />
|
||||
<Rule Id="CA2229" Action="Warning" />
|
||||
<Rule Id="CA2230" Action="Warning" />
|
||||
<Rule Id="CA2231" Action="Warning" />
|
||||
<Rule Id="CA2232" Action="Warning" />
|
||||
<Rule Id="CA2233" Action="Warning" />
|
||||
<Rule Id="CA2234" Action="Warning" />
|
||||
<Rule Id="CA2235" Action="Warning" />
|
||||
<Rule Id="CA2236" Action="Warning" />
|
||||
<Rule Id="CA2237" Action="Warning" />
|
||||
<Rule Id="CA2238" Action="Warning" />
|
||||
<Rule Id="CA2239" Action="Warning" />
|
||||
<Rule Id="CA2240" Action="Warning" />
|
||||
<Rule Id="CA2241" Action="Warning" />
|
||||
<Rule Id="CA2242" Action="Warning" />
|
||||
<Rule Id="CA2243" Action="Warning" />
|
||||
<Rule Id="CA5122" Action="Warning" />
|
||||
</Rules>
|
||||
</RuleSet>
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Open Packager")]
|
||||
[assembly: AssemblyDescription("Open Packager is a free tool allowing anyone to create their own software packages. It's designed to be easy to use but more importantly to allow anyone to freely distribute software with confidence using only free and open standards. This software uses the excellent 7-Zip archiving engine as a foundation for generating packages. You are permitted to legally modify the software's source code and redistribute it at your own will. Open Packager is protected under the GPL V3 licence agreement. Please use Open Packager at your own risk; the original owner is not responsible for any potential damage or unreliability caused to your data.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Fil Sapia")]
|
||||
[assembly: AssemblyProduct("Open Packager")]
|
||||
[assembly: AssemblyCopyright("GPL V3")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.4.1")]
|
||||
[assembly: AssemblyFileVersion("0.8.4.1")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en-GB")]
|
||||
@@ -0,0 +1,83 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenPackager.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenPackager.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LogoV2 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("LogoV2", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap LogoV21 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("LogoV21", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="LogoV2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Icon.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="LogoV21" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\LogoV2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenPackager.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 361 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 257 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace OpenPackager
|
||||
{
|
||||
public static class Shutdown
|
||||
{
|
||||
public static void PerformCleanup(int exitCode)
|
||||
{
|
||||
MessageHandler mh = new MessageHandler();
|
||||
int _exitCode = exitCode;
|
||||
|
||||
try
|
||||
{
|
||||
string[] files = Directory.GetFiles(SysEnvironment.workingDir, "*.*", SearchOption.AllDirectories);
|
||||
string[] dirs = Directory.GetDirectories(SysEnvironment.workingDir, "*", SearchOption.AllDirectories);
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
File.SetAttributes(file, FileAttributes.Normal);
|
||||
//File.Delete(file);
|
||||
}
|
||||
|
||||
foreach (var dir in dirs)
|
||||
{
|
||||
if (Directory.Exists(dir))
|
||||
Directory.Delete(dir, true);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
exitCode = 1;
|
||||
throw;
|
||||
}
|
||||
|
||||
Application.Current.Shutdown(_exitCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<Window x:Class="OpenPackager.Startup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Open Packager" Height="350" Width="525" ShowInTaskbar="False" ResizeMode="NoResize" Visibility="Hidden" Initialized="Window_Initialized" Closing="Window_Closing">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,255 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace OpenPackager
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Startup.xaml
|
||||
/// </summary>
|
||||
public partial class Startup : Window
|
||||
{
|
||||
public Startup()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run necassary checks to import correct system variables
|
||||
/// for MainSetupForm.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Window_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
detectSysArch();
|
||||
// Only continue loading Open Packager if 7-zip is installed.
|
||||
if (checkSevenZip(SysEnvironment.isSysArch64))
|
||||
{
|
||||
checkLocalData();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required to detect correct registry keys and system paths.
|
||||
/// </summary>
|
||||
private void detectSysArch()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (IntPtr.Size == 8)
|
||||
{
|
||||
// x64
|
||||
SysEnvironment.isSysArch64 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// x32
|
||||
SysEnvironment.isSysArch64 = false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check for 7-zip installation.
|
||||
/// Get system architecture so the correct registry path is used.
|
||||
/// </summary>
|
||||
/// <param name="is64">Correct path is used depending on system arhitecture</param>
|
||||
private bool checkSevenZip(bool is64)
|
||||
{
|
||||
string sevenZipRegPath = @"SOFTWARE\7-Zip\";
|
||||
string sevenZipRegValueName = "Path";
|
||||
bool sevenZipExists = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (is64 == true)
|
||||
{
|
||||
// x64
|
||||
var regPath64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
|
||||
var regKey64 = regPath64.OpenSubKey(sevenZipRegPath);
|
||||
var value64 = regKey64.GetValue(sevenZipRegValueName);
|
||||
|
||||
if (File.Exists(value64 + SysEnvironment.szExe))
|
||||
{
|
||||
SysEnvironment.szFullPath = value64 + SysEnvironment.szExe;
|
||||
SysEnvironment.szWorkDir = Convert.ToString(value64);
|
||||
|
||||
Debug.Write("// 7-Zip Exists");
|
||||
sevenZipExists = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// x32
|
||||
var regPath32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
|
||||
var regKey32 = regPath32.OpenSubKey(sevenZipRegPath);
|
||||
var value32 = regKey32.GetValue(sevenZipRegValueName);
|
||||
|
||||
if (File.Exists(value32 + SysEnvironment.szExe))
|
||||
{
|
||||
SysEnvironment.szFullPath = value32 + SysEnvironment.szExe;
|
||||
SysEnvironment.szWorkDir = Convert.ToString(value32);
|
||||
|
||||
Debug.Write("// 7-Zip Exists");
|
||||
sevenZipExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (!sevenZipExists)
|
||||
{
|
||||
SevenZipWarning szw = new SevenZipWarning();
|
||||
szw.Show();
|
||||
}
|
||||
|
||||
return sevenZipExists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scan local data to detect whether Open Packager is part of an
|
||||
/// installation or is in standalone mode.
|
||||
/// </summary>
|
||||
private void checkLocalData()
|
||||
{
|
||||
if (File.Exists(SysEnvironment.xmlFullPath))
|
||||
{
|
||||
Debug.Write("// OPF XML exists");
|
||||
|
||||
// Set displayImageExt
|
||||
if (File.Exists(PackageStructure.opfDirs[0] + PackageStructure.displayImage + ".jpg"))
|
||||
{
|
||||
PackageStructure.displayImageExt = ".jpg";
|
||||
}
|
||||
else if (File.Exists(PackageStructure.opfDirs[0] + PackageStructure.displayImage + ".png"))
|
||||
{
|
||||
PackageStructure.displayImageExt = ".png";
|
||||
}
|
||||
|
||||
BackgroundWorker importXmlWorker = new BackgroundWorker();
|
||||
importXmlWorker.DoWork += new DoWorkEventHandler(importXml_DoWork);
|
||||
importXmlWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(importXml_Finish);
|
||||
importXmlWorker.RunWorkerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Write("// OPF XML doesn't exist");
|
||||
//SysEnvironment.loadXmlConfig = false;
|
||||
|
||||
LoadMainWindow(false);
|
||||
}
|
||||
}
|
||||
|
||||
#region Import XML Worker
|
||||
|
||||
public static XML.LoadPackage loadPackage = new XML.LoadPackage();
|
||||
private LogWriter.Writer logWriter = new LogWriter.Writer();
|
||||
private void importXml_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
loadPackage.LoadFromXml(SysEnvironment.xmlFullPath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
e.Result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private MessageHandler _messageHandler = new MessageHandler();
|
||||
private void importXml_Finish(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
// Check if XML file has been loaded succesfully.
|
||||
if (e.Result == null)
|
||||
{
|
||||
WriteToTextFile(logWriter.Records(LogWriter.Writer.logEntries.FinishReadXml,
|
||||
null, 0));
|
||||
|
||||
//SysEnvironment.loadXmlConfig = true;
|
||||
LoadMainWindow(true);
|
||||
}
|
||||
else // Terminate application with error code if the existing XML cannot be parsed.
|
||||
{
|
||||
WriteToTextFile(logWriter.Records(LogWriter.Writer.logEntries.ErrorReadXml,
|
||||
PackageStructure.xmlName, 0));
|
||||
|
||||
_messageHandler.errorMessage(MessageHandler.msgCodes.ERR_XMLError, null);
|
||||
Shutdown.PerformCleanup(1);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Log files are written using their own thread as not to stall
|
||||
/// the UI thread.
|
||||
/// </summary>
|
||||
/// <param name="entry">Text to write</param>
|
||||
private void WriteToTextFile(string entry)
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Background,
|
||||
new Action(() =>
|
||||
{
|
||||
logWriter.WriteOutLog(entry, SysEnvironment.instLogFileName);
|
||||
}));
|
||||
}
|
||||
|
||||
private void LoadMainWindow(bool loadXmlConfig)
|
||||
{
|
||||
// Only one instance for _setupForm should exist at a time.
|
||||
SetupWizard.MainSetupForm msForm = new SetupWizard.MainSetupForm(loadXmlConfig);
|
||||
msForm.Show();
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// Never shutdown Open Packager conventionally, always call
|
||||
// Shutdown.PerformCleanup which will clear out any
|
||||
// temporary data generated.
|
||||
Shutdown.PerformCleanup(0);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class SysEnvironment
|
||||
{
|
||||
public static string workingDir = Path.GetTempPath() + "OpenPackager\\";
|
||||
public static string szFullPath { get; set; }
|
||||
public static string szWorkDir { get; set; }
|
||||
public static string xmlFullPath = PackageStructure.opfDirs[0] + "\\" + PackageStructure.xmlName;
|
||||
public static bool isSysArch64 { get; set; }
|
||||
public static string szExe = "7z.exe";
|
||||
//public static bool loadXmlConfig { get; set; }
|
||||
public static string instLogFileName = SysEnvironment.workingDir + "\\" + DateTime.Now.Ticks + "_InstallLog.txt";
|
||||
}
|
||||
|
||||
public abstract class PackageStructure
|
||||
{
|
||||
public static string[] opfDirs =
|
||||
{
|
||||
"Data\\",
|
||||
"Data\\Scripts\\",
|
||||
"Data\\Scripts\\Install\\",
|
||||
"Data\\Scripts\\Uninstall\\",
|
||||
};
|
||||
public static string displayImage = "Image"; // Extension is undetermined.
|
||||
public static string displayImageExt { get; set; }
|
||||
public static string licenceFile = "License.txt";
|
||||
public static string readmeFile = "Readme.txt";
|
||||
public static string xmlName = "Setup.xml";
|
||||
public static string szExe = "7z.exe";
|
||||
public static string zipName = "Data.7z";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenPackager.XML
|
||||
{
|
||||
public class WriteToXml
|
||||
{
|
||||
/// <summary>
|
||||
/// These values are written directly to the final XML exactly
|
||||
/// as displayed in the CreationWiz2 form.
|
||||
/// </summary>
|
||||
public string pkgName { get; set; }
|
||||
public string pkgSku { get; set; }
|
||||
public decimal pkgVer { get; set; }
|
||||
public string pkgUpid { get; set; }
|
||||
public string pkgAuthor { get; set; }
|
||||
public string pkgShortcutFile { get; set; }
|
||||
public string pkgShortcutName { get; set; }
|
||||
public bool pkgPassword { get; set; }
|
||||
public long pkgSize { get; set; }
|
||||
|
||||
public static string xmlStartElement = "OPFPackage";
|
||||
public enum xmlElement
|
||||
{
|
||||
Package,
|
||||
Sku,
|
||||
Version,
|
||||
Upid,
|
||||
Author,
|
||||
ShortcutPath,
|
||||
ShortcutName,
|
||||
Password,
|
||||
Size
|
||||
};
|
||||
}
|
||||
|
||||
public class OpfGen
|
||||
{
|
||||
/// <summary>
|
||||
/// The following values are used purely for OPF generation and
|
||||
/// are isolated from the Setup.xml file.
|
||||
/// </summary>
|
||||
public string pkgDisplayImg { get; set; }
|
||||
public string pkgSourceDir { get; set; }
|
||||
public string pkgOutputDir { get; set; }
|
||||
public string pkgLicAgreement { get; set; }
|
||||
public string pkgMoreInfo { get; set; }
|
||||
public int pkgCompressionLvl { get; set; }
|
||||
public string pkgPassword { get; set; }
|
||||
public int pkgPostOps { get; set; }
|
||||
public string[] pkgBatInst { get; set; }
|
||||
public string[] pkgBatRem { get; set; }
|
||||
public string pkgIcon { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace OpenPackager.XML
|
||||
{
|
||||
public class LoadPackage : WriteToXml
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads specified XML config and returns new instance of settings.
|
||||
/// </summary>
|
||||
/// <param name="xmlLocation">Location of Setup.XML</param>
|
||||
public WriteToXml LoadFromXml(string xmlLocation)
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(xmlLocation))
|
||||
{
|
||||
while (!reader.EOF)
|
||||
{
|
||||
if (reader.IsStartElement())
|
||||
{
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "Package":
|
||||
this.pkgName = reader.ReadElementContentAsString();
|
||||
continue;
|
||||
case "Sku":
|
||||
this.pkgSku = reader.ReadElementContentAsString();
|
||||
continue;
|
||||
case "Version":
|
||||
this.pkgVer = Convert.ToDecimal(reader.ReadElementContentAsString());
|
||||
continue;
|
||||
case "Upid":
|
||||
this.pkgUpid = reader.ReadElementContentAsString();
|
||||
continue;
|
||||
case "Author":
|
||||
this.pkgAuthor = reader.ReadElementContentAsString();
|
||||
continue;
|
||||
case "ShortcutPath":
|
||||
this.pkgShortcutFile = reader.ReadElementContentAsString();
|
||||
continue;
|
||||
case "ShortcutName":
|
||||
this.pkgShortcutName = reader.ReadElementContentAsString();
|
||||
continue;
|
||||
case "Password":
|
||||
if (reader.ReadElementContentAsString() == "True")
|
||||
{
|
||||
this.pkgPassword = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pkgPassword = false;
|
||||
}
|
||||
continue;
|
||||
case "Size":
|
||||
this.pkgSize = Convert.ToInt64(reader.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with.
|
||||
Windows will automatically select the most compatible environment.-->
|
||||
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
|
||||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
|
||||
<!-- If your application is designed to work with Windows 8.1, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
</asmv1:assembly>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel node will disable file and registry virtualization.
|
||||
If you want to utilize File and Registry Virtualization for backward
|
||||
compatibility then delete the requestedExecutionLevel node.
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with.
|
||||
Windows will automatically select the most compatible environment.-->
|
||||
<!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->
|
||||
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
|
||||
<!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>-->
|
||||
<!-- If your application is designed to work with Windows 8.1, uncomment the following supportedOS node-->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!-- <dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>-->
|
||||
</asmv1:assembly>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 361 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 257 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
@@ -0,0 +1 @@
|
||||
Some Information...
|
||||
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
echo Installing batch file...
|
||||
mkdir RunByInstallBatch
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
This is a license agreement. This is a license agreement. This is a license agreement. This is a license agreement. This is a license agreement. This is a license agreement. This is a license agreement. This is a license agreement.
|
||||