當前位置: 首頁>>代碼示例>>C#>>正文


C# System.Program類代碼示例

本文整理匯總了C#中System.Program的典型用法代碼示例。如果您正苦於以下問題:C# Program類的具體用法?C# Program怎麽用?C# Program使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Program類屬於System命名空間,在下文中一共展示了Program類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddsAPluginByNameWithVersion

        public void AddsAPluginByNameWithVersion()
        {
            var program = new Program(new FakeApplicationEnvironment());

            program.ParseArguments(new string[] { "--plugin-name", "[email protected]", "--plugin-name", "PluginB" });
            Assert.True(program.PluginNames.Any(z => z.Key == "PluginA" && z.Value == "1.0.0"));
        }
開發者ID:RLittlesII,項目名稱:omnisharp-roslyn,代碼行數:7,代碼來源:SampleTest.cs

示例2: Insert

 ///<summary>Inserts one Program into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(Program program,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         program.ProgramNum=ReplicationServers.GetKey("program","ProgramNum");
     }
     string command="INSERT INTO program (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="ProgramNum,";
     }
     command+="ProgName,ProgDesc,Enabled,Path,CommandLine,Note,PluginDllName) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(program.ProgramNum)+",";
     }
     command+=
          "'"+POut.String(program.ProgName)+"',"
         +"'"+POut.String(program.ProgDesc)+"',"
         +    POut.Bool  (program.Enabled)+","
         +"'"+POut.String(program.Path)+"',"
         +"'"+POut.String(program.CommandLine)+"',"
         +"'"+POut.String(program.Note)+"',"
         +"'"+POut.String(program.PluginDllName)+"')";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         program.ProgramNum=Db.NonQ(command,true);
     }
     return program.ProgramNum;
 }
開發者ID:nampn,項目名稱:ODental,代碼行數:30,代碼來源:ProgramCrud.cs

示例3: AddsPlugins

        public void AddsPlugins()
        {
            var program = new Program(new FakeApplicationEnvironment());

            program.ParseArguments(new string[] { "--plugins", "/a/b/c/d" });
            Assert.Contains("/a/b/c/d", program.PluginPaths);
        }
開發者ID:RLittlesII,項目名稱:omnisharp-roslyn,代碼行數:7,代碼來源:SampleTest.cs

示例4: GivenAnItemWithTheNameAQualityAndASellInOf

 public void GivenAnItemWithTheNameAQualityAndASellInOf(string name, int quality, int sellIn)
 {
     _program = new Program()
     {
         Items = new List<Item> { new Item { Name = name, SellIn = sellIn, Quality = quality } }
     };
 }
開發者ID:neilharvey,項目名稱:kata-gildedrose-specflow,代碼行數:7,代碼來源:UpdateInventorySteps.cs

示例5: GivenAnItemWithQualityOf

 public void GivenAnItemWithQualityOf(int quality)
 {
     _program = new Program()
     {
         Items = new List<Item> { new Item { Name = "+5 Dexterity Vest", SellIn = 10, Quality = quality } }
     };
 }
開發者ID:neilharvey,項目名稱:kata-gildedrose-specflow,代碼行數:7,代碼來源:UpdateInventorySteps.cs

示例6: GivenAnItemWithASellInOf

 public void GivenAnItemWithASellInOf(int sellin)
 {
     _program = new Program()
     {
         Items = new List<Item> { new Item { Name = "+5 Dexterity Vest", SellIn = sellin, Quality = 5 } }
     };
 }
開發者ID:neilharvey,項目名稱:kata-gildedrose-specflow,代碼行數:7,代碼來源:UpdateInventorySteps.cs

示例7: Auto_Syncada_Inv_Mktg_Request

			public void Auto_Syncada_Inv_Mktg_Request()
			{
			Program prog = new Program();
            int result = prog.Addition(10, 10);
            int actual = 20;
            Assert.AreEqual<int>(result, actual);
			}
開發者ID:EdiCarlos,項目名稱:MyPractices,代碼行數:7,代碼來源:GenerateTestMethods.cs

