Exemplo n.º 1
0
        public static MapObject LoadFromFile(string aFilePath)
        {
            string bitmapPath = aFilePath + ".png";
            string objectPath = aFilePath + ".xml";

            if (!File.Exists(bitmapPath))
            {
            }
            if (!File.Exists(objectPath))
            {
            }

            Bitmap tempBitmap = new Bitmap(bitmapPath);

            if (tempBitmap.PixelFormat != PixelFormat.Format32bppArgb)
            {
                Bitmap tempBitmap2 = BitmapHelper.ConvertToPixelFormat(tempBitmap, PixelFormat.Format32bppArgb);
                tempBitmap.Dispose();
                tempBitmap = tempBitmap2;
            }

            MapObject tempMapObject = new MapObject
            {
                TheBitmap    = tempBitmap,
                TheMapDetail = (MapDetail)SaveObjects.DeserializeObject(objectPath, typeof(MapDetail))
            };

            return(tempMapObject);
        }
Exemplo n.º 2
0
        internal static Map LoadMap(string aFilePath)
        {
            Map aMap = (Map)SaveObjects.DeserializeObject(aFilePath, typeof(Map));

            return(aMap);
        }