private void frmCardView_FormClosing(object sender, FormClosingEventArgs e) { DB2Config config = DB2Config.GetInstance(); if (string.Equals(config.GetSetting("SaveLayout"), "True", StringComparison.OrdinalIgnoreCase)) { if (listViewEx1.View == View.Details) { config.SetSetting("CardView", "List"); } else { config.SetSetting("CardView", "Ico"); } } }
private void frmConfig_Load(object sender, EventArgs e) { DB2Config config = DB2Config.GetInstance(); CLConfig clconfig = CLConfig.GetInstance(); if (string.Equals(config.GetSettingNext("NotShowIco"), "True", StringComparison.OrdinalIgnoreCase)) { checkBoxX1.Checked = true; } if (string.Equals(config.GetSettingNext("NoVirtualMode"), "True", StringComparison.OrdinalIgnoreCase)) { checkBoxX2.Checked = true; } if (string.Equals(clconfig.GetSetting("AllowForbiddenCard"), "True", StringComparison.OrdinalIgnoreCase)) { checkBoxX3.Checked = true; } if (string.Equals(config.GetSettingNext("NoDrag"), "True", StringComparison.OrdinalIgnoreCase)) { checkBoxX4.Checked = true; } if (!string.Equals(clconfig.GetSettingNext("AllowDIY"), "True", StringComparison.OrdinalIgnoreCase)) { checkBoxX5.Checked = false; } if (!string.Equals(config.GetSetting("SaveLayout"), "True", StringComparison.OrdinalIgnoreCase)) { checkBoxX6.Checked = false; } textBox1.Text = config.GetSetting("ImagePath"); textBox2.Text = config.GetSetting("IcoPath"); textBox3.Text = config.GetSetting("NBXPath"); textBox4.Text = config.GetSetting("DeckPath"); textBox5.Text = config.GetSetting("DIYImagePath"); }
public PicLoader(int capacity, string dirPath, string diyPath) { if (!string.Equals(DB2Config.GetInstance().GetSetting("NotShowIco"), "True", StringComparison.OrdinalIgnoreCase)) { refreshinterval = Tools.Config.GetIntValue(DB2Config.GetInstance().GetSetting("RefreshInterval"), 200); loadpicinterval = Tools.Config.GetIntValue(DB2Config.GetInstance().GetSetting("LoadPicInterval"), 20); loadoncenum = Tools.Config.GetIntValue(DB2Config.GetInstance().GetSetting("LoadPicOnceNum"), 10); Global.loadPicEnd = false; Capacity = capacity; DirPath = dirPath; DIYPath = diyPath; if (DirPath[DirPath.Length - 1] != '\\') { DirPath += "\\"; } if (DIYPath[DIYPath.Length - 1] != '\\') { DIYPath += "\\"; } NeedShow = new Stack <PicInfo>(); mutex = new Mutex(); for (int i = capacity; i > 0; i--) { NeedShow.Push(new PicInfo(i, false)); } IndexMapper = new Hashtable(capacity + 1); Thread WorkThread = new Thread(new ThreadStart(LoadPic)); WorkThread.IsBackground = true; WorkThread.Priority = ThreadPriority.BelowNormal; WorkThread.Start(); } else { //MethodInvoker Invoker = new MethodInvoker(Global.frmMainHolder.LoadPicEnd); //Global.frmMainHolder.BeginInvoke(Invoker); Global.loadPicEnd = true; } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string appPath = Application.ExecutablePath; for (int i = appPath.Length - 1; i >= 0; i--) { if (appPath[i] == '\\') { Global.appPath = appPath.Substring(0, i); break; } } if (string.Equals(DB2Config.GetInstance().GetSetting("FirstTimeRun"), "True", StringComparison.OrdinalIgnoreCase)) { string icodir = DB2Config.GetInstance().GetSetting("IcoPath"); string testicofile = icodir + "1.jpg"; if (!System.IO.File.Exists(testicofile)) { DB2Config.GetInstance().SetSetting("FirstTimeRun", "False"); if (MessageBox.Show("您是第一次运行本程序,为了完整的体验本程序的所有功能,请先运行辅助转换工具(ConveterTools.exe)生成略缩图。是否生成略缩图?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { System.Diagnostics.Process.Start(Application.StartupPath + "\\ConveterTools.exe"); } catch { } return; } } } Application.Run(new frmMain()); //Application.Run(new frmDeckView()); }
//构造函数(略缩图数量, 略缩图路径, DIY略缩图路径) public PicLoader(int capacity, string icoPath, string diyIcoPath) { DB2Config config = DB2Config.GetInstance(); if (!string.Equals(config.GetSetting("NotShowIco"), "True", StringComparison.OrdinalIgnoreCase)) { //读取参数 refreshinterval = MyTools.Config.GetIntValue(config.GetSetting("RefreshInterval"), 200); loadpicinterval = MyTools.Config.GetIntValue(config.GetSetting("LoadPicInterval"), 20); loadoncenum = MyTools.Config.GetIntValue(config.GetSetting("LoadPicOnceNum"), 10); //初始化 Global.loadPicEnd = false; Capacity = capacity; IcoPath = FileTools.DirToPath(FileTools.RelativeToAbsolutePath(icoPath)); DIYIcoPath = FileTools.DirToPath(FileTools.RelativeToAbsolutePath(diyIcoPath)); NeedShow = new Stack <PicInfo>(); IndexMapper = new Hashtable(capacity + 1); //将所有载入略缩图请求压栈 for (int i = capacity - 1; i >= 0; i--) { NeedShow.Push(new PicInfo(i, false)); } //在新线程载入略缩图 Thread WorkThread = new Thread(new ThreadStart(LoadPic)); WorkThread.IsBackground = true; WorkThread.Priority = ThreadPriority.BelowNormal; WorkThread.Start(); } else { DoLoadEnd(); } }
private void frmDeckView_Load(object sender, EventArgs e) { DB2Config config = DB2Config.GetInstance(); SaveLayout("DefaultDeckViewLayout.xml"); if (string.Equals(config.GetSetting("SaveLayout"), "True", StringComparison.OrdinalIgnoreCase)) { LoadLayout("DeckViewLayout.xml"); } // // columnHeader1 // this.columnHeader1.Text = "中文名"; this.columnHeader1.Width = 128; // // columnHeader2 // this.columnHeader2.Text = "日文名"; this.columnHeader2.Width = 125; // // columnHeader3 // this.columnHeader3.Text = "卡种"; this.columnHeader3.Width = 65; // // columnHeader4 // this.columnHeader4.Text = "种族"; // // columnHeader5 // this.columnHeader5.Text = "属性"; this.columnHeader5.Width = 42; // // columnHeader6 // this.columnHeader6.Text = "星级"; this.columnHeader6.Width = 42; // // columnHeader7 // this.columnHeader7.Text = "攻击"; // // columnHeader8 // this.columnHeader8.Text = "防御"; // // columnHeader9 // this.columnHeader9.Text = "自编号"; this.columnHeader9.Width = 51; this.listViewEx1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2, this.columnHeader3, this.columnHeader4, this.columnHeader5, this.columnHeader6, this.columnHeader7, this.columnHeader8, this.columnHeader9 }); listViewEx1.LargeImageList = Global.frmMainHolder.imageList1; listViewEx2.LargeImageList = Global.frmMainHolder.imageList1; listViewEx3.LargeImageList = Global.frmMainHolder.imageList1; listViewEx1.SmallImageList = Global.frmMainHolder.imageList2; listViewEx2.SmallImageList = Global.frmMainHolder.imageList2; listViewEx3.SmallImageList = Global.frmMainHolder.imageList2; sorter.AddField("cardType2", SortField.INT, false, false); sorter.AddField("atkValue", SortField.INT); sorter.AddField("defValue", SortField.INT); sorter.AddField("ID", SortField.DOC, true, false); sorter.AddField("name2", SortField.STRING, true); sorter.AddField("japName2", SortField.STRING, true); sorter.AddField("element", SortField.STRING); sorter.AddField("tribe", SortField.STRING); sorter.AddField("level", SortField.INT); if (string.Equals(config.GetSetting("SaveLayout"), "True", StringComparison.OrdinalIgnoreCase)) { if (string.Equals(config.GetSetting("DeckView1"), "List", StringComparison.OrdinalIgnoreCase)) { listViewEx1.View = View.Details; } else { listViewEx1.View = View.LargeIcon; } if (string.Equals(config.GetSetting("DeckView2"), "List", StringComparison.OrdinalIgnoreCase)) { listViewEx2.View = View.Details; } else { listViewEx2.View = View.LargeIcon; } if (string.Equals(config.GetSetting("DeckView3"), "List", StringComparison.OrdinalIgnoreCase)) { listViewEx3.View = View.Details; } else { listViewEx3.View = View.LargeIcon; } } }
private void buttonX1_Click(object sender, EventArgs e) { DB2Config config = DB2Config.GetInstance(); CLConfig clconfig = CLConfig.GetInstance(); if (checkBoxX1.Checked) { config.SetSettingNext("NotShowIco", "True"); } else { config.SetSettingNext("NotShowIco", "False"); } if (checkBoxX2.Checked) { config.SetSettingNext("NoVirtualMode", "True"); } else { config.SetSettingNext("NoVirtualMode", "False"); } if (checkBoxX3.Checked) { clconfig.SetSetting("AllowForbiddenCard", "True"); } else { clconfig.SetSetting("AllowForbiddenCard", "False"); } if (checkBoxX4.Checked) { config.SetSetting("NoDrag", "True"); } else { config.SetSetting("NoDrag", "False"); } if (checkBoxX5.Checked) { clconfig.SetSetting("AllowDIY", "True"); } else { clconfig.SetSetting("AllowDIY", "False"); } if (checkBoxX6.Checked) { config.SetSetting("SaveLayout", "True"); } else { config.SetSetting("SaveLayout", "False"); } config.SetSetting("ImagePath", textBox1.Text); config.SetSetting("IcoPath", textBox2.Text); config.SetSetting("NBXPath", textBox3.Text); config.SetSetting("DeckPath", textBox4.Text); config.SetSetting("DIYImagePath", textBox5.Text); this.Close(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string appPath = Application.ExecutablePath; for (int i = appPath.Length - 1; i >= 0; i--) { if (appPath[i] == '\\') { Global.appPath = appPath.Substring(0, i); break; } } Patch1(); if (string.Equals(DB2Config.GetInstance().GetSetting("FirstTimeRun"), "True", StringComparison.OrdinalIgnoreCase)) { string icodir = DB2Config.GetInstance().GetSetting("IcoPath"); string testicofile = icodir + "1.jpg"; if (!System.IO.File.Exists(testicofile)) { DB2Config.GetInstance().SetSetting("FirstTimeRun", "False"); if (MessageBox.Show("您是第一次运行本程序,为了完整的体验本程序的所有功能,请先运行辅助转换工具(ConveterTools.exe)生成略缩图。是否生成略缩图?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { System.Diagnostics.Process.Start(Application.StartupPath + "\\ConveterTools.exe"); } catch { } return; } } } BaseCardLibrary.Search.CardLibrary cardLibrary = BaseCardLibrary.Search.CardLibrary.GetInstance(); Global.DataVersion = Global.InternalVersion * 100000 + cardLibrary.GetNonDIYCount(); //为SoftMgr设置初始信息 mAppInterface.SetProgramInfo("DeckBuilder", Global.appPath, Global.DataVersion); //获取目录信息 mAppInterface.GetCardImgDirEx(ref PicLoader.commonImagePath); PicLoader.commonImagePath = FileTools.DirToPath(PicLoader.commonImagePath); PicLoader.imagePath = DB2Config.GetInstance().GetSetting("ImagePath"); PicLoader.imagePath = FileTools.DirToPath(PicLoader.imagePath); mAppInterface.GetDIYCardImgDirEx(ref PicLoader.commonDiyImagePath); PicLoader.commonDiyImagePath = FileTools.DirToPath(PicLoader.commonDiyImagePath); PicLoader.diyImagePath = DB2Config.GetInstance().GetSetting("DIYImagePath"); PicLoader.diyImagePath = FileTools.DirToPath(PicLoader.diyImagePath); PicLoader.icoPath = DB2Config.GetInstance().GetSetting("IcoPath"); PicLoader.diyIcoPath = DB2Config.GetInstance().GetSetting("IcoPath"); Application.Run(new frmMain()); //Application.Run(new frmDeckView()); }