Esempio n. 1
0
 public void FileFragRefresh(FileFragInfo fileinfo)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         this.CurrentContext.FileFragRefresh(fileinfo);
     });
 }
Esempio n. 2
0
 private static void addRecieFileCache(FileFragInfo info)
 {
     if (caches_recive_files.Any(o => o.fileGuid == info.fileGuid) == false)
     {
         caches_recive_files.Add(info);
     }
 }
Esempio n. 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));
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
     }));
 }
Esempio n. 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));
        }
Esempio n. 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;
         }
     }));
 }
Esempio n. 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));
        }
Esempio n. 9
0
 private string cuteFilePercent(FileFragInfo fileinfo)
 {
     return(((double)fileinfo.currentFragIndex * 100 / fileinfo.fragLength).ToString("F2") + "%");
 }