コード例 #1
0
ファイル: Puzzle.cs プロジェクト: Isthimius/Gondwana
        public Puzzle(Graphics dc, string imgFile, int columns, int rows, Size size)
        {
            tilesheet = new Tilesheet("picture", imgFile);

            int tileWidth  = (int)((float)tilesheet.Bmp.Width / (float)columns);
            int tileHeight = (int)((float)tilesheet.Bmp.Height / (float)rows);
            int adjWidth   = tileWidth * columns;
            int adjHeight  = tileHeight * rows;

            tilesheet.TileSize = new Size(tileWidth, tileHeight);

            originalSize = tilesheet.Bmp.Size;
            numColumns   = columns;
            numRows      = rows;
            adjustedSize = new Size(adjWidth, adjHeight);

            GridPointMatrix matrix = new GridPointMatrix(numColumns, numRows, tileWidth, tileHeight);

            matrix.CoordinateSystem = new SquareIsoCoordinates();
            matrixes = new GridPointMatrixes(matrix);

            surface = new VisibleSurface(dc, size.Width, size.Height, matrixes);
            surface.Erase();

            InitializeSprites(tileWidth, tileHeight);
            //Gondwana.Scripting.Parser.WriteToFile("bmpProp_file.gond", System.IO.FileMode.Create, tilesheet);
            //Engine.ScriptEngineState("file.gond", true);

            delMoveStart = new SpriteMovementEventHandler(Sprites_SpriteMovementStarted);
            delMoveStop  = new SpriteMovementEventHandler(Sprites_SpriteMovementStopped);

            Sprites.SpriteMovementStarted += delMoveStart;
            Sprites.SpriteMovementStopped += delMoveStop;
        }
コード例 #2
0
ファイル: DirectImage.cs プロジェクト: Isthimius/Gondwana
 public DirectImage(VisibleSurfaceBase surface, Rectangle bounds, Tilesheet bmp,
                    TernaryRasterOperations rasterOp)
     : base(surface, bounds)
 {
     _tilesheet = bmp;
     _rasterOp  = rasterOp;
 }
コード例 #3
0
ファイル: DirectImage.cs プロジェクト: Isthimius/Gondwana
 public DirectImage(VisibleSurfaceBase surface, Rectangle bounds, Tilesheet bmp,
     TernaryRasterOperations rasterOp)
     : base(surface, bounds)
 {
     _tilesheet = bmp;
     _rasterOp = rasterOp;
 }
コード例 #4
0
        private void CreateResizedGDIBitmap(Tilesheet origTilesheet, ref Bitmap newBmp, ref Graphics newGraphics, ref IntPtr hdc, ref IntPtr hbmp)
        {
            // create the new Bitmap object with the new stretched Size
            newBmp = new Bitmap(RenderSize.Width, RenderSize.Height);

            // get Graphics object from new Bitmap with new size
            newGraphics = Graphics.FromImage(newBmp);

            // get pointer to Graphics object for new Bitmap
            hdc = ResizedGraphics.GetHdc();

            // create and get handle to a GDI bitmap object compatible with the GDI+ Bitmap
            hbmp = NewBmp.GetHbitmap();

            // associate the new bitmap handle with the new Graphics handle
            pInvoke.SelectObject(hdc, hbmp);

            // draw (i.e., StretchBlt) to new Graphics object from original Frame Bitmap
            Win32Support.DrawBitmap(hdc,
                                    new Rectangle(0, 0, NewBmp.Width, NewBmp.Height),
                                    origTilesheet.hDC,
                                    origTilesheet.GetSourceRange(OriginalFrame.XTile, OriginalFrame.YTile),
                                    TernaryRasterOperations.SRCCOPY);

            // release the pointer to the Graphics Hdc
            ResizedGraphics.ReleaseHdc(hdc);
        }
