コード例 #1
0
        public void DeleteFile(string virtualPath)
        {
            DeleteFileInternal(virtualPath);

            if (FileDeleted != null)
            {
                FileDeleted.Invoke(this, new FileEventArgs(virtualPath, null));
            }
        }
コード例 #2
0
        public void DeleteFile()
        {
            if (_progress < 100)
            {
                _fileModel.ChangeConvertProcessType(ConvertProcessType.Cancel);
            }

            FileDeleted?.Invoke();
            _fileModel.FileDeleted -= OnDeleted;
            _cts.Cancel();
        }
コード例 #3
0
 void fileWatcher_Deleted(object sender, FileSystemEventArgs e)
 {
     ThreadManager.invoke(() =>
     {
         editorResourceProvider.ResourceCache.forceCloseResourceFile(e.FullPath);
         if (FileDeleted != null)
         {
             FileDeleted.Invoke(e.Name);
         }
     });
 }
コード例 #4
0
        /// <summary>Delets a file from the file system.</summary>
        /// <param name="virtualPath">The path of the file to delete.</param>
        public virtual void DeleteFile(string virtualPath)
        {
            string path = MapPath(virtualPath);

            File.Delete(path);

            if (FileDeleted != null)
            {
                FileDeleted.Invoke(this, new FileEventArgs(virtualPath, null));
            }
        }
コード例 #5
0
        private void OnDeleted(object source, FileSystemEventArgs e)
        {
            string fileName = e.Name;

            if (PendingIds.Contains(fileName))
            {
                PendingIds.Remove(fileName);
            }

            FileDeleted?.Invoke(fileName);
        }
コード例 #6
0
ファイル: LspManager.cs プロジェクト: Nucs/Autocad-Utilities
        private void FileDeletedHandler(string filename, DateTime when)
        {
            var lsfile = FindLspFile(filename, when);

            if (lsfile == null)
            {
                return;
            }
            Remove(lsfile);
            lsfile.OnFileDeleted(lsfile, when);
            FileDeleted?.Invoke(lsfile, when);
        }
        public void DeleteFile(string path)
        {
            var blob = AzureFileSystemProvider.Instance.GetFile(path);

            blob.DeleteIfExists();

            if (FileDeleted != null)
            {
                FileDeleted.Invoke(this, new FileEventArgs(path, null));
            }

            AzureFileSystemProvider.Instance.RemoveFromCache(path);
        }
コード例 #8
0
        public void DeleteFile(string virtualPath)
        {
            var request = new DeleteObjectRequest()
                          .WithBucketName(this.bucketName)
                          .WithKey(FixPathForS3(virtualPath));

            using (this.s3.DeleteObject(request)) { }

            if (FileDeleted != null)
            {
                FileDeleted.Invoke(this, new FileEventArgs(virtualPath, null));
            }
        }
コード例 #9
0
        //删除
        public bool DelCards(bool deletefiles)
        {
            if (!dataform.CheckOpen())
            {
                return(false);
            }
            Card[] cards = dataform.GetCardList(true);
            if (cards == null || cards.Length == 0)
            {
                return(false);
            }
            string undo = "";

            if (!MyMsg.Question(LMSG.IfDeleteCard))
            {
                return(false);
            }
            List <string> sql    = new List <string>();
            FileDeleted   delete = new FileDeleted();

            foreach (Card c in cards)
            {
                sql.Add(DataBase.GetDeleteSQL(c));//删除
                undo += DataBase.GetInsertSQL(c, true);
                //删除资源
                if (deletefiles)
                {
                    YGOUtil.CardDelete(c.id, dataform.GetPath(), YGOUtil.DeleteOption.BACKUP);
                    delete.deleted = true;
                    delete.ids.Add(c.id);
                }
            }
            if (DataBase.Command(dataform.GetOpenFile(), sql.ToArray()) >= (sql.Count * 2))
            {
                MyMsg.Show(LMSG.DeleteSucceed);
                dataform.Search(true);
                undoSQL.Add(undo);
                undoDeleted.Add(delete);
                undoModified.Add(new FileModified());
                undoCopied.Add(new DBcopied());
                return(true);
            }
            else
            {
                MyMsg.Error(LMSG.DeleteFail);
                dataform.Search(true);
            }
            return(false);
        }
