Exemplo n.º 1
0
        private void export_Click(object sender, EventArgs e)
        {
            if (this.chunks.Count == 0)
            {
                return;
            }
            // first, open and create directory
            var folderBrowserDialog1 = new FolderBrowserDialog();

            folderBrowserDialog1.SelectedPath = Settings.Default.LastDirectory;
            folderBrowserDialog1.Description  = "Select directory to export to";
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                Settings.Default.LastDirectory = folderBrowserDialog1.SelectedPath;
            }
            else
            {
                return;
            }
            string fullPath = folderBrowserDialog1.SelectedPath + "\\";
            var    fi       = new FileInfo(fullPath);
            var    di       = new DirectoryInfo(fi.DirectoryName);

            if (!di.Exists)
            {
                di.Create();
            }
            foreach (var chunk in chunks)
            {
                Do.Export(chunk, null, fullPath + chunk.Name + ".dat");
            }
        }
        private void templateExport_Click(object sender, EventArgs e)
        {
            if (this.templates.Count == 0)
            {
                return;
            }
            // first, open and create directory
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

            folderBrowserDialog1.SelectedPath = Settings.Default.LastDirectory;
            folderBrowserDialog1.Description  = "Select directory to export to";
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                Settings.Default.LastDirectory = folderBrowserDialog1.SelectedPath;
            }
            else
            {
                return;
            }
            string        fullPath = folderBrowserDialog1.SelectedPath + "\\";
            FileInfo      fi       = new FileInfo(fullPath);
            DirectoryInfo di       = new DirectoryInfo(fi.DirectoryName);

            if (!di.Exists)
            {
                di.Create();
            }
            foreach (LevelTemplate lt in templates)
            {
                Do.Export(lt, null, fullPath + lt.Name + ".dat");
            }
        }
Exemplo n.º 3
0
        public static void ExportAreas(string fullPath)
        {
            // create the serialized level
            var sLevels = new Serialized[510];

            for (int i = 0; i < sLevels.Length; i++)
            {
                sLevels[i]          = new Serialized();
                sLevels[i].Layering = Areas[i].Layering;
                sLevels[i].MapNum   = Areas[i].Map;
                var map = Maps[Areas[i].Map];
                sLevels[i].Map          = map;// Add it to serialized level data object
                sLevels[i].TilesetL1    = Tilesets[map.TilesetL1 + 0x20];
                sLevels[i].TilesetL2    = Tilesets[map.TilesetL2 + 0x20];
                sLevels[i].TilesetL3    = Tilesets[map.TilesetL3];
                sLevels[i].TilemapL1    = Tilemaps[map.TilemapL1 + 0x40];
                sLevels[i].TilemapL2    = Tilemaps[map.TilemapL2 + 0x40];
                sLevels[i].TilemapL3    = Tilemaps[map.TilemapL3];
                sLevels[i].CollisionMap = CollisionMaps[map.CollisionMap];
                sLevels[i].NPCs         = Areas[i].NPCObjects;
                sLevels[i].Exits        = Areas[i].ExitTriggers;
                sLevels[i].Events       = Areas[i].EventTriggers;
                sLevels[i].Overlaps     = Areas[i].Overlaps;
            }
            // finally export the serialized levels
            Do.Export(sLevels,
                      fullPath + "\\" + LazyShell.Model.GetFileNameWithoutPath() + " - Areas\\" + "area", "AREA", true);
        }
Exemplo n.º 4
0
        // IO elements
        public static void ExportBattlefield(int index, string fullPath)
        {
            var battlefield = battlefields[index];
            var serialized  = new Serialized(Tilesets[battlefield.Tileset],
                                             paletteSets[battlefield.PaletteSet], battlefield);

            Do.Export(serialized, null, fullPath);
        }
