Example #1
0
        //---------------------------------------------------------------------
        public override void Create(Commands.CreateItemCommand Command)
        {
            if (this._ShellAdapter.Root.Length == 0)
            {
                throw new Exceptions.InvalidOperationException("Create", "FileSystem root is undefined");
            }
            string syspath = this.MakeSystemPathname(this._ShellAdapter.Root, Command.in_Pathname);

            string ShellCommand = "";

            if (Command.in_IsFolder)
            {
                ShellCommand = "mkdir " + syspath + "/";
            }
            else
            {
                ShellCommand = "touch " + syspath;
            }
            string output = this._ShellAdapter.ExecuteCommand(ShellCommand);

            // Get item.
            Commands.ReadItemCommand ReadCmd = new Commands.ReadItemCommand();
            ReadCmd.in_Pathname = Command.in_Pathname;
            this.Read(ReadCmd);
            if (ReadCmd.out_Item == null)
            {
                throw new Exceptions.InvalidOperationException("Create", "Item does not exist.");
            }
            if (Command.in_CreatePath)
            {
            }
            Command.out_Item = ReadCmd.out_Item;
            return;
        }
Example #2
0
 //---------------------------------------------------------------------
 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 Create(Commands.CreateItemCommand Command)
        {
            if (this._Root.Length == 0)
            {
                throw new Exceptions.InvalidOperationException("Create", "FileSystem root is undefined");
            }
            Pathname ItemPathname = Pathname.Append(this._Root, Command.in_Pathname);

            if (Directory.Exists(ItemPathname.Path) == false)
            {
                throw new InvalidOperationException();
            }
            if (Command.in_IsFolder)
            {
                Directory.CreateDirectory(ItemPathname);
            }
            else
            {
                FileStream stream = File.Create(ItemPathname);
                stream.Close();
            }
            Command.out_Item = this.ItemFromPathname(ItemPathname);
            return;
        }
Example #4
0
 //---------------------------------------------------------------------
 public FileSystemItem Create(string Pathname, bool IsFolder, bool CreatePath)
 {
     Commands.CreateItemCommand CreateCommand = new Commands.CreateItemCommand(Pathname, IsFolder, CreatePath);
     this.Create(CreateCommand);
     return(CreateCommand.out_Item);
 }
Example #5
0
 public abstract void Create(Commands.CreateItemCommand Command);
Example #6
0
 //--------------------------------------------------------------------------------
 public override void Create(Commands.CreateItemCommand Command)
 {
     throw new NotImplementedException();
 }