Ejemplo n.º 1
0
        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
            });
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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);
         }
     }
 }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
 protected static void AddGlobalSuffix <T>(string suffixName, ISuffix suffixToAdd)
 {
     AddGlobalSuffix <T>(new[] { suffixName }, suffixToAdd);
 }
Ejemplo n.º 6
0
 protected void AddSuffix(string suffixName, ISuffix suffixToAdd)
 {
     AddSuffix(new[] { suffixName }, suffixToAdd);
 }
Ejemplo n.º 7
0
 public void TestAddInstanceSuffix(string[] name, ISuffix suffix)
 {
     AddSuffix(name, suffix);
 }
Ejemplo n.º 8
0
 public static void TestAddGlobal <T>(string[] name, ISuffix suffix)
 {
     AddGlobalSuffix <T>(name, suffix);
 }