//删除 private void btnDelini_Click(object sender, EventArgs e) { try { if (this.lbxIni.Items.Count > 0) { _Ini ini = new _Ini("Ttyping.ty"); string select = this.lbxIni.SelectedItem.ToString(); string[] idget = select.Split('|'); string get = idget[0].Trim(); ini.IniWriteValue("发文配置", get, null); string temp = ini.IniReadValue("发文面板配置", "总序列", "0"); if (temp != "0") { if (ini.IniReadValue("发文配置", get, "NO") == "NO") { if (temp.Contains(get)) { temp = temp.Remove(temp.IndexOf(get), 2); ini.IniWriteValue("发文面板配置", "总序列", temp); } iniRead(); ClearAll(); } } } } catch { } }
private bool iniRead() { try { this.lbxIni.Items.Clear(); _Ini getData = new _Ini("Ttyping.ty"); ArrayList getini = ReadKeys("发文配置"); int count = getini.Count; for (int i = 0; i < count; i++) { string getit = getData.IniReadValue("发文配置", getini[i].ToString(), "0"); if (getit == "0") { return(false); } string[] get = getit.ToString().Split('|'); this.lbxIni.Items.Add(getini[i] + " | " + get[3] + " | " + get[12]); } return(true); } catch (Exception err) { MessageBox.Show(err.Message); return(false); } }
private void btnCancel_Click(object sender, EventArgs e) { Theme.ThemeApply = false; _Ini ini = new _Ini("Ttyping.ty"); ini.IniWriteValue("主题", "是否启用主题", "False"); frm.LoadTheme("", Theme.ThemeColorBG, Theme.ThemeColorFC, Theme.ThemeBG); this.Close(); }
private void radioButtonTab_CheckedChanged(object sender, EventArgs e) { if (radioButtonTab.Checked) { _Ini Setupini = new _Ini("Ttyping.ty"); Glob.getStyle = true; Setupini.IniWriteValue("载入", "方式", "true"); } }
private void cbx乱序全段不重复_CheckedChanged(object sender, EventArgs e) { bool temp = (sender as CheckBox).Checked; _Ini t2 = new _Ini("Ttyping.ty"); if (temp) { t2.IniWriteValue("发文面板配置", "乱序全段不重复", "True"); } else { t2.IniWriteValue("发文面板配置", "乱序全段不重复", "False"); } }
/// <summary> /// 设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { _Ini ini = new _Ini("Ttyping.ty"); ini.IniWriteValue("主题", "是否启用主题", "True"); ini.IniWriteValue("主题", "是否应用主题背景", this.SwitchB1.Checked.ToString()); ini.IniWriteValue("主题", "背景路径", this.lblBGPath.Text); ini.IniWriteValue("主题", "纯色", this.lblPicShow.BackColor.ToArgb().ToString()); ini.IniWriteValue("主题", "主题颜色", this.lblThemeBGShow.BackColor.ToArgb().ToString()); ini.IniWriteValue("主题", "字体颜色", this.lblThemeFCShow.BackColor.ToArgb().ToString()); ini.IniWriteValue("主题", "预览", this.SwitchB2.Checked.ToString()); Theme.isBackBmp = this.SwitchB1.Checked; Theme.ThemeBackBmp = this.lblBGPath.Text; Theme.ThemeBG = this.lblPicShow.BackColor; Theme.ThemeColorBG = this.lblThemeBGShow.BackColor; Theme.ThemeColorFC = this.lblThemeFCShow.BackColor; Theme.ReView = this.SwitchB2.Checked; Theme.ThemeApply = true; this.Close(); }
}//个签 public void srfSave() { _Ini Setupini = new _Ini("Ttyping.ty"); if (this.checkBox3.Checked) { if (this.textBox2.Text != "") { Setupini.IniWriteValue("输入法", "签名", this.textBox2.Text); Setupini.IniWriteValue("输入法", "标志", "1"); } else { Setupini.IniWriteValue("输入法", "标志", "0"); } } else { Setupini.IniWriteValue("输入法", "标志", "0"); } } //输入法
public void gQ() { _Ini Setupini = new _Ini("Ttyping.ty"); if (this.checkBox1.Checked) { if (this.textBox1.Text != "") { Setupini.IniWriteValue("个签", "签名", this.textBox1.Text); Setupini.IniWriteValue("个签", "标志", "1"); } else { Setupini.IniWriteValue("个签", "标志", "0"); // 0 表示未设置 } } else { Setupini.IniWriteValue("个签", "标志", "0"); // 0 表示未设置 } }//个签
private void 新发文_Load(object sender, EventArgs e) { //DriveInfo[] Drives = DriveInfo.GetDrives(); //HeaderFresh("我的电脑"); //foreach (DriveInfo Dirs in Drives) { // listViewFile.Items.Add(new ListViewItem(new string[] {Dirs.Name,"磁盘"})); //} NewSendText.已发段数 = 0; NewSendText.起始段号 = 1; NewSendText.当前配置序列 = ""; ReadAll(Application.StartupPath); this.Text += "[当前群:" + frm.lblQuan.Text + "]"; _Ini t2 = new _Ini("Ttyping.ty"); this.cbxTickOut.Checked = bool.Parse(t2.IniReadValue("发文面板配置", "自动剔除空格", "True")); this.cbx乱序全段不重复.Checked = bool.Parse(t2.IniReadValue("发文面板配置", "乱序全段不重复", "False")); if (!File.Exists(Application.StartupPath + "\\TyDll.dll")) { this.lbxTextList.Items.Clear(); this.lbxTextList.SelectedIndexChanged -= new EventHandler(lbxTextList_SelectedIndexChanged); MessageBox.Show("未找到TyDll.dll文件!"); } }
/// <summary> /// 保存配置说明 /// 顺序:配置序号 | 文章来源 | 文章地址 | 文章标题 | 当前标记 | /// 发送字数 | 已发字数 | 当前段号 | 是否乱序 | 是否周期 | 周期时间 | 是否独练 |保存时间 /// 配置名称:给配置的命名 可由用户自定义 /// 发文标记:上一次发文断点位置 /// 文章标题:发文的文章标题 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { //检测当前存在几个配置 try { int count = AllIniCount; int infoNo; bool SetupAll = true; if (NewSendText.当前配置序列.Length != 0) { DialogResult temp = MessageBox.Show("当前配置序列为:" + NewSendText.当前配置序列 + ",确认要覆盖该配置?\n点击是:覆盖配置\n点击否:重新建立新配置", "保存配置提示", MessageBoxButtons.YesNoCancel); switch (temp) { case DialogResult.Yes: infoNo = int.Parse(NewSendText.当前配置序列); SetupAll = false; break; case DialogResult.No: infoNo = count + 1; //配置序号 break; default: return; } } else { infoNo = count + 1;//配置序号 } NewSendText.当前配置序列 = infoNo.ToString(); string infoTextSources = NewSendText.文章来源.ToString(); string infoTextAdd = NewSendText.文章地址; string infoTextTitle = NewSendText.标题; string infoNowStart = NewSendText.标记.ToString(); string infoSendTextCount = NewSendText.字数.ToString(); //发送字数 string infoHaveSend = NewSendText.已发字数.ToString(); string infoNowDuan = this.tbxNowStartCount.Text; //当前段号 string infoIsInOrder = NewSendText.是否乱序.ToString(); string infoIsT = NewSendText.是否周期.ToString(); string infoTTime = NewSendText.周期.ToString(); string infoisMyseft = NewSendText.是否独练.ToString(); _Ini setupini = new _Ini("Ttyping.ty"); string getALL_ = setupini.IniReadValue("发文面板配置", "总序列", "0"); if (getALL_ != "0") { if (getALL_.Contains(infoNo.ToString())) { if (SetupAll) { for (int i = 1; i <= 50; i++) { if (!getALL_.Contains(i.ToString())) { //if (MessageBox.Show("找到未用到的配置序列:" + i + "\n是否使用?", "配置序列说明", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) //{ infoNo = i; NewSendText.当前配置序列 = i.ToString(); getALL_ += infoNo + "|"; setupini.IniWriteValue("发文面板配置", "总序列", getALL_); break; //} //else //{ // return; // } } } } } else { getALL_ += infoNo + "|"; setupini.IniWriteValue("发文面板配置", "总序列", getALL_); } } else { setupini.IniWriteValue("发文面板配置", "总序列", infoNo + "|"); } //配置集中 string info = infoNo + "|" + infoTextSources + "|" + infoTextAdd + "|" + infoTextTitle + "|" + infoNowStart + "|" + infoSendTextCount + "|" + infoHaveSend + "|" + infoNowDuan + "|" + infoIsInOrder + "|" + infoIsT + "|" + infoTTime + "|" + infoisMyseft + "|" + DateTime.Now; setupini.IniWriteValue("发文配置", infoNo.ToString(), info.ToString()); MessageBox.Show("保存成功!发文配置序列:" + infoNo, "保存提示", MessageBoxButtons.OK); this.lblAll.Text = ReadKeys("发文配置").Count.ToString(); this.lblNowIni.Text = infoNo.ToString(); } catch { } }
private void Setup_Load(object sender, EventArgs e) { ShowInputLan();//显示所有的安装的输入法 this.comboBox1.SelectedItem = IniRead("输入法", "惯用设置", "未设置"); string gq = IniRead("个签", "标志", "0"); if (gq != "0") //个签初始化 { this.checkBox1.Checked = true; } else { this.checkBox1.Checked = false; } this.textBox1.Text = IniRead("个签", "签名", ""); //延时初始化 int delay = int.Parse(IniRead("发送", "延时", "50")); this.trackBar1.Value = delay; this.label19.Text = delay.ToString(); //输入法签名初始化 string srfsave = IniRead("输入法", "标志", "0"); if (srfsave != "0") { this.checkBox3.Checked = true; } else { this.checkBox3.Checked = false; } this.textBox2.Text = IniRead("输入法", "签名", ""); //排序顺序初始化 sortsend(); //载入字体 FontConverter fc = new FontConverter(); fo1 = (Font)fc.ConvertFromString(IniRead("外观", "对照区字体", "宋体, 14.25pt")); fo2 = (Font)fc.ConvertFromString(IniRead("外观", "跟打区字体", "宋体, 12pt")); this.button3.Text = fo1.FontFamily.GetName(0) + " - " + fo1.Size; this.button4.Text = fo2.FontFamily.GetName(0) + " - " + fo2.Size; //速度计初始化 _Ini setupini = new _Ini("Ttyping.ty"); //各个外观配置初始化 buttoncolor1.BackColor = frm.richTextBox1.BackColor; //对照区底色 buttoncolor2.BackColor = frm.textBoxEx1.BackColor; //跟打区底色 this.pictureBoxRight.BackColor = Glob.Right; this.pictureBoxFalse.BackColor = Glob.False; //是否发送初始化 this.checkBox16.Checked = Glob.sendOrNo; this.checkBoxGDQAction.Checked = bool.Parse(IniRead("发送", "激活", "false")); //载入初始化 string pretext = IniRead("载入", "前导", "-----"); string preduan = IniRead("载入", "段标", "第xx段"); bool ison = bool.Parse(IniRead("载入", "开启", "false")); this.checkBox19.Checked = ison; this.textBoxPreText.Text = pretext; this.textBoxDuan.Text = preduan; bool get = bool.Parse(IniRead("载入", "方式", "false")); if (get) { this.radioButtonTab.Checked = true; } else { this.radioButton4.Checked = true; } //QQ this.checkBox21.Checked = bool.Parse(IniRead("发送", "QQSta", "false")); this.textBoxQQ.Text = IniRead("发送", "QQ", ""); //曲线 this.checkBox22.Checked = Glob.isShowSpline; //停止时间初始化 int StopTime = int.Parse(IniRead("控制", "停止", "1")); if (StopTime < 1 || StopTime > 10) { StopTime = 1; } this.trackBar2.Value = StopTime; this.label17.Text = StopTime + "分"; //极简设置 this.checkBox23.Checked = Glob.simpleMoudle; this.textBox4.Text = Glob.simpleSplite; this.checkBox28.Checked = bool.Parse(IniRead("控制", "不显示即时", "False")); this.checkBox30.Checked = bool.Parse(IniRead("发送", "是否速度限制", "False")); this.numericUpDown1.Value = decimal.Parse(IniRead("发送", "速度限制", "0.00")); this.tbxName.Text = IniRead("发送", "昵称", this.tbxName.Text); //bool c; //this.checkBox31.Checked = bool.TryParse(IniRead("控制", "自动获取", "True"), out c) ? c : true; }
private void button1_Click(object sender, EventArgs e) { _Ini Setupini = new _Ini("Ttyping.ty"); string srf = Setupini.IniReadValue("输入法", "惯用设置", "0"); if (srf != this.comboBox1.Text) { Setupini.IniWriteValue("输入法", "惯用设置", this.comboBox1.Text); Glob.InstraSrf = this.comboBox1.Text; } gQ();//保存个签 //保存延时 Setupini.IniWriteValue("发送", "延时", this.trackBar1.Value.ToString()); //保存QQ Setupini.IniWriteValue("发送", "QQ", this.textBoxQQ.Text); Setupini.IniWriteValue("发送", "QQSta", this.checkBox21.Checked.ToString()); //保存输入法签名 srfSave(); //颜色设置 Setupini.IniWriteValue("外观", "对照区颜色", buttoncolor1.BackColor.ToArgb().ToString()); Glob.r1Back = buttoncolor1.BackColor; Setupini.IniWriteValue("外观", "跟打区颜色", buttoncolor2.BackColor.ToArgb().ToString()); Setupini.IniWriteValue("外观", "打对颜色", this.pictureBoxRight.BackColor.ToArgb().ToString()); Glob.Right = this.pictureBoxRight.BackColor; Setupini.IniWriteValue("外观", "打错颜色", this.pictureBoxFalse.BackColor.ToArgb().ToString()); Glob.Right = this.pictureBoxFalse.BackColor; //字体设置 FontConverter fc = new FontConverter(); Setupini.IniWriteValue("外观", "对照区字体", fc.ConvertToInvariantString(fo1)); Setupini.IniWriteValue("外观", "跟打区字体", fc.ConvertToInvariantString(fo2)); //Point a1 = frm.richTextBox1.GetPositionFromCharIndex(1); //Point a2 = frm.richTextBox1.GetPositionFromCharIndex(frm.richTextBox1.GetFirstCharIndexFromLine(1)); frm.richTextBox1.Font = fo1; frm.textBoxEx1.Font = fo2; //前导 if (checkBox19.Checked) { if (this.textBoxDuan.Text.Contains("xx")) { Setupini.IniWriteValue("载入", "前导", this.textBoxPreText.Text); Setupini.IniWriteValue("载入", "段标", this.textBoxDuan.Text); Setupini.IniWriteValue("载入", "开启", this.checkBox19.Checked.ToString()); } else { MessageBox.Show("段标输入错误!未保存!", "警告"); return; } } else { Setupini.IniWriteValue("载入", "开启", this.checkBox19.Checked.ToString()); } //跟打完后 是否 激活 if (checkBoxGDQAction.Checked) { Glob.GDQActon = true; Setupini.IniWriteValue("发送", "激活", "true"); } else { Glob.GDQActon = false; Setupini.IniWriteValue("发送", "激活", "false"); } //是否显示曲线 if (checkBox22.Checked) { frm.splitContainer4.Panel1Collapsed = true; Setupini.IniWriteValue("拖动条", "曲线", "true"); } else { frm.splitContainer4.Panel1Collapsed = false; Setupini.IniWriteValue("拖动条", "曲线", "false"); } //停止时间 Setupini.IniWriteValue("控制", "停止", this.trackBar2.Value.ToString()); Glob.StopUse = this.trackBar2.Value; frm.toolTip1.SetToolTip(frm.lblAutoReType, "跟打停止时间,大于" + this.trackBar2.Value + "分钟时自动停止跟打"); //速度限制 Setupini.IniWriteValue("发送", "速度限制", this.numericUpDown1.Value.ToString()); Glob.速度限制 = (double)this.numericUpDown1.Value; Glob.是否速度限制 = this.checkBox30.Checked; if (Glob.是否速度限制) { Glob.是否速度限制 = true; Setupini.IniWriteValue("发送", "是否速度限制", "True"); frm.toolStripBtnLS.ForeColor = Color.White; string tips = frm.toolStripBtnLS.ToolTipText; frm.toolStripBtnLS.ToolTipText = tips.Remove(tips.IndexOf(':') + 1) + Glob.速度限制; } else { Glob.是否速度限制 = false; Setupini.IniWriteValue("发送", "是否速度限制", "False"); frm.toolStripBtnLS.ForeColor = Color.Silver; } //极简模式 Setupini.IniWriteValue("发送", "状态", this.checkBox23.Checked.ToString()); Setupini.IniWriteValue("发送", "分隔符", this.textBox4.Text); Glob.simpleMoudle = this.checkBox23.Checked; Glob.simpleSplite = this.textBox4.Text; frm.toolStripButton2.Checked = this.checkBox23.Checked; if (!saveSort()) { MessageBox.Show(this, "含有错误排序字符,请重新检查!", "添雨跟打器排序提示"); return; } else { Setupini.IniWriteValue("发送", "顺序", textBox3.Text); } //跟打过程中不显示即时数据 if (this.checkBox28.Checked) { Setupini.IniWriteValue("控制", "不显示即时", "True"); Glob.notShowjs = true; } else { Setupini.IniWriteValue("控制", "不显示即时", "False"); Glob.notShowjs = false; } if (this.checkBox1.Checked) { Glob.InstraPre_ = "1"; } else { Glob.InstraPre_ = "0"; } Glob.InstraPre = this.textBox1.Text; //个签 Glob.InstraSrf = this.textBox2.Text; //输入法签名 Glob.InstraSrf_ = IniRead("输入法", "标志", "0"); Glob.binput = true; //输入法修改 Glob.DelaySend = int.Parse(IniRead("发送", "延时", "50")); Glob.sortSend = this.textBox3.Text; Glob.Right = pictureBoxRight.BackColor; Glob.False = pictureBoxFalse.BackColor; frm.richTextBox1.BackColor = this.buttoncolor1.BackColor; frm.textBoxEx1.BackColor = this.buttoncolor2.BackColor; if (checkBox19.Checked) { Glob.PreText = this.textBoxPreText.Text; Glob.PreDuan = this.textBoxDuan.Text.Replace("xx", @"\d+"); Glob.isZdy = true; } else { Glob.PreText = "-----"; Glob.PreDuan = @"第\d+段"; } Glob.isQQ = this.checkBox21.Checked; Glob.QQnumber = this.textBoxQQ.Text; //图片成绩发送昵称 Setupini.IniWriteValue("发送", "昵称", this.tbxName.Text); Glob.PicName = this.tbxName.Text; // Setupini.IniWriteValue("控制", "自动获取", this.checkBox31.Checked.ToString()); if (File.Exists("Ttyping.ty")) { this.Close(); } else { MessageBox.Show("文件丢失!"); } }
public string IniRead(string section, string key, string def) { //ini的快捷读取 _Ini sing = new _Ini("Ttyping.ty"); return(sing.IniReadValue(section, key, def)); }
private void lbxIni_SelectedIndexChanged(object sender, EventArgs e) { string select = ""; _Ini getdata = new _Ini("Ttyping.ty"); try { select = (sender as ListBox).SelectedItem.ToString(); } catch { return; } string[] idget = select.Split('|'); string get = getdata.IniReadValue("发文配置", idget[0].Trim(), "0"); if (get != "0") { string[] getAll = get.Split('|'); //确定文章 switch (getAll[1]) { case "0": _assembly = Assembly.GetExecutingAssembly(); _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream("WindowsFormsApplication2.Resources." + this.lbxTextList.Items[int.Parse(getAll[2])].ToString() + ".txt")); if (_textStreamReader.Peek() != -1) { GetText = _textStreamReader.ReadLine(); //文 ComText(GetText); //确认文章信息 } break; //自带文章 case "1": string path = getAll[2]; if (File.Exists(path)) { StreamReader fm = new StreamReader(path, System.Text.Encoding.Default); GetText = fm.ReadToEnd(); lblTitle.Text = Path.GetFileNameWithoutExtension(path); ComText(GetText); NewSendText.文章地址 = path; } break; //自定义文章 } //显式信息写入 lblTitle.Text = getAll[3]; //文章标题 if (bool.Parse(getAll[8])) //是否乱序 { rbnOutOrder.PerformClick(); } else { rbninOrder.PerformClick(); } tbxSendCount.Text = getAll[5]; //字数 tbxSendStart.Text = getAll[4]; //标记 this.checkBox1.Checked = bool.Parse(getAll[9]); //周期 if (this.checkBox1.Checked) { nudSendTimer.Value = int.Parse(getAll[10]); } this.checkBox2.Checked = bool.Parse(getAll[11]); //隐式信息写入 NewSendText.起始段号 = int.Parse(getAll[7]); NewSendText.文章来源 = int.Parse(getAll[1]); NewSendText.已发段数 = int.Parse(getAll[6]); NewSendText.当前配置序列 = getAll[0]; } }