本文整理汇总了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"));
}
示例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;
}
示例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);
}
示例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 } }
};
}
示例5: GivenAnItemWithQualityOf
public void GivenAnItemWithQualityOf(int quality)
{
_program = new Program()
{
Items = new List<Item> { new Item { Name = "+5 Dexterity Vest", SellIn = 10, Quality = quality } }
};
}
示例6: GivenAnItemWithASellInOf
public void GivenAnItemWithASellInOf(int sellin)
{
_program = new Program()
{
Items = new List<Item> { new Item { Name = "+5 Dexterity Vest", SellIn = sellin, Quality = 5 } }
};
}
示例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);
}
示例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;
}
示例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();
}
示例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,
}
};
}
示例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");
}
}
示例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);
}
示例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();
}
}
}
示例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,
};
}
示例15: SubtractionTest
public void SubtractionTest()
{
Program prog = new Program();
int result = prog.Subtraction(100, 10);
int actual = 90;
Assert.AreEqual<int>(result, actual);
}