Ejemplo n.º 1
0
        private static Type GetTypeFromStr(Dictionary <string, TokenDeclSDType> sdTypes, string s)
        {
            Type t;

            // internal fixed types like int and xmrarray etc
            if (string2Type.TryGetValue(s, out t))
            {
                return(t);
            }

            // script-defined types
            if (s.StartsWith("sdt$"))
            {
                return(sdTypes[s.Substring(4)].GetSysType());
            }

            // inline function types
            t = TokenDeclSDTypeDelegate.TryGetInlineSysType(s);
            if (t != null)
            {
                return(t);
            }

            // last resort
            return(Type.GetType(s, true));
        }
Ejemplo n.º 2
0
        private string GetStrFromTypeWork(Type t)
        {
            string s;

            // internal fixed types like int and xmrarray etc
            if (type2String.TryGetValue(t, out s))
            {
                return(s);
            }

            // script-defined types
            if (sdTypesRev.TryGetValue(t, out s))
            {
                return("sdt$" + s);
            }

            // inline function types
            s = TokenDeclSDTypeDelegate.TryGetInlineName(t);
            if (s != null)
            {
                return(s);
            }

            // last resort
            return(t.AssemblyQualifiedName);
        }