Esempio n. 1
0
            public ValuePatch _Create()
            {
                ValuePatch mv = new ValuePatch();

                mNexts.Add(mv);
                return(mv);
            }
Esempio n. 2
0
        public void Set(string key, FileMould value)
        {
            ValuePatch mv = new ValuePatch();

            mv.Set(key, value);
            mValuePatchs[key] = mv;
        }
Esempio n. 3
0
        public ValuePatch CreateSet(string key)
        {
            ValuePatch mv = null;

            if (!mValuePatchs.TryGetValue(key, out mv))
            {
                mv = new ValuePatch();
                mValuePatchs[key] = mv;
            }
            return(mv._Create());
        }
Esempio n. 4
0
        protected void _Build(MouldPatch patch, StringBuilder builder, List <ValuePatch> valPatch)
        {
            for (int i = 0; i < patch.datas.Count; i++)
            {
                var data = patch.datas[i];
                if (data.type == MouldPatch.PatchType.PT_DEFINE)
                {
                    string[] tempStrs = data.strValue.Split('/');
                    if (tempStrs[0] == "0")
                    {
                        bool res = false;
                        if (!mDefines.TryGetValue(tempStrs[1], out res))
                        {
                            res = false;
                        }
                        mValueDataEditor.SetDef(res == bool.Parse(tempStrs[2]));
                    }
                    else if (tempStrs[0] == "1")
                    {
                        mValueDataEditor.SetElseDef();
                    }
                    else
                    {
                        mValueDataEditor.SetEnd();
                    }
                }
                if (!mValueDataEditor.IsCanWrite())
                {
                    continue;
                }
                if (data.type == MouldPatch.PatchType.PT_LineHead)
                {
                    builder.Append(mValueDataEditor.mSpace);
                }
                else if (data.type == MouldPatch.PatchType.PT_Space)
                {
                    string[] temps = data.strValue.Split('/');
                    mValueDataEditor._Space(int.Parse(temps[0]), bool.Parse(temps[1]));
                }
                else if (data.type == MouldPatch.PatchType.PT_Back)
                {
                    builder.Length -= int.Parse(data.strValue);
                }
                else if (data.type == MouldPatch.PatchType.PT_Value)
                {
                    builder.Append(data.strValue);
                }
                else if (data.type == MouldPatch.PatchType.PT_Analy)
                {
                    ValuePatch.VData vData = null;
                    if (valPatch != null)
                    {
                        for (int v = 0; v < valPatch.Count; v++)
                        {
                            if (valPatch[v].mDataValues.TryGetValue(data.strValue, out vData))
                            {
                                break;
                            }
                        }
                    }
                    if (vData == null)
                    {
                        ValuePatch vp = null;
                        if (mValuePatchs.TryGetValue(data.strValue, out vp))
                        {
                            vp.mDataValues.TryGetValue(data.strValue, out vData);
                        }
                    }

                    if (vData != null)
                    {
                        if (vData.mFileTool != null)
                        {
                            //子模块编译
                            var tool = vData.mFileTool.GetTool();
                            tool.mIsNextLine = false;
                            tool.mValueDataEditor._Space(mValueDataEditor.mSpace.Length);
                            vData.mFileTool.Init();
                            tool._Build(tool.GetHead(), builder, valPatch);
                            builder.Length--;
                        }
                        else
                        {
                            builder.Append(vData.value);
                        }
                    }
                    else
                    {
                        builder.Append("[" + data.strValue + "]");
                    }
                }
                else if (data.type == MouldPatch.PatchType.PT_For)
                {
                    ValuePatch vp = null;
                    if (mValuePatchs.TryGetValue(data.strValue, out vp))
                    {
                        for (int v = 0; v < vp.mNexts.Count; v++)
                        {
                            ValuePatch        vPatch     = vp.mNexts[v];
                            List <ValuePatch> vPatchList = new List <ValuePatch>();
                            vPatchList.Add(vPatch);
                            if (valPatch != null)
                            {
                                vPatchList.AddRange(valPatch);
                            }
                            _Build(data.patchValue, builder, vPatchList);
                        }
                    }
                }
            }
        }