private void Button_lua_Click(object sender, EventArgs e) { if (textBox_code.Text.Length > 0) { CCFile.CheckFolder(SET.GamePath + @"script"); string luafile = SET.GamePath + @"script\c" + textBox_code.Text + ".lua"; if (!File.Exists(luafile)) { if (MessageBox.Show("是否创建?\n" + luafile, "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { CCFile.WriteText(luafile, "--" + textBox_name.Text + "\n", new UTF8Encoding(false)); } } if (File.Exists(luafile)) { if (File.Exists(SET.NPPpath)) { CCFile.RUN(SET.NPPpath, " \"" + luafile + "\""); } else { luaEditor le = new luaEditor(luafile); le.Show(); } } } }
private void ProcessForm_Load(object sender, EventArgs e) { t = null; stop = true; this.Text = title; switch (title) { case "复制图片,脚本": stop = false; CCFile.CheckFolder(path2); CCFile.CheckFolder(path2 + "pics"); CCFile.CheckFolder(path2 + "pics\\field"); CCFile.CheckFolder(path2 + "pics\\thumbnail"); CCFile.CheckFolder(path2 + "script"); NUM = CDB.ids.Count; t = new Thread(Copy); break; case "裁剪图片": stop = false; CCFile.CheckFolder(path2); NUM = CDB.cards.Count; t = new Thread(Cut); break; case "图片调整": stop = false; CCFile.CheckFolder(path2); CCFile.CheckFolder(path2 + "pics"); CCFile.CheckFolder(path2 + "pics\\thumbnail"); names = CCFile.FindFiles(path1, ex, false); NUM = names.Length; t = new Thread(ReSize); break; case "提取图片": stop = false; label1.Text = "提取中。。。"; progressBar1.Style = ProgressBarStyle.Marquee; NUM = 1; t = new Thread(Get_setjpg); break; } if (t != null && NUM > 0) { pb1 = new _ProcessBar1(ProcessADD); lb1 = new _Label1(Setlabel); fm = new _Form(closeForm); progressBar1.Maximum = NUM; t.IsBackground = true; t.Start(); } else { stop = true; this.Close(); } }
private void tabPage_jpg_DragDrop(object sender, DragEventArgs e) { if (textBox_code.Text.Length > 0) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string str = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString(); if (str.EndsWith("jpg", StringComparison.CurrentCultureIgnoreCase) || str.EndsWith("png", StringComparison.CurrentCultureIgnoreCase) || str.EndsWith("bmp", StringComparison.CurrentCultureIgnoreCase)) { if (MessageBox.Show("是否把调整图片", "提示", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { CCFile.CheckFolder(SET.GamePath + "pics"); CCFile.CheckFolder(SET.GamePath + "pics\\thumbnail"); PIC.savejpg(PIC.zoom(PIC.GetBitmap(str), 177, 254), SET.GamePath + "pics\\" + textBox_code.Text + ".jpg", 96); PIC.savejpg(PIC.zoom(PIC.GetBitmap(str), 44, 64), SET.GamePath + "pics\\thumbnail\\" + textBox_code.Text + ".jpg", 96); MessageBox.Show("调整完成!"); } } } } }
private void Get_setjpg() { string ostr = " e -tzip " + file + " -aoa"; CCFile.CheckFolder(path1); CCFile.CheckFolder(path2); CCFile._7zip(path1, path2, ostr); int t, w, i = 0; string img, id; if (File.Exists(path2 + "set")) { string temp = File.ReadAllText(path2 + "set", Encoding.UTF8); t = temp.IndexOf("stylesheet: "); w = temp.IndexOf("\r\n", t); t = temp.IndexOf("card:\r\n", w); while (t >= 0) { if (stop == false) { i++; try { t = temp.IndexOf("image: ", t); w = temp.IndexOf("\r\n", t); } catch { } if ((w - t - 7) > 0 && (w - t - 7) <= 16) { img = temp.Substring(t + 7, w - t - 7); try { t = temp.IndexOf("gamecode: ", w); w = temp.IndexOf("\r\n", t); } catch { t = w + 2; } if ((w - t - 10) > 0 && (w - t - 10) <= 16) { id = temp.Substring(t + 10, w - t - 10); if (File.Exists(path2 + img)) { if (img.IndexOf(".jpg") >= 0) { File.Move(path2 + img, path2 + img); } else { File.Move(path2 + img, path2 + id + ".png"); } } } } t = temp.IndexOf("card:\r\n", w); } else { break; } } File.Delete(path2 + "set"); } if (stop == true) { MessageBox.Show("已经取消!"); } else { stop = true; MessageBox.Show("图片提取完成。\n图片在\n" + path2); } this.Invoke(fm); }