public static void CreateMapFromImage(WzImage mapImage, string mapName, string streetName, PageCollection Tabs, MultiBoard multiBoard, EventHandler rightClickHandler) { if (!mapImage.Parsed) { mapImage.ParseImage(); } VerifyMapPropsKnown(mapImage); MapInfo info = new MapInfo(mapImage, mapName, streetName); MapType type = GetMapType(mapImage); if (type == MapType.RegularMap) { info.id = int.Parse(WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name))); } info.mapType = type; Point center = new Point(); Point size = new Point(); if (mapImage["miniMap"] == null) { if (info.VR == null) { if (!GetMapVR(mapImage, ref info.VR)) { MessageBox.Show("Error - map does not contain size information and HaCreator was unable to generate it. An error has been logged.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ErrorLogger.Log(ErrorLevel.IncorrectStructure, "no size @map " + info.id.ToString()); return; } } size = new Point(info.VR.Value.Width + 10, info.VR.Value.Height + 10); //leave 5 pixels on each side center = new Point(5 - info.VR.Value.Left, 5 - info.VR.Value.Top); } else { IWzImageProperty miniMap = mapImage["miniMap"]; size = new Point(InfoTool.GetInt(miniMap["width"]), InfoTool.GetInt(miniMap["height"])); center = new Point(InfoTool.GetInt(miniMap["centerX"]), InfoTool.GetInt(miniMap["centerY"])); } CreateMap(mapName, WzInfoTools.RemoveLeadingZeros(WzInfoTools.RemoveExtension(mapImage.Name)), CreateStandardMapMenu(rightClickHandler), size, center, 8, Tabs, multiBoard); Board mapBoard = multiBoard.SelectedBoard; mapBoard.MapInfo = info; if (mapImage["miniMap"] != null) { mapBoard.MiniMap = ((WzCanvasProperty)mapImage["miniMap"]["canvas"]).PngProperty.GetPNG(false); } LoadLayers(mapImage, mapBoard); LoadLife(mapImage, mapBoard); LoadFootholds(mapImage, mapBoard); LoadRopes(mapImage, mapBoard); LoadChairs(mapImage, mapBoard); LoadPortals(mapImage, mapBoard); LoadReactors(mapImage, mapBoard); LoadToolTips(mapImage, mapBoard); LoadBackgrounds(mapImage, mapBoard); mapBoard.BoardItems.Sort(); }