Exemplo n.º 1
0
        public override void Paste()
        {
            Paste paste = new Paste();

            paste.Execute(textedit.ActiveTextAreaControl.TextArea);
            paste = null;
        }
Exemplo n.º 2
0
        static void Main()
        {
            Document document = new Document("Greetings");
            Paste    paste    = new Paste(document);
            Print    print    = new Print(document);

            clipboard = "Hello, everyone";
            paste.Execute();
            print.Execute();
            paste.Undo();
            clipboard = "Bonjour, mes amis";
            paste.Execute();
            clipboard = "Guten morgen, meine Freunde";
            paste.Redo();
            print.Execute();
            print.Undo();
            Console.WriteLine("Logged " + paste.Execute.Count() + " commands");
        }
Exemplo n.º 3
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            ICanvas canvas = this.editor.GetSelectedCanvas();

            switch (keyData)
            {
            case Keys.Control | Keys.Z:
                undo.Execute();
                break;

            case Keys.Control | Keys.Y:
                redo.Execute();
                break;

            case Keys.Control | Keys.C:
                copy.Execute();
                break;

            case Keys.Control | Keys.V:
                paste.Execute();
                break;

            case Keys.Delete:
                DeleteObject deleteCommand = new DeleteObject(canvas);
                deleteCommand.Execute();
                canvas.AddCommand(deleteCommand);
                break;

            case Keys.Control | Keys.Q:
                if (canvas != null)
                {
                    ICommand command = new Exit();
                    command.Execute();
                    canvas.Repaint();
                }
                break;

            case Keys.Control | Keys.S:
                if (canvas != null)
                {
                    ICommand command = new Save(canvas);
                    command.Execute();
                    canvas.Repaint();
                }
                break;
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
Exemplo n.º 4
0
        private void pasteButton_Click(object sender, EventArgs e)
        {
            Paste paste = new Paste();

            paste.Execute(textEditorControl1);
        }
        private void Paste(object sender, EventArgs e)
        {
            Paste paste = new Paste();

            paste.Execute(textEditorControl);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 貼り付け
        /// </summary>
        public void PasteText()
        {
            IEditAction action = new Paste();

            action.Execute(ActiveTextArea);
        }
Exemplo n.º 7
0
        public Response DispatchCommand()
        {
            var cmdName = Parameters["cmd"];

            if (string.IsNullOrEmpty(cmdName))
            {
                return new ErrorResponse("Command not set");
            }

            ICommand cmd = null;

            switch (cmdName)
            {
                case "open":
                    if (!string.IsNullOrEmpty(Parameters["init"]) && Parameters["init"] == "true")
                        cmd = new Init();
                    else
                    {
                        cmd = new Open(Parameters["target"]);
                    }
                    break;
                case "mkdir":
                    cmd = new MkDir(Parameters["current"], Parameters["name"]);
                    break;
                case "rm":
                    cmd = new Rm(Parameters["current"], Parameters["targets[]"]);
                    break;
                case "rename":
                    cmd = new Rename(Parameters["current"], Parameters["target"], Parameters["name"]);
                    break;
                case "upload":
                    cmd = new Upload(Parameters["current"], Files);
                    break;
                case "ping":
                    cmd = new Ping();
                    break;
                case "duplicate":
                    cmd = new Duplicate(Parameters["current"], Parameters["target"]);
                    break;
                case "paste":
                    cmd = new Paste(Parameters["src"], Parameters["dst"], Parameters["targets[]"], Parameters["cut"]);
                    break;
            }

            if (cmd == null)
            {
                return new ErrorResponse("Unknown command");
            }

            return cmd.Execute();

            return new ErrorResponse("Unknown error");
        }
Exemplo n.º 8
0
        static void Prompt()
        {
            // If the directory nor the files exist, create them
            if (!Directory.Exists(copyPath))
            {
                Directory.CreateDirectory(copyPath);
            }
            if (!File.Exists(copyPath + "\\copylist.tute"))
            {
                File.Create(copyPath + "\\copylist.tute").Close();
            }

            while (!done)
            {
                Console.Write($"#{line} ");
                string   command  = Console.ReadLine();
                string[] args     = command.Split(new[] { ' ' }, 2);
                string[] argsFull = command.Split(' ');    // Ask for a command, split it into two arrays, one where it only splits once and one when it constantly splits
                char[]   check    = args[0].ToCharArray(); // Convert the first argument of args into a char array
                switch (args[0])
                {
                case "/save":
                    var Save = new Save();
                    Save.ParseArgs(argsFull);
                    Save.Execute();
                    break;

                case "/load":
                    var Load = new Load();
                    Load.ParseArgs(argsFull);
                    Load.Execute();
                    break;

                case "/undo":
                    var Undo = new Undo();
                    Undo.Execute();
                    break;

                case "/redo":
                    var Redo = new Redo();
                    Redo.Execute();
                    break;

                case "/copy":
                    var Copy = new Copy();
                    Copy.ParseArgs(argsFull);
                    Copy.Execute();
                    break;

                case "/paste":
                    var Paste        = new Paste();
                    var PasteReplace = new PasteReplace();
                    if ((argsFull.Length == 3) && (argsFull[1] == "r")) // if there are 3 arguments and the second one is r
                    {
                        PasteReplace.ParseArgs(argsFull);
                        PasteReplace.Execute();
                    }
                    else if ((argsFull.Length == 2) && (argsFull[1] == "a")) // if there are two arguments and the second one is a
                    {
                        Paste.ParseArgs(argsFull);
                        Paste.Execute();
                    }
                    else
                    {
                        Console.WriteLine(argError);
                    }
                    break;

                case "/dis":
                    var Display = new Display();
                    Display.Execute();
                    break;

                case "/edit":
                    var Edit = new Edit();
                    Edit.ParseArgs(argsFull);
                    Edit.Execute();
                    break;

                case "/move":
                    var Move = new Move();
                    Move.ParseArgs(argsFull);
                    Move.Execute();
                    break;

                case "/del":
                    var Delete = new Delete();
                    Delete.ParseArgs(argsFull);
                    Delete.Execute();
                    break;

                case "/clear":
                    Console.Clear();
                    break;

                case "/exit":
                    var Exit = new Exit();
                    Exit.ParseArgs(args);
                    Exit.Execute();
                    break;

                default:
                    string fullCommand;                        // Initialize a full command string
                    if (args.Length > 1)                       // if args has more than one argument
                    {
                        fullCommand = args[0] + " " + args[1]; // the full command is the argument 0, plus a space, plus the rest
                    }
                    else
                    {
                        fullCommand = args[0]; // else its just the arg 0
                    }

                    if (check[0] == '/') // check if the char array made before has as its first letter a /
                    {
                        Console.WriteLine(syntaxError);
                    }
                    else
                    {
                        lines.Add(fullCommand); // add the command to the lines list
                        line++;                 // increment the lines counter
                    }
                    hasSaved = false;
                    break;
                }
            }
        }