private void Init() { this.comboBox_Select.Items.Clear(); List <string> list = new List <string>(); list.Add("UTF8"); list.Add("ASCII"); list.Add("Unicode"); list.Add("UTF8(BOM)"); this.comboBox_Select.Items.AddRange(list.ToArray()); this.comboBox_Select.SelectedIndex = 0; this.richTextBox_FileType.Text = IniManager.Load("Option", "fileList", ".txt|.lua|.cs", this.Inifilepath); //this.textBox_active.Text = IniManager.Load("Option", "active", "", this.Inifilepath); //this.cpuId = Encryption.GetCPUID() + Encryption.GetDiskSerialNumber() + Encryption.GetMoAddress(); //this.activestr = Encryption.Md5Encrypt(this.cpuId + this.key, true); //bool flag = this.activestr.Equals(this.textBox_active.Text); //if (flag) //{ // this.button_Change.Enabled = true; // this.textBox_info.Visible = false; // this.textBox_active.Visible = false; // this.button_active.Visible = false; //} //else //{ // this.button_Change.Enabled = false; // this.textBox_info.Text = this.cpuId; //} }
public static string Load(string _section, string _key, string _def, string _filePath) { StringBuilder stringBuilder = new StringBuilder(1024); int privateProfileString = IniManager.GetPrivateProfileString(_section, _key, _def, stringBuilder, 1024, _filePath); return(stringBuilder.ToString()); }
private void RefreshAllFile() { this.fileEndList.Clear(); bool flag = string.IsNullOrEmpty(this.richTextBox_FileType.Text); if (flag) { this.richTextBox_FileType.Text = ".txt|.lua|.cs"; } string[] array = this.richTextBox_FileType.Text.Trim().Split(new char[] { '|' }); for (int i = 0; i < array.Length; i++) { bool flag2 = !string.IsNullOrEmpty(array[i]); if (flag2) { this.fileEndList.Add(array[i]); } } IniManager.Save("Option", "fileList", this.richTextBox_FileType.Text, this.Inifilepath); this.listView_Mes.Items.Clear(); string[] array2 = this.richTextBox_path.Text.Split(new char[] { '\n' }); for (int j = 0; j < array2.Length; j++) { bool flag3 = string.IsNullOrEmpty(array2[j]); if (!flag3) { ListViewGroup listViewGroup = new ListViewGroup(); listViewGroup.Header = array2[j]; this.listView_Mes.Groups.Add(listViewGroup); string[] files = Directory.GetFiles(array2[j], "*.*", SearchOption.AllDirectories); for (int k = 0; k < files.Length; k++) { bool flag4 = !this.ChageFileType(files[k]); if (!flag4) { byte[] array3 = File.ReadAllBytes(files[k]); if (array3.Length == 0) { continue; } string text = files[k].Replace(array2[j], "").Replace('/', '\\'); ListViewItem listViewItem = new ListViewItem(); listViewItem.SubItems.Add(text); listViewItem.SubItems.Add(this.GetEncode(array3)); bool flag5 = array3.Length < 1024; if (flag5) { listViewItem.SubItems.Add(array3.Length.ToString() + "B"); } else { bool flag6 = array3.Length < 1048576; if (flag6) { listViewItem.SubItems.Add(((float)array3.Length / 1024f).ToString("f3") + "KB"); } else { listViewItem.SubItems.Add(((float)array3.Length / 1048576f).ToString("f3") + "MB"); } } listViewItem.SubItems.RemoveAt(0); listViewItem.Group = listViewGroup; this.listView_Mes.Items.Add(listViewItem); } } } } }
public static void Save(string _section, string _key, string _value, string _filepath) { IniManager.WritePrivateProfileString(_section, _key, _value, _filepath); }