private CompletionItem GetSuffixCompletionItem(string name, ISuffix suffix) { var type = suffix.GetType(); var detail = ""; try { var infoGetter = typeof(SuffixBase).GetMethod( "DelegateInfo", BindingFlags.NonPublic | BindingFlags.Instance); var info = (DelegateInfo)infoGetter.Invoke(suffix, null); if (info != null) { detail += "( "; foreach (var arg in info.Parameters) { detail += arg.ParameterType.Name + " "; } detail += ") -> " + info.ReturnType.Name; } } catch (TargetInvocationException) { detail = type.GenericTypeArguments?[0].Name; } return(new CompletionItem() { Label = name, Detail = detail, Documentation = suffix.Description }); }
public bool Set(ISuffix <IStatus> t) { var statusModifierCore = new StatusModifierCore { type = t.modifier.type, amount = t.modifier.amount }; Data = ZeroFormatterSerializer.Serialize(new FigereCore { statusModifierCore = statusModifierCore, tier = t.tier }); DataType = TypeUtils.TypeToString(t.GetType().GenericTypeArguments.First()); return(true); }
protected void AddSuffix(IEnumerable <string> suffixNames, ISuffix suffixToAdd) { foreach (var suffixName in suffixNames) { if (instanceSuffixes.ContainsKey(suffixName)) { instanceSuffixes[suffixName] = suffixToAdd; } else { instanceSuffixes.Add(suffixName, suffixToAdd); } } }
protected static void AddGlobalSuffix <T>(IEnumerable <string> suffixNames, ISuffix suffixToAdd) { var type = typeof(T); var typeSuffixes = GetStaticSuffixesForType(type); foreach (var suffixName in suffixNames) { if (typeSuffixes.ContainsKey(suffixName)) { typeSuffixes[suffixName] = suffixToAdd; } else { typeSuffixes.Add(suffixName, suffixToAdd); } } globalSuffixes[type] = typeSuffixes; }
protected static void AddGlobalSuffix <T>(string suffixName, ISuffix suffixToAdd) { AddGlobalSuffix <T>(new[] { suffixName }, suffixToAdd); }
protected void AddSuffix(string suffixName, ISuffix suffixToAdd) { AddSuffix(new[] { suffixName }, suffixToAdd); }
public void TestAddInstanceSuffix(string[] name, ISuffix suffix) { AddSuffix(name, suffix); }
public static void TestAddGlobal <T>(string[] name, ISuffix suffix) { AddGlobalSuffix <T>(name, suffix); }