Exemplo n.º 1
0
        public override bool Open()
        {
            var filename = GetNameWithoutExtension();

            if (CheckFileMagic(file, CityAreasMagic))
            {
                CityAreaEditor editor = new CityAreaEditor(file);
                return(true);
            }
            else if (CheckFileMagic(file, CityShopsMagic))
            {
                CityShopEditor editor = new CityShopEditor(file);
                return(true);
            }
            else if (CheckFileMagic(file, ShopMenu2Magic))
            {
                ShopMenu2Editor editor = new ShopMenu2Editor(file);
                return(true);
            }
            else if (CheckFileMagic(file, SDSConfigMagic))
            {
                SdsConfigFile SDSConfigEditor = new SdsConfigFile();
                SDSConfigEditor.ReadFromFile(file);
                return(true);
            }
            else if (CheckFileMagic(file, TapIndicesMagic))
            {
                TAPIndices editor = new TAPIndices();
                editor.ReadFromFile(file);
                return(true);
            }
            else if (CheckFileMagic(file, StreamMapMagic))
            {
                StreamEditor editor = new StreamEditor(file);
                return(true);
            }
            else if (CheckFileMagic(file, CGameMagic))
            {
                CGameData data = new CGameData(file);
                return(true);
            }
            else
            {
                // Unsure on how we should handle this. For now we will just try and hope the loader works.
                SoundSectorLoader loader = new SoundSectorLoader(file);
            }

            return(false);
        }
Exemplo n.º 2
0
 public static void CleanData()
 {
     FrameNameTable   = null;
     FrameResource    = null;
     VertexBufferPool = null;
     IndexBufferPool  = null;
     SoundSector      = null;
     Actors           = null;
     ItemDescs        = null;
     Collisions       = null;
     CityAreas        = null;
     CityShops        = null;
     roadMap          = null;
     ATLoader         = null;
     AIWorlds         = null;
     OBJData          = null;
 }
