public async Task AddFilePathsAsync(IEnumerable <string> paths) { CanProcessing.Value = false; await Task.Run(() => { foreach (var path in paths) { CancellationToken.ThrowIfCancellationRequested(); if (FilePaths.Contains(path) || !File.Exists(path)) { continue; } try { using (var bmp = new Bitmap(path)) { } } catch (Exception) { continue; } FilePaths.AddOnScheduler(path); } }, CancellationToken); CanProcessing.Value = true; }
public override void GetContainer(TransactionContainerAbstract container, string filePath) { if (!FilePaths.Contains(filePath)) { FilePaths.Add(filePath); } else { throw new Exception("This file has already been loaded"); } container.Clear(); foreach (var currentPath in FilePaths) { var lines = File.ReadLines(currentPath); foreach (string s in lines) { string[] split = s.Split(','); if (split.Length != AttributeNumber) { throw new Exception("Column number mismatch"); } container.AddTransaction(long.Parse(split[0]), DateTime.ParseExact(split[1], "HH:mm:ss", CultureInfo.InvariantCulture), split[4], double.Parse(split[5], CultureInfo.InvariantCulture), double.Parse(split[7], CultureInfo.InvariantCulture), split[15] == "B" ? true : false); } } }
/// <summary> /// パスを削除する /// </summary> /// <param name="niconicoId"></param> /// <param name="filePath"></param> public void Delete(string niconicoId, string filePath) { if (!this.Exists(niconicoId)) { return; } var data = this.GetFileData(niconicoId); if (data !.FilePaths.Contains(filePath)) { data.FilePaths.Remove(filePath); this.dataBase.Update(data, Types.VideoFile.TableName); } }
private void AddInputFilesHandler() { List <string> files = new List <string>(); CommonOpenFileDialog openFileDialog = new CommonOpenFileDialog(); openFileDialog.IsFolderPicker = true; openFileDialog.Multiselect = true; openFileDialog.RestoreDirectory = true; openFileDialog.AllowNonFileSystemItems = true; //ileDialog.Filter = "*.d"; if (openFileDialog.ShowDialog() == CommonFileDialogResult.Ok) { var iter = openFileDialog.FileNames.GetEnumerator(); while (iter.MoveNext()) { if (iter.Current.EndsWith(".d")) { files.Add(iter.Current); } else { throw new Exception("Selecter is not a \".d\" folder."); } } } if (files.Count != 0) { if (FilePaths.Count == 0) { int i = FilePaths.Count + 1; FilePaths = files; foreach (string file in files) { var source = GetFilePolarity(file); Samples.Add(new Sample { HideOrShow = true, ExpOrder = i, FileName = file, Source = source, SampleType = null, Group = null }); i++; } } else { int i = FilePaths.Count + 1; foreach (string filename in files) { if (!FilePaths.Contains(filename)) { FilePaths.Add(filename); var source = GetFilePolarity(filename); Samples.Add(new Sample { HideOrShow = true, ExpOrder = i, FileName = filename, Source = source, SampleType = null, Group = null }); } } } } }