本文整理汇总了C#中CommandSet类的典型用法代码示例。如果您正苦于以下问题:C# CommandSet类的具体用法?C# CommandSet怎么用?C# CommandSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandSet类属于命名空间,在下文中一共展示了CommandSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Do
public override Menu Do(CommandSet commandSet, string resultPath)
{
Console.Clear();
foreach (var a in Settings.Values)
{
Console.WriteLine("[{0}] {1}", a.Key, a.Description);
}
Console.WriteLine("Press exit for exit and press back to back to parent menus.");
while (true)
{
var cmd = Console.ReadLine().ToLower();
if (cmd == "exit")
{
return Menu.ExitSaveOrNot;
}
if (cmd == "parent")
{
return Parent;
}
if (Settings.ContainsKey(cmd))
{
return Settings[cmd];
}
Console.WriteLine("Not Recongiaze Cmd.");
}
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:26,代码来源:MenusList.cs
示例2: Insert
/// <summary> Called to save a pdu into the database </summary>
/// <param name="dataTransaction"></param>
/// <param name="logKey"></param>
/// <param name="smscServiceId"></param>
/// <param name="pduDirectionType"></param>
/// <param name="commandLength"></param>
/// <param name="commandSet"></param>
/// <param name="commandStatus"></param>
/// <param name="sequenceNumber"></param>
/// <param name="details"></param>
/// <param name="pduDataBlocks"></param>
/// <returns> long </returns>
public static Guid? Insert(DataTransaction dataTransaction, string logKey, int smscServiceId, PduDirectionTypes pduDirectionType, long commandLength,
CommandSet commandSet, CommandStatus commandStatus, long sequenceNumber, List<PduPropertyDetail> details, List<byte[]> pduDataBlocks)
{
Guid? pduHeaderId = null;
// Prepare the database call
using (DbCommand dbCommand = dataTransaction.GetStoredProcCommand("spSMPP_Pdu_Insert"))
{
// Prepare the call
dataTransaction.AddInParameterString(dbCommand, "LogKey", logKey);
dataTransaction.AddInParameterInteger(dbCommand, "SMSCServiceID", smscServiceId);
dataTransaction.AddInParameterShort(dbCommand, "Direction", (short) pduDirectionType);
dataTransaction.AddInParameterLong(dbCommand, "CommandLength", commandLength);
dataTransaction.AddInParameterString(dbCommand, "CommandId", commandSet.ToString());
dataTransaction.AddInParameterString(dbCommand, "CommandStatusId", commandStatus.ToString());
dataTransaction.AddInParameterLong(dbCommand, "SequenceNumber", sequenceNumber);
dataTransaction.AddInParameterTable(dbCommand, "PduPropertyDetails", new PduPropertyDetails(details));
dataTransaction.AddInParameterTable(dbCommand, "PduDataBlocks", new SMSCPduDataBlocks(pduDataBlocks));
dataTransaction.AddOutParameterGuid(dbCommand, "PduHeaderId");
dataTransaction.ExecuteNonQuery(dbCommand);
pduHeaderId = dataTransaction.GetParameterValueGuid(dbCommand, "PduHeaderId");
}
return pduHeaderId;
}
开发者ID:kamaroly,项目名称:SMPPClient,代码行数:40,代码来源:PduData.cs
示例3: InGameUser
public InGameUser(StageEntity2 stageEntity, Status.Handle onGoldChanged, TimedConsumableCommandSet.Handle onChargedAttack)
{
this.stat = new Stat<PlayerStatType>(StatGenerator.ExportData<PlayerStatType>(stageEntity, new StatConstants()));
this.status = new Status<PlayerStatusType>(null, stat);
status.InitMinMaxVal(PlayerStatusType.exp, 0, PlayerStatType.maxEXP, 0);
status.InitMinMaxVal(PlayerStatusType.gold, 0, PlayerStatType.maxGold, 0);
status.InitMinMaxVal(PlayerStatusType.key, 0, PlayerStatType.maxKey, 0);
status.InitMinMaxVal(PlayerStatusType.feverPoint, 0, PlayerStatType.maxFeverPoint, 0);
/*
actionHandler = new ActionHandler(status);
AddAction(Action.E_Type.Money,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(PlayerStatusType.gold, value);
}
);
AddAction(Action.E_Type.Exp,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(PlayerStatusType.exp, value);
}
);
*/
status.RegisterOnChangeEvent(PlayerStatusType.gold, onGoldChanged);
commandQueue = new TimedConsumableCommandSet(100, false, null, onChargedAttack);
}
开发者ID:pb0,项目名称:ID0_Test,代码行数:29,代码来源:InGameUser.cs
示例4: InGameUser
public InGameUser(StageEntity stageEntity, Status.Handle onGoldChanged, TimedConsumableCommandSet.Handle onChargedAttack)
{
status = new Status<User>(null, null);
actionHandler = new ActionHandler(status);
status.InitMinMaxVal(User.Gold, 0, stageEntity.maxGold, 0);
status.InitMinMaxVal(User.Exp, 0, stageEntity.maxEXP, 0);
status.InitMinMaxVal(User.Key, 0, stageEntity.maxKey, 0);
AddAction(Action.E_Type.Money,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(User.Gold, value);
}
);
AddAction(Action.E_Type.GetKey,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(User.Key, value);
}
);
AddAction(Action.E_Type.Exp,
delegate(float value, GameInstance firer, string[] param)
{
return new ActionHandler.Result(User.Exp, value);
}
);
status.RegisterOnChangeEvent(User.Gold, onGoldChanged);
commandQueue = new TimedConsumableCommandSet(null, 100, false, null, onChargedAttack);
}
开发者ID:pb0,项目名称:ID0_Test,代码行数:31,代码来源:InGameUser.cs
示例5: CommandSet
public CommandSet(Automaton owner, int capacity, bool autoFire, CommandSet pipe)
{
this.owner = owner;
this.capacity = capacity;
this.queue = new List<Command>();
this.pipe = pipe;
}
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:CommandSet.cs
示例6: TestMethod1
public void TestMethod1()
{
var executeSetting = new ExecuteSetting("./");
executeSetting.ForWidnow();
var commandSet = new CommandSet(executeSetting);
commandSet.Svn("svn_sample")
.Url("http://svn.address.com/trunk")
.Auth("username", "password")
.Tags("tag1", "tab2")
.WorkingCopy("workongfolder")
.Tags("tag1", "tag2");
var manager = new SettingManager();
manager.Save(commandSet, "svn.ini", true);
Assert.IsTrue(File.Exists("svn.ini"));
var target = new CommandSet(new ExecuteSetting("./"));
manager.ReadSetting(target, "svn.ini");
var setting = (SvnSetting)target.Settings.First();
Assert.AreEqual("http://svn.address.com/trunk", setting.Url);
Assert.AreEqual("username", setting.UserName);
Assert.AreEqual("password", setting.Password);
Assert.AreEqual("tag1,tag2", String.Join(",", setting.Tags));
Assert.AreEqual("workongfolder", setting.WorkingCopy);
Assert.AreEqual("svn_sample", setting.Id);
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:30,代码来源:IniWriterUnitTest.cs
示例7: Save
public void Save(CommandSet commandSet, string filename, bool buildComment = false)
{
var file = new IniFile();
var isFirst = true;
foreach (var setting in commandSet.Settings)
{
var seciontName = SectionSettingMap.GetSectionName(setting.GetType());
if (!string.IsNullOrEmpty(setting.Id))
{
seciontName = seciontName + "_" + setting.Id;
}
var section = file.Section(seciontName);
if (buildComment)
{
if (isFirst)
{
section.Comment = BuildFileHeaderDescription();
isFirst = false;
}
var cus = setting.GetType().GetCustomAttributes(typeof(DescriptionAttribute), true);
if (cus.Length > 0)
{
section.Comment += ((DescriptionAttribute)cus[0]).Description.Replace("\r\n", "\r\n#");
}
}
SetToSection(section, setting, buildComment);
}
file.Save(filename);
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:32,代码来源:SettingManager.cs
示例8: Can_Execute_Nested_Commands
public void Can_Execute_Nested_Commands()
{
var foundNet = false;
var foundSend = false;
var foundSendArguments = false;
var options = new CommandSet()
{
new CommandArgument("net|--net","{net} performs some network communication and status operations.", v => foundNet = true,
new CommandSet()
{
new CommandArgument("send", "{net send} sends a message to another client on the network", v =>
{
foundSend = true;
if (v[0] != null && v[1] != null)
foundSendArguments = true;
})
})};
var commandLine = "net send * \"Hello everyone!\"";
options.Parse(commandLine);
Assert.IsTrue(foundNet);
Assert.IsTrue(foundSend);
Assert.IsTrue(foundSendArguments);
}
开发者ID:Aaronontheweb,项目名称:websockets-mvc3,代码行数:25,代码来源:CommandLineParserTests.cs
示例9: From_complex_un_sortId_and_dependy
public void From_complex_un_sortId_and_dependy()
{
var actual = new List<string>();
var commands = new List<ICommand>
{
new CommandMock(actual)
{
Setting = new SettingMock
{
Id = "1"
}
},
new CommandMock(actual)
{
Setting = new SettingMock
{
Id = "2",
}
},
new CommandMock(actual)
{
Setting = new SettingMock
{
Id = "1-1",
Dependency="1"
}
},
new CommandMock(actual)
{
Setting = new SettingMock
{
Id = "3"
}
},
new CommandMock(actual)
{
Setting = new SettingMock
{
Id = "1-1-1",
Dependency="1-1"
}
},
new CommandMock(actual)
{
Setting = new SettingMock
{
Id = "1-2",
Dependency="1"
}
}
};
var st = new CommandSet(new ExecuteSetting("./"), commands);
st.Skip.Add("1");
st.Invoke();
Assert.AreEqual(2, actual.Count);
Assert.AreEqual("2", actual[0]);
Assert.AreEqual("3", actual[1]);
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:60,代码来源:UnitTest_CommandSet.cs
示例10: Modify
public override void Modify(int index1, CommandSet commandSet, string resultPath)
{
Console.WriteLine("For web project(y/n)?");
var readLine = Console.ReadLine();
var msbuild = (MsBuild)commandSet.Commands[index1];
var y = readLine != null && readLine.ToLower().Trim() == "y";
var builder = new MsBuildCommandBuilder(msbuild, y);
var working = WorkingFolder ?? Environment.CurrentDirectory;
var fileList = Find(working);
for (var index = 0; index < fileList.Count; index++)
{
var file = fileList[index];
Console.WriteLine(index + ":" + file);
}
Console.WriteLine("Please input the project file. e.g *.csproj or choice menuList");
var cmd = Console.ReadLine();
builder.ProjectPath(cmd);
Console.WriteLine(
"if you want to copy compiled folder to another place, please input the path, or press enter for noting.");
var copyPath = Console.ReadLine();
if (copyPath != null)
{
builder.CopyTo(copyPath);
}
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:30,代码来源:MsBuildCommandMenu.cs
示例11: Do
public override Menu Do(CommandSet commandSet, string resultPath)
{
Console.Clear();
Console.WriteLine("Coimmand: <command_key><record index>");
Console.WriteLine("e:Edit, d:Delete, Move-up:u,Move-down:d");
Console.WriteLine("e.g. e0 for edit the first record");
Console.WriteLine();
Console.WriteLine("Command list:");
Console.WriteLine();
for (var i = 0; i < commandSet.Commands.Count; i++)
{
Console.WriteLine("{0} - {1}", i, commandSet.Commands[i]);
}
while (true)
{
var input = Console.ReadLine();
if (input == null)
{
Console.WriteLine("Error Command!");
continue;
}
if (input.ToLower() == "exit")
break;
try
{
HandleCommand(input, commandSet, resultPath);
}
catch (Exception ex)
{
Console.WriteLine("Error Command!");
}
}
return Parent;
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:35,代码来源:SetOrder.cs
示例12: Handle
public override bool Handle(CommandSet commandSet, string fileName, string argument)
{
commandSet.Svn("svn_sample")
.Url("http://svn.address.com/trunk")
.Auth("username", "password")
.Tags("tag1","tab2")
.WorkingCopy("workongfolder")
.Tags("tag1", "tag2")
;
commandSet
.Build(true, "compileSample")
.Dependency("svn_sample")
.Tags("tag2", "tab3")
.Release()
.ProjectPath("/mypathfor.csproj")
.CopyTo("publish/%prjName%");
commandSet
.CopyTo("publishFolder_or_network_path", "copySample")
.Auth("networkPath_username", "networkPath_password")
.Dependency("compileSample")
.Tags("tag4", "tab5")
;
var manager = new SettingManager();
manager.Save(commandSet, fileName, true);
return false;
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:29,代码来源:SaveTemplateHandler.cs
示例13: Do
public override Menu Do(CommandSet commandSet, string resultPath)
{
var cmd = CreateCommand();
commandSet.Commands.Add(cmd);
if(commandSet.Commands.Count>1)
resultPath=
Modify(commandSet.Commands.Count - 1, commandSet, resultPath);
return Parent;
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:9,代码来源:Setting.cs
示例14: Handle
public override bool Handle(CommandSet set, string fileName, string argument)
{
var f = argument.Split(':');
if (f.Length == 1)
return true;
var commandNames = f[1].Split(new[] { ';', ',' });
set.IncludeTags.AddRange(commandNames);
return true;
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:10,代码来源:RunTags.cs
示例15: Modify
public override void Modify(int index, CommandSet commandSet, string resultPath)
{
var vc = (VersionControl)commandSet.Commands[index];
SetUrl(vc);
SetWorkingCopy(vc);
SetUserName(vc);
if (!string.IsNullOrEmpty(vc.UserName))
SetPassword(vc);
TryToRun(vc, commandSet);
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:10,代码来源:VersionControlCommandMenu.cs
示例16: Header
/// <summary> Constructor </summary>
/// <param name="commandSet"></param>
/// <param name="sequence"></param>
/// <param name="defaultEncoding"></param>
public Header(DataCodings defaultEncoding, CommandSet commandSet, uint sequence)
{
DefaultEncoding = defaultEncoding;
PduData = null;
Length = HEADER_LENGTH;
Command = commandSet;
Status = CommandStatus.ESME_ROK;
Sequence = sequence;
}
开发者ID:kamaroly,项目名称:SMPPClient,代码行数:15,代码来源:Header.cs
示例17: Can_Match_Command_Regardless_Of_Case
public void Can_Match_Command_Regardless_Of_Case()
{
var setFinished = false;
var options = new CommandSet(
new[]{
new CommandArgument("help|--help","Used to display help information", v => setFinished = !setFinished)
});
options.Parse("HELP");
Assert.IsTrue(setFinished); //This should have been set to true by the lamba expression
}
开发者ID:Aaronontheweb,项目名称:websockets-mvc3,代码行数:11,代码来源:CommandLineParserTests.cs
示例18: Can_Find_Valid_Match_With_Multiple_Signatures
public void Can_Find_Valid_Match_With_Multiple_Signatures()
{
var setFinished = false;
var options = new CommandSet(
new []{
new CommandArgument("help|--help","Used to display help information", v => setFinished = !setFinished)
});
options.Parse("help");
Assert.IsTrue(setFinished); //This should have been set to true by the lamba expression
options.Parse("--help");
Assert.IsFalse(setFinished); //Should have been set to "false" when the options found it ;)
}
开发者ID:Aaronontheweb,项目名称:websockets-mvc3,代码行数:13,代码来源:CommandLineParserTests.cs
示例19: Handle
/// <summary>
/// </summary>
/// <param name="keies"></param>
/// <param name="set"></param>
/// <param name="fileName"></param>
/// <returns></returns>
public bool Handle(IEnumerable<string> keies, CommandSet set, string fileName)
{
foreach (var key in keies)
{
var paramName = Regex.Match(key, "[A-z0-9]*").Value;
if (_creator.ContainsKey(paramName))
{
var goOn = _creator[paramName].Handle(set, fileName, key);
if (!goOn)
{
return false;
}
}
}
return true;
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:22,代码来源:ArgumentFactory.cs
示例20: Handle
public override bool Handle(CommandSet set, string fileName, string argument)
{
Console.WriteLine("releaseIt [fileName] for run.");
Console.WriteLine();
Console.WriteLine("/skip:commandName;commandName for skip command");
Console.WriteLine("/run:commandName;commandName run following command.");
Console.WriteLine("/tags:tag1;tag2 for run");
Console.WriteLine("/skiptag:tag;tag2; to skip");
Console.WriteLine("/c [fileName] to create a template setting file.");
Console.WriteLine("e.g. releaseIt setting.ini /t");
return false;
}
开发者ID:luqizheng,项目名称:lb_releaseIt,代码行数:17,代码来源:ShowHelpArgumentHandler.cs
注:本文中的CommandSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论