示例8: TerrainEditor

        /// <summary>
        /// Initialise the editor.
        /// </summary>
        /// <param name="terrainEditorProgram">The terrain editor effect to clone. In the default content, this is stored as "Terracotta/TerrainEditorEffect".</param>
        /// <param name="terrain">The terrain to edit.</param>
        public TerrainEditor(PlanarTerrainBlock block)
        {
            this.terrainBlock = block;

            var builder = ShaderBuilder.CreateFromAssemblyResource("Glare.Graphics.Shaders.TerrainEditor.glsl");
            Program = new Program(
                builder.VertexShader("Common", "Vertex"),
                builder.FragmentShader("Common", "Fragment"));

            Program.Uniforms["TerrainSize"].Set(Terrain.BlockSize);
            Program.Uniforms["InverseTerrainSize"].Set(1.0 / Terrain.BlockSize);
            Rng = new Random();

            byte[] permutations = new byte[PerlinSize];
            for (int i = 0; i < permutations.Length; i++)
                permutations[i] = (byte)i;
            for (int i = 0; i < permutations.Length; i++)
                Extensions.Swap(ref permutations[i], ref permutations[Rng.Next(permutations.Length)]);

            CreatePerlinPermutationTexture(permutations);
            CreatePerlinGradientTexture(permutations);
            CreateTemporaryTexture();
            //LoadRandomPerlinTransform();
            PerlinTransform = Matrix4d.Identity;
        }
開發者ID:Burton-Radons,項目名稱:Alexandria,代碼行數:30,代碼來源:TerrainEditor.cs

示例9: OnApplicationStartup

        void OnApplicationStartup(object sender, StartupEventArgs e)
        {
            DispatcherUnhandledException += App_DispatcherUnhandledException;

            Program program = null;
            if (e.Args.Length >= 1)
            {
                try
                {
                    program = Program.Load(e.Args[0]);
                }
                catch (Exception ex)
                {
                    CommonExceptionHandlers.HandleException(null, ex);
                }
            }
            if (program == null)
            {
                program = new Program();
            }

            AppState.Program = program;

            var bootstrapper = new Bootstrapper();
            bootstrapper.Run();
        }
開發者ID:wallymathieu,項目名稱:Prolog.NET,代碼行數:26,代碼來源:App.xaml.cs

示例10: VisitProgram

 public ProjectFile_v2 VisitProgram(Program program)
 {
     var dtSerializer = new DataTypeSerializer();
     return new DecompilerInput_v2
     {
         Address = program.Image != null 
             ? program.Image.BaseAddress.ToString()
             : null,
         Filename = program.Filename,
         UserProcedures = program.UserProcedures
             .Select(de => { de.Value.Address = de.Key.ToString(); return de.Value; })
             .ToList(),
         UserCalls = program.UserCalls
             .Select(uc => uc.Value)
             .ToList(),
         UserGlobalData = program.UserGlobalData
             .Select(de => new GlobalDataItem_v2
             {
                 Address = de.Key.ToString(),
                 DataType = de.Value.DataType,
                 Name = string.Format("g_{0:X}", de.Key.ToLinear())
             })
             .ToList(),
         DisassemblyFilename = program.DisassemblyFilename,
         IntermediateFilename = program.IntermediateFilename,
         OutputFilename = program.OutputFilename,
         TypesFilename = program.TypesFilename,
         GlobalsFilename = program.GlobalsFilename,
         OnLoadedScript = program.OnLoadedScript,
         Options = new ProgramOptions_v2
         {
             HeuristicScanning = program.Options.HeuristicScanning,
         }
     };
 }
開發者ID:killbug2004,項目名稱:reko,代碼行數:35,代碼來源:ProjectSaver.cs

示例11: SolveInstance

        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string name = null; 
            GH_RobotSystem robotSystem = null;
            var initCommandsGH = new List<GH_Command>();
            var targetsA = new List<GH_Target>();
            var targetsB = new List<GH_Target>();
            var multiFileIndices = new List<int>();
            double stepSize = 1;

            if (!DA.GetData(0, ref name)) { return; }
            if (!DA.GetData(1, ref robotSystem)) { return; }
            if (!DA.GetDataList(2, targetsA)) { return; }
            DA.GetDataList(3, targetsB);
            DA.GetDataList(4, initCommandsGH);
            DA.GetDataList(5, multiFileIndices);
            if (!DA.GetData(6, ref stepSize)) { return; }

            var initCommands = initCommandsGH.Count > 0 ? new Robots.Commands.Group(initCommandsGH.Select(x => x.Value)) : null;

            var targets = new List<IEnumerable<Target>>();
            targets.Add(targetsA.Select(x => x.Value));
            if (targetsB.Count > 0) targets.Add(targetsB.Select(x => x.Value));

            var program = new Program(name, robotSystem.Value, targets, initCommands, multiFileIndices, stepSize);

            DA.SetData(0, new GH_Program(program));


            if (program.Code != null)
            {
                var path = DA.ParameterTargetPath(2);
                var structure = new GH_Structure<GH_String>();

                for (int i = 0; i < program.Code.Count; i++)
                {
                    var tempPath = path.AppendElement(i);
                    for (int j = 0; j < program.Code[i].Count; j++)
                    {
                        structure.AppendRange(program.Code[i][j].Select(x => new GH_String(x)), tempPath.AppendElement(j));
                    }
                }

                DA.SetDataTree(1, structure);
            }

            DA.SetData(2, program.Duration);

            if (program.Warnings.Count > 0)
            {
                DA.SetDataList(3, program.Warnings);
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Warnings in program");
            }

            if (program.Errors.Count > 0)
            {
                DA.SetDataList(4, program.Errors);
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Errors in program");
            }
        }