Exemplo n.º 5
0
        // ToolStrip
        private void saveImage_Click(object sender, EventArgs e)
        {
            var image    = new Bitmap(256, 256);
            var graphics = Graphics.FromImage(image);

            DrawFormation(graphics);
            Do.Export(image, "formation-" + Index + ".png");
        }
Exemplo n.º 6
0
 public static void ExportBRRSamples(string fullPath)
 {
     byte[][] samples = new byte[BRRSamples.Length][];
     for (int i = 0; i < brrSamples.Length; i++)
     {
         samples[i] = brrSamples[i].Sample;
     }
     Do.Export(samples,
               fullPath + "\\" + LazyShell.Model.GetFileNameWithoutPath() + " - BRR Samples\\" + "brr-sample",
               "BRR SAMPLE", true);
 }
Exemplo n.º 7
0
        public static void ExportWAVSamples(string fullPath, int rate)
        {
            byte[][] samples = new byte[BRRSamples.Length][];
            int      i       = 0;

            foreach (var brr in BRRSamples)
            {
                samples[i++] = BRR.BRRToWAV(brr.Sample, rate);
            }
            Do.Export(samples,
                      fullPath + "\\" + LazyShell.Model.GetFileNameWithoutPath() + " - WAV Samples\\" + "wav-sample",
                      "SAMPLE", true);
        }
Exemplo n.º 8
0
 // functions
 private void Export_Architecture()
 {
     byte[] array = new byte[0x80000];
     ExportPalette(array, 0);
     ExportGraphics(array, 0x200);
     ExportTileset(array, 0, 0x10200);
     ExportTileset(array, 1, 0x11200);
     ExportTileset(array, 2, 0x12200);
     ExportTilemap(array, 0, 0x13200);
     ExportTilemap(array, 1, 0x33200);
     ExportTilemap(array, 2, 0x53200);
     ExportPriority(array, 0x73200);
     Do.Export(array, "", fullPath);
 }
Exemplo n.º 9
0
        public static void ExportBattlefields(string fullPath)
        {
            var battlefields = Battlefields;
            var serialized   = new Serialized[battlefields.Length];

            PaletteSet[] paletteSets = PaletteSets;
            for (int i = 0; i < battlefields.Length; i++)
            {
                serialized[i] = new Serialized(Tilesets[battlefields[i].Tileset],
                                               paletteSets[battlefields[i++].PaletteSet], battlefields[i]);
            }
            Do.Export(serialized,
                      fullPath + "\\" + LazyShell.Model.GetFileNameWithoutPath() + " - Battlefields\\" + "battlefield",
                      "BATTLEFIELD", true);
        }
Exemplo n.º 10
0
        private void saveImageAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (FontType)
            {
            case FontType.Menu: Do.Export(fontTableImage, "fontTableMenu.png"); break;

            case FontType.Dialogue: Do.Export(fontTableImage, "fontTableDialogue.png"); break;

            case FontType.Description: Do.Export(fontTableImage, "fontTableDescription.png"); break;

            case FontType.Triangles: Do.Export(fontTableImage, "fontTableTriangles.png"); break;

            case FontType.BattleMenu: Do.Export(fontTableImage, "fontTableBattleMenu.png"); break;
            }
        }
Exemplo n.º 11
0
        // IO elements
        public static void ExportArea(int index, string fullPath)
        {
            // create the serialized level
            var sLevel = new Serialized();

            sLevel.Layering = Areas[index].Layering;
            sLevel.MapNum   = Areas[index].Map;
            var lMap = Maps[Areas[index].Map];

            sLevel.Map          = lMap;// Add it to serialized level data object
            sLevel.TilesetL1    = Tilesets[lMap.TilesetL1 + 0x20];
            sLevel.TilesetL2    = Tilesets[lMap.TilesetL2 + 0x20];
            sLevel.TilesetL3    = Tilesets[lMap.TilesetL3];
            sLevel.TilemapL1    = Tilemaps[lMap.TilemapL1 + 0x40];
            sLevel.TilemapL2    = Tilemaps[lMap.TilemapL2 + 0x40];
            sLevel.TilemapL3    = Tilemaps[lMap.TilemapL3];
            sLevel.CollisionMap = CollisionMaps[lMap.CollisionMap];
            sLevel.NPCs         = Areas[index].NPCObjects;
            sLevel.Exits        = Areas[index].ExitTriggers;
            sLevel.Events       = Areas[index].EventTriggers;
            sLevel.Overlaps     = Areas[index].Overlaps;
            // finally export the serialized levels
            Do.Export(sLevel, null, fullPath);
        }