コード例 #5
0
        public static BitmapChangeColorPopUp Open(Bitmap bitmap, bool createMask)
        {
            if (_singleton == null)
            {
                _singleton = new BitmapChangeColorPopUp();
            }

            _singleton._bmp             = bitmap;
            _singleton._backColor       = Tilesheet.InferBackgroundColor(bitmap);
            _singleton.picBox.BackColor = _singleton._backColor;
            _singleton._isMask          = createMask;

            if (!createMask)
            {
                _singleton.lblMessage.Text = "Select color to change";
                _singleton.Text            = "Change Background";
            }
            else
            {
                _singleton.lblMessage.Text = "Select transparency key";
                _singleton.Text            = "Create Mask";
            }

            _singleton.Show();

            return(_singleton);
        }
コード例 #6
0
        private void CopyFilesToAssets()
        {
            if (EngineState == null)
            {
                return;
            }

            foreach (var tilesheet in new List <Tilesheet>(EngineState.Tilesheets.Values))
            {
                if (tilesheet.ResourceIdentifier != null)
                {
                    continue;
                }

                if (Path.GetDirectoryName(tilesheet.ImageFilePath) != Path.GetDirectoryName(AssetsDirectory))
                {
                    string destFile = AssetsDirectory + Path.GetFileName(tilesheet.ImageFilePath);
                    File.Copy(tilesheet.ImageFilePath, destFile, true);
                    var tmpTilesheet = new Tilesheet(tilesheet, tilesheet.Name, destFile);      // this will replace original Tilesheet
                    this.IsDirty = true;
                }
            }

            foreach (var mediaFile in new List <MediaFile>(EngineState.MediaFiles.Values))
            {
                if (mediaFile.ResourceIdentifier != null)
                {
                    continue;
                }

                if (Path.GetDirectoryName(mediaFile.FileName) != Path.GetDirectoryName(AssetsDirectory))
                {
                    string destFile = AssetsDirectory + Path.GetFileName(mediaFile.FileName);
                    File.Copy(mediaFile.FileName, destFile, true);
                    var tmpMediaFile = new MediaFile(mediaFile, mediaFile.Alias, destFile, mediaFile.FileType);     // this will replace original MediaFile
                    this.IsDirty = true;
                }
            }

            foreach (var resourceFile in new List <Resource.EngineResourceFile>(EngineState.ResourceFiles))
            {
                if (Path.GetDirectoryName(resourceFile.FilePath) != Path.GetDirectoryName(AssetsDirectory))
                {
                    string sourceFile  = resourceFile.FilePath;
                    string destFile    = AssetsDirectory + Path.GetFileName(sourceFile);
                    string password    = resourceFile.Password;
                    bool   isEcnrypted = resourceFile.IsEncrypted;

                    resourceFile.Dispose();

                    File.Copy(sourceFile, destFile, true);
                    var tmpResourceFile = new Resource.EngineResourceFile(destFile, password, isEcnrypted);
                    this.IsDirty = true;
                }
            }
        }