開發者ID:visose,項目名稱:Robots,代碼行數:60,代碼來源:Program.cs

示例12: ConcurrentHoudini

 public ConcurrentHoudini(int taskId, Program program, HoudiniSession.HoudiniStatistics stats, string cexTraceFile = "houdiniCexTrace.txt") {
   Contract.Assert(taskId >= 0);
   this.program = program;
   this.cexTraceFile = cexTraceFile;
   this.taskID = taskId;
   Initialize(program, stats);
 }
開發者ID:qunyanm,項目名稱:boogie,代碼行數:7,代碼來源:ConcurrentHoudini.cs

示例13: Main

 public static void Main(string[] args)
 {
     Gnome.Program program =
     new Program("collection-properties", "0.10.0", Modules.UI, args);
        Store store = Store.GetStore();
        if(args.Length < 1)
        {
     Console.WriteLine("Usage: ColPropViewer [collectionID]");
     Console.WriteLine("       where collectionID is:");
     foreach(ShallowNode sn in store)
     {
      Collection col = store.GetCollectionByID(sn.ID);
      Console.WriteLine("{0} : {1}", col.Name, col.ID);
     }
        }
        else
        {
     Collection col = store.GetCollectionByID(args[0]);
     if(col != null)
     {
      CollectionProperties cp = new CollectionProperties();
      cp.Collection = col;
      cp.Closed += new EventHandler(on_cp_closed);
      cp.Show();
      program.Run();
     }
        }
 }
開發者ID:RoDaniel,項目名稱:featurehouse,代碼行數:28,代碼來源:CPApp.cs

示例14: VisitProgram

 public ProjectFile_v3 VisitProgram(Program program)
 {
     var dtSerializer = new DataTypeSerializer();
     return new DecompilerInput_v3
     {
         Filename = program.Filename,
         User = new UserData_v3
         {
             Procedures = program.User.Procedures
                 .Select(de => { de.Value.Address = de.Key.ToString(); return de.Value; })
                 .ToList(),
             Processor = SerializeProcessorOptions(program.User, program.Architecture),
             PlatformOptions = SerializePlatformOptions(program.User, program.Platform),
             LoadAddress = program.User.LoadAddress != null ? program.User.LoadAddress.ToString() : null,
             Calls = program.User.Calls
                 .Select(uc => uc.Value)
                 .ToList(),
             GlobalData = program.User.Globals
                 .Select(de => new GlobalDataItem_v2
                 {
                     Address = de.Key.ToString(),
                     DataType = de.Value.DataType,
                     Name = string.Format("g_{0:X}", de.Key.ToLinear())
                 })
                 .ToList(),
             OnLoadedScript = program.User.OnLoadedScript,
             Heuristics = program.User.Heuristics.Select(h => new Heuristic_v3 { Name = h }).ToList(),
         },
         DisassemblyFilename = program.DisassemblyFilename,
         IntermediateFilename = program.IntermediateFilename,
         OutputFilename = program.OutputFilename,
         TypesFilename = program.TypesFilename,
         GlobalsFilename = program.GlobalsFilename,
     };
 }
開發者ID:nemerle,項目名稱:reko,代碼行數:35,代碼來源:ProjectSaver.cs

示例15: SubtractionTest

 public void SubtractionTest()
 {
     Program prog = new Program();
     int result = prog.Subtraction(100, 10);
     int actual = 90;
     Assert.AreEqual<int>(result, actual);
 }
開發者ID:EdiCarlos,項目名稱:MyPractices,代碼行數:7,代碼來源:ProgramTest.cs


注:本文中的System.Program類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。