コード例 #10
0
        public void DeleteFile(string itemId, string imagePath)
        {
            bool result = true;

            try
            {
                File.Delete(imagePath);
            }
            catch (Exception e)
            {
                result = false;
            }

            FileDeleted?.Invoke(itemId, result);
        }
コード例 #11
0
ファイル: Mirror.cs プロジェクト: NikolayXHD/IndexExercise
        private void processDeletedDirectoryRecursively(DirectoryEntry <Metadata> directory)
        {
            if (_scannedDirectory == directory)
            {
                _interruptScanningDirectory = true;
            }

            foreach (var file in directory.Files.Values)
            {
                FileDeleted?.Invoke(this, file);
            }

            foreach (var subdirectory in directory.Directories.Values)
            {
                processDeletedDirectoryRecursively(subdirectory);
            }
        }
コード例 #12
0
        private bool DeleteSingleFile(CancellationToken ct)
        {
            if (ct.IsCancellationRequested)
            {
                return(true);
            }
            // Simulate half a second to delete one file
            Task.Delay(500).Wait();
            // SIMULATE ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

            // Decrement remaining count
            _remaining--;

            // Notify the UI thread
            FileDeleted?.Invoke(this, EventArgs.Empty);
            return(false);
        }
コード例 #13
0
        private void HandleFileChange(FileSystemEventArgs e)
        {
            switch (e.ChangeType)
            {
            case WatcherChangeTypes.Changed:
            case WatcherChangeTypes.Created:
                // Console.WriteLine($"OnChange {e.Name}");
                OnFileChanged(e);
                FileChanged?.Invoke(e);
                break;

            case WatcherChangeTypes.Deleted:
                // Console.WriteLine($"delete {e.Name} {e.ChangeType}");
                OnFileDeleted(e);
                FileDeleted?.Invoke(e);
                break;

            default:
                break;
            }
        }
コード例 #14
0
        public static void Delete(string path)
        {
            string[] pathlist = path.Split('/');
            int      vol      = Convert.ToInt32(pathlist[0].Replace(":", ""));
            var      dir      = Mounts[vol];

            for (int i = 1; i <= pathlist.Length - 2; i++)
            {
                dir = dir.FindDirectoryByName(pathlist[i]);
            }

            if (FileExists(path))
            {
                dir.RemoveFile(pathlist[pathlist.Length - 1]);
                FileDeleted?.Invoke(path);
            }
            else
            {
                dir.RemoveDirectory(pathlist[pathlist.Length - 1]);
                DirectoryDeleted?.Invoke(path);
            }
        }
コード例 #15
0
        public void DeleteFile(string virtualPath)
        {
            using (var trx = Session.BeginTransaction())
            {
                var path = FileSystemPath.File(virtualPath);

                var file = GetSpecificItem(path);

                int deletedChunks = Session.CreateQuery("delete from " + typeof(FileSystemChunk).Name + " where BelongsTo = :file")
                                    .SetParameter("file", file)
                                    .ExecuteUpdate();

                Session.Delete(file);
                logger.Debug("Deleted 1 item and " + deletedChunks + " chunks at " + path);

                trx.Commit();
            }

            if (FileDeleted != null)
            {
                FileDeleted.Invoke(this, new FileEventArgs(virtualPath, null));
            }
        }
コード例 #16
0
        public void Dispose()
        {
            if (!IsDisposed)
            {
                IsDisposed = true;

                foreach (var item in FileDeleted.GetInvocationList())
                {
                    FileDeleted -= item as Action;
                }

                foreach (var item in FileChanged.GetInvocationList())
                {
                    FileChanged -= item as Action;
                }

                if (fileSystemWatcher != null)
                {
                    fileSystemWatcher.Dispose();
                    fileSystemWatcher = null;
                }
            }
        }
