private void CompileFilesTable()
        {
            DataDumper.FilesTable.Clear();
            for (int i = 0; i < 2; i++)
            {
                TreeNode tn   = treeView2.Nodes[i];
                string   path = "";

                for (int j = 0; j < 9; j++)
                {
                    TreeNode tn_sub = tn.Nodes[j];
                    foreach (TreeNode tn_sub_child in tn_sub.Nodes)
                    {
                        if (tn.Text == "Squads")
                        {
                            path = DataPath.GetPath(DataPath.GetCategoryPath(tn_sub_child.Text, DataDumper.GetInfoType(tn.Text), tn_sub.Text));
                        }
                        else
                        if (tn.Text == "Buildings")
                        {
                            path = DataPath.GetPath(DataPath.GetCategoryPath(tn_sub_child.Text, DataDumper.GetInfoType(tn.Text), tn_sub.Text));
                        }
                        DataDumper.FilesTable.Add(tn_sub_child.Text, new LuaInfo(path, DataDumper.GetInfoType(tn.Text), tn_sub.Text));
                    }
                }
            }
        }
예제 #2
0
        // Load File Index from previous saved index
        public static bool LoadFilesList()
        {
            FilesTable = new Hashtable();

            string file = Path.Combine(Directory.GetCurrentDirectory(), "Config/FilesIndex.def");

            if (File.Exists(file))
            {
                StreamReader reader = new StreamReader(File.OpenRead(file));
                while (reader.Peek() > -1)
                {
                    string line = reader.ReadLine();

                    Match m = Regex.Match(line, @"<(?<type>.*)\>\s\<(?<race>.*)\>\s\<(?<file>.*)\>");
                    if (m.Success)
                    {
                        Group typeGr = m.Groups["type"];
                        Group raceGr = m.Groups["race"];
                        Group fileGr = m.Groups["file"];

                        string lua = fileGr.Value;

                        InfoTypes infoType = GetInfoType(typeGr.Value);
                        if (!FilesTable.Contains(lua))
                        {
                            try
                            {
                                string path = DataPath.GetPath(DataPath.GetCategoryPath(lua, infoType, raceGr.Value));
                                FilesTable.Add(/*Regex.Replace(file, @"^.*\\", "")*/ lua, new LuaInfo(path, infoType, raceGr.Value));
                            }
                            catch (Exception e)
                            {
                            }
                        }
                    }
                }
                reader.Close();
                return(true);
            }
            return(false);
        }