public void SetCommandInArg(string targetCommandId, string argIndex, string commandId, string customeArg) { try { //initial data var data = string.Empty; //get command func Func <RecordModel> func = () => { var record = RecordQueries.GetRecord(Int32.Parse(commandId)); return(new RecordModel() { Id = record.Key, args = record.Value.args, MethodName = record.Value.method.Name, Once = false, ModelInstanceName = record.Value.modelInstance.ToString(), ReturnedName = record.Value.method.Name + '-' + record.Key }); }; //validation var result = commandId == "" ? data = customeArg : data = JsonConvert.SerializeObject(func()); //get target var targetCommand = RecordQueries.GetRecord(Int32.Parse(targetCommandId)); targetCommand.Value.args[Int32.Parse(argIndex)] = data; //update arg System.Console.WriteLine(); } catch (Exception e) { CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER); } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="position"></param> /// <param name="value"></param> public void RecordDynamicize(string key, string position, string value) { try { var record = RecordQueries.GetRecord(Int32.Parse(key)); record.Value.args[Int32.Parse(position)] = value; } catch (Exception e) { CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER); } }