public void DeleteFile(string virtualPath) { DeleteFileInternal(virtualPath); if (FileDeleted != null) { FileDeleted.Invoke(this, new FileEventArgs(virtualPath, null)); } }
public void DeleteFile() { if (_progress < 100) { _fileModel.ChangeConvertProcessType(ConvertProcessType.Cancel); } FileDeleted?.Invoke(); _fileModel.FileDeleted -= OnDeleted; _cts.Cancel(); }
void fileWatcher_Deleted(object sender, FileSystemEventArgs e) { ThreadManager.invoke(() => { editorResourceProvider.ResourceCache.forceCloseResourceFile(e.FullPath); if (FileDeleted != null) { FileDeleted.Invoke(e.Name); } }); }
/// <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)); } }
private void OnDeleted(object source, FileSystemEventArgs e) { string fileName = e.Name; if (PendingIds.Contains(fileName)) { PendingIds.Remove(fileName); } FileDeleted?.Invoke(fileName); }
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); }
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)); } }
//删除 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); }
public void DeleteFile(string itemId, string imagePath) { bool result = true; try { File.Delete(imagePath); } catch (Exception e) { result = false; } FileDeleted?.Invoke(itemId, result); }
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); } }
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); }
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; } }
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); } }
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)); } }
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; } } }
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"); } }
private void FileSystemWatcherOnDeleted(object sender, FileSystemEventArgs e) { var args = new FileDeletedEventArgs(e.FullPath); FileDeleted.Raise(this, args); }
private void fileDeleted(object sender, FileEntry <Metadata> file) { FileDeleted?.Invoke(this, file); remove(file); }
public void DeleteFile(string path) { FileDeleted?.Invoke(path); }
public void DeleteFile() { FileDeleted?.Invoke(); }
void NotifyFileDeleted() { FileDeleted.Execute(); }
protected virtual void OnFileDeleted() { FileDeleted?.Invoke(this); }
protected virtual void OnFileDeleted(FileDeleteEventArgs e) { FileDeleted?.Invoke(this, e); }
private void Apply(FileDeleted e) { IsDeleted = true; UpdatedBy = e.UserId; UpdatedDateTime = e.TimeStamp; }
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 }
private void OnDeleted(object sender, FileSystemEventArgs eventArgs) { FileDeleted?.Invoke(sender, eventArgs); }
public virtual void OnFileDeleted(LspFile file, DateTime @when) { FileDeleted?.Invoke(file, when); }
private void OnFileDeleted(TreeFile file) { FileDeleted?.Invoke(this, new TreeFileEventArgs(file)); }
public void InvokeDeleteFile(File file) { FileDeleted?.Invoke(file); }
//删除 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; }