public Command(string name, CommandFunction function) { this.Name = name; this.Function = function; CommandDispatcher.CommandList.Add(this.Name, this); }
public void AddCommand(string Text, CommandFunction F) { Command.TextOnly temp = new Command.TextOnly(Text); temp.OnClick = F; commands.Add(temp); RebuildWindow(); }
public ReplicationCommandType GetReplicationCommandType(System.Data.IDbCommand cmd, CommandFunction fct) { switch (fct) { case CommandFunction.ExecuteNonQuery: return ReplicationCommandType.Write; case CommandFunction.ExecuteScalar: case CommandFunction.ExecuteReader: return ReplicationCommandType.Read; } return ReplicationCommandType.Read; }
void CommandButton(CommandFunction func, string buttonLabel, ref float buttonIndex) { if(GUI.Button(new Rect(margin, buttonEndY + (buttonIndex*(buttonHeight+buttonGap)), buttonWidth, buttonHeight), buttonLabel, HighLogic.Skin.button)) { if(!selectAll) { if(focusIndex < wingmen.Count) { func(wingmen[focusIndex], focusIndex); } } else { for(int i = 0; i < wingmen.Count; i++) { func(wingmen[i], i); } } } buttonIndex++; }
/// <summary> /// Constructor /// </summary> /// <param name="sCmd"></param> /// <param name="sHelp"></param> /// <param name="pFunc"></param> public GameCommand(string sCmd, string sHelp, CommandFunction pFunc) { m_sCommand = sCmd; m_sHelp = sHelp; m_Function = pFunc; }
internal PrtgRequestMessage(ConnectionDetails connectionDetails, CommandFunction function, IParameters parameters) : this(connectionDetails, GetResourcePath(function), parameters) { }
public static void RegisterCommandEx(CommandFunction<CCommand, bool[], bool> action) { CRegistery.RegisterDelegate(action); }
/// <summary> /// Add a command to the debugger with a specific name and help text. /// </summary> /// <param name="name">The name of the method in the debugger.</param> /// <param name="help">The help text to display in the console for the function.</param> /// <param name="function">The method to register.</param> /// <param name="types">The types for the arguments.</param> public void RegisterCommand(string name, string help, CommandFunction function, params CommandType[] types) { if (commands.ContainsKey(name)) return; if (instantCommands.ContainsKey(name)) return; commands.Add(name, new DebugCommand(function, types) { HelpDescription = help, Name = name }); }
void RegisterInstantCommand(string name, string help, CommandFunction function, params CommandType[] types) { instantCommands.Add(name, new DebugCommand(function, types) { HelpDescription = help, Name = name }); }
public static void RegisterCommandEx(string name, CommandFunction <float[]> action) { CRegistery.RegisterDelegate(name, action); }
public static void RegisterCommandEx(CommandFunction <string, string, string, bool> action) { CRegistery.RegisterDelegate(action); }
public Command(CommandFunction func, string descr, int args) { description = descr; function = func; argumentCount = args; }
private async Task AddObjectInternalAsync(int objectId, NewObjectParameters parameters, CommandFunction function) { var lengthLimit = RequestParser.ValidateObjectParameters(parameters); var internalParams = RequestParser.GetInternalNewObjectParameters(objectId, parameters); if (lengthLimit.Count > 0) { await AddObjectWithExcessiveValueAsync(lengthLimit, internalParams, function).ConfigureAwait(false); } else { await requestEngine.ExecuteRequestAsync(function, internalParams).ConfigureAwait(false); } }
internal async Task <List <T> > AddObjectAsync <T>(int parentId, NewObjectParameters parameters, CommandFunction function, Func <SearchFilter[], Task <List <T> > > getObjects, bool resolve, Action <Type, int> errorCallback = null, Func <bool> shouldStop = null, bool allowMultiple = false) where T : SensorOrDeviceOrGroupOrProbe { if (resolve) { var filters = RequestParser.GetFilters(parentId, parameters); Func <Task> addObjectInternal = async() => await AddObjectInternalAsync(parentId, parameters, function).ConfigureAwait(false); Func <Task <List <T> > > getObjs = async() => await getObjects(filters).ConfigureAwait(false); return((await ResolveWithDiffAsync(addObjectInternal, getObjs, ResponseParser.ExceptTableObject, errorCallback, shouldStop, allowMultiple).ConfigureAwait(false)).OrderBy(o => o.Id).ToList()); } else { await AddObjectInternalAsync(parentId, parameters, function).ConfigureAwait(false); return(null); } }
//###################################### // AddObject //###################################### internal List <T> AddObject <T>(int parentId, NewObjectParameters parameters, CommandFunction function, Func <SearchFilter[], List <T> > getObjects, bool resolve, Action <Type, int> errorCallback = null, Func <bool> shouldStop = null, bool allowMultiple = false) where T : SensorOrDeviceOrGroupOrProbe { if (resolve) { var filters = RequestParser.GetFilters(parentId, parameters); Action addObjectInternal = () => AddObjectInternal(parentId, parameters, function); Func <List <T> > getObjs = () => getObjects(filters); return((ResolveWithDiff(addObjectInternal, getObjs, ResponseParser.ExceptTableObject, errorCallback, shouldStop, allowMultiple)).OrderBy(o => o.Id).ToList()); } else { AddObjectInternal(parentId, parameters, function); return(null); } }
private async Task AddObjectWithExcessiveValueAsync(List <KeyValuePair <Parameter, object> > lengthLimit, Parameters.Parameters internalParams, CommandFunction function) { var limitParam = lengthLimit.First(); var limit = limitParam.Key.GetEnumAttribute <LengthLimitAttribute>().Length; if (limitParam.Value is IEnumerable) { var list = ((IEnumerable)limitParam.Value).Cast <object>().ToList(); var count = list.Count(); if (count > limit) { for (int i = 0; i < count; i += limit) { var thisRequest = list.Skip(i).Take(limit); internalParams[limitParam.Key] = thisRequest; await requestEngine.ExecuteRequestAsync(function, internalParams).ConfigureAwait(false); } } else { await requestEngine.ExecuteRequestAsync(function, internalParams).ConfigureAwait(false); } } else { throw new NotImplementedException($"Don't know how to handle {nameof(LengthLimitAttribute)} applied to value of type {limitParam.Value.GetType()}"); } }
CommandType(string nam, CommandFunction fun, int pos, int lvl, LogType logged, bool shown, bool removeinvis, bool removehide, bool removemed, bool usePara, bool mustSpellOut) { Name = nam; Function = fun; MinLevel = lvl; LoggingType = logged; Show = shown; BreakInvisibility = removeinvis; BreakHide = removehide; BreakMeditate = removemed; MinPosition = pos; CanUseWhenParalyzed = usePara; MustSpellOut = mustSpellOut; }
public void RegisterInstantCommand(CommandFunction function, params CommandType[] types) { RegisterInstantCommand(function, types); }
public PrtgUrl(ConnectionDetails connectionDetails, CommandFunction function, IParameters parameters) : this(connectionDetails, GetResourcePath(function), parameters) { }
private PrtgUrl GetPrtgUrl(CommandFunction function, IParameters parameters) => new PrtgUrl(prtgClient.connectionDetails, function, parameters);
public static void RegisterCommandEx(CommandFunction <CCommand, bool[], bool> action) { CRegistery.RegisterDelegate(action); }
public CommandFunctionParameters(CommandFunction function) { Function = function; }
public static void RegisterCommandEx(string name, CommandFunction <CCommand, bool, bool, bool, bool> action) { CRegistery.RegisterDelegate(name, action); }
internal List <T> AddAndResolveObject <T>(int destinationId, NewObjectParameters parameters, CommandFunction function, Func <SearchFilter[], List <T> > getObjects) where T : SensorOrDeviceOrGroupOrProbe { return(AddAndResolveRunner( () => client.AddObject( destinationId, parameters, function, getObjects, true, DisplayResolutionError, ShouldStop, typeof(T) == typeof(Sensor) ) )); }
/// <summary> /// Add a command to the debugger with help text. /// </summary> /// <param name="function">The method to register.</param> /// <param name="help">The help text to display in the console for the function.</param> /// <param name="types">The types for the arguments.</param> public void RegisterCommand(CommandFunction function, string help, params CommandType[] types) { RegisterCommand(function.Method.Name.ToLower(), help, function, types); }
public static void RegisterCommandEx(string name, CommandFunction<CCommand, int[], bool> action) { CRegistery.RegisterDelegate(name, action); }
public static void RegisterCommandEx(CommandFunction<string, string, string, bool> action) { CRegistery.RegisterDelegate(action); }
void CommandButton(CommandFunction func, string buttonLabel, ref float buttonLine, float startY, float margin, float buttonGap, float buttonWidth, float buttonHeight, bool sendToWingmen, bool pressed, object data) { float yPos = startY + margin + ((buttonHeight + buttonGap) * buttonLine); if(GUI.Button(new Rect(margin, yPos, buttonWidth, buttonHeight), buttonLabel, pressed ? HighLogic.Skin.box : HighLogic.Skin.button)) { if(sendToWingmen) { if(wingmen.Count > 0) { foreach(var index in focusIndexes) { func(wingmen[index], index, data); } } if(commandSelf) { foreach(var ai in vessel.FindPartModulesImplementing<BDModulePilotAI>()) { func(ai, -1, data); } } } else { func(null, -1, null); } } buttonLine++; }
public static void RegisterCommandEx(string name, CommandFunction<float[]> action) { CRegistery.RegisterDelegate(name, action); }
void CommandButton(CommandFunction func, string buttonLabel, ref float buttonLine, bool sendToWingmen, bool pressed, object data = null) { CommandButton(func, buttonLabel, ref buttonLine, buttonEndY, margin, buttonGap, buttonWidth, buttonHeight, sendToWingmen, pressed, data); }
private bool WrapCommandFunction(Command command, CommandFunction function, bool doing) { try { m_currentCommnd = command; return function(doing); } finally { m_currentCommnd = Command.Invalid; } }
public PrtgUrl(string server, string username, string passhash, CommandFunction function, Parameters.Parameters parameters) : this(server, username, passhash, GetResourcePath(function), parameters) { }