Beispiel #1
0
        void LoadScriptLang02()
        {
            string[] allLines = File.ReadAllLines("script_lang02.txt");
            _scriptLangGroup2 = new List <ScriptLangGroup>();
            ScriptLangGroup currentGroup = new ScriptLangGroup();

            _scriptLangGroup2.Add(currentGroup);
            currentGroup.GroupName = allLines[0].Substring(1);
            for (int i = 2; i < allLines.Length; ++i) //start at2
            {
                string[] cells = allLines[i].Split('\t');
                //USE= universal shaping engine
                currentGroup.Pairs.Add(new ScriptAndLangPair()
                {
                    ScriptTag          = GetFormatedTagName(cells[1]),//1
                    ScriptName         = cells[0].Trim(),
                    LanguageSystemTag  = "USE",
                    LanguageSystemName = "USE",
                });
            }
        }
Beispiel #2
0
        void LoadScriptLang01()
        {
            //parse script_lang01.txt
            string[] allLines = File.ReadAllLines("script_lang01.txt");
            _scriptLangGroup1 = new List <ScriptLangGroup>();
            ScriptLangGroup currentGroup = null;

            for (int i = 0; i < allLines.Length; ++i)
            {
                string line = allLines[i];
                if (line.StartsWith("#"))
                {
                    //new section with url link
                    currentGroup     = new ScriptLangGroup();
                    currentGroup.Url = line.Substring(1).Trim();
                    _scriptLangGroup1.Add(currentGroup);

                    //read next 2 line
                    string[] cells_next1 = allLines[i + 1].Split('\t');
                    string[] cells_next2 = allLines[i + 2].Split('\t');
                    if (cells_next1.Length == 4 && cells_next2.Length == 4)
                    {
                        if (cells_next2[0].ToLower().Trim() == "script tag")
                        {
                            //ensure
                        }
                        else
                        {
                            throw new NotSupportedException();
                        }
                    }
                    else
                    {
                        throw new NotSupportedException();
                    }
                    i += 3;
                }
                else if (line.StartsWith("\""))
                {
                    string[] cells = line.Split('\t');

                    var pair = new ScriptAndLangPair()
                    {
                        ScriptTag          = GetFormatedTagName(cells[0]),
                        ScriptName         = cells[1].Trim(),
                        LanguageSystemTag  = GetFormatedTagName(cells[2]),
                        LanguageSystemName = cells[3].Trim()
                    };

                    if (!pair.LanguageSystemTag.StartsWith("("))
                    {
                        currentGroup.Pairs.Add(pair);
                    }
                }
                else
                {
                    //
                    //blank line or title
                    string line2 = line.ToLower().Trim();
                    if (line2.Length != 0)
                    {
                        throw new NotSupportedException();
                    }
                    //string[] cells = line2.Split('\t');
                    //ensure all blank line
                }
            }

            //-------
        }