Example #1
0
 public void FileFragRefresh(FileFragInfo fileinfo)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         this.CurrentContext.FileFragRefresh(fileinfo);
     });
 }
Example #2
0
 private static void addRecieFileCache(FileFragInfo info)
 {
     if (caches_recive_files.Any(o => o.fileGuid == info.fileGuid) == false)
     {
         caches_recive_files.Add(info);
     }
 }
Example #3
0
        private static void ReciveFileError(FileFragInfo info, DataChannel channel)
        {
            var oldfilepath = localDirectory + info.fileGuid;

            File.Delete(oldfilepath);
            removeRecieFileCache(info);
            onFileCountChanged?.Invoke(channel, cuteFileCount(channel));
        }
Example #4
0
        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);
            }
        }
Example #5
0
 private void FileChannelMessageDeal_onFragChanged(object sender, FileFragInfo e)
 {
     Application.Current.Dispatcher.BeginInvoke(new Action(() =>
     {
         if (this.FileListView == null)
         {
             return;
         }
         this.FileListView.FileFragRefresh(e);
     }));
 }
Example #6
0
        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));
        }
Example #7
0
 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;
         }
     }));
 }
Example #8
0
        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));
        }
Example #9
0
 private string cuteFilePercent(FileFragInfo fileinfo)
 {
     return(((double)fileinfo.currentFragIndex * 100 / fileinfo.fragLength).ToString("F2") + "%");
 }