public void FileFragRefresh(FileFragInfo fileinfo) { Application.Current.Dispatcher.Invoke(() => { this.CurrentContext.FileFragRefresh(fileinfo); }); }
private static void addRecieFileCache(FileFragInfo info) { if (caches_recive_files.Any(o => o.fileGuid == info.fileGuid) == false) { caches_recive_files.Add(info); } }
private static void ReciveFileError(FileFragInfo info, DataChannel channel) { var oldfilepath = localDirectory + info.fileGuid; File.Delete(oldfilepath); removeRecieFileCache(info); onFileCountChanged?.Invoke(channel, cuteFileCount(channel)); }
private static void removeRecieFileCache(FileFragInfo info) { var find = caches_recive_files.FirstOrDefault(o => o.fileGuid == info.fileGuid); if (find != null) { caches_recive_files.Remove(find); } }
private void FileChannelMessageDeal_onFragChanged(object sender, FileFragInfo e) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (this.FileListView == null) { return; } this.FileListView.FileFragRefresh(e); })); }
private static void EndWriteFile(FileFragInfo info, DataChannel channel) { var oldfilepath = localDirectory + info.fileGuid; var newfilepath = localDirectory + info.fileGuid + "__" + info.fileName; File.Move(oldfilepath, newfilepath); // FileInfo localfile = new FileInfo(newfilepath); localfile.Attributes = FileAttributes.Normal; // removeRecieFileCache(info); onFileCountChanged?.Invoke(channel, cuteFileCount(channel)); }
public void FileFragRefresh(FileFragInfo fileinfo) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var find = CurrentSendFiles.FirstOrDefault(o => o.FileGuid == fileinfo.fileGuid); if (find != null) { find.PersentStr = cuteFilePercent(fileinfo); //CurrentSendFiles = CurrentSendFiles; } find = CurrentRecivesFiles.FirstOrDefault(o => o.FileGuid == fileinfo.fileGuid); if (find != null) { find.PersentStr = cuteFilePercent(fileinfo); //CurrentSendFiles = CurrentSendFiles; } })); }
private static void CreateFile(FileFragInfo info, DataChannel channel) { if (Directory.Exists(localDirectory) == false) { Directory.CreateDirectory(localDirectory); } var filepath = localDirectory + info.fileGuid; var stream = File.Create(filepath); stream.Close(); stream.Dispose(); // FileInfo localfile = new FileInfo(filepath); localfile.Attributes = FileAttributes.Hidden; // addRecieFileCache(info); onFileCountChanged?.Invoke(channel, cuteFileCount(channel)); }
private string cuteFilePercent(FileFragInfo fileinfo) { return(((double)fileinfo.currentFragIndex * 100 / fileinfo.fragLength).ToString("F2") + "%"); }