• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConsoleService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ConsoleService的典型用法代码示例。如果您正苦于以下问题:C# ConsoleService类的具体用法?C# ConsoleService怎么用?C# ConsoleService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConsoleService类属于命名空间,在下文中一共展示了ConsoleService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProtocolChoicePromptHandler

 public ProtocolChoicePromptHandler(
     IMessageSender messageSender,
     ConsoleService consoleService)
 {
     this.messageSender = messageSender;
     this.consoleService = consoleService;
 }
开发者ID:sunnyc7,项目名称:PowerShellEditorServices,代码行数:7,代码来源:PromptHandlers.cs


示例2: Run

        public void Run()
        {
            var sut = new ConsoleService("sampleconsole.exe", "");

            var result = sut.Process("a\nb");
            Assert.AreEqual("<<<A\nB>>>\n", result);
        }
开发者ID:ralfw,项目名称:ccdacdnov13,代码行数:7,代码来源:test_ConsoleService.cs


示例3: StartSession

        /// <summary>
        /// Starts the session using the provided IConsoleHost implementation
        /// for the ConsoleService.
        /// </summary>
        public void StartSession()
        {
            // Create a workspace to contain open files
            this.Workspace = new Workspace();

            // Initialize all services
            this.PowerShellContext = new PowerShellContext();
            this.LanguageService = new LanguageService(this.PowerShellContext);
            this.AnalysisService = new AnalysisService();
            this.DebugService = new DebugService(this.PowerShellContext);
            this.ConsoleService = new ConsoleService(this.PowerShellContext);
        }
开发者ID:modulexcite,项目名称:PowerShellEditorServices,代码行数:16,代码来源:EditorSession.cs


示例4: ConsoleServiceTests

        public ConsoleServiceTests()
        {
            this.powerShellContext = new PowerShellContext();

            this.promptHandlerContext = 
                new TestConsolePromptHandlerContext();

            this.consoleService =
                new ConsoleService(
                    this.powerShellContext,
                    promptHandlerContext);

            this.consoleService.OutputWritten += OnOutputWritten;
            promptHandlerContext.ConsoleHost = this.consoleService;
        }
开发者ID:modulexcite,项目名称:PowerShellEditorServices,代码行数:15,代码来源:ConsoleServiceTests.cs


