Got rid of 'Compression' groupbox

This commit is contained in:
Roman Belkov 2015-04-03 16:42:34 +03:00
parent e47ae11302
commit 7cc3dd8123
4 changed files with 1532 additions and 819 deletions

View file

@ -40,12 +40,6 @@
this.labelFileName = new System.Windows.Forms.Label();
this.labelDriveTitle = new System.Windows.Forms.Label();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxCompression = new System.Windows.Forms.GroupBox();
this.radioButtonCompXZ = new System.Windows.Forms.RadioButton();
this.radioButtonCompNone = new System.Windows.Forms.RadioButton();
this.radioButtonCompTgz = new System.Windows.Forms.RadioButton();
this.radioButtonCompGz = new System.Windows.Forms.RadioButton();
this.radioButtonCompZip = new System.Windows.Forms.RadioButton();
this.menuStripMain = new System.Windows.Forms.MenuStrip();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayAllDrivesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -61,8 +55,8 @@
this.flowLayoutPanelProgressLabels = new System.Windows.Forms.FlowLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.label2 = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.groupBoxCompression.SuspendLayout();
this.menuStripMain.SuspendLayout();
this.SuspendLayout();
//
@ -70,12 +64,14 @@
//
resources.ApplyResources(this.textBoxFileName, "textBoxFileName");
this.textBoxFileName.Name = "textBoxFileName";
this.toolTip.SetToolTip(this.textBoxFileName, resources.GetString("textBoxFileName.ToolTip"));
this.textBoxFileName.TextChanged += new System.EventHandler(this.TextBoxFileNameTextChanged);
//
// buttonRead
//
resources.ApplyResources(this.buttonRead, "buttonRead");
this.buttonRead.Name = "buttonRead";
this.toolTip.SetToolTip(this.buttonRead, resources.GetString("buttonRead.ToolTip"));
this.buttonRead.UseVisualStyleBackColor = true;
this.buttonRead.Click += new System.EventHandler(this.ButtonReadClick);
//
@ -83,6 +79,7 @@
//
resources.ApplyResources(this.buttonWrite, "buttonWrite");
this.buttonWrite.Name = "buttonWrite";
this.toolTip.SetToolTip(this.buttonWrite, resources.GetString("buttonWrite.ToolTip"));
this.buttonWrite.UseVisualStyleBackColor = true;
this.buttonWrite.Click += new System.EventHandler(this.ButtonWriteClick);
//
@ -96,19 +93,19 @@
//
// statusStrip1
//
resources.ApplyResources(this.statusStrip1, "statusStrip1");
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1});
resources.ApplyResources(this.statusStrip1, "statusStrip1");
this.statusStrip1.Name = "statusStrip1";
this.toolTip.SetToolTip(this.statusStrip1, resources.GetString("statusStrip1.ToolTip"));
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1");
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
//
// saveFileDialog1
//
this.saveFileDialog1.AddExtension = false;
this.saveFileDialog1.DefaultExt = "img";
resources.ApplyResources(this.saveFileDialog1, "saveFileDialog1");
//
@ -116,167 +113,125 @@
//
resources.ApplyResources(this.labelFileName, "labelFileName");
this.labelFileName.Name = "labelFileName";
this.toolTip.SetToolTip(this.labelFileName, resources.GetString("labelFileName.ToolTip"));
//
// labelDriveTitle
//
resources.ApplyResources(this.labelDriveTitle, "labelDriveTitle");
this.labelDriveTitle.Name = "labelDriveTitle";
this.toolTip.SetToolTip(this.labelDriveTitle, resources.GetString("labelDriveTitle.ToolTip"));
//
// buttonCancel
//
resources.ApplyResources(this.buttonCancel, "buttonCancel");
this.buttonCancel.Name = "buttonCancel";
this.toolTip.SetToolTip(this.buttonCancel, resources.GetString("buttonCancel.ToolTip"));
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick);
//
// groupBoxCompression
//
this.groupBoxCompression.Controls.Add(this.radioButtonCompXZ);
this.groupBoxCompression.Controls.Add(this.radioButtonCompNone);
this.groupBoxCompression.Controls.Add(this.radioButtonCompTgz);
this.groupBoxCompression.Controls.Add(this.radioButtonCompGz);
this.groupBoxCompression.Controls.Add(this.radioButtonCompZip);
resources.ApplyResources(this.groupBoxCompression, "groupBoxCompression");
this.groupBoxCompression.Name = "groupBoxCompression";
this.groupBoxCompression.TabStop = false;
this.toolTip.SetToolTip(this.groupBoxCompression, resources.GetString("groupBoxCompression.ToolTip"));
//
// radioButtonCompXZ
//
resources.ApplyResources(this.radioButtonCompXZ, "radioButtonCompXZ");
this.radioButtonCompXZ.Name = "radioButtonCompXZ";
this.radioButtonCompXZ.TabStop = true;
this.radioButtonCompXZ.UseVisualStyleBackColor = true;
this.radioButtonCompXZ.CheckedChanged += new System.EventHandler(this.radioButtonCompXZ_CheckedChanged);
//
// radioButtonCompNone
//
resources.ApplyResources(this.radioButtonCompNone, "radioButtonCompNone");
this.radioButtonCompNone.Checked = true;
this.radioButtonCompNone.Name = "radioButtonCompNone";
this.radioButtonCompNone.TabStop = true;
this.radioButtonCompNone.UseVisualStyleBackColor = true;
this.radioButtonCompNone.CheckedChanged += new System.EventHandler(this.RadioButtonCompNoneCheckedChanged);
//
// radioButtonCompTgz
//
resources.ApplyResources(this.radioButtonCompTgz, "radioButtonCompTgz");
this.radioButtonCompTgz.Name = "radioButtonCompTgz";
this.radioButtonCompTgz.UseVisualStyleBackColor = true;
this.radioButtonCompTgz.CheckedChanged += new System.EventHandler(this.RadioButtonCompTgzCheckedChanged);
//
// radioButtonCompGz
//
resources.ApplyResources(this.radioButtonCompGz, "radioButtonCompGz");
this.radioButtonCompGz.Name = "radioButtonCompGz";
this.radioButtonCompGz.UseVisualStyleBackColor = true;
this.radioButtonCompGz.CheckedChanged += new System.EventHandler(this.RadioButtonCompGzCheckedChanged);
//
// radioButtonCompZip
//
resources.ApplyResources(this.radioButtonCompZip, "radioButtonCompZip");
this.radioButtonCompZip.Name = "radioButtonCompZip";
this.radioButtonCompZip.UseVisualStyleBackColor = true;
this.radioButtonCompZip.CheckedChanged += new System.EventHandler(this.RadioButtonCompZipCheckedChanged);
//
// menuStripMain
//
resources.ApplyResources(this.menuStripMain, "menuStripMain");
this.menuStripMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.optionsToolStripMenuItem,
this.aboutToolStripMenuItem});
resources.ApplyResources(this.menuStripMain, "menuStripMain");
this.menuStripMain.Name = "menuStripMain";
this.menuStripMain.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.toolTip.SetToolTip(this.menuStripMain, resources.GetString("menuStripMain.ToolTip"));
//
// optionsToolStripMenuItem
//
resources.ApplyResources(this.optionsToolStripMenuItem, "optionsToolStripMenuItem");
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.displayAllDrivesToolStripMenuItem,
this.useMBRToolStripMenuItem,
this.unmountDrivesToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
resources.ApplyResources(this.optionsToolStripMenuItem, "optionsToolStripMenuItem");
//
// displayAllDrivesToolStripMenuItem
//
resources.ApplyResources(this.displayAllDrivesToolStripMenuItem, "displayAllDrivesToolStripMenuItem");
this.displayAllDrivesToolStripMenuItem.CheckOnClick = true;
this.displayAllDrivesToolStripMenuItem.Name = "displayAllDrivesToolStripMenuItem";
resources.ApplyResources(this.displayAllDrivesToolStripMenuItem, "displayAllDrivesToolStripMenuItem");
this.displayAllDrivesToolStripMenuItem.CheckedChanged += new System.EventHandler(this.DisplayAllDrivesToolStripMenuItemCheckedChanged);
//
// useMBRToolStripMenuItem
//
resources.ApplyResources(this.useMBRToolStripMenuItem, "useMBRToolStripMenuItem");
this.useMBRToolStripMenuItem.Checked = true;
this.useMBRToolStripMenuItem.CheckOnClick = true;
this.useMBRToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.useMBRToolStripMenuItem.Name = "useMBRToolStripMenuItem";
resources.ApplyResources(this.useMBRToolStripMenuItem, "useMBRToolStripMenuItem");
//
// unmountDrivesToolStripMenuItem
//
resources.ApplyResources(this.unmountDrivesToolStripMenuItem, "unmountDrivesToolStripMenuItem");
this.unmountDrivesToolStripMenuItem.Checked = true;
this.unmountDrivesToolStripMenuItem.CheckOnClick = true;
this.unmountDrivesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.unmountDrivesToolStripMenuItem.Name = "unmountDrivesToolStripMenuItem";
resources.ApplyResources(this.unmountDrivesToolStripMenuItem, "unmountDrivesToolStripMenuItem");
//
// aboutToolStripMenuItem
//
resources.ApplyResources(this.aboutToolStripMenuItem, "aboutToolStripMenuItem");
this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.languageToolStripMenuItem,
this.helpToolStripMenuItem});
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
resources.ApplyResources(this.aboutToolStripMenuItem, "aboutToolStripMenuItem");
//
// languageToolStripMenuItem
//
resources.ApplyResources(this.languageToolStripMenuItem, "languageToolStripMenuItem");
this.languageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.englishToolStripMenuItem,
this.russianToolStripMenuItem});
this.languageToolStripMenuItem.Name = "languageToolStripMenuItem";
resources.ApplyResources(this.languageToolStripMenuItem, "languageToolStripMenuItem");
//
// englishToolStripMenuItem
//
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
resources.ApplyResources(this.englishToolStripMenuItem, "englishToolStripMenuItem");
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
//
// russianToolStripMenuItem
//
this.russianToolStripMenuItem.Name = "russianToolStripMenuItem";
resources.ApplyResources(this.russianToolStripMenuItem, "russianToolStripMenuItem");
this.russianToolStripMenuItem.Name = "russianToolStripMenuItem";
this.russianToolStripMenuItem.Click += new System.EventHandler(this.russianToolStripMenuItem_Click);
//
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
resources.ApplyResources(this.helpToolStripMenuItem, "helpToolStripMenuItem");
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Click += new System.EventHandler(this.helpToolStripMenuItem_Click);
//
// checkedListBoxDrives
//
this.checkedListBoxDrives.FormattingEnabled = true;
resources.ApplyResources(this.checkedListBoxDrives, "checkedListBoxDrives");
this.checkedListBoxDrives.FormattingEnabled = true;
this.checkedListBoxDrives.Name = "checkedListBoxDrives";
this.checkedListBoxDrives.Sorted = true;
this.toolTip.SetToolTip(this.checkedListBoxDrives, resources.GetString("checkedListBoxDrives.ToolTip"));
//
// flowLayoutPanelProgressBars
//
this.flowLayoutPanelProgressBars.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
resources.ApplyResources(this.flowLayoutPanelProgressBars, "flowLayoutPanelProgressBars");
this.flowLayoutPanelProgressBars.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowLayoutPanelProgressBars.Name = "flowLayoutPanelProgressBars";
this.toolTip.SetToolTip(this.flowLayoutPanelProgressBars, resources.GetString("flowLayoutPanelProgressBars.ToolTip"));
//
// flowLayoutPanelProgressLabels
//
this.flowLayoutPanelProgressLabels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
resources.ApplyResources(this.flowLayoutPanelProgressLabels, "flowLayoutPanelProgressLabels");
this.flowLayoutPanelProgressLabels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowLayoutPanelProgressLabels.Name = "flowLayoutPanelProgressLabels";
this.toolTip.SetToolTip(this.flowLayoutPanelProgressLabels, resources.GetString("flowLayoutPanelProgressLabels.ToolTip"));
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
this.toolTip.SetToolTip(this.label1, resources.GetString("label1.ToolTip"));
//
// toolTip
//
@ -284,15 +239,21 @@
this.toolTip.InitialDelay = 500;
this.toolTip.ReshowDelay = 100;
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
this.toolTip.SetToolTip(this.label2, resources.GetString("label2.ToolTip"));
//
// MainForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.flowLayoutPanelProgressLabels);
this.Controls.Add(this.flowLayoutPanelProgressBars);
this.Controls.Add(this.checkedListBoxDrives);
this.Controls.Add(this.groupBoxCompression);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.labelDriveTitle);
this.Controls.Add(this.labelFileName);
@ -307,11 +268,10 @@
this.MaximizeBox = false;
this.Name = "MainForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.toolTip.SetToolTip(this, resources.GetString("$this.ToolTip"));
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormFormClosing);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.groupBoxCompression.ResumeLayout(false);
this.groupBoxCompression.PerformLayout();
this.menuStripMain.ResumeLayout(false);
this.menuStripMain.PerformLayout();
this.ResumeLayout(false);
@ -331,11 +291,6 @@
private System.Windows.Forms.Label labelFileName;
private System.Windows.Forms.Label labelDriveTitle;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.GroupBox groupBoxCompression;
private System.Windows.Forms.RadioButton radioButtonCompNone;
private System.Windows.Forms.RadioButton radioButtonCompTgz;
private System.Windows.Forms.RadioButton radioButtonCompGz;
private System.Windows.Forms.RadioButton radioButtonCompZip;
private System.Windows.Forms.MenuStrip menuStripMain;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayAllDrivesToolStripMenuItem;
@ -343,7 +298,6 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelProgressBars;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelProgressLabels;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RadioButton radioButtonCompXZ;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.ToolStripMenuItem useMBRToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem unmountDrivesToolStripMenuItem;
@ -352,6 +306,7 @@
private System.Windows.Forms.ToolStripMenuItem englishToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem russianToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
private System.Windows.Forms.Label label2;
}
}

