private bool ReadConfigeFile(FileInfo file, InputVedio v) { bool result; using (StreamReader fs = new StreamReader(file.FullName)) { string diffStr = fs.ReadLine(); string[] diff = diffStr.Split(new char[] { '=' }); bool flag = diff.Length != 2; if (flag) { result = false; } else { int difficulty; bool flag2 = !int.TryParse(diff[1], out difficulty); if (flag2) { result = false; } else { v.Diffculty = difficulty; string disStr = fs.ReadLine(); string[] disS = disStr.Split(new char[] { '=' }); bool flag3 = disS.Length != 2; if (flag3) { result = false; } else { double distance; bool flag4 = !double.TryParse(disS[1], out distance); if (flag4) { result = false; } else { v.Distance = distance; fs.Dispose(); fs.Close(); result = true; } } } } } return(result); }
private void DeleteClick(object sender, RoutedEventArgs e) { bool flag = this.ButtonName == MultiLanguage.Inputing; if (flag) { MessageBox.Show(MultiLanguage.Warn23); } else { bool flag2 = this.listBox.SelectedItem == null; if (!flag2) { InputVedio v = this.listBox.SelectedItem as InputVedio; bool flag3 = v == null; if (!flag3) { this.vedioList.Remove(v); } } } }
private void ReadVedioFile() { bool flag = !Directory.Exists(this.path); if (flag) { MessageBox.Show(MultiLanguage.Warn20); } else { DirectoryInfo directory = new DirectoryInfo(this.path); Dictionary <string, FileInfo> vedioDict = new Dictionary <string, FileInfo>(); Dictionary <string, FileInfo> imageDict = new Dictionary <string, FileInfo>(); Dictionary <string, FileInfo> slopeDict = new Dictionary <string, FileInfo>(); Dictionary <string, FileInfo> configeDict = new Dictionary <string, FileInfo>(); FileInfo[] files = directory.GetFiles(); for (int i = 0; i < files.Length; i++) { FileInfo file = files[i]; string extension = file.Extension; string name = file.Name.Substring(0, file.Name.Length - extension.Length); bool flag2 = Regex.IsMatch(extension.ToLower(), this.vedioType); if (flag2) { bool flag3 = !vedioDict.ContainsKey(name); if (flag3) { vedioDict.Add(name, file); } } else { bool flag4 = Regex.IsMatch(extension.ToLower(), this.imageType); if (flag4) { bool flag5 = !imageDict.ContainsKey(name); if (flag5) { imageDict.Add(name, file); } } else { bool flag6 = Regex.IsMatch(extension.ToLower(), ".txt"); if (flag6) { bool flag7 = !slopeDict.ContainsKey(name); if (flag7) { slopeDict.Add(name, file); } } else { bool flag8 = Regex.IsMatch(extension.ToLower(), ".ini"); if (flag8) { bool flag9 = !configeDict.ContainsKey(name); if (flag9) { configeDict.Add(name, file); } } } } } } foreach (string key in vedioDict.Keys) { InputVedio v = new InputVedio(); v.Name = key; v.VedioExtension = vedioDict[key].Extension; v.VideoPath = vedioDict[key].FullName; this.vedioList.Add(v); bool flag10 = !imageDict.ContainsKey(key); if (flag10) { v.Note = MultiLanguage.Note1; } else { v.ImagePath = imageDict[key].FullName; v.ImageExtension = imageDict[key].Extension; bool flag11 = !slopeDict.ContainsKey(key); if (flag11) { v.Note = MultiLanguage.Note1; } else { v.SlopePath = slopeDict[key].FullName; bool flag12 = !configeDict.ContainsKey(key); if (flag12) { v.Note = MultiLanguage.Note1; } else { bool flag13 = !this.ReadConfigeFile(configeDict[key], v); if (flag13) { v.Note = MultiLanguage.Note2; break; } v.CanInput = true; } } } } } }