using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Diagnostics;
namespace Laj
{
// Last modified: 2002-10-21
// Version: 0.42 ID:LAJGAIS44
// Compiles with Microsoft Visual C# .NET 7.0.9466 on Windows 95.
// The source code is free. It is not under any kind of license.
// If this code works, it was written by Lars Johansson, Göteborg.
// If not, I don't know who wrote it.
// Changes
// Version: 0.43 2002-10-21
// DragDrop implemented
// Version: 0.44 2002-10-21
// comboBoxFileName.Items.AddRange(fileNames); replaced in filesToForm
public class FormMain : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonAbout;
private System.Windows.Forms.Button buttonAllFiles;
private System.Windows.Forms.Button buttonHelp;
private System.Windows.Forms.Button buttonAddFile;
private System.Windows.Forms.CheckBox checkBoxProcessAllFileNames;
private System.Windows.Forms.CheckBox checkBoxWalkSubfolders;
private System.Windows.Forms.ComboBox comboBoxFileName;
private System.Windows.Forms.GroupBox groupBoxFile;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textBoxLocation;
private System.Windows.Forms.Button buttonClearAllFiles;
private System.Windows.Forms.Button buttonClearCurrentFile;
private System.Windows.Forms.StatusBar statusBar1;
internal System.Windows.Forms.StatusBarPanel statusBarPanelDirectory;
internal System.Windows.Forms.StatusBarPanel statusBarPanelFileNumber;
internal System.Windows.Forms.StatusBarPanel statusBarPanelFilesCount;
private System.Windows.Forms.Button buttonTidy;
private System.Windows.Forms.GroupBox groupBoxTidy;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button buttonClean;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBoxCleanBegin;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBoxCleanEnd;
private System.Windows.Forms.TextBox textBoxSwitchesTidy;
private System.Windows.Forms.TextBox textBoxNewLocationTidy;
private System.Windows.Forms.TextBox textBoxNewLocationClean;
private System.Windows.Forms.GroupBox groupBoxClean;
private System.Windows.Forms.CheckBox checkBoxCleanMatchCase;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public FormMain()
{
InitializeComponent();
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMain));
this.groupBoxFile = new System.Windows.Forms.GroupBox();
this.buttonClearCurrentFile = new System.Windows.Forms.Button();
this.buttonClearAllFiles = new System.Windows.Forms.Button();
this.textBoxLocation = new System.Windows.Forms.TextBox();
this.checkBoxProcessAllFileNames = new System.Windows.Forms.CheckBox();
this.buttonAllFiles = new System.Windows.Forms.Button();
this.checkBoxWalkSubfolders = new System.Windows.Forms.CheckBox();
this.label9 = new System.Windows.Forms.Label();
this.buttonAddFile = new System.Windows.Forms.Button();
this.comboBoxFileName = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.buttonTidy = new System.Windows.Forms.Button();
this.buttonAbout = new System.Windows.Forms.Button();
this.buttonHelp = new System.Windows.Forms.Button();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanelDirectory = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanelFileNumber = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanelFilesCount = new System.Windows.Forms.StatusBarPanel();
this.groupBoxTidy = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.textBoxNewLocationTidy = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBoxSwitchesTidy = new System.Windows.Forms.TextBox();
this.buttonClean = new System.Windows.Forms.Button();
this.groupBoxClean = new System.Windows.Forms.GroupBox();
this.textBoxCleanEnd = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBoxNewLocationClean = new System.Windows.Forms.TextBox();
this.textBoxCleanBegin = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.checkBoxCleanMatchCase = new System.Windows.Forms.CheckBox();
this.groupBoxFile.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanelDirectory)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanelFileNumber)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanelFilesCount)).BeginInit();
this.groupBoxTidy.SuspendLayout();
this.groupBoxClean.SuspendLayout();
this.SuspendLayout();
//
// groupBoxFile
//
this.groupBoxFile.Controls.AddRange(new System.Windows.Forms.Control[] {
this.buttonClearCurrentFile,
this.buttonClearAllFiles,
this.textBoxLocation,
this.checkBoxProcessAllFileNames,
this.buttonAllFiles,
this.checkBoxWalkSubfolders,
this.label9,
this.buttonAddFile,
this.comboBoxFileName,
this.label10});
this.groupBoxFile.Location = new System.Drawing.Point(8, 8);
this.groupBoxFile.Name = "groupBoxFile";
this.groupBoxFile.Size = new System.Drawing.Size(432, 160);
this.groupBoxFile.TabIndex = 0;
this.groupBoxFile.TabStop = false;
this.groupBoxFile.Text = "File/Files";
//
// buttonClearCurrentFile
//
this.buttonClearCurrentFile.Location = new System.Drawing.Point(128, 16);
this.buttonClearCurrentFile.Name = "buttonClearCurrentFile";
this.buttonClearCurrentFile.Size = new System.Drawing.Size(96, 23);
this.buttonClearCurrentFile.TabIndex = 1;
this.buttonClearCurrentFile.Text = "Clear current file";
this.buttonClearCurrentFile.Click += new System.EventHandler(this.buttonClearCurrentFile_Click);
//
// buttonClearAllFiles
//
this.buttonClearAllFiles.Location = new System.Drawing.Point(232, 16);
this.buttonClearAllFiles.Name = "buttonClearAllFiles";
this.buttonClearAllFiles.Size = new System.Drawing.Size(80, 23);
this.buttonClearAllFiles.TabIndex = 2;
this.buttonClearAllFiles.Text = "Clear all files";
this.buttonClearAllFiles.Click += new System.EventHandler(this.buttonClearAllFiles_Click);
//
// textBoxLocation
//
this.textBoxLocation.Location = new System.Drawing.Point(72, 72);
this.textBoxLocation.Name = "textBoxLocation";
this.textBoxLocation.Size = new System.Drawing.Size(352, 20);
this.textBoxLocation.TabIndex = 5;
this.textBoxLocation.Text = ".";
//
// checkBoxProcessAllFileNames
//
this.checkBoxProcessAllFileNames.Location = new System.Drawing.Point(8, 104);
this.checkBoxProcessAllFileNames.Name = "checkBoxProcessAllFileNames";
this.checkBoxProcessAllFileNames.Size = new System.Drawing.Size(352, 24);
this.checkBoxProcessAllFileNames.TabIndex = 6;
this.checkBoxProcessAllFileNames.Text = "Process all file names";
//
// buttonAllFiles
//
this.buttonAllFiles.Location = new System.Drawing.Point(360, 16);
this.buttonAllFiles.Name = "buttonAllFiles";
this.buttonAllFiles.Size = new System.Drawing.Size(64, 23);
this.buttonAllFiles.TabIndex = 3;
this.buttonAllFiles.Text = "All files *.*";
this.buttonAllFiles.Click += new System.EventHandler(this.buttonAllFiles_Click);
//
// checkBoxWalkSubfolders
//
this.checkBoxWalkSubfolders.Location = new System.Drawing.Point(8, 128);
this.checkBoxWalkSubfolders.Name = "checkBoxWalkSubfolders";
this.checkBoxWalkSubfolders.Size = new System.Drawing.Size(352, 24);
this.checkBoxWalkSubfolders.TabIndex = 7;
this.checkBoxWalkSubfolders.Text = "Process matching files in the current folder and all subfolders (T)";
//
// label9
//
this.label9.Location = new System.Drawing.Point(8, 72);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(64, 23);
this.label9.TabIndex = 32;
this.label9.Text = "Folder";
//
// buttonAddFile
//
this.buttonAddFile.Location = new System.Drawing.Point(8, 16);
this.buttonAddFile.Name = "buttonAddFile";
this.buttonAddFile.Size = new System.Drawing.Size(96, 23);
this.buttonAddFile.TabIndex = 0;
this.buttonAddFile.Text = "Add file(s)...";
this.buttonAddFile.Click += new System.EventHandler(this.buttonAddFile_Click);
//
// comboBoxFileName
//
this.comboBoxFileName.Location = new System.Drawing.Point(72, 48);
this.comboBoxFileName.Name = "comboBoxFileName";
this.comboBoxFileName.Size = new System.Drawing.Size(352, 21);
this.comboBoxFileName.TabIndex = 4;
this.comboBoxFileName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBoxFileName_KeyPress);
//
// label10
//
this.label10.Location = new System.Drawing.Point(8, 48);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(72, 23);
this.label10.TabIndex = 27;
this.label10.Text = "File name(s)";
//
// label11
//
this.label11.Location = new System.Drawing.Point(16, 80);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(64, 23);
this.label11.TabIndex = 30;
this.label11.Text = "Location";
//
// buttonTidy
//
this.buttonTidy.Location = new System.Drawing.Point(8, 392);
this.buttonTidy.Name = "buttonTidy";
this.buttonTidy.TabIndex = 3;
this.buttonTidy.Text = "Tidy";
this.buttonTidy.Click += new System.EventHandler(this.buttonTidy_Click);
//
// buttonAbout
//
this.buttonAbout.Location = new System.Drawing.Point(360, 392);
this.buttonAbout.Name = "buttonAbout";
this.buttonAbout.TabIndex = 6;
this.buttonAbout.Text = "About";
this.buttonAbout.Click += new System.EventHandler(this.buttonAbout_Click);
//
// buttonHelp
//
this.buttonHelp.Location = new System.Drawing.Point(280, 392);
this.buttonHelp.Name = "buttonHelp";
this.buttonHelp.TabIndex = 5;
this.buttonHelp.Text = "Help";
this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click);
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 421);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.statusBarPanelDirectory,
this.statusBarPanelFileNumber,
this.statusBarPanelFilesCount});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(448, 16);
this.statusBar1.TabIndex = 31;
//
// statusBarPanelDirectory
//
this.statusBarPanelDirectory.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
this.statusBarPanelDirectory.MinWidth = 200;
this.statusBarPanelDirectory.Width = 332;
//
// statusBarPanelFileNumber
//
this.statusBarPanelFileNumber.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
this.statusBarPanelFileNumber.MinWidth = 50;
this.statusBarPanelFileNumber.Width = 50;
//
// statusBarPanelFilesCount
//
this.statusBarPanelFilesCount.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
this.statusBarPanelFilesCount.MinWidth = 50;
this.statusBarPanelFilesCount.Width = 50;
//
// groupBoxTidy
//
this.groupBoxTidy.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label2,
this.textBoxNewLocationTidy,
this.label1,
this.textBoxSwitchesTidy});
this.groupBoxTidy.Location = new System.Drawing.Point(8, 176);
this.groupBoxTidy.Name = "groupBoxTidy";
this.groupBoxTidy.Size = new System.Drawing.Size(432, 72);
this.groupBoxTidy.TabIndex = 1;
this.groupBoxTidy.TabStop = false;
this.groupBoxTidy.Text = "Tidy";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 23);
this.label2.TabIndex = 43;
this.label2.Text = "New folder";
//
// textBoxNewLocationTidy
//
this.textBoxNewLocationTidy.Location = new System.Drawing.Point(72, 40);
this.textBoxNewLocationTidy.Name = "textBoxNewLocationTidy";
this.textBoxNewLocationTidy.Size = new System.Drawing.Size(352, 20);
this.textBoxNewLocationTidy.TabIndex = 1;
this.textBoxNewLocationTidy.Text = "tidy";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 23);
this.label1.TabIndex = 41;
this.label1.Text = "Switches";
//
// textBoxSwitchesTidy
//
this.textBoxSwitchesTidy.Location = new System.Drawing.Point(72, 16);
this.textBoxSwitchesTidy.Name = "textBoxSwitchesTidy";
this.textBoxSwitchesTidy.Size = new System.Drawing.Size(352, 20);
this.textBoxSwitchesTidy.TabIndex = 0;
this.textBoxSwitchesTidy.Text = "-o -u -wrap 120 -latin1";
//
// buttonClean
//
this.buttonClean.Location = new System.Drawing.Point(88, 392);
this.buttonClean.Name = "buttonClean";
this.buttonClean.TabIndex = 4;
this.buttonClean.Text = "Clean";
this.buttonClean.Click += new System.EventHandler(this.buttonClean_Click);
//
// groupBoxClean
//
this.groupBoxClean.Controls.AddRange(new System.Windows.Forms.Control[] {
this.checkBoxCleanMatchCase,
this.textBoxCleanEnd,
this.label3,
this.textBoxNewLocationClean,
this.textBoxCleanBegin,
this.label4,
this.label5});
this.groupBoxClean.Location = new System.Drawing.Point(8, 256);
this.groupBoxClean.Name = "groupBoxClean";
this.groupBoxClean.Size = new System.Drawing.Size(432, 128);
this.groupBoxClean.TabIndex = 2;
this.groupBoxClean.TabStop = false;
this.groupBoxClean.Text = "Clean HTML";
//
// textBoxCleanEnd
//
this.textBoxCleanEnd.Location = new System.Drawing.Point(104, 40);
this.textBoxCleanEnd.Name = "textBoxCleanEnd";
this.textBoxCleanEnd.Size = new System.Drawing.Size(320, 20);
this.textBoxCleanEnd.TabIndex = 1;
this.textBoxCleanEnd.Text = "BORDER=\"0\">";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 96);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 23);
this.label3.TabIndex = 43;
this.label3.Text = "New folder";
//
// textBoxNewLocationClean
//
this.textBoxNewLocationClean.Location = new System.Drawing.Point(72, 96);
this.textBoxNewLocationClean.Name = "textBoxNewLocationClean";
this.textBoxNewLocationClean.Size = new System.Drawing.Size(352, 20);
this.textBoxNewLocationClean.TabIndex = 3;
this.textBoxNewLocationClean.Text = "clean";
//
// textBoxCleanBegin
//
this.textBoxCleanBegin.Location = new System.Drawing.Point(104, 16);
this.textBoxCleanBegin.Name = "textBoxCleanBegin";
this.textBoxCleanBegin.Size = new System.Drawing.Size(320, 20);
this.textBoxCleanBegin.TabIndex = 0;
this.textBoxCleanBegin.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(96, 23);
this.label4.TabIndex = 41;
this.label4.Text = "Begin cleaning at";
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 40);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(96, 23);
this.label5.TabIndex = 45;
this.label5.Text = "End cleaning at";
//
// checkBoxCleanMatchCase
//
this.checkBoxCleanMatchCase.Location = new System.Drawing.Point(8, 64);
this.checkBoxCleanMatchCase.Name = "checkBoxCleanMatchCase";
this.checkBoxCleanMatchCase.Size = new System.Drawing.Size(88, 24);
this.checkBoxCleanMatchCase.TabIndex = 2;
this.checkBoxCleanMatchCase.Text = "Match case";
//
// FormMain
//
this.AllowDrop = true;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(448, 437);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBoxClean,
this.buttonClean,
this.groupBoxTidy,
this.statusBar1,
this.buttonHelp,
this.buttonAbout,
this.buttonTidy,
this.groupBoxFile,
this.label11});
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FormMain";
this.Text = "TidySharp";
this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);
this.Load += new System.EventHandler(this.Form1_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.FormMain_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.FormMain_DragEnter);
this.groupBoxFile.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanelDirectory)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanelFileNumber)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanelFilesCount)).EndInit();
this.groupBoxTidy.ResumeLayout(false);
this.groupBoxClean.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
formMain = new FormMain();
Application.Run(formMain);
}
static internal FormMain formMain;
int FormMainWidthOrig;
int groupBoxFileWidthOrig;
int comboBoxFileNameWidthOrig;
string fixFolder(string location)
{
if (location.LastIndexOf(@"\")+1 == location.Length)
{
if (location.Length >= 1)
{
location = location.Substring(0, location.Length-1);
}
}
return location;
}
void allDataFromForm()
{
Backend.Location = fixFolder(textBoxLocation.Text);
Backend.ProcessAllFileNames = checkBoxProcessAllFileNames.Checked;
Backend.WalkSubfolders = checkBoxWalkSubfolders.Checked;
Backend.SwitchesTidy = textBoxSwitchesTidy.Text;
Backend.NewLocationTidy = fixFolder(textBoxNewLocationTidy.Text);
Backend.CleanBegin = textBoxCleanBegin.Text;
Backend.CleanEnd = textBoxCleanEnd.Text;
Backend.CleanMatchCase = checkBoxCleanMatchCase.Checked;
Backend.NewLocationClean = fixFolder(textBoxNewLocationClean.Text);
}
void allDataToForm()
{
}
void filesToForm(string[] fileNames)
{
foreach (string file in fileNames)
{
if (!comboBoxFileName.Items.Contains(file) )
{
comboBoxFileName.Items.Add(file);
}
}
int index = comboBoxFileName.FindStringExact(fileNames[0]);
comboBoxFileName.SelectedIndex = index;
checkBoxProcessAllFileNames.Checked = (comboBoxFileName.Items.Count > 1);
}
bool shouldTextBeAddedToItems()
{
string file = comboBoxFileName.Text.Trim();
if (file.Length > 0)
{
if (!comboBoxFileName.Items.Contains(file) ) return true;
}
return false;
}
void addTextToItems()
{
if (shouldTextBeAddedToItems() )
{
comboBoxFileName.Items.Insert(0, comboBoxFileName.Text.Trim() );
}
}
void clearCurrentFile()
{
string file = comboBoxFileName.Text;
comboBoxFileName.Text = "";
int index = comboBoxFileName.FindStringExact(file);
if (index >= 0)
{
comboBoxFileName.Items.RemoveAt(index);
if (comboBoxFileName.Items.Count > 0)
{
comboBoxFileName.SelectedIndex = 0;
comboBoxFileName.Text =
comboBoxFileName.SelectedItem.ToString();
}
}
}
void clearAllFiles()
{
comboBoxFileName.Items.Clear();
comboBoxFileName.Text = "";
}
private void buttonAddFile_Click(object sender, System.EventArgs e)
{
string[] fileNames;
bool ok = Backend.ShowOpenFileDialog(out fileNames);
this.Text = Application.ProductName + " - " + System.IO.Directory.GetCurrentDirectory();
if (!ok) return;
filesToForm(fileNames);
textBoxLocation.Text = Directory.GetParent(fileNames[0]).FullName;
}
private void buttonClearCurrentFile_Click(object sender, System.EventArgs e)
{
clearCurrentFile();
}
private void buttonClearAllFiles_Click(object sender, System.EventArgs e)
{
clearAllFiles();
}
private void buttonAllFiles_Click(object sender, System.EventArgs e)
{
clearAllFiles();
comboBoxFileName.Text = "*.*";
addTextToItems();
}
private void comboBoxFileName_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == (int)Keys.Enter)
{
addTextToItems();
//TODO2 Varför försvinner musen?
//comboBoxFileName.DroppedDown = true;
e.Handled = true; //TODO3 Varför "låter" det?
}
//TODO0 Varför funkar inte Keys.Delete?
else if (e.KeyChar == (int)Keys.Back)
{
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
{ //TODO1 Kommer aldrig hit
Debug.WriteLine("Pressed " + Keys.Control);
}
else if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
{ //...men hit
Debug.WriteLine("Pressed " + Keys.Shift);
clearAllFiles();
}
e.Handled = true;
}
else if (e.KeyChar == 127)
{ //...och hit
Debug.WriteLine("Pressed 127 " + Keys.Control);
// char #127 is at the end
comboBoxFileName.Text = comboBoxFileName.Text.Substring(0,
comboBoxFileName.Text.Length-1).Trim();
clearCurrentFile();
e.Handled = true;
}
}
private void processAll()
{
allDataFromForm();
int c = (Backend.ProcessAllFileNames) ? comboBoxFileName.Items.Count : 0;
int t = (shouldTextBeAddedToItems() ) ? 1 : 0;
if (t== 0 && !Backend.ProcessAllFileNames) t = 1;
string[] files = new String[t+c];
for (int k = 0; k < c; k++)
{
files[k] = (string)comboBoxFileName.Items[k];
}
if (t == 1) files[c] = comboBoxFileName.Text.Trim();
Backend.ProcessAll(files);
}
private void Form1_Load(object sender, System.EventArgs e)
{
FormMainWidthOrig = this.Size.Width;
groupBoxFileWidthOrig = groupBoxFile.Width;
comboBoxFileNameWidthOrig = comboBoxFileName.Width;
this.Text = Application.ProductName + " - " + System.IO.Directory.GetCurrentDirectory();
}
private void Form1_SizeChanged(object sender, System.EventArgs e)
{
int delta = this.Size.Width - FormMainWidthOrig;
if (delta >= 0)
{
groupBoxFile.Width = groupBoxFileWidthOrig + delta;
comboBoxFileName.Width = comboBoxFileNameWidthOrig + delta;
textBoxLocation.Width = comboBoxFileNameWidthOrig + delta;
groupBoxTidy.Width = groupBoxFileWidthOrig + delta;
textBoxSwitchesTidy.Width = comboBoxFileNameWidthOrig + delta;
textBoxNewLocationTidy.Width = comboBoxFileNameWidthOrig + delta;
groupBoxClean.Width = groupBoxFileWidthOrig + delta;
textBoxCleanBegin.Width = comboBoxFileNameWidthOrig + delta-32;
textBoxCleanEnd.Width = comboBoxFileNameWidthOrig + delta-32;
textBoxNewLocationClean.Width = comboBoxFileNameWidthOrig + delta;
}
}
private void buttonUndo_Click(object sender, System.EventArgs e)
{
Laj.SWEgenskaper.DlgHelp dlgHelp = new Laj.SWEgenskaper.DlgHelp();
dlgHelp.Text = "Undo";
dlgHelp.ShowDialog();
}
private void buttonHelp_Click(object sender, System.EventArgs e)
{
FormMain.formMain.statusBarPanelDirectory.Text = "directoryName";
Laj.SWEgenskaper.DlgHelp dlgHelp = new Laj.SWEgenskaper.DlgHelp();
dlgHelp.ShowDialog();
}
private void buttonAbout_Click(object sender, System.EventArgs e)
{
Laj.DlgArchetype.DlgAbout dlgAbout = new Laj.DlgArchetype.DlgAbout();
dlgAbout.ShowDialog();
}
private void FormMain_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop) )
e.Effect = DragDropEffects.All;
else
e.Effect = DragDropEffects.None;
}
private void FormMain_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
string[] fileNames = (string[])e.Data.GetData("FileDrop", false);
this.Text = Application.ProductName + " - " + System.IO.Directory.GetCurrentDirectory();
filesToForm(fileNames);
textBoxLocation.Text = Directory.GetParent(fileNames[0]).FullName;
}
private void buttonTidy_Click(object sender, System.EventArgs e)
{
Backend.DoTidy = true;
processAll();
}
private void buttonClean_Click(object sender, System.EventArgs e)
{
Backend.DoTidy = false;
processAll();
}
}
}