コード例 #7
0
ファイル: Processors.cs プロジェクト: tpf89/StardewMods
        internal static void ApplyTilesheet(Tilesheet tilesheet)
        {
            int stage  = 0;
            int branch = 0;
            int skip   = 0;

            try
            {
                stage++; // 1
                GameLocation location = Game1.getLocationFromName(tilesheet.MapName);
                stage++; // 2
                if (tilesheet.FileName == null)
                {
                    skip = 1;
                }
                else
                {
                    skip = 2;
                    string fakepath = Path.Combine(Path.GetDirectoryName(tilesheet.FileName), "all_sheet_paths_objects", tilesheet.SheetId, Path.GetFileName(tilesheet.FileName));
                    if (tilesheet.Seasonal)
                    {
                        fakepath = fakepath.Replace("all_sheet_paths_objects", Path.Combine("all_sheet_paths_objects", Game1.currentSeason));
                    }
                    stage++; // 3
                    ContentRegistry.RegisterXnb(fakepath, tilesheet.Seasonal ? (tilesheet.FileName + "_" + Game1.currentSeason) : tilesheet.FileName);
                    stage++; // 4
                    if (location.map.GetTileSheet(tilesheet.SheetId) != null)
                    {
                        branch = 1;
                        location.map.GetTileSheet(tilesheet.SheetId).ImageSource = fakepath;
                        AdvancedLocationLoaderMod.Logger.Log($"{tilesheet} ~> {(tilesheet.Seasonal ? "seasonal" : "normal")}/override", LogLevel.Trace);
                    }
                    else
                    {
                        branch = 2;
                        Texture2D sheet = Game1.content.Load <Texture2D>(fakepath);
                        location.map.AddTileSheet(new xTile.Tiles.TileSheet(tilesheet.SheetId, location.map, fakepath, new xTile.Dimensions.Size((int)Math.Ceiling(sheet.Width / 16.0), (int)Math.Ceiling(sheet.Height / 16.0)), new xTile.Dimensions.Size(16, 16)));
                        AdvancedLocationLoaderMod.Logger.Log($"{tilesheet} ~> {(tilesheet.Seasonal ? "seasonal" : "normal")}/insert", LogLevel.Trace);
                    }
                }
                stage++; // 5 (skip 3)
                if (tilesheet.Properties.Count > 0)
                {
                    xTile.Tiles.TileSheet sheet = location.map.GetTileSheet(tilesheet.SheetId);
                    foreach (string prop in tilesheet.Properties.Keys)
                    {
                        sheet.Properties[prop] = tilesheet.Properties[prop];
                    }
                }
            }
            catch (Exception err)
            {
                AdvancedLocationLoaderMod.Logger.ExitGameImmediately($"Unable to patch tilesheet, a unexpected error occured at stage {stage}{(skip > 0 ? ("-" + skip) : "")}{(branch > 0 ? ("-" + branch) : "")}: {tilesheet}", err);
            }
        }
コード例 #8
0
 /// <summary>
 /// Clear all EngineState collection properties associated with the Engine class
 /// </summary>
 public void Clear()
 {
     ValueBag.Clear();
     EngineResourceFile.ClearAll();
     Tilesheet.ClearAllTilesheets();
     Cycle.ClearAllAnimationCycles();
     GridPointMatrixes.ClearAllGridPointMatrixes();
     GridPointMatrix.ClearAllGridPointMatrix();
     Gondwana.Common.Drawing.Sprites.Sprites.Clear();
     MediaFile.DisposeAll();
 }
コード例 #9
0
        public static void LoadBitmaps()
        {
            tilesheet                     = new Tilesheet("original", path + "graphics\\original.bmp");
            tilesheet.TileSize            = new Size(64, 32);
            tilesheet.InitialOffsetX      = 1;
            tilesheet.InitialOffsetY      = 1;
            tilesheet.XPixelsBetweenTiles = 1;
            tilesheet.YPixelsBetweenTiles = 1;

            tilesheetMask                     = new Tilesheet("original_mask", path + "graphics\\original_mask.bmp");
            tilesheetMask.TileSize            = new Size(64, 32);
            tilesheetMask.InitialOffsetX      = 1;
            tilesheetMask.InitialOffsetY      = 1;
            tilesheetMask.XPixelsBetweenTiles = 1;
            tilesheetMask.YPixelsBetweenTiles = 1;

            sprtBmp          = new Tilesheet("rooster", path + "graphics\\rooster.bmp");
            sprtBmp.TileSize = new Size(50, 50);

            sprtBmpMask          = new Tilesheet("rooster_mask", path + "graphics\\rooster_mask.bmp");
            sprtBmpMask.TileSize = new Size(50, 50);


            tilesheet.Mask = tilesheetMask;
            sprtBmp.Mask   = sprtBmpMask;

            //tilesheet.ApplyBmpSettingsFile(@"E:\TFS\Hidden Worlds Games\Gondwana\TestHarness\GondwanaWinTest\resources\XMLFile1.xml");
            //tilesheetMask.ApplyBmpSettingsFile(@"E:\TFS\Hidden Worlds Games\Gondwana\TestHarness\GondwanaWinTest\resources\XMLFile1.xml");
            //sprtBmp.ApplyBmpSettingsFile(@"E:\TFS\Hidden Worlds Games\Gondwana\TestHarness\GondwanaWinTest\resources\XMLFile2.xml");
            //sprtBmpMask.ApplyBmpSettingsFile(@"E:\TFS\Hidden Worlds Games\Gondwana\TestHarness\GondwanaWinTest\resources\XMLFile2.xml");

            //tilesheet.SaveBmpSettingsFile(path + "tilesheet.xml");
            //tilesheetMask.SaveBmpSettingsFile(path + "tilesheetMask.xml");

            //tilesheet.SaveBmpSettingsFile(@"E:\Finances\" + tilesheet.Name + ".xml");

            FileStream             writer = new FileStream(@"E:\TFS\Hidden Worlds Games\Gondwana\TestHarness\GondwanaWinTest\resources\tilesets.xml", FileMode.Create);
            DataContractSerializer ser    = new DataContractSerializer(typeof(Tilesheet));

            ser.WriteObject(writer, tilesheet);
            ser.WriteObject(writer, tilesheetMask);
            ser.WriteObject(writer, sprtBmp);
            ser.WriteObject(writer, sprtBmpMask);
            writer.Close();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: Isthimius/Gondwana
        static void Main(string[] args)
        {
            Bitmap bmp = new Bitmap(@"C:\test\shops 2 tileset.bmp");

            //Bitmap bmpMask = Tilesheet.CreateBitmapMask(ref bmp);
            //bmpMask.Save(@"C:\test\shops 2 tileset mask.bmp");


            var transparentCol = Tilesheet.InferBackgroundColor(bmp);
            var black          = Color.Black;


            //RemapColor(bmp, transparentCol, black);
            //bmp.Save(@"C:\test\shops 2 tileset new.bmp");

            var mask = CreateMask(bmp, Tilesheet.InferBackgroundColor(bmp));

            mask.Save(@"C:\test\shops 2 tileset new mask.bmp");

            mask.Dispose();
            bmp.Dispose();
        }
コード例 #11
0
        internal void CreateObjectCategoryFromSelectedTile()
        {
            CreateObjectCategoryForm createObjectCategoryForm = new CreateObjectCategoryForm();

            try
            {
                createObjectCategoryForm.ObjCategoryImage = Tilesheet.CropImage(new RectangleF(_selectedTile.X * @interface.TileWidth,
                                                                                               _selectedTile.Y * @interface.TileHeight,
                                                                                               @interface.TileWidth,
                                                                                               @interface.TileHeight));
            }
            catch
            {
                return;
            }

            createObjectCategoryForm.CollisionTypeDataSource = @interface.CollisionTypeTable;
            if (createObjectCategoryForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int tileIndex = _selectedTile.Y * _columns + _selectedTile.X;
                foreach (var obj in @interface.GameObjectCategories)
                {
                    if (obj.TileIndex == tileIndex)
                    {
                        @interface.AddTileObjectFromAvailableObjectCategory(tileIndex, obj);
                        return;
                    }
                }
                GameObjectCategory gameObjectCategory = new GameObjectCategory();
                gameObjectCategory.Id   = createObjectCategoryForm.ObjectCategoryId;
                gameObjectCategory.Name = createObjectCategoryForm.ObjectCategoryName;
                gameObjectCategory.ObjectCategoryImage = createObjectCategoryForm.ObjCategoryImage;
                gameObjectCategory.TileIndex           = tileIndex;
                @interface.AddCollisionType(createObjectCategoryForm.CollisionTypeName);
                gameObjectCategory.CollisionType = createObjectCategoryForm.CollisionTypeName;
                @interface.AddGameObjectCategory(gameObjectCategory);
            }
        }
コード例 #12
0
ファイル: FrameSequence.cs プロジェクト: Isthimius/Gondwana
 public Frame AddFrame(Tilesheet bmp, int xTile, int yTile)
 {
     return(AddFrame(new Frame(bmp, xTile, yTile)));
 }
コード例 #13
0
ファイル: TileWorldGame.cs プロジェクト: half-ogre/TileWorld
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _masterTilesheet = Content.Load<Tilesheet>("master-tilesheet");
            _masterTilesheetTexture = Content.Load<Texture2D>(_masterTilesheet.TextureName);
            _worldMap = Content.Load<World>("world");

            _graphics.PreferredBackBufferHeight = _masterTilesheet.TileSize.Y * _worldMap.Size.Y;
            _graphics.PreferredBackBufferWidth = _masterTilesheet.TileSize.X * _worldMap.Size.X;
            _graphics.ApplyChanges();
        }
コード例 #14
0
        public static void ApplyTilesheet(IContentHelper coreContentHelper, IContentPack contentPack, Tilesheet tilesheet, Map map)
        {
            int stage  = 0;
            int branch = 0;
            int skip   = 0;

            try
            {
                stage++; // 1
                if (tilesheet.FileName == null)
                {
                    skip = 1;
                }
                else
                {
                    skip = 2;
                    string fakepath = Path.Combine("AdvancedLocationLoader/FakePath_paths_objects", tilesheet.FileName);
                    if (tilesheet.Seasonal)
                    {
                        fakepath = fakepath.Replace("all_sheet_paths_objects", Path.Combine("all_sheet_paths_objects", Game1.currentSeason));
                    }
                    stage++; // 2
                    if (!Processors.MappingCache.ContainsKey(tilesheet.FileName))
                    {
                        string toAssetPath = contentPack.GetRelativePath(
                            fromAbsolutePath: ModEntry.SHelper.DirectoryPath,
                            toLocalPath: tilesheet.Seasonal ? ($"{tilesheet.FileName}_{Game1.currentSeason}") : tilesheet.FileName
                            );
                        coreContentHelper.RegisterXnbReplacement(fakepath, toAssetPath);
                        Processors.MappingCache[tilesheet.FileName] = fakepath;
                    }

                    stage++; // 3
                    if (map.GetTileSheet(tilesheet.SheetId) != null)
                    {
                        branch = 1;
                        map.GetTileSheet(tilesheet.SheetId).ImageSource = fakepath;
                    }
                    else
                    {
                        branch = 2;
                        Texture2D sheet = Game1.content.Load <Texture2D>(fakepath);
                        map.AddTileSheet(new TileSheet(tilesheet.SheetId, map, fakepath, new Size((int)Math.Ceiling(sheet.Width / 16.0), (int)Math.Ceiling(sheet.Height / 16.0)), new Size(16, 16)));
                    }
                }

                stage++; // 4 (skip 2)
                if (tilesheet.Properties.Count > 0)
                {
                    TileSheet sheet = map.GetTileSheet(tilesheet.SheetId);
                    foreach (string prop in tilesheet.Properties.Keys)
                    {
                        sheet.Properties[prop] = tilesheet.Properties[prop];
                    }
                }
            }
            catch (Exception err)
            {
                ModEntry.Logger.ExitGameImmediately($"Unable to patch tilesheet, a unexpected error occured at stage {stage}{(skip > 0 ? ("-" + skip) : "")}{(branch > 0 ? ("-" + branch) : "")}: {tilesheet}", err);
            }
        }
コード例 #15
0
 protected internal TilesheetDisposedEventArgs(Tilesheet tilesheet)
 {
     Tilesheet = tilesheet;
 }
コード例 #16
0
        public static void Load(string filepath)
        {
            AdvancedLocationLoaderMod.Logger.Log("Converting legacy 1.1 manifest to new 1.2 format...", LogLevel.Debug);
            LocationConfig1_1 Config;

            try
            {
                Config = JsonConvert.DeserializeObject <LocationConfig1_1>(File.ReadAllText(filepath));
            }
            catch (Exception err)
            {
                AdvancedLocationLoaderMod.Logger.Log(LogLevel.Error, "Unable to load legacy manifest, json cannot be parsed: " + filepath, err);
                return;
            }
            MainLocationManifest1_2 Updated = new MainLocationManifest1_2();

            // Prepare the 1.2 properties
            Updated.LoaderVersion = "1.2.0";
            AdvancedLocationLoaderMod.Logger.Log("Converting the `about` section", LogLevel.Trace);
            // Convert the `about` section
            Updated.About = new About();
            if (Config.about.ContainsKey("author"))
            {
                Updated.About.Author = Config.about["author"];
            }
            if (Config.about.ContainsKey("description"))
            {
                Updated.About.Description = Config.about["description"];
            }
            if (Config.about.ContainsKey("version"))
            {
                Updated.About.Version = Config.about["version"];
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `locations` section", LogLevel.Trace);
            // Convert the `locations` section
            if (Config.locations != null)
            {
                Updated.Locations = new List <Location>();
                foreach (Dictionary <string, string> loc in Config.locations)
                {
                    Location newLoc = new Location();
                    newLoc.Farmable = loc.ContainsKey("farmable") ? Convert.ToBoolean(loc["farmable"]) : false;
                    newLoc.Outdoor  = loc.ContainsKey("outdoor") ? Convert.ToBoolean(loc["outdoor"]) : false;
                    newLoc.FileName = loc["file"];
                    newLoc.MapName  = loc["name"];
                    newLoc.Type     = "Default";
                    Updated.Locations.Add(newLoc);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `overrides` section", LogLevel.Trace);
            // Convert the `overrides` section
            if (Config.overrides != null)
            {
                Updated.Overrides = new List <Override>();
                foreach (Dictionary <string, string> ovr in Config.overrides)
                {
                    Override newOvr = new Override();
                    newOvr.FileName = ovr["file"];
                    newOvr.MapName  = ovr["name"];
                    Updated.Overrides.Add(newOvr);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `tilesheets` section", LogLevel.Trace);
            // Convert the `tilesheets` section
            if (Config.tilesheets != null)
            {
                Updated.Tilesheets = new List <Tilesheet>();
                foreach (Dictionary <string, string> sheet in Config.tilesheets)
                {
                    Tilesheet newSheet = new Tilesheet();
                    newSheet.FileName = sheet["file"];
                    newSheet.MapName  = sheet["map"];
                    newSheet.SheetId  = sheet["sheet"];
                    newSheet.Seasonal = sheet.ContainsKey("seasonal") ? Convert.ToBoolean(sheet["seasonal"]) : false;
                    Updated.Tilesheets.Add(newSheet);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `tiles` section", LogLevel.Trace);
            // Convert the `tiles` section
            if (Config.tiles != null)
            {
                Updated.Tiles = new List <Tile>();
                foreach (Dictionary <string, string> tile in Config.tiles)
                {
                    Tile newTile = new Tile();
                    newTile.TileX   = Convert.ToInt32(tile["x"]);
                    newTile.TileY   = Convert.ToInt32(tile["y"]);
                    newTile.MapName = tile["map"];
                    newTile.LayerId = tile["layer"];
                    newTile.SheetId = tile.ContainsKey("sheet") ? tile["sheet"] : null;
                    if (tile.ContainsKey("interval"))
                    {
                        newTile.Interval    = Convert.ToInt32(tile["interval"]);
                        newTile.TileIndexes = new List <string>(tile["tileIndex"].Split(',')).ConvertAll(Convert.ToInt32).ToArray();
                    }
                    else
                    {
                        newTile.TileIndex = Convert.ToInt32(tile["tileIndex"]);
                    }
                    newTile.Conditions = tile.ContainsKey("conditions") ? tile["conditions"] : null;
                    Updated.Tiles.Add(newTile);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `properties` section", LogLevel.Trace);
            // Convert the `properties` section
            if (Config.properties != null)
            {
                Updated.Properties = new List <Property>();
                foreach (List <string> prop in Config.properties)
                {
                    Property newProp = new Property();
                    newProp.MapName = prop[0];
                    newProp.LayerId = prop[1];
                    newProp.TileX   = Convert.ToInt32(prop[2]);
                    newProp.TileY   = Convert.ToInt32(prop[3]);
                    newProp.Key     = prop[4];
                    newProp.Value   = prop[5];
                    Updated.Properties.Add(newProp);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `warps` section", LogLevel.Trace);
            // Convert the `warps` section
            if (Config.warps != null)
            {
                Updated.Warps = new List <Warp>();
                foreach (List <string> warp in Config.warps)
                {
                    Warp newWarp = new Warp();
                    newWarp.MapName    = warp[0];
                    newWarp.TileX      = Convert.ToInt32(warp[1]);
                    newWarp.TileY      = Convert.ToInt32(warp[2]);
                    newWarp.TargetName = warp[3];
                    newWarp.TargetX    = Convert.ToInt32(warp[4]);
                    newWarp.TargetY    = Convert.ToInt32(warp[5]);
                    Updated.Warps.Add(newWarp);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `conditions` section", LogLevel.Trace);
            // Convert the `conditions` into the new `Conditionals` section
            if (Config.conditions != null)
            {
                Updated.Conditionals = new List <Conditional>();
                foreach (KeyValuePair <string, Dictionary <string, string> > cond in Config.conditions)
                {
                    Conditional newCond = new Conditional();
                    newCond.Name     = cond.Key;
                    newCond.Item     = Convert.ToInt32(cond.Value["item"]);
                    newCond.Amount   = Convert.ToInt32(cond.Value["amount"]);
                    newCond.Question = cond.Value["question"];
                    Updated.Conditionals.Add(newCond);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `minecarts` section", LogLevel.Trace);
            // Convert the `minecarts` section
            if (Config.minecarts != null)
            {
                Updated.Teleporters = new List <TeleporterList>();
                foreach (KeyValuePair <string, Dictionary <string, List <string> > > set in Config.minecarts)
                {
                    TeleporterList newSet = new TeleporterList();
                    newSet.ListName = set.Key;
                    foreach (KeyValuePair <string, List <string> > dest in set.Value)
                    {
                        TeleporterDestination newDest = new TeleporterDestination();
                        newDest.ItemText  = dest.Key;
                        newDest.MapName   = dest.Value[0];
                        newDest.TileX     = Convert.ToInt32(dest.Value[1]);
                        newDest.TileY     = Convert.ToInt32(dest.Value[2]);
                        newDest.Direction = Convert.ToInt32(dest.Value[3]);
                        newSet.Destinations.Add(newDest);
                    }
                    Updated.Teleporters.Add(newSet);
                }
            }
            AdvancedLocationLoaderMod.Logger.Log("Converting the `shops` section", LogLevel.Trace);
            // Convert the `shops` section
            Updated.Shops = Config.shops;
            // Remove empty fields
            if (Updated.Conditionals.Count == 0)
            {
                Updated.Conditionals = null;
            }
            if (Updated.Locations.Count == 0)
            {
                Updated.Locations = null;
            }
            if (Updated.Overrides.Count == 0)
            {
                Updated.Overrides = null;
            }
            if (Updated.Properties.Count == 0)
            {
                Updated.Properties = null;
            }
            if (Updated.Redirects.Count == 0)
            {
                Updated.Redirects = null;
            }
            if (Updated.Shops.Count == 0)
            {
                Updated.Shops = null;
            }
            if (Updated.Teleporters.Count == 0)
            {
                Updated.Teleporters = null;
            }
            if (Updated.Tiles.Count == 0)
            {
                Updated.Tiles = null;
            }
            if (Updated.Tilesheets.Count == 0)
            {
                Updated.Tilesheets = null;
            }
            if (Updated.Warps.Count == 0)
            {
                Updated.Warps = null;
            }
            AdvancedLocationLoaderMod.Logger.Log("Saving converted manifest to file...", LogLevel.Trace);
            // Save and then parse the updated config
            File.WriteAllText(filepath, JsonConvert.SerializeObject(Updated, new JsonSerializerSettings()
            {
                Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore
            }));
            AdvancedLocationLoaderMod.Logger.Log("Loading the converted manifest", LogLevel.Trace);
            Loader1_2.Load(filepath);
        }