コード例 #1
0
ファイル: HudElement.cs プロジェクト: rurre/TF2HudToolbox
 public void Add(SubElement se)
 {
     m_SubList.Add(se);            
 }
コード例 #2
0
ファイル: HudParse.cs プロジェクト: rurre/TF2HudToolbox
        //Currently uses almost the same code as ParseHudElement. 
        //TODO: Derive SubElement from HudElement and share code.
        //TODO: Check if it's a .res file before parsing and return null if it's not as a flag to copy the file over when installing.
        //TODO: Set folder check to Hud's path + folder name, or whatever, so it ignores the parsing ONLY if we're in the root hud folder.
        static SubElement ParseSubElement(ref string s)
        {
            SubElement sb = new SubElement();

            string ss = s;

            ss = RefLib.GetLine(ref ss);
            sb.Name = ss;
            ss = s;
            ss = RefLib.GetLine(ref ss);
            int toRemove = 0;

            for(int i = 0; i < ss.Length; i++)
            {
                if(ss[i] == '\"')
                    toRemove++;
            }
            s = s.Remove(0,ss.Length + toRemove);
            RefLib.Seek(ref s);
            if(s.First() == '{')
            {
                s = s.Remove(0,1);
                while(true)
                {
                    RefLib.Seek(ref s);
                    SubElement ssb = new SubElement();
                    ss = s;
                    ss = RefLib.GetLines(2,ref ss);
                    if(ss.IndexOf('{') != -1)
                    {
                        ssb = ParseSubElement(ref s);
                        if(!ssb.IsNull)
                        {
                            sb.Add(ssb);
                            s = s.Remove(0,s.IndexOf('}') + 1);
                            continue;
                        }
                    }

                    RefLib.Seek(ref s);
                    KeyValue kv = new KeyValue();
                    if(s.First() != '}')
                    {
                        ss = GetKeyValuePair(s);
                        s = s.Remove(0,ss.Length);
                        kv = ParseKeyValue(ss);
                    }                    
                    if(!kv.IsNull)
                        sb.Add(kv);
                    else break; 
                }
            }
            return sb;
        }
コード例 #3
0
 public void Add(SubElement sb)
 {
     m_SubList.Add(sb);
 }