Esempio n. 1
0
        public void Reload()
        {
            comboBox1.Items.Clear();
            Add(original);
            comboBox1.SelectedItem = original;

            DirectoryInfo bonus = new DirectoryInfo("Bonus");
            if (!bonus.Exists) bonus.Create();

            var found = new List<string>();
            DirectoryInfo[] dirs = bonus.GetDirectories();
            foreach (DirectoryInfo dir in dirs) {
                if (dir.Name != "temp") {
                    LevelPack pack = new DirectoryPack(dir);
                    Add(pack);
                    found.Add(dir.Name);
                }
            }
            FileInfo[] files = bonus.GetFiles();
            foreach (FileInfo file in files) {
                if (!found.Contains(file.Name.Substring(0, file.Name.Length - 4))) {
                    LevelPack pack = new ArchivePack(file);
                    Add(pack);
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            bool mutexWasCreated;
            mut = new Mutex(true, "T Starter 3", out mutexWasCreated);
            if (!mutexWasCreated) return;

            if (args.Length > 0) {
                try {
                    var pack = new DirectoryPack(new DirectoryInfo("Bonus\\" + args[0]));
                    var process = pack.Load();
                    process.WaitForExit();
                }
                catch (Exception) { }
                CleanUp();
                return;
            }

            try {
                XmlDocument doc = new XmlDocument();
                doc.Load("T2002Levels.xml");
                OnlineLevels.levels.Clear();
                var nodes = doc.GetElementsByTagName("Level");
                foreach (XmlNode node in nodes) {
                    string levelname = node.Attributes.GetNamedItem("name").Value;

                    OnlineLevel level = new OnlineLevel();
                    level.name = levelname;
                    level.author = node.Attributes.GetNamedItem("author").Value;
                    level.date = node.Attributes.GetNamedItem("date").Value;
                    OnlineLevels.levels.Add(level);
                }
            }
            catch (Exception) {

            }

            Application.EnableVisualStyles();
            Application.Run(Instance = new Form1());
        }