guys i use this code to create my files for App updater.
with this code i can just select one files every time and also the output copied to clipboard and zipped files crated in same directory near unzipped files.
BUT:
i need to edit this code for:
1)possible to select multiple files (all files with files in folders and sub folders) or i think its better give a folder address to add all files also the files in sub folders.
2)put output data on a file named "info.xml" except clipboard in somewhere.(each data for each files in per line)
an example for output data on clipboard is:
3) at last put zipped files (lzma format) on the other place with same files names and folders and sub folders with included files.
Guys i need full code.
Thank you for Help
this is my code:
with this code i can just select one files every time and also the output copied to clipboard and zipped files crated in same directory near unzipped files.
BUT:
i need to edit this code for:
1)possible to select multiple files (all files with files in folders and sub folders) or i think its better give a folder address to add all files also the files in sub folders.
2)put output data on a file named "info.xml" except clipboard in somewhere.(each data for each files in per line)
an example for output data on clipboard is:
Code:
<ContentFile Name="logo.bmp" Size="109976" SHA1Hash="280EFF2ADD6557E90C542263B1C7971F8EBF19A8" CompressedSize="8625" />Guys i need full code.
Thank you for Help
this is my code:
Code:
namespace UpdateBuilder
{
public partial class MainFrm : Form
{
public string fileName = "";
public string output = "";
public MainFrm()
{
InitializeComponent();
}
private void browseBtn_Click(object sender, EventArgs e)
{
// Show a file browsing dialog
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "All files (*.*)|*.*";
dialog.InitialDirectory = Directory.GetCurrentDirectory();
dialog.Title = "Select a file to build";
if (dialog.ShowDialog() == DialogResult.OK)
{
// Place the selected file's path in the input textbox
inBox.Text = dialog.FileName;
fileName = dialog.SafeFileName;
}
}
private void buildBtn_Click(object sender, EventArgs e)
{
if (inBox.Text != "")
{
// Disable all controls
inBox.Enabled = false;
browseBtn.Enabled = false;
buildBtn.Enabled = false;
// Start the converion utility
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "lzma.exe";
startInfo.Arguments = "e " + inBox.Text + " " + inBox.Text + ".lzma -d21";
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
using (Process p = Process.Start(startInfo))
{
// And wait for it to finish
while (!p.HasExited)
{
Thread.Sleep(100);
}
}
// Generate that final string
FileInfo inFile = new FileInfo(inBox.Text);
FileInfo outFile = new FileInfo(inBox.Text + ".lzma");
output = "<ContentFile Name=\"" + fileName + "\" Size=\"" + inFile.Length.ToString() + "\" SHA1Hash=\"" + HashCalc.GetSHA1Hash(inBox.Text) + "\" CompressedSize=\"" + outFile.Length.ToString() + "\" />";
// Re-enable the controls
inBox.Enabled = true;
browseBtn.Enabled = true;
buildBtn.Enabled = true;
// Show notice and copy output to clipboard
Clipboard.SetText(output);
MessageBox.Show("Build succeeded.\nCopied output to clipboard.");
}
else
{
MessageBox.Show("Please select a file to build.");
}
}
}
}