Exemplo n.º 3
0
        //Improve this, its bad.
        private void HandleFile(ListViewItem item)
        {
            if (ToolkitSettings.UseSDSToolFormat)
            {
                switch (item.SubItems[1].Text)
                {
                case "Directory":
                    OpenDirectory((DirectoryInfo)item.Tag);
                    return;

                case "SDS Archive":
                    OpenSDS((FileInfo)item.Tag);
                    break;

                default:
                    Process.Start(((FileInfo)item.Tag).FullName);
                    break;
                }
                return;
            }

            MaterialTool            mTool;
            CollisionEditor         cTool;
            ActorEditor             aTool;
            PrefabLoader            prefabs;
            SpeechEditor            sTool;
            CutsceneLoader          cutscene;
            IOFxFile                iofx;
            EmitterFile             emitterFile;
            TableEditor             tTool;
            NAVData                 nav;
            ApexRenderMesh          mesh;
            ApexClothingAssetLoader aca;
            CityAreaEditor          caEditor;
            CityShopEditor          csEditor;
            SoundSectorLoader       soundSector;

            //DEBUG
            D3DForm d3dForm;

            //special case:
            if (item.SubItems[0].Text.Contains("SDSContent") && item.SubItems[1].Text == "XML")
            {
                new SDSContentEditor((FileInfo)item.Tag);
                return;
            }
            else if (item.SubItems[0].Text.Contains("cityareas") && item.SubItems[1].Text == "BIN")
            {
                caEditor = new CityAreaEditor((FileInfo)item.Tag);
                return;
            }
            else if (item.SubItems[0].Text.Contains("FrameProps") && item.SubItems[1].Text == "BIN")
            {
                FrameProps fProps = new FrameProps((FileInfo)item.Tag);
                return;
            }
            else if (item.SubItems[0].Text.Contains("cityshop") && item.SubItems[1].Text == "BIN")
            {
                csEditor = new CityShopEditor((FileInfo)item.Tag);
                return;
            }
            else if (item.SubItems[0].Text.Contains("roadmap") && item.SubItems[1].Text == "GSD")
            {
                Roadmap roadmap = new Roadmap((item.Tag as FileInfo));
                return;
            }
            else if (item.SubItems[0].Text.Contains("shopmenu2") && item.SubItems[1].Text == "BIN")
            {
                ShopMenu2Editor editor = new ShopMenu2Editor((item.Tag as FileInfo));
                return;
            }
            else if (item.SubItems[1].Text == "BIN" && HandleStreamMap((item.Tag as FileInfo)))
            {
                StreamEditor editor = new StreamEditor((item.Tag as FileInfo));
                return;
            }
            else if (item.SubItems[1].Text == "BIN" && CGameData.CheckHeader((item.Tag as FileInfo)))
            {
                CGameData data = new CGameData((item.Tag as FileInfo));
                return;
            }
            else if (item.SubItems[0].Text.Contains("sdsconfig") && item.SubItems[1].Text == "BIN")
            {
                using (BinaryReader reader = new BinaryReader(File.Open((item.Tag as FileInfo).FullName, FileMode.Open)))
                {
                    SdsConfigFile sdsConfig = new SdsConfigFile();
                    sdsConfig.ReadFromFile(reader);
                }
                return;
            }

            switch (item.SubItems[1].Text)
            {
            case "ARM":
                mesh = new ApexRenderMesh((FileInfo)item.Tag);
                return;

            case "ATP":
                AnimalTrafficLoader loader = new AnimalTrafficLoader((FileInfo)item.Tag);
                return;

            case "ACA":
                aca = new ApexClothingAssetLoader((FileInfo)item.Tag);
                return;

            case "Directory":
                OpenDirectory((DirectoryInfo)item.Tag);
                return;

            case "Material Library":
                mTool = new MaterialTool((FileInfo)item.Tag);
                return;

            case "NAV":
            case "NOV":
            case "NHV":
                nav = new NAVData((FileInfo)item.Tag);
                return;

            case "Speech Data":
                sTool = new SpeechEditor((FileInfo)item.Tag);
                return;

            case "CUT":
                cutscene = new CutsceneLoader((FileInfo)item.Tag);
                return;

            case "SDS Archive":
                OpenSDS((FileInfo)item.Tag);
                break;

            case "PATCH Archive":
                OpenPATCH((FileInfo)item.Tag);
                break;

            case "FR":
                //fTool = new FrameResourceTool((FileInfo)item.Tag);
                d3dForm = new D3DForm((FileInfo)item.Tag);
                d3dForm.Dispose();
                return;

            case "COL":
                cTool = new CollisionEditor((FileInfo)item.Tag);
                return;

            case "IOFX":
                iofx = new IOFxFile((FileInfo)item.Tag);
                return;

            case "AEA":
                emitterFile = new EmitterFile((FileInfo)item.Tag);
                return;

            case "Table":
                tTool = new TableEditor((FileInfo)item.Tag);
                return;

            case "TRA":
                TranslokatorEditor editor = new TranslokatorEditor((FileInfo)item.Tag);
                return;

            case "ACT":
                aTool = new ActorEditor((FileInfo)item.Tag);
                break;

            case "PRF":
                prefabs = new PrefabLoader((FileInfo)item.Tag);
                return;

            case "LUA":
            case "AP":
            case "SHP":
                HandleLuaFile((FileInfo)item.Tag);
                return;

            case "IFL":
                ResourceTypes.AnimatedTexture.AnimatedTextureLoader an = new ResourceTypes.AnimatedTexture.AnimatedTextureLoader((FileInfo)item.Tag);
                return;

            case "IDS":
                ResourceTypes.ItemDesc.ItemDescLoader itemDesc = new ResourceTypes.ItemDesc.ItemDescLoader((item.Tag as FileInfo).FullName);
                return;

            case "BIN":
                SoundSectorLoader sLoader = new SoundSectorLoader(item.Tag as FileInfo);
                return;

            default:
                Process.Start(((FileInfo)item.Tag).FullName);
                break;
            }
        }