//--------------------------------------------------------------------- public override void Delete(Commands.DeleteItemCommand Command) { if (this._ShellAdapter.Root.Length == 0) { throw new Exceptions.InvalidOperationException("Delete", "FileSystem root is undefined"); } string syspath = this.MakeSystemPathname(this._ShellAdapter.Root, Command.in_Pathname); string ShellCommand = ""; if (Command.in_IsFolder) { ShellCommand = "rmdir " + syspath; } else { ShellCommand = "rm " + syspath; } string output = this._ShellAdapter.ExecuteCommand(ShellCommand); string[] lines = output.Split(new string[] { "\n" }, StringSplitOptions.None); // Return, OK. return; }
//--------------------------------------------------------------------- public void Invoke(CommandContext Command) { if (Command == null) { } else if (Command is Commands.SettingsCommand) { Commands.SettingsCommand SettingsCommand = (Commands.SettingsCommand)Command; this.Settings(SettingsCommand); } else if (Command is Commands.ListEntriesCommand) { Commands.ListEntriesCommand ListCommand = (Commands.ListEntriesCommand)Command; this.List(ListCommand); } else if (Command is Commands.CreateItemCommand) { Commands.CreateItemCommand CreateCommand = (Commands.CreateItemCommand)Command; this.Create(CreateCommand); } else if (Command is Commands.ReadItemCommand) { Commands.ReadItemCommand ReadCommand = (Commands.ReadItemCommand)Command; this.Read(ReadCommand); } else if (Command is Commands.UpdateItemCommand) { Commands.UpdateItemCommand UpdateCommand = (Commands.UpdateItemCommand)Command; this.Update(UpdateCommand); } else if (Command is Commands.DeleteItemCommand) { Commands.DeleteItemCommand DeleteCommand = (Commands.DeleteItemCommand)Command; this.Delete(DeleteCommand); } else if (Command is Commands.ReadFileContentCommand) { Commands.ReadFileContentCommand ReadContentCommand = (Commands.ReadFileContentCommand)Command; this.ReadFileContent(ReadContentCommand); } else if (Command is Commands.WriteFileContentCommand) { Commands.WriteFileContentCommand WriteContentCommand = (Commands.WriteFileContentCommand)Command; this.WriteFileContent(WriteContentCommand); } else { } return; }
//--------------------------------------------------------------------- public override void Delete(Commands.DeleteItemCommand Command) { if (this._Root.Length == 0) { throw new Exceptions.InvalidOperationException("Delete", "FileSystem root is undefined"); } Pathname ItemPathname = Pathname.Append(this._Root, Command.in_Pathname); if (Command.in_IsFolder) { Directory.Delete(ItemPathname, true); } else { File.Delete(ItemPathname); } //FileSystemItem item = this.ItemFromPathname( item_path_name ); //if( item.Exists ) //{ // if( item.IsFolder ) // { // Directory.Delete( item_path_name, true ); // } // else // { // File.Delete( item_path_name ); // } //} //else //{ // throw new Exceptions.InvalidOperationException( "Delete", "Item does not exist." ); //} return; }
public abstract void Delete(Commands.DeleteItemCommand Command);
//--------------------------------------------------------------------- public void Delete(string Pathname, bool IsFolder) { Commands.DeleteItemCommand DeleteCommand = new Commands.DeleteItemCommand(Pathname, IsFolder); this.Delete(DeleteCommand); return; }
//-------------------------------------------------------------------------------- public override void Delete(Commands.DeleteItemCommand Command) { throw new NotImplementedException(); }