Beispiel #1
0
        public void MainTest()
        {
            // Sample Initialization
            string FilesExamplePath = AHelper.BASE_PATH + @"\FilesExample", ExampleFileName = "demoFile.txt";

            Directory.CreateDirectory(FilesExamplePath);
            using (StreamWriter streamWriter = new StreamWriter(FilesExamplePath + @"\" + ExampleFileName, false))
            {
                streamWriter.WriteLine("Hello Alterful!");
            }
            AFile.Add("demo", FilesExamplePath + @"\" + ExampleFileName);

            // ----Instruction Sample----
            // new AInstruction_Startup("demo demo-f").Execute();
            // new AInstruction_Macro("@new a.txt b.txt").Execute();
            // new AInstruction_Macro(@"@add f f:\").Execute();
            // new AInstruction_Macro("f").Execute();
            // new AInstruction_Macro(@"@del f").Execute();
            // -----Demo End-----

            // ----Sample For fun----
            string yourChromePath = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";

            AInstruction.GetInstruction("@add chrome " + yourChromePath).Execute();
            AInstruction.GetInstruction("@add #fy chrome-o/https://fanyi.baidu.com/#zh/en/").Execute();
            AInstruction.GetInstruction("#fy+键盘增强").Execute();
            // ----Sample For fun----
        }
Beispiel #2
0
 /// <summary>
 /// 执行宏启动项添加指令
 /// </summary>
 /// <param name="macroInstructionParameters">宏添加指令参数列表</param>
 /// <exception cref="FileNotFoundException"></exception>
 /// <exception cref="ConstQuoteParseError"></exception>
 private void ExecuteMacroAddStartup(List <string> macroInstructionParameters)
 {
     try
     {
         string startupName = AConstQuote.ConstQuoteParse(macroInstructionParameters[0]);
         string targetPath  = AConstQuote.ConstQuoteParse(macroInstructionParameters[1]);
         if (AFile.Exists(startupName))
         {
             //throw new NotImplementedException("添加失败,因为启动名 [" + startupName + "] 已经存在。");
             throw new NotImplementedException("Failed to add, because item [" + startupName + "] is already exist.");
         }
         AFile.Add(startupName, targetPath);
         reportType = ReportType.OK;
     }
     catch (FileNotFoundException)
     {
         throw;
     }
     catch (ConstQuoteParseError)
     {
         throw;
     }
 }