コード例 #17
0
ファイル: Mirror.cs プロジェクト: NikolayXHD/IndexExercise
        private void processDeletedEntry(Entry <Metadata> entry)
        {
            ProcessingDeletedEntry?.Invoke(this, entry);

            switch (entry)
            {
            case RootEntry <Metadata> _:
                throw new InvalidOperationException($"processing {entry.GetType()} entry is not supported");

            case FileEntry <Metadata> file:
                FileDeleted?.Invoke(this, file);
                break;

            case DirectoryEntry <Metadata> directory:
                processDeletedDirectoryRecursively(directory);
                break;

            case UnclassifiedEntry <Metadata> _:
                break;

            default:
                throw new InvalidOperationException($"processing {entry.GetType()} entry is not supported");
            }
        }
コード例 #18
0
        private void FileSystemWatcherOnDeleted(object sender, FileSystemEventArgs e)
        {
            var args = new FileDeletedEventArgs(e.FullPath);

            FileDeleted.Raise(this, args);
        }
コード例 #19
0
 private void fileDeleted(object sender, FileEntry <Metadata> file)
 {
     FileDeleted?.Invoke(this, file);
     remove(file);
 }
コード例 #20
0
 public void DeleteFile(string path)
 {
     FileDeleted?.Invoke(path);
 }
コード例 #21
0
 public void DeleteFile()
 {
     FileDeleted?.Invoke();
 }
コード例 #22
0
ファイル: UpToDateFile.cs プロジェクト: shaneasd/ConEdit
 void NotifyFileDeleted()
 {
     FileDeleted.Execute();
 }
コード例 #23
0
 protected virtual void OnFileDeleted()
 {
     FileDeleted?.Invoke(this);
 }
コード例 #24
0
 protected virtual void OnFileDeleted(FileDeleteEventArgs e)
 {
     FileDeleted?.Invoke(this, e);
 }
コード例 #25
0
ファイル: File.cs プロジェクト: xlgwr/osdr
 private void Apply(FileDeleted e)
 {
     IsDeleted       = true;
     UpdatedBy       = e.UserId;
     UpdatedDateTime = e.TimeStamp;
 }
コード例 #26
0
 private void WatcherDeleted(object sender, FileSystemEventArgs e)
 {
     _log.Debug("System triggered {changeType} for {path}.", e.ChangeType, e.FullPath);
     FileDeleted?.Invoke(this, e); // No need to debounce deleted events as far as I know
 }
コード例 #27
0
 private void OnDeleted(object sender, FileSystemEventArgs eventArgs)
 {
     FileDeleted?.Invoke(sender, eventArgs);
 }
コード例 #28
0
 public virtual void OnFileDeleted(LspFile file, DateTime @when)
 {
     FileDeleted?.Invoke(file, when);
 }
コード例 #29
0
 private void OnFileDeleted(TreeFile file)
 {
     FileDeleted?.Invoke(this, new TreeFileEventArgs(file));
 }
 public void InvokeDeleteFile(File file)
 {
     FileDeleted?.Invoke(file);
 }
コード例 #31
0
ファイル: CardEdit.cs プロジェクト: yugiohone/DataEditorX
 //删除
 public bool DelCards(bool deletefiles)
 {
     if (!dataform.CheckOpen())
         return false;
     Card[] cards = dataform.GetCardList(true);
     if (cards == null || cards.Length == 0)
         return false;
     string undo = "";
     if (!MyMsg.Question(LMSG.IfDeleteCard))
         return false;
     List<string> sql = new List<string>();
     FileDeleted delete = new FileDeleted();
     foreach (Card c in cards)
     {
         sql.Add(DataBase.GetDeleteSQL(c));//删除
         undo += DataBase.GetInsertSQL(c, true);
         //删除资源
         if (deletefiles)
         {
             YGOUtil.CardDelete(c.id, dataform.GetPath(), YGOUtil.DeleteOption.BACKUP);
             delete.deleted = true;
             delete.ids.Add(c.id);
         }
     }
     if (DataBase.Command(dataform.GetOpenFile(), sql.ToArray()) >= (sql.Count * 2))
     {
         MyMsg.Show(LMSG.DeleteSucceed);
         dataform.Search(true);
         undoSQL.Add(undo);
         undoDeleted.Add(delete);
         undoModified.Add(new FileModified());
         undoCopied.Add(new DBcopied());
         return true;
     }
     else
     {
         MyMsg.Error(LMSG.DeleteFail);
         dataform.Search(true);
     }
     return false;
 }