Exemplo n.º 12
0
 // ContextMenuStrip : Tileset
 private void menuTilesetSaveImageAs_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "effect-animation-" + animation.Index.ToString("d2") + ".tileset.png");
 }
Exemplo n.º 13
0
 private void menuSaveImageAs_Click(object sender, EventArgs e)
 {
     Do.Export(tilemapImage,
               "effect-animation-" + animation.Index.ToString("d3") + ".mold-" + index.ToString("d2") + ".png");
 }
Exemplo n.º 14
0
 private void saveImageAsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "tileset.png");
 }
Exemplo n.º 15
0
 private void exportTilemapsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Do.Export(Model.MinecartM7TilemapA, "minecartStage1tilemap.bin");
     Do.Export(Model.MinecartM7TilemapB, "minecartStage3tilemap.bin");
     Do.Export(Model.MinecartSSTilemap, "minecartStage2tilemap.bin");
 }
Exemplo n.º 16
0
 private void exportTilesetsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Do.Export(Model.MinecartM7TilesetSubtiles, "minecartStage1subtiles.bin");
     Do.Export(Model.MinecartM7TilesetPalettes, "minecartStage1palettes.bin");
     Do.Export(Model.MinecartSSTileset, "minecartStage2tileset.bin");
 }
Exemplo n.º 17
0
 private void saveImage_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "world-map-" + Index.ToString("d2") + ".png");
 }
Exemplo n.º 18
0
 private void saveImageAsToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "effectAnimation." + animation.Index.ToString("d2") + ".Tileset.png");
 }
Exemplo n.º 19
0
 private void exportTilemaps_Click(object sender, EventArgs e)
 {
     Do.Export(Model.M7TilemapA, "minecartStage1tilemap.bin");
     Do.Export(Model.M7TilemapB, "minecartStage3tilemap.bin");
     Do.Export(Model.SSTilemap, "minecartStage2tilemap.bin");
 }
Exemplo n.º 20
0
 private void menuSaveImageAs_Click(object sender, EventArgs e)
 {
     Do.Export(battlefieldImage, "battlefield-" + Index.ToString("d2") + ".png");
 }
Exemplo n.º 21
0
 public static void ExportSPCs(string fullPath)
 {
     Do.Export(SPCs, fullPath + "\\" + LazyShell.Model.GetFileNameWithoutPath() + " - SPCs\\" + "spc", "SPC", true);
 }
Exemplo n.º 22
0
 public static void ExportSPC(string fullPath, int index)
 {
     Do.Export(SPCs[index], null, fullPath);
 }
Exemplo n.º 23
0
 // Export elements
 public static void ExportBRRSample(string fullPath, int index)
 {
     Do.Export(BRRSamples[index].Sample,
               "brr-sample-" + index.ToString("d3") + ".brr", fullPath);
 }
Exemplo n.º 24
0
 public static void ExportWAVSample(string fullPath, int index, int rate)
 {
     Do.Export(BRR.BRRToWAV(BRRSamples[index].Sample, rate),
               "wav-sample-" + index.ToString("d3") + ".wav", fullPath);
 }
