public void TestHelp() { var tryCommand = new TryCommand(); Console.WriteLine("command helper:"); ClusterCommand.Exec <Option>(new[] { "/?" }, "TestHelp"); Console.WriteLine("action helper:"); ClusterCommand.Exec <Option>(new[] { "controller", "/h" }, "TestHelp"); }
private void LoadData() { ProgressIndeterminate = true; var filePath = GetFileSelection(); LoadedFileName = Path.GetFileName(filePath); data = LoadCsvFile(filePath); eventAggregator.GetEvent <DataLoadedEvent>().Publish(data); ClusterCommand.RaiseCanExecuteChanged(); ProgressIndeterminate = false; }
public void TestActions() { var tryCommand = new TryCommand(); Console.WriteLine("controller-action1:"); ClusterCommand.Exec <Option>(new [] { "controller", "action1", "/con:controller", "/act1:one" }); Console.WriteLine("controller-action2:"); ClusterCommand.Exec <Option>(new[] { "controller", "action2", "/con:controller", "/act2:two", "/act2a:twoa" }); Console.WriteLine("controller-action2 with optional parameter:"); ClusterCommand.Exec <Option>(new[] { "controller", "action2", "/con:controller", "/act2:two", "/act2a:twoa", "/act2Optional:twoOptional" }); }
static void Main(string[] args) { try { TfsClientService.Instance.LoadTfsClientService(args.ToTcmOption()); ClusterCommand.Exec <Option>(args); } catch (Exception e) { Console.WriteLine("Command failed at {0}", e.Message); } }
public void DataRefresh() { IntInstance = Random.Range(0, 50); Vector3Instance = Vector3.one * Random.Range(0, 50); string all = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+"; int slength = Random.Range(1, 20); StringInstance = ""; for (int i = 0; i < slength; ++i) { StringInstance += all[Random.Range(0, all.Length)]; } CustomDataInstance.CustomVector3Data = Vector3.one * Random.Range(0, 50); CustomDataInstance.CustomColorData = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)); CustomDataInstance.CustomEnumData = (CustomEnum)Random.Range(0, 3); CustomDataInstance.InsideData.insideData = Random.Range(0, 50); ListData.Clear(); ListData.Add(new InsideCustomData(Random.Range(0, 50))); ListData.Add(new InsideCustomData(Random.Range(0, 50))); ListData.Add(new InsideCustomData(Random.Range(0, 50))); DicData.Clear(); DicData.Add("Key1", Vector3.one * Random.Range(0, 50)); DicData.Add("Key2", Vector3.one * Random.Range(0, 50)); DicData.Add("Key3", Vector3.one * Random.Range(0, 50)); CustomClassDataInstance = new CustomClassData(); int len = Random.Range(1, 5); CustomClassDataInstance.CustomClassStringData = ""; for (int i = 0; i < len; ++i) { CustomClassDataInstance.CustomClassList.Add(Random.Range(0, 50)); CustomClassDataInstance.CustomClassDictionaryData.Add("Key" + i, Random.Range(0, 50)); CustomClassDataInstance.CustomClassStringData += all[Random.Range(0, all.Length)]; } ClusterCommand c = ClusterCommand.create("666"); c.addParameters("123", 456, "555", "miao"); c.addDic <string, Vector3>("dicName", DicData); FduClusterCommandDispatcher.SendClusterCommand(c); }
public override bool DoAction(string entityName, ulong index, byte[] data) { //Console.WriteLine($"wow committed {entityName}/{index}; DataLen: {(data == null ? -1 : data.Length)}"); //handle shards operation try { string str = System.Text.Encoding.Default.GetString(data); string json = str; ClusterCommand command = Newtonsoft.Json.JsonConvert.DeserializeObject <ClusterCommand>(json); Console.WriteLine($"command received:{command.Command},{command.Target}"); if (command.Command == "CreateShard") { } } catch (Exception ex) { } return(true); }
//根据集群事件类的实例获取该事件包含的所有参数的格式化显示字符串 string getCommandParameters(ClusterCommand e) { string result = ""; Dictionary <string, object> .Enumerator paras = e.getMapEnumerator(); if (paras.MoveNext()) { result += paras.Current.Key; } while (paras.MoveNext()) { result += "," + paras.Current.Key; } var collparas = e.getCollectionsMapEnumerator(); while (collparas.MoveNext()) { result += "," + collparas.Current.Key; } return(result); }
public static void Main(string[] args) { ClusterCommand.Exec <Option>(args); }
protected override void ParseBody(ByteBuffer buf) { SubCommand = (ClusterCommand)buf.Get(); }