private void RunOptimizer() { wow = new Stopwatch(); wow.Start(); try { lbl_Line1.Text = "Preparing for optimization, please wait..."; long lines = SControl.GetFileLine(root); lbl_Line1.Text = ""; SControl.Backup(root); Optimizer.ReadFile(root, lines); } catch (ThreadAbortException) { } catch (System.IO.FileNotFoundException) { lbl_Line1.Text = "No such file."; @finish_rdy(true); t1.Abort(); } catch (Exception ex) { lbl_Line1.Text = ex.Message; //if (InfoCollector.IfCollectEx) //{ // try { InfoCollector.UploadEx(ex); } catch { } //} //MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //sControls.WriteFile(ex.Message, "Exception.log"); @finish_rdy(true); progressbar.Value = 0; progress.Text = "0%"; t1.Abort(); GC.Collect(); } wow.Stop(); //Console.WriteLine(wow.Elapsed); }
private void detectStatus_Tick(object sender, EventArgs e) { //root = txtRoot.Text; if (Optimizer.Finsh == true) { //MessageBox.Show("Optimization finished. Time: " + wow.Elapsed.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); if (System.IO.Path.GetExtension(root).ToLower() == ".osb") { objectroot = root; } else { objectroot = System.IO.Path.GetDirectoryName(root) + @"\" + System.IO.Path.GetFileNameWithoutExtension(root) + ".osb"; } SControl.WriteFile(Optimizer.sb.ToString(), objectroot); Optimizer.Finsh = false; @finish_rdy(false); return; } }
private void Coloring() { string gjz = "Sprite,Animation"; string[] cm = gjz.Split(','); foreach (string a in cm) { int indexSp = richTextBox3.Text.IndexOf(a); if (indexSp != -1) { richTextBox3.Select(indexSp, a.Length); richTextBox3.SelectionColor = Color.FromArgb(255, 86, 156, 214); } } string cs = "Background,Fail,Pass,Foreground,TopLeft,TopCentre,TopRight,CentreLeft,Centre,CentreRight,BottomLeft,BottomCentre,BottomRight"; string[] cm2 = cs.Split(','); foreach (string a in cm2) { int indexSp = richTextBox3.Text.IndexOf(a); if (indexSp != -1) { richTextBox3.Select(indexSp, a.Length); richTextBox3.SelectionColor = Color.FromArgb(255, 184, 215, 163); //richTextBox3 .SelectionBackColor = Color.FromArgb(55, 255, 255, 255); } } int q1 = richTextBox3.Text.IndexOf("\""); int q2 = richTextBox3.Text.LastIndexOf("\""); if (q1 != -1 && q2 != -1 && q1 != q2) { richTextBox3.Select(q1, q2 - q1 + 1); richTextBox3.SelectionColor = Color.FromArgb(255, 214, 157, 133); } List <int> lst = SControl.FindAllindex(richTextBox3.Text, "M,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "C,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "F,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "L,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "MX,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 2); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "MY,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 2); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "P,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "R,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "S,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "T,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } lst = SControl.FindAllindex(richTextBox3.Text, "V,"); for (int i = 0; i < lst.Count; i++) { richTextBox3.Select(lst[i], 1); richTextBox3.SelectionColor = Color.FromArgb(255, 78, 201, 176); } richTextBox3.Select(0, 0); }