Exemplo n.º 25
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     #region Levels
     if (this.Text == "EXPORT LEVEL DATA...")
     {
         this.Enabled = false;
         if (radioButtonCurrent.Checked)
         {
             // create the serialized level
             SerializedLevel sLevel = new SerializedLevel();
             sLevel.LevelLayer  = Model.Levels[currentIndex].Layer;
             sLevel.LevelMapNum = Model.Levels[currentIndex].LevelMap;
             LevelMap lMap = Model.LevelMaps[Model.Levels[currentIndex].LevelMap];
             sLevel.LevelMap      = lMap;// Add it to serialized level data object
             sLevel.TilesetL1     = Model.Tilesets[lMap.TilesetL1 + 0x20];
             sLevel.TilesetL2     = Model.Tilesets[lMap.TilesetL2 + 0x20];
             sLevel.TilesetL3     = Model.Tilesets[lMap.TilesetL3];
             sLevel.TilemapL1     = Model.Tilemaps[lMap.TilemapL1 + 0x40];
             sLevel.TilemapL2     = Model.Tilemaps[lMap.TilemapL2 + 0x40];
             sLevel.TilemapL3     = Model.Tilemaps[lMap.TilemapL3];
             sLevel.SolidityMap   = Model.SolidityMaps[lMap.SolidityMap];
             sLevel.LevelNPCs     = Model.Levels[currentIndex].LevelNPCs;
             sLevel.LevelExits    = Model.Levels[currentIndex].LevelExits;
             sLevel.LevelEvents   = Model.Levels[currentIndex].LevelEvents;
             sLevel.LevelOverlaps = Model.Levels[currentIndex].LevelOverlaps;
             // finally export the serialized levels
             Do.Export(sLevel, null, fullPath);
         }
         else
         {
             // create the serialized level
             SerializedLevel[] sLevels = new SerializedLevel[510];
             for (int i = 0; i < sLevels.Length; i++)
             {
                 sLevels[i]             = new SerializedLevel();
                 sLevels[i].LevelLayer  = Model.Levels[i].Layer;
                 sLevels[i].LevelMapNum = Model.Levels[i].LevelMap;
                 LevelMap lMap = Model.LevelMaps[Model.Levels[i].LevelMap];
                 sLevels[i].LevelMap      = lMap;// Add it to serialized level data object
                 sLevels[i].TilesetL1     = Model.Tilesets[lMap.TilesetL1 + 0x20];
                 sLevels[i].TilesetL2     = Model.Tilesets[lMap.TilesetL2 + 0x20];
                 sLevels[i].TilesetL3     = Model.Tilesets[lMap.TilesetL3];
                 sLevels[i].TilemapL1     = Model.Tilemaps[lMap.TilemapL1 + 0x40];
                 sLevels[i].TilemapL2     = Model.Tilemaps[lMap.TilemapL2 + 0x40];
                 sLevels[i].TilemapL3     = Model.Tilemaps[lMap.TilemapL3];
                 sLevels[i].SolidityMap   = Model.SolidityMaps[lMap.SolidityMap];
                 sLevels[i].LevelNPCs     = Model.Levels[i].LevelNPCs;
                 sLevels[i].LevelExits    = Model.Levels[i].LevelExits;
                 sLevels[i].LevelEvents   = Model.Levels[i].LevelEvents;
                 sLevels[i].LevelOverlaps = Model.Levels[i].LevelOverlaps;
             }
             // finally export the serialized levels
             Do.Export(sLevels,
                       fullPath + "\\" + Model.GetFileNameWithoutPath() + " - Levels\\" + "level", "LEVEL", true);
         }
     }
     if (this.Text == "IMPORT LEVEL DATA...")
     {
         this.Enabled = false;
         if (radioButtonCurrent.Checked)
         {
             SerializedLevel sLevel = new SerializedLevel();
             try
             {
                 sLevel = (SerializedLevel)Do.Import(sLevel, fullPath);
             }
             catch
             {
                 MessageBox.Show("File not a level data file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             Model.Levels[currentIndex].Layer       = sLevel.LevelLayer;
             Model.Levels[currentIndex].Layer.Index = currentIndex;
             Model.Levels[currentIndex].LevelMap    = sLevel.LevelMapNum;
             LevelMap lMap = sLevel.LevelMap;
             Model.LevelMaps[Model.Levels[currentIndex].LevelMap] = lMap;
             Model.Tilesets[lMap.TilesetL1 + 0x20]          = sLevel.TilesetL1;
             Model.Tilesets[lMap.TilesetL2 + 0x20]          = sLevel.TilesetL2;
             Model.Tilesets[lMap.TilesetL3]                 = sLevel.TilesetL3;
             Model.EditTilesets[lMap.TilesetL1 + 0x20]      = true;
             Model.EditTilesets[lMap.TilesetL2 + 0x20]      = true;
             Model.EditTilesets[lMap.TilesetL3]             = true;
             Model.Tilemaps[lMap.TilemapL1 + 0x40]          = sLevel.TilemapL1;
             Model.Tilemaps[lMap.TilemapL2 + 0x40]          = sLevel.TilemapL2;
             Model.Tilemaps[lMap.TilemapL3]                 = sLevel.TilemapL3;
             Model.EditTilemaps[lMap.TilemapL1 + 0x40]      = true;
             Model.EditTilemaps[lMap.TilemapL2 + 0x40]      = true;
             Model.EditTilemaps[lMap.TilemapL3]             = true;
             Model.SolidityMaps[lMap.SolidityMap]           = sLevel.SolidityMap;
             Model.EditSolidityMaps[lMap.SolidityMap]       = true;
             Model.Levels[currentIndex].LevelNPCs           = sLevel.LevelNPCs;
             Model.Levels[currentIndex].LevelExits          = sLevel.LevelExits;
             Model.Levels[currentIndex].LevelEvents         = sLevel.LevelEvents;
             Model.Levels[currentIndex].LevelOverlaps       = sLevel.LevelOverlaps;
             Model.Levels[currentIndex].LevelNPCs.Index     = currentIndex;
             Model.Levels[currentIndex].LevelExits.Index    = currentIndex;
             Model.Levels[currentIndex].LevelEvents.Index   = currentIndex;
             Model.Levels[currentIndex].LevelOverlaps.Index = currentIndex;
         }
         else
         {
             SerializedLevel[] sLevels = new SerializedLevel[510];
             for (int i = 0; i < sLevels.Length; i++)
             {
                 sLevels[i] = new SerializedLevel();
             }
             try
             {
                 Do.Import(sLevels, fullPath + "\\" + "level", "LEVEL", true);
             }
             catch
             {
                 MessageBox.Show("One or more files not a level data file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             for (int i = 0; i < sLevels.Length; i++)
             {
                 Model.Levels[i].Layer       = sLevels[i].LevelLayer;
                 Model.Levels[i].Layer.Index = currentIndex;
                 Model.Levels[i].LevelMap    = sLevels[i].LevelMapNum;
                 LevelMap lMap = sLevels[i].LevelMap;
                 Model.LevelMaps[Model.Levels[i].LevelMap] = lMap;
                 Model.Tilesets[lMap.TilesetL1 + 0x20]     = sLevels[i].TilesetL1;
                 Model.Tilesets[lMap.TilesetL2 + 0x20]     = sLevels[i].TilesetL2;
                 Model.Tilesets[lMap.TilesetL3]            = sLevels[i].TilesetL3;
                 Model.EditTilesets[lMap.TilesetL1 + 0x20] = true;
                 Model.EditTilesets[lMap.TilesetL2 + 0x20] = true;
                 Model.EditTilesets[lMap.TilesetL3]        = true;
                 Model.Tilemaps[lMap.TilemapL1 + 0x40]     = sLevels[i].TilemapL1;
                 Model.Tilemaps[lMap.TilemapL2 + 0x40]     = sLevels[i].TilemapL2;
                 Model.Tilemaps[lMap.TilemapL3]            = sLevels[i].TilemapL3;
                 Model.EditTilemaps[lMap.TilemapL1 + 0x40] = true;
                 Model.EditTilemaps[lMap.TilemapL2 + 0x40] = true;
                 Model.EditTilemaps[lMap.TilemapL3]        = true;
                 Model.SolidityMaps[lMap.SolidityMap]      = sLevels[i].SolidityMap;
                 Model.EditSolidityMaps[lMap.SolidityMap]  = true;
                 Model.Levels[i].LevelNPCs           = sLevels[i].LevelNPCs;
                 Model.Levels[i].LevelExits          = sLevels[i].LevelExits;
                 Model.Levels[i].LevelEvents         = sLevels[i].LevelEvents;
                 Model.Levels[i].LevelOverlaps       = sLevels[i].LevelOverlaps;
                 Model.Levels[i].LevelNPCs.Index     = currentIndex;
                 Model.Levels[i].LevelExits.Index    = currentIndex;
                 Model.Levels[i].LevelEvents.Index   = currentIndex;
                 Model.Levels[i].LevelOverlaps.Index = currentIndex;
             }
         }
     }
     #endregion
     #region Battlefields
     if (this.Text == "EXPORT BATTLEFIELDS...")
     {
         Battlefield[]           battlefields = Model.Battlefields;
         SerializedBattlefield[] serialized   = new SerializedBattlefield[battlefields.Length];
         PaletteSet[]            paletteSets  = Model.PaletteSetsBF;
         int i = 0;
         foreach (Battlefield battlefield in battlefields)
         {
             serialized[i] = new SerializedBattlefield(Model.TilesetsBF[battlefields[i].TileSet],
                                                       paletteSets[battlefields[i++].PaletteSet], battlefield);
         }
         if (radioButtonCurrent.Checked)
         {
             Do.Export(serialized[currentIndex], null, fullPath);
         }
         else
         {
             Do.Export(serialized,
                       fullPath + "\\" + Model.GetFileNameWithoutPath() + " - Battlefields\\" + "battlefield",
                       "BATTLEFIELD", true);
         }
     }
     if (this.Text == "IMPORT BATTLEFIELDS...")
     {
         Battlefield[] battlefields = Model.Battlefields;
         if (radioButtonCurrent.Checked)
         {
             SerializedBattlefield battlefield = new SerializedBattlefield();
             try
             {
                 battlefield = (SerializedBattlefield)Do.Import(battlefield, fullPath);
             }
             catch
             {
                 MessageBox.Show("File not a battlefield data file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             Model.TilesetsBF[battlefields[currentIndex].TileSet] = battlefield.tileset;
             battlefields[currentIndex].GraphicSetA = battlefield.graphicSetA;
             battlefields[currentIndex].GraphicSetB = battlefield.graphicSetB;
             battlefields[currentIndex].GraphicSetC = battlefield.graphicSetC;
             battlefields[currentIndex].GraphicSetD = battlefield.graphicSetD;
             battlefields[currentIndex].GraphicSetE = battlefield.graphicSetE;
             Model.PaletteSetsBF[battlefields[currentIndex].PaletteSet] = battlefield.paletteSet;
             battlefields[currentIndex].Index = currentIndex;
         }
         else
         {
             SerializedBattlefield[] battlefield = new SerializedBattlefield[battlefields.Length];
             for (int i = 0; i < battlefield.Length; i++)
             {
                 battlefield[i] = new SerializedBattlefield();
             }
             try
             {
                 Do.Import(battlefield, fullPath + "\\" + "battlefield", "BATTLEFIELD", true);
             }
             catch
             {
                 MessageBox.Show("One or more files not a battlefield data file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             for (int i = 0; i < battlefield.Length; i++)
             {
                 Model.TilesetsBF[battlefields[i].TileSet] = battlefield[i].tileset;
                 battlefields[i].GraphicSetA = battlefield[i].graphicSetA;
                 battlefields[i].GraphicSetB = battlefield[i].graphicSetB;
                 battlefields[i].GraphicSetC = battlefield[i].graphicSetC;
                 battlefields[i].GraphicSetD = battlefield[i].graphicSetD;
                 battlefields[i].GraphicSetE = battlefield[i].graphicSetE;
                 Model.PaletteSetsBF[battlefields[i].PaletteSet] = battlefield[i].paletteSet;
                 battlefields[i].Index = i;
             }
         }
     }
     #endregion
     #region Audio
     if (this.Text == "EXPORT SAMPLE BRRs...")
     {
         if (radioButtonCurrent.Checked)
         {
             Do.Export(Model.AudioSamples[currentIndex].Sample,
                       "sampleBRR." + currentIndex.ToString("d3") + ".brr", fullPath);
         }
         else
         {
             byte[][] samples = new byte[Model.AudioSamples.Length][];
             int      i       = 0;
             foreach (BRRSample s in Model.AudioSamples)
             {
                 samples[i++] = s.Sample;
             }
             Do.Export(samples,
                       fullPath + "\\" + Model.GetFileNameWithoutPath() + " - BRR Samples\\" + "sampleBRR",
                       "BRR SAMPLE", true);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
         return;
     }
     if (this.Text == "IMPORT SAMPLE BRRs...")
     {
         if (radioButtonCurrent.Checked)
         {
             try
             {
                 byte[] sample = (byte[])Do.Import(new byte[1], fullPath);
                 Model.AudioSamples[currentIndex].Sample = sample;
             }
             catch
             {
                 MessageBox.Show("Error importing .brr file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
         }
         else
         {
             byte[][] samples = new byte[Model.AudioSamples.Length][];
             try
             {
                 Do.Import(samples, fullPath + "\\" + "sampleBRR", "BRR SAMPLE", true);
             }
             catch
             {
                 MessageBox.Show("Error importing .brr file(s).", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             int i = 0;
             foreach (BRRSample sample in Model.AudioSamples)
             {
                 sample.Sample = samples[i++];
             }
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
         return;
     }
     if (this.Text == "EXPORT SAMPLE WAVs...")
     {
         if (radioButtonCurrent.Checked)
         {
             Do.Export(BRR.BRRToWAV(Model.AudioSamples[currentIndex].Sample, (int)args[0]),
                       "sampleWAV." + currentIndex.ToString("d3") + ".wav", fullPath);
         }
         else
         {
             byte[][] samples = new byte[Model.AudioSamples.Length][];
             int      i       = 0;
             foreach (BRRSample s in Model.AudioSamples)
             {
                 samples[i++] = BRR.BRRToWAV(s.Sample, (int)args[0]);
             }
             Do.Export(samples,
                       fullPath + "\\" + Model.GetFileNameWithoutPath() + " - WAV Samples\\" + "sampleWAV",
                       "SAMPLE", true);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
         return;
     }
     if (this.Text == "IMPORT SAMPLE WAVs...")
     {
         if (radioButtonCurrent.Checked)
         {
             try
             {
                 byte[] sample = (byte[])Do.Import(new byte[1], fullPath);
                 Model.AudioSamples[currentIndex].Sample = BRR.Encode(sample);
             }
             catch
             {
                 MessageBox.Show("Error encoding .wav file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
         }
         else
         {
             byte[][] samples = new byte[Model.AudioSamples.Length][];
             try
             {
                 Do.Import(samples, fullPath + "\\" + "sampleWAV", "WAV SAMPLE", true);
             }
             catch
             {
                 MessageBox.Show("Error encoding .wav file(s).", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             int i = 0;
             foreach (BRRSample sample in Model.AudioSamples)
             {
                 sample.Sample = BRR.Encode(samples[i++]);
             }
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
         return;
     }
     if (this.Text == "EXPORT SPCs...")
     {
         if (radioButtonCurrent.Checked)
         {
             Do.Export(Model.SPCs[currentIndex], null, textBoxCurrent.Text);
         }
         else
         {
             Do.Export(Model.SPCs, fullPath + "\\" + Model.GetFileNameWithoutPath() + " - SPCs\\" + "spc", "SPC", true);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
         return;
     }
     if (this.Text == "IMPORT SPCs...")
     {
         if (radioButtonCurrent.Checked)
         {
             SPCTrack spc = new SPCTrack();
             try
             {
                 spc = (SPCTrack)Do.Import(spc, fullPath);
             }
             catch
             {
                 MessageBox.Show("File not an SPC data file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             spc.CreateCommands();
             Model.SPCs[currentIndex] = spc;
         }
         else
         {
             SPCTrack[] spcs = new SPCTrack[Model.SPCs.Length];
             for (int i = 0; i < spcs.Length; i++)
             {
                 spcs[i] = new SPCTrack();
             }
             try
             {
                 Do.Import(spcs, fullPath + "\\" + "spc", "SPC", true);
             }
             catch
             {
                 MessageBox.Show("One or more files not an SPC data file.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 return;
             }
             for (int i = 0; i < spcs.Length; i++)
             {
                 if (spcs[i].SPCData == null)
                 {
                     continue;
                 }
                 Model.SPCs[i] = spcs[i];
                 Model.SPCs[i].CreateCommands();
             }
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
         return;
     }
     #endregion
     #region Other
     try
     {
         Element[] array = (Element[])element;
         string    name  = this.Text.ToLower().Substring(7, this.Text.Length - 7 - 4);
         if (this.Text.Substring(0, 6) == "EXPORT")
         {
             if (radioButtonCurrent.Checked)
             {
                 Do.Export(array[currentIndex], null, textBoxCurrent.Text);
             }
             else
             {
                 Do.Export(array,
                           fullPath + "\\" + Model.GetFileNameWithoutPath() + " - " +
                           Lists.ToTitleCase(name) + "s" + "\\" + name,
                           name.ToUpper(), true);
             }
         }
         if (this.Text.Substring(0, 6) == "IMPORT")
         {
             if (radioButtonCurrent.Checked)
             {
                 try
                 {
                     array[currentIndex] = (Element)Do.Import(array[currentIndex], fullPath);
                 }
                 catch
                 {
                     MessageBox.Show("Incorrect data file type.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                     return;
                 }
                 array[currentIndex].Index = currentIndex;
             }
             else
             {
                 try
                 {
                     Do.Import(array, fullPath + "\\" + name, name.ToUpper(), true);
                 }
                 catch
                 {
                     MessageBox.Show("One or more files incorrect data file type.", "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                     return;
                 }
                 int i = 0;
                 foreach (Element item in array)
                 {
                     item.Index = i++;
                 }
             }
         }
     }
     catch { }
     #endregion
     this.Tag          = radioButtonAll.Checked;
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Exemplo n.º 26
0
 private void saveImageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "worldMap." + index.ToString("d2") + ".png");
 }
Exemplo n.º 27
0
 private void saveImageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Do.Export(battlefieldImage, "battlefield." + index.ToString("d2") + ".png");
 }
Exemplo n.º 28
0
 private void saveImageAsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Do.Export(tilemapImage,
               "effectAnimation." + animation.Index.ToString("d3") + ".Mold." + index.ToString("d2") + ".png");
 }
Exemplo n.º 29
0
 private void exportImage_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "openingCredits.png");
 }
Exemplo n.º 30
0
 // IO image
 private void saveOverlapsImage_Click(object sender, EventArgs e)
 {
     Do.Export(tilesetImage, "overlaps-tileset.png");
 }