protected void Btn_Launch_Click(object sender, EventArgs e) { protocol = DataUtils.GetProtocol(); var selector = new Selector(); string location = Server.MapPath("") + "\\Output\\file.txt"; selector.GetFiles(ref fileObjects, location); switch (protocol) { case 1: var replaceEngine = new ReplaceEngine(); replaceEngine.Run(fileObjects, Tb_Target.Text, Tb_Replacement.Text); replaceEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 2: var hyperLinkEngine = new HyperLinkEngine(); hyperLinkEngine.Run(fileObjects); hyperLinkEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 3: var encodingCleanEngine = new EncodingCleanEngine(); encodingCleanEngine.Run(fileObjects); encodingCleanEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 4: var renameEngine = new RenameEngine(); int headerSize = 2; //2 Is a standard header size try { headerSize = Convert.ToInt32(Tb_Target.Text); } catch (Exception) { TextBlockConsole.Text = "Please enter a number"; } renameEngine.Run(fileObjects, headerSize); renameEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 5: var splitEngine = new SplitEngine(); splitEngine.Run(fileObjects, Tb_Target.Text); TextBlockConsole.Text = "Process Complete!"; break; case 6: var labelEngine = new LabelEngine(); labelEngine.Run(fileObjects); labelEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 7: var purgeEngine = new PurgeEngine(); purgeEngine.Run(fileObjects, Tb_Target.Text, Tb_Replacement.Text); purgeEngine = null; TextBlockConsole.Text = "Process Complete!"; break; default: TextBlockConsole.Text = "Please select an option."; break; } Response.Redirect("UploadedItem.aspx"); var cleaner = new Cleaner(); cleaner.CleanFiles(); }
/// <summary> /// When the uses presses launch, the selected protocol will be launched. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_launch_Click(object sender, RoutedEventArgs e) { switch (protocol) { case 1: var replaceEngine = new ReplaceEngine(); replaceEngine.Run(fileObjects, tb_target.Text, tb_replacement.Text); replaceEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 2: var hyperLinkEngine = new HyperLinkEngine(); hyperLinkEngine.Run(fileObjects); hyperLinkEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 3: var encodingCleanEngine = new EncodingCleanEngine(); encodingCleanEngine.Run(fileObjects); encodingCleanEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 4: var renameEngine = new RenameEngine(); int headerSize = 2; //2 Is a standard header size try { headerSize = Convert.ToInt32(tb_target.Text); } catch (Exception ex) { MessageBox.Show("Please enter a number" + ex); } renameEngine.Run(fileObjects, headerSize); renameEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 5: var splitEngine = new SplitEngine(); splitEngine.Run(fileObjects, tb_target.Text); TextBlockConsole.Text = "Process Complete!"; Process.Start(@"C:\\Users\\" + Environment.UserName + "\\Desktop\\output"); break; case 6: var labelEngine = new LabelEngine(); labelEngine.Run(fileObjects); labelEngine = null; TextBlockConsole.Text = "Process Complete!"; break; case 7: var purgeEngine = new PurgeEngine(); purgeEngine.Run(fileObjects, tb_target.Text, tb_replacement.Text); purgeEngine = null; TextBlockConsole.Text = "Process Complete!"; break; default: TextBlockConsole.Text = "Please select an option."; break; } }