Ejemplo n.º 1
0
        public bool LoadFromString(string content, string resourceName)
        {
#if UNITY_EDITOR
            Parser.DslToken      tokens = new Parser.DslToken(content);
            Parser.DslError      error  = new Parser.DslError(tokens);
            Parser.RuntimeAction action = new Parser.RuntimeAction(mScriptableDatas);
            action.onGetLastToken      = () => { return(tokens.getLastToken()); };
            action.onGetLastLineNumber = () => { return(tokens.getLastLineNumber()); };
            Parser.DslParser.parse(action, tokens, error, 0);
            if (error.HasError)
            {
                foreach (ScriptableDataInfo data in mScriptableDatas)
                {
                    data.Clear();
                }
            }
            else
            {
                foreach (ScriptableDataInfo data in mScriptableDatas)
                {
                    data.SetResourceName(resourceName);
                }
            }
            return(!error.HasError);
#else
            return(false);
#endif
        }
Ejemplo n.º 2
0
        public string GenerateObfuscatedCode(string content, Dictionary <string, string> encodeTable)
        {
#if FULL_VERSION
            Parser.DslToken          tokens = new Parser.DslToken(content);
            Parser.DslError          error  = new Parser.DslError(tokens);
            Parser.ObfuscationAction action = new Parser.ObfuscationAction();
            action.onGetLastToken = () => { return(tokens.getLastToken()); };
            action.onEncodeString = s => Encode(s, encodeTable);
            Parser.DslParser.parse(action, tokens, error, 0);
            if (error.HasError)
            {
                return("");
            }
            else
            {
                return(action.getObfuscatedCode());
            }
#else
            return("");
#endif
        }
Ejemplo n.º 3
0
        public bool LoadFromString(string content, string resourceName)
        {
#if FULL_VERSION
            Parser.DslToken      tokens = new Parser.DslToken(content);
            Parser.DslError      error  = new Parser.DslError(tokens);
            Parser.RuntimeAction action = new Parser.RuntimeAction(mScriptableDatas);
            action.onGetLastToken      = () => { return(tokens.getLastToken()); };
            action.onGetLastLineNumber = () => { return(tokens.getLastLineNumber()); };
            Parser.DslParser.parse(action, tokens, error, 0);
            if (error.HasError)
            {
                for (int i = 0; i < mScriptableDatas.Count; i++)
                {
                    mScriptableDatas[i].Clear();
                }

                /*
                 *    foreach(ScriptableDataInfo data in mScriptableDatas) {
                 *        data.Clear();
                 *    }*/
            }
            else
            {
                for (int i = 0; i < mScriptableDatas.Count; i++)
                {
                    mScriptableDatas[i].SetResourceName(resourceName);
                }

                /*
                 * foreach (ScriptableDataInfo data in mScriptableDatas) {
                 *        data.SetResourceName(resourceName);
                 *    }*/
            }
            return(!error.HasError);
#else
            return(false);
#endif
        }
Ejemplo n.º 4
0
 internal DslError(DslToken tokens)
 {
     this.tokens = tokens;
 }