示例5: BuildWin32

        static int BuildWin32(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[yes|no]", ConsoleService.Prompt, "Increments build number (y/n) ? ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("NORMALIZESRC", ConsoleService.Prompt, "Normalizes source codes (y/n) ? ", ConsoleService.EvalNotEmpty, null)
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            if (vl.DefaultParam.BoolValue)
            {
                Win32BuildUtil.IncrementBuildNumber();
            }
            if (vl.DefaultParam.BoolValue || vl["NORMALIZESRC"].BoolValue)
            {
                Win32BuildUtil.NormalizeBuildInfo();
            }

            Paths.DeleteAllReleaseTarGz();
            Paths.DeleteAllReleaseExe();
            Paths.DeleteAllReleaseManuals();
            Paths.DeleteAllReleaseAdminKits();

            Win32BuildUtil.BuildMain();
            Win32BuildUtil.SignAllBinaryFiles();
            HamCoreBuildUtil.BuildHamcore();
            Win32BuildUtil.CopyDebugSnapshot();

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:30,代码来源:BuildUtilCommands.cs


示例6: BuildHamCore

        static int BuildHamCore(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            HamCoreBuildUtil.BuildHamcore();

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:11,代码来源:BuildUtilCommands.cs


示例7: PostBuild

        static int PostBuild(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            Win32BuildUtil.SignAllBinaryFiles();
            HamCoreBuildUtil.BuildHamcore();

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:12,代码来源:BuildUtilCommands.cs


示例8: GenerateWin8InfFiles

        static int GenerateWin8InfFiles(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[cpu]", ConsoleService.Prompt, "x86 / x64: ", ConsoleService.EvalNotEmpty, null)
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            #if	!BU_OSS

            Win32BuildUtil.GenerateINFFilesForWindows8(vl.DefaultParam.StrValue);

            #endif

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:16,代码来源:BuildUtilCommands.cs


示例9: GenerateVersionResource

        static int GenerateVersionResource(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[targetFileName]", ConsoleService.Prompt, "Target Filename: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("OUT", ConsoleService.Prompt, "Dst Filename: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("PRODUCT"),
                new ConsoleParam("RC"),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            string targetFilename = vl.DefaultParam.StrValue;
            string outFilename = vl["OUT"].StrValue;
            string product_name = vl["PRODUCT"].StrValue;

            Win32BuildUtil.GenerateVersionInfoResource(targetFilename, outFilename, vl["RC"].StrValue, product_name);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:19,代码来源:BuildUtilCommands.cs


示例10: Count

        static int Count(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[DIR]", null, null, null, null),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            string dir = vl.DefaultParam.StrValue;
            if (Str.IsEmptyStr(dir))
            {
                dir = Paths.BaseDirName;
            }

            string[] files = Directory.GetFiles(dir, "*", SearchOption.AllDirectories);

            int numLines = 0;
            int numBytes = 0;
            int numComments = 0;
            int totalLetters = 0;

            Dictionary<string, int> commentsDict = new Dictionary<string, int>();

            foreach (string file in files)
            {
                string ext = Path.GetExtension(file);

                if (Str.StrCmpi(ext, ".c") || Str.StrCmpi(ext, ".cpp") || Str.StrCmpi(ext, ".h") ||
                    Str.StrCmpi(ext, ".rc") || Str.StrCmpi(ext, ".stb") || Str.StrCmpi(ext, ".cs")
                     || Str.StrCmpi(ext, ".fx") || Str.StrCmpi(ext, ".hlsl"))
                {
                    if (Str.InStr(file, "\\.svn\\") == false && Str.InStr(file, "\\seedll\\") == false && Str.InStr(file, "\\see\\") == false && Str.InStr(file, "\\openssl\\") == false)
                    {
                        string[] lines = File.ReadAllLines(file);

                        numLines += lines.Length;
                        numBytes += (int)new FileInfo(file).Length;

                        foreach (string line in lines)
                        {
                            if (Str.InStr(line, "//") && Str.InStr(line, "// Validate arguments") == false)
                            {
                                if (commentsDict.ContainsKey(line) == false)
                                {
                                    commentsDict.Add(line, 1);
                                }
                                numComments++;

                                totalLetters += line.Trim().Length - 3;
                            }
                        }
                    }
                }
            }

            Con.WriteLine("{0} Lines,  {1} Bytes.  {2} Comments ({3} distinct, aver: {4})", Str.ToStr3(numLines), Str.ToStr3(numBytes),
                Str.ToStr3(numComments), commentsDict.Count, totalLetters / numComments);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:60,代码来源:BuildUtilCommands.cs


示例11: SetPE4

        static int SetPE4(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[filename]", ConsoleService.Prompt, "Filename: ", ConsoleService.EvalNotEmpty, null)
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            PEUtil.SetPEVersionTo4(vl.DefaultParam.StrValue);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:12,代码来源:BuildUtilCommands.cs


示例12: SetManifest

        static int SetManifest(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[filename]", ConsoleService.Prompt, "Target Filename: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("MANIFEST", ConsoleService.Prompt, "Manifest Filename: ", ConsoleService.EvalNotEmpty, null),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            PEUtil.SetManifest(vl.DefaultParam.StrValue, vl["MANIFEST"].StrValue);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:13,代码来源:BuildUtilCommands.cs


示例13: ProtocolInputPromptHandler

 public ProtocolInputPromptHandler(
     IMessageSender messageSender,
     ConsoleService consoleService)
         : base(consoleService)
 {
     this.messageSender = messageSender;
     this.consoleService = consoleService;
 }
开发者ID:sunnyc7,项目名称:PowerShellEditorServices,代码行数:8,代码来源:PromptHandlers.cs


示例14: BuildUtil

        public static int BuildUtil(ConsoleService c, string cmdName, string str)
        {
            Con.WriteLine("");
            Con.WriteLine("Copyright (c) SoftEther VPN Project. All Rights Reserved.");
            Con.WriteLine("");

            ConsoleParam[] args =
            {
                new ConsoleParam("IN", null, null, null, null),
                new ConsoleParam("OUT", null, null, null, null),
                new ConsoleParam("CMD", null, null, null, null),
                new ConsoleParam("CSV", null, null, null, null),
                new ConsoleParam("PAUSEIFERROR", null, null, null, null),
                new ConsoleParam("DT", null, null, null, null),
            };

            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            pause = vl["PAUSEIFERROR"].BoolValue;

            string cmdline = vl["CMD"].StrValue;

            if (vl["DT"].IsEmpty == false)
            {
                BuildSoftwareList.ListCreatedDateTime = Str.StrToDateTime(vl["DT"].StrValue);
            }

            ConsoleService cs = c;

            while (cs.DispatchCommand(cmdline, "BuildUtil>", typeof(BuildUtilCommands), null))
            {
                if (Str.IsEmptyStr(cmdline) == false)
                {
                    break;
                }
            }

            return cs.RetCode;
        }
开发者ID:hummermania,项目名称:SoftEtherVPN,代码行数:39,代码来源:BuildUtilMain.cs


示例15: CopyRelease

        static int CopyRelease(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            int build, version;
            string name;
            DateTime date;
            Win32BuildUtil.ReadBuildInfoFromTextFile(out build, out version, out name, out date);

            string baseName = string.Format("v{0}-{1}-{2}-{3:D4}.{4:D2}.{5:D2}",
                                    BuildHelper.VersionIntToString(version),
                                    build,
                                    name,
                                    date.Year, date.Month, date.Day);

            #if !BU_OSS
            string destDirName = Path.Combine(Paths.ReleaseDestDir,
                string.Format(@"{0}-{1}-{2}-{3}",
                    Str.DateToStrShort(BuildSoftwareList.ListCreatedDateTime),
                    baseName,
                    Env.MachineName, Env.UserName));
            #else	// !BU_OSS
            string destDirName = Path.Combine(Paths.ReleaseDestDir,
                string.Format(@"{1}",
                    Str.DateToStrShort(BuildSoftwareList.ListCreatedDateTime),
                    baseName,
                    Env.MachineName, Env.UserName));
            #endif

            #if !BU_OSS
            string publicDir = Path.Combine(destDirName, "Public");
            #else	// !BU_OSS
            string publicDir = destDirName;
            #endif

            #if !BU_OSS
            string filesReleaseDir = Path.Combine(publicDir, baseName);
            #else	// !BU_OSS
            string filesReleaseDir = publicDir;
            #endif

            string autorunReleaseSrcDir = Path.Combine(publicDir, "autorun");

            IO.CopyDir(Paths.ReleaseDir, filesReleaseDir, null, false, true);

            #if !BU_OSS
            IO.CopyDir(Paths.ReleaseSrckitDir, Path.Combine(destDirName, "Private"), null, false, true);
            IO.CopyDir(Path.Combine(Paths.BaseDirName, @"tmp\lib"), Path.Combine(destDirName, @"Private\lib"), null, false, true);
            #endif

            //IO.MakeDir(autorunReleaseSrcDir);

            /*
            File.Copy(Path.Combine(Paths.AutorunSrcDir, "Project1.exe"),
                Path.Combine(autorunReleaseSrcDir, "autorun.exe"), true);

            File.Copy(Path.Combine(Paths.AutorunSrcDir, "autorun.inf"),
                Path.Combine(autorunReleaseSrcDir, "autorun.inf"), true);

            File.Copy(Path.Combine(Paths.AutorunSrcDir, "packetix.ico"),
                Path.Combine(autorunReleaseSrcDir, "autorun.ico"), true);*/

            // Create a batch file
            string batchFileName = Path.Combine(publicDir, "MakeCD.cmd");
            #if !BU_OSS
            StreamWriter w = new StreamWriter(batchFileName);
            #else	// !BU_OSS
            StringWriter w = new StringWriter();
            #endif
            w.WriteLine(@"SETLOCAL");
            w.WriteLine(@"SET BATCH_FILE_NAME=%0");
            w.WriteLine(@"SET BATCH_DIR_NAME=%0\..");
            w.WriteLine(@"SET NOW_TMP=%time:~0,2%");
            w.WriteLine(@"SET NOW=%date:~0,4%%date:~5,2%%date:~8,2%_%NOW_TMP: =0%%time:~3,2%%time:~6,2%");
            w.WriteLine();
            w.WriteLine();

            string[] files = Directory.GetFiles(filesReleaseDir, "*", SearchOption.AllDirectories);

            string cddir = "CD";
                /*string.Format("CD-v{0}.{1}-{2}-{3}-{4:D4}.{5:D2}.{6:D2}",
                version / 100, version % 100, build, name,
                date.Year, date.Month, date.Day);*/

            StringWriter txt = new StringWriter();

            foreach (string filename in files)
            {
                string file = filename;

                BuildSoftware s = new BuildSoftware(file);

                // Software\Windows\PacketiX VPN Server 4.0\32bit (Intel x86)\filename.exe
                string cpustr = string.Format("{0} - {1}", CPUBitsUtil.CPUBitsToString(s.Cpu.Bits), s.Cpu.Title).Replace("/", "or");
                string cpustr2 = cpustr;

                if (s.Cpu == CpuList.intel)
//.........这里部分代码省略.........
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:101,代码来源:BuildUtilCommands.cs


示例16: CopyUnixSrc

        static int CopyUnixSrc(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[destdir]", ConsoleService.Prompt, "Destination directory : ", ConsoleService.EvalNotEmpty, null),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            ((BuildSoftwareUnix)BuildSoftwareList.vpnbridge_linux_x86_ja).CopyUnixSrc(vl.DefaultParam.StrValue);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:12,代码来源:BuildUtilCommands.cs


示例17: SignCode

        static int SignCode(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[filename]", ConsoleService.Prompt, "Filename: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("DEST"),
                new ConsoleParam("COMMENT", ConsoleService.Prompt, "Comment: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("KERNEL"),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            string destFileName = vl["DEST"].StrValue;
            string srcFileName = vl.DefaultParam.StrValue;
            if (Str.IsEmptyStr(destFileName))
            {
                destFileName = srcFileName;
            }
            string comment = vl["COMMENT"].StrValue;
            bool kernel = vl["KERNEL"].BoolValue;

            CodeSign.SignFile(destFileName, srcFileName, comment, kernel);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:24,代码来源:BuildUtilCommands.cs


示例18: FileCopy

        static int FileCopy(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[src]", ConsoleService.Prompt, "Src Filename: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("DEST", ConsoleService.Prompt, "Dst Filename: ", ConsoleService.EvalNotEmpty, null),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            string destFileName = vl["DEST"].StrValue;
            string srcFileName = vl.DefaultParam.StrValue;

            IO.FileCopy(srcFileName, destFileName, true, false);

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:16,代码来源:BuildUtilCommands.cs


示例19: Test

        static int Test(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            TestClass.Test();

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:11,代码来源:BuildUtilCommands.cs


示例20: GenerateVpnWebOcxCab

        static int GenerateVpnWebOcxCab(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[src]", ConsoleService.Prompt, "Src Filename: ", ConsoleService.EvalNotEmpty, null),
                new ConsoleParam("DEST", ConsoleService.Prompt, "Dst Filename: ", ConsoleService.EvalNotEmpty, null),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            #if	!BU_OSS
            string destFileName = vl["DEST"].StrValue;
            string srcFileName = vl.DefaultParam.StrValue;

            Win32BuildUtil.GenerateVpnWebOcxCab(destFileName, srcFileName);
            #endif

            return 0;
        }
开发者ID:nenew,项目名称:SoftEtherVPN,代码行数:18,代码来源:BuildUtilCommands.cs



注:本文中的ConsoleService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConsoleSystem类代码示例发布时间:2022-05-24
下一篇:
C# ConsoleOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap