Exemple #1
0
 public static void AddCommandButton(string name, CommandButton cb)
 {
     if (!commandButtons.ContainsKey(name))
         commandButtons.Add(name, cb);
     else
         commandButtons[name] = cb;
 }
Exemple #2
0
 public static bool TryGetCommandButton(string name, out CommandButton cb)
 {
     if (commandButtons.ContainsKey(name))
     {
         cb = commandButtons[name];
         return(true);
     }
     cb = null;
     return(false);
 }
Exemple #3
0
 public static void AddCommandButton(string name, CommandButton cb)
 {
     if (!commandButtons.ContainsKey(name))
     {
         commandButtons.Add(name, cb);
     }
     else
     {
         commandButtons[name] = cb;
     }
 }
Exemple #4
0
 public static bool TryGetCommandButton(string name, out CommandButton cb)
 {
     if (commandButtons.ContainsKey(name))
     {
         cb = commandButtons[name];
         return true;
     }
     cb = null;
     return false;
 }
Exemple #5
0
        public INIParser(Stream stream)
            : base(stream)
        {
            str = (BigStream)stream;
            //Console.WriteLine(str.Name);
            long filesize = str.Length;
            while (str.Position < filesize)
            {
                ParseLine();
                string s = getString();
                string name;
                switch (s)
                {
                    case "#include":
                        includeFile(getString());
                        break;
                    case "#define":
                        macros.Add(getString().ToUpper(), getStrings());
                        break;

                    case "Armor":
                        Armor ar = new Armor();
                        name = getString();
                        ParseObject(ar);
                        INIManager.AddArmor(name, ar);
                        break;
                    case "AmbientStream":
                        AmbientStream ast = new AmbientStream();
                        name = getString();
                        ParseObject(ast);
                        INIManager.AddAmbientStream(name, ast);
                        break;
                    case "AudioEvent":
                        AudioEvent e = new AudioEvent();
                        name = getString();
                        ParseObject(e);
                        INIManager.AddAudioEvent(name, e);
                        break;
                    case "CommandButton":
                        CommandButton cb = new CommandButton();
                        name = getString();
                        ParseObject(cb);
                        INIManager.AddCommandButton(name, cb);
                        break;
                    case "DialogEvent":
                        DialogEvent de = new DialogEvent();
                        name = getString();
                        ParseObject(de);
                        INIManager.AddDialogEvent(name, de);
                        break;
                    case "FXList":
                        FXList fl = new FXList();
                        name = getString();
                        ParseObject(fl);
                        INIManager.AddFXList(name, fl);
                        break;
                    case "GameData":
                        GameData data = new GameData();
                        ParseObject(data);
                        INIManager.SetGameData(data);
                        break;
                    case "LoadSubsystem":
                        LoadSubsystem ls = new LoadSubsystem();
                        name = getString();
                        ParseObject(ls);
                        ls.LoadFiles();
                        break;
                    case "MappedImage":
                        MappedImage mi = new MappedImage();
                        name = getString();
                        ParseObject(mi);
                        INIManager.AddMappedImage(name, mi);
                        break;
                    case "ModifierList":
                        ModifierList ml = new ModifierList();
                        name = getString();
                        ParseObject(ml);
                        INIManager.AddModifierList(name, ml);
                        break;
                    case "Multisound":
                        Multisound ms = new Multisound();
                        name = getString();
                        ParseObject(ms);
                        INIManager.AddMultisound(name, ms);
                        break;
                    case "MusicTrack":
                        MusicTrack mt = new MusicTrack();
                        name = getString();
                        ParseObject(mt);
                        INIManager.AddMusicTrack(name, mt);
                        break;
                    case "Object":
                        INI.Object o = new INI.Object();
                        name = getString();
                        ParseObject(o);
                        INIManager.AddObject(name, o);
                        break;
                    case "Science":
                        Science sc = new Science();
                        name = getString();
                        ParseObject(sc);
                        INIManager.AddScience(name, sc);
                        break;
                    case "StreamedSound":
                        StreamedSound ss = new StreamedSound();
                        name = getString();
                        ParseObject(ss);
                        INIManager.AddStreamedSound(name, ss);
                        break;
                    case "Upgrade":
                        Upgrade u = new Upgrade();
                        name = getString();
                        ParseObject(u);
                        INIManager.AddUpgrade(name, u);
                        break;
                    case "Weapon":
                        Weapon w = new Weapon();
                        name = getString();
                        ParseObject(w);
                        INIManager.AddWeapon(name, w);
                        break;
                    default:
                        if (!objects.Contains(s))
                        {
                            //PrintError("unhandled entry: " + s);
                            objects.Add(s);
                        }
                        break;
                }
            }
            count++;
        }
Exemple #6
0
        public INIParser(Stream str)
            : base(str)
        {
            long filesize = str.Length;
            while (str.Position < filesize)
            {
                ParseLine();
                string s = getString();
                string name;
                switch (s)
                {
                    case "#include":
                        PrintError("include");
                        break;
                    case "#define":
                        macros.Add(getString().ToUpper(), getStrings());
                        break;

                    case "GameData":
                        //GameData data = new GameData();
                        //ParseObject(data);
                        //INIManager.SetGameData(data);
                        break;
                    case "Object":
                        //INI.Object.Parse(this, getString());
                        break;
                    case "MappedImage":
                        //MappedImage.Parse(this, getString());
                        break;
                    case "Upgrade":
                        //Upgrade.Parse(this, getString());
                        break;
                    case "Weapon":
                        //Weapon.Parse(this, getString());
                        break;
                    case "ModifierList":
                        ModifierList ml = new ModifierList();
                        name = getString();
                        ParseObject(ml);
                        INIManager.AddModifierList(name, ml);
                        break;
                    case "Armor":
                        Armor ar = new Armor();
                        name = getString();
                        ParseObject(ar);
                        INIManager.AddArmor(name, ar);
                        break;
                    case "AmbientStream":
                        AmbientStream ast = new AmbientStream();
                        name = getString();
                        ParseObject(ast);
                        INIManager.AddAmbientStream(name, ast);
                        break;
                    case "CommandButton":
                        CommandButton cb = new CommandButton();
                        name = getString();
                        ParseObject(cb);
                        INIManager.AddCommandButton(name, cb);
                        break;
                    default:
                        //PrintError("unhandled entry: " + data[0]);
                        break;
                }
            }
        }