Example #1
0
 public static void AddAmbientStream(string name, AmbientStream ast)
 {
     if (!ambientStreams.ContainsKey(name))
         ambientStreams.Add(name, ast);
     else
         ambientStreams[name] = ast;
 }
Example #2
0
 public static bool TryGetAmbientStream(string name, out AmbientStream ast)
 {
     if (ambientStreams.ContainsKey(name))
     {
         ast = ambientStreams[name];
         return(true);
     }
     ast = null;
     return(false);
 }
Example #3
0
 public static void AddAmbientStream(string name, AmbientStream ast)
 {
     if (!ambientStreams.ContainsKey(name))
     {
         ambientStreams.Add(name, ast);
     }
     else
     {
         ambientStreams[name] = ast;
     }
 }
Example #4
0
 public static bool TryGetAmbientStream(string name, out AmbientStream ast)
 {
     if (ambientStreams.ContainsKey(name))
     {
         ast = ambientStreams[name];
         return true;
     }
     ast = null;
     return false;
 }
Example #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++;
        }
Example #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;
                }
            }
        }