public void MapMake(string directory, string bitmaplocation, string bitmapZLocation, int x, int y, int index, bool automaticz) { var bitmapMap = new BitmapReader(bitmaplocation, false).BitmapColors; var bitmapZ = new BitmapReader(bitmapZLocation, true).BitmapColors; var mulmaker = new MapMaking.MapMaker(bitmapMap, bitmapZ, x, y, index) { ColorAreas = ColorArea, ColorAreasCoast = ColorCoast, ColorMountainsAreas = ColorMountains, Items = Items, ItemsSmooth = Smooths, ItemsCoasts = ItemsCoasts, TextureAreas = TextureArea, TxtureSmooth = SmoothTextures, Cliffs = Cliffs, AutomaticZMode = automaticz, MulDirectory = directory }; mulmaker.Bmp2Map(); }
public void MapMake(string directory, string bitmaplocation, string bitmapZLocation, int x, int y, int index) { CollectionColorArea.InitializeSeaches(); CollectionAreaTexture.InitializeSeaches(); var list_errors = new List <string>(); foreach (var VARIABLE in CollectionColorArea.List) { Elements.Textures.TextureArea.AreaTextures area; CollectionAreaTexture._fast.TryGetValue(VARIABLE.TextureIndex, out area); if (VARIABLE.Max < VARIABLE.Min) { var tmp = VARIABLE.Max; VARIABLE.Max = VARIABLE.Min; VARIABLE.Min = tmp; } if (area != null || VARIABLE.Type == TypeColor.Cliff) { continue; } var error = VARIABLE.Name + @" refers to a non-existent texture '" + VARIABLE.TextureIndex + @"' not found"; list_errors.Add(error); } if (list_errors.Count > 0) { string errors = ""; foreach (var error_in in list_errors) { errors += error_in + '\n'; } throw new Exception(errors); } var task = new Task[2]; var taskMapBitmap = Task <AreaColor[]> .Factory.StartNew(() => BitmapReader.ColorsFromBitmap(CollectionColorArea, bitmaplocation, x, y)); var taskMapZ = Task <sbyte[]> .Factory.StartNew(() => BitmapReader.AltitudeFromBitmapVersion2(bitmapZLocation, x, y)); task[0] = taskMapBitmap; task[1] = taskMapZ; try { Task.WaitAll(task); } catch (Exception e) { throw e; } GC.Collect(); var mulmaker = new MapMaking.MapMaker(taskMapZ.Result, taskMapBitmap.Result, x, y, index) { CollectionAreaColor = CollectionColorArea, TextureAreas = CollectionAreaTexture, AutomaticZMode = AutomaticMode, MulDirectory = directory }; mulmaker.ProgressText += EventProgress; try { mulmaker.Bmp2Map(); OnMakingMap(EventArgs.Empty); } catch (Exception e) { throw e; } GC.Collect(); }