View file

@ -266,69 +266,10 @@ namespace DynamicDevices.DiskWriter
}
}
private void RadioButtonCompZipCheckedChanged(object sender, EventArgs e)
{
UpdateFileNameText();
}
private void RadioButtonCompTgzCheckedChanged(object sender, EventArgs e)
{
UpdateFileNameText();
}
private void RadioButtonCompGzCheckedChanged(object sender, EventArgs e)
{
UpdateFileNameText();
}
private void radioButtonCompXZ_CheckedChanged(object sender, EventArgs e)
{
UpdateFileNameText();
}
private void RadioButtonCompNoneCheckedChanged(object sender, EventArgs e)
{
UpdateFileNameText();
}
#endregion
#region Implementation
private void UpdateFileNameText()
{
var text = textBoxFileName.Text;
text = text.Replace(".tar.gz", "");
text = text.Replace(".tgz", "");
text = text.Replace(".tar", "");
text = text.Replace(".gzip", "");
text = text.Replace(".gz", "");
text = text.Replace(".zip", "");
text = text.Replace(".xz", "");
if (radioButtonCompNone.Checked)
{
textBoxFileName.Text = text;
} else if(radioButtonCompZip.Checked)
{
text += ".zip";
textBoxFileName.Text = text;
} else if(radioButtonCompTgz.Checked)
{
text += ".tgz";
textBoxFileName.Text = text;
} else if (radioButtonCompGz.Checked)
{
text += ".gz";
textBoxFileName.Text = text;
} else if (radioButtonCompXZ.Checked)
{
text += ".xz";
textBoxFileName.Text = text;
}
}
/// <summary>
/// Select the file for read / write and setup defaults for whether we're using compression based on extension
/// </summary>
@ -390,26 +331,15 @@ namespace DynamicDevices.DiskWriter
private void TextBoxFileNameTextChanged(object sender, EventArgs e)
{
if (textBoxFileName.Text.ToLower().EndsWith(".tar.gz") || textBoxFileName.Text.ToLower().EndsWith(".tgz"))
radioButtonCompTgz.Checked = true;
else if (textBoxFileName.Text.ToLower().EndsWith(".gz"))
radioButtonCompGz.Checked = true;
else if (textBoxFileName.Text.ToLower().EndsWith(".zip"))
radioButtonCompZip.Checked = true;
else if (textBoxFileName.Text.ToLower().EndsWith(".img") || textBoxFileName.Text.ToLower().EndsWith(".bin") || textBoxFileName.Text.ToLower().EndsWith(".sdcard"))
radioButtonCompNone.Checked = true;
else if (textBoxFileName.Text.ToLower().EndsWith(".xz"))
radioButtonCompXZ.Checked = true;
if (radioButtonCompNone.Checked)
_eCompType = EnumCompressionType.None;
else if (radioButtonCompTgz.Checked)
_eCompType = EnumCompressionType.Targzip;
else if (radioButtonCompGz.Checked)
else if (textBoxFileName.Text.ToLower().EndsWith(".gz"))
_eCompType = EnumCompressionType.Gzip;
else if (radioButtonCompZip.Checked)
else if (textBoxFileName.Text.ToLower().EndsWith(".zip"))
_eCompType = EnumCompressionType.Zip;
else if (radioButtonCompXZ.Checked)
else if (textBoxFileName.Text.ToLower().EndsWith(".xz"))
_eCompType = EnumCompressionType.XZ;
else
_eCompType = EnumCompressionType.None;
}
private void DisplayAllDrivesToolStripMenuItemCheckedChanged(object sender, EventArgs e)
@ -442,19 +372,6 @@ namespace DynamicDevices.DiskWriter
checkedListBoxDrives.Items.Add(drive.Name.TrimEnd('\\'));
}
}
#if false
//import the System.Management namespace at the top in your "using" statement.
var searcher = new ManagementObjectSearcher(
"SELECT * FROM Win32_DiskDrive WHERE InterfaceType='USB'");
foreach (var disk in searcher.Get())
{
var props = disk.Properties;
foreach(var p in props)
Console.WriteLine(p.Name + " = " + p.Value);
}
#endif
}
/// <summary>
@ -490,7 +407,6 @@ namespace DynamicDevices.DiskWriter
checkedListBoxDrives.Enabled = false;
textBoxFileName.Enabled = false;
buttonChooseFile.Enabled = false;
groupBoxCompression.Enabled = false;
menuStripMain.Enabled = !running;
}
@ -505,7 +421,6 @@ namespace DynamicDevices.DiskWriter
checkedListBoxDrives.Enabled = true;
textBoxFileName.Enabled = true;
buttonChooseFile.Enabled = true;
groupBoxCompression.Enabled = true;
menuStripMain.Enabled = true;
}
@ -588,7 +503,6 @@ namespace DynamicDevices.DiskWriter
private void ChangeToolTipLanguage(ComponentResourceManager resources)
{
toolTip.SetToolTip(buttonChooseFile, resources.GetString("buttonChooseFile.ToolTip"));
toolTip.SetToolTip(groupBoxCompression, resources.GetString("groupBoxCompression.ToolTip"));
toolTip.SetToolTip(checkedListBoxDrives, resources.GetString("checkedListBoxDrives.ToolTip"));
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff