/// <summary> /// Gets incremental incline data for a point and a neighboring point. /// </summary> /// <param name="mapMetaData">Map meta data.</param> /// <param name="startPoint">Start point, using mapmetadata indices.</param> /// <param name="endPoint">End point, using mapmetadata indices.</param> /// <param name="incline">Incline (out).</param> /// <param name="decline">Decline (out).</param> /// <param name="distance">Distance (out).</param> void getIncrementalInclines(MapMetaData mapMetaData, Point startPoint, Point endPoint, out float incline, out float decline, out float distance) { Vector3 startVector = mapMetaData.getWorldPos(startPoint); Vector3 endVector = mapMetaData.getWorldPos(endPoint); MapTerrainDataCell startCell = mapMetaData.GetCellAt(startPoint); MapTerrainDataCell endCell = mapMetaData.GetCellAt(endPoint); float horzDistance = Mathf.Abs(startVector.x - endVector.x) + Mathf.Abs(startVector.z - endVector.z); distance = horzDistance; float vertDistance = endCell.cachedHeight - startCell.cachedHeight; if (vertDistance > 0) { decline = 0.0f; incline = vertDistance / horzDistance; } else { incline = 0.0f; decline = -(vertDistance / horzDistance); } }
public static bool SaveMapMetaData(MapMetaData metaData) { if (metaData == null) { return(false); } try { CreateMetaDataFolder(); string fileName = metaData.GetJsonFileName(); string pathToFile = Path.Combine(FullPathToMetaFolder, fileName); string jsonToSave = JsonConvert.SerializeObject(metaData, Formatting.Indented); File.WriteAllText(pathToFile, jsonToSave); return(true); } catch (Exception e) { Logger.Error(e, "failed to save map meta data"); return(false); } }
private void LoadMapMetaData() { var taglist = VariousFunctions.GZip.Decompress(VariousFunctions.GetTaglistFile(GameId, SandboxHeader.MapID)); SandboxMapMetaData = JsonConvert.DeserializeObject <MapMetaData>(VariousFunctions.ByteArrayToString(taglist, VariousFunctions.EncodingType.ASCII)); }
public static BoolWithMessage DeleteMapFiles(MapMetaData metaData) { if (metaData == null) { return(BoolWithMessage.False($"meta data is null")); } if (metaData.FilePaths?.Count == 0) { return(BoolWithMessage.False($"List of files to delete is unknown for {metaData.MapName}. You must manually delete the map files from the following folder: {metaData.MapFileDirectory}")); } try { BoolWithMessage result = FileUtils.DeleteFiles(metaData.FilePaths); if (result.Result == false) { return(result); } // lastly delete meta data file string pathToMetaData = Path.Combine(MetaDataManager.FullPathToMetaFolder, metaData.GetJsonFileName()); if (File.Exists(pathToMetaData)) { File.Delete(pathToMetaData); } return(BoolWithMessage.True($"{metaData.MapName} has been deleted!")); } catch (Exception e) { return(BoolWithMessage.False($"Failed to delete files: {e.Message}")); } }
public IEnumerator HandleReadInMapMetaData() { string sStream = AsynchronousClient.Instance.Send("RequestMapMetaData:0"); yield return(sStream); string[] sMaps = sStream.Split("#".ToCharArray()); foreach (string sMapStream in sMaps) { if (sMapStream != "") { string[] sMapMetaData = sMapStream.Split(",".ToCharArray()); MapMetaData cMapMetaData = GameObject.Find("_MapManager").AddComponent <MapMetaData>(); GameObject.Find("_MapManager").GetComponent <MapManager>().MapMetaDatas.Add(cMapMetaData); cMapMetaData.sName = sMapMetaData[0]; cMapMetaData.sExpansion = sMapMetaData[1]; cMapMetaData.sPlayers = sMapMetaData[2]; int.TryParse(sMapMetaData[2], out cMapMetaData.iNoOfPlayers); cMapMetaData.sMapType = sMapMetaData[3]; } } }
/// <summary> /// Map assets loading task /// </summary> /// <param name="map">Map to be loaded</param> /// <param name="mapMetaData">Map meta data to be loaded</param> private async Task LoadMapAssets(AssetModel map, MapMetaData mapMetaData) { var loading = true; try { var callback = new Action <bool, string, string>((isDone, sceneName, mapBundlePath) => { var scene = SceneManager.GetSceneByName(sceneName); SceneManager.SetActiveScene(scene); CurrentMapMetaData = mapMetaData; if (Loader.Instance.SimConfig != null) { Loader.Instance.SimConfig.MapName = CurrentMapMetaData.name; } CurrentMapBounds = CalculateMapBounds(scene); LaneSnapping.Initialize(); loadedSceneName = sceneName; PlayerPrefs.SetString(MapPersistenceKey, CurrentMapMetaData.name); loading = false; MapChanged?.Invoke(CurrentMapMetaData); }); Loader.LoadMap(map.AssetGuid, map.Name, LoadSceneMode.Additive, callback); while (loading) { await Task.Delay(100); } } catch (Exception ex) { ScenarioManager.Instance.logPanel.EnqueueError(ex.Message); } }
private void StartNewGameRoutine() { //begin mod var m_MapName = this.Find <UITextField>("MapName"); var m_FileList = this.Find <UIListBox>("MapList"); //end mod SimulationMetaData ngs = new SimulationMetaData() { m_CityName = m_MapName.text, m_gameInstanceIdentifier = Guid.NewGuid().ToString(), m_invertTraffic = !this.Find <UICheckBox>("InvertTraffic").isChecked ? SimulationMetaData.MetaBool.False : SimulationMetaData.MetaBool.True, m_disableAchievements = Singleton <PluginManager> .instance.enabledModCount <= 0 ? SimulationMetaData.MetaBool.False : SimulationMetaData.MetaBool.True, m_currentDateTime = DateTime.Now, m_newGameAppVersion = 159507472, m_updateMode = SimulationManager.UpdateMode.NewGameFromMap }; //begin mod ngs.m_environment = m_forceEnvironment; //end mod MapMetaData listingMetaData = this.GetListingMetaData(m_FileList.selectedIndex); if (listingMetaData.mapThemeRef != null) { Package.Asset assetByName = PackageManager.FindAssetByName(listingMetaData.mapThemeRef); if (assetByName != (Package.Asset)null) { ngs.m_MapThemeMetaData = assetByName.Instantiate <MapThemeMetaData>(); ngs.m_MapThemeMetaData.SetSelfRef(assetByName); } } Singleton <LoadingManager> .instance.LoadLevel(this.GetListingData(m_FileList.selectedIndex), "Game", "InGame", ngs); UIView.library.Hide(this.GetType().Name, 1); }
public void PreprocessMain(ReplayGamestate gamestate, MapMetaData mapmeta, EncounterDetectionData nedData) { //foreach (var round in gamestate.match.rounds) // foreach (var tick in round.ticks) // foreach (var tevent in tick.tickevents) // HashGridcells(tevent); }
public static MapMetaData CreateMapMetaData(string sourceMapFolder, bool findMapFiles) { MapMetaData metaData = new MapMetaData(); metaData.IsHiddenByUser = false; metaData.CustomName = ""; MapListItem validMap = GetFirstMapInFolder(sourceMapFolder, isValid: true); if (validMap == null) { return(null); } metaData.MapName = validMap.MapName; metaData.MapFileDirectory = ReplaceSourceMapPathWithPathToContent(sourceMapFolder, validMap.DirectoryPath); if (findMapFiles) { metaData.FilePaths = FileUtils.GetAllFilesInDirectory(sourceMapFolder); // modify file paths to match the target folder Session "Content" folder for (int i = 0; i < metaData.FilePaths.Count; i++) { metaData.FilePaths[i] = ReplaceSourceMapPathWithPathToContent(sourceMapFolder, metaData.FilePaths[i]); } } else { metaData.FilePaths = new List <string>(); } return(metaData); }
public InclineMeshData BuildMeshData(MapMetaData mapMetaData) { DateTime startTime = System.DateTime.Now; Debug.Log("started making incline mesh at " + startTime); int numInclineNodesX = Mathf.CeilToInt(mapMetaData.mapTerrainDataCells.GetLength(0) / (float)downsampleFactor); int numInclineNodesZ = Mathf.CeilToInt(mapMetaData.mapTerrainDataCells.GetLength(1) / (float)downsampleFactor); InclineMeshData meshData = new InclineMeshData(numInclineNodesX, numInclineNodesZ); meshData.downsampleFactor = downsampleFactor; meshData.mapMetaData = mapMetaData; for (int x = 0; x < numInclineNodesX; ++x) { for (int z = 0; z < numInclineNodesZ; ++z) { InclineIndexPoint inclinePoint = new InclineIndexPoint(x, z); processNode(meshData, mapMetaData, inclinePoint); } } DateTime endTime = System.DateTime.Now; TimeSpan elapsed = endTime - startTime; Debug.Log("finished making incline mesh at " + endTime); Debug.Log("Elapsed Time: " + elapsed); return(meshData); }
static bool Prefix(MapMetaData __instance, ref MapTerrainDataCell __result, Point index, MapTerrainDataCell[,] ___mapTerrainDataCells) { try { __result = ___mapTerrainDataCells[index.Z, index.X]; } catch (IndexOutOfRangeException) { __result = InvalidCell; } return(false); }
static bool Prefix(MapMetaDataExporter __instance, MapMetaData existingMapMetaData, string encounterLayerGuid, DataManager dataManager) { Main.Logger.Log($"[MapMetaDataExporterPatch Prefix] Patching LoadMapMetaDataV2"); if (MissionControl.Instance.IsCustomContractType) { return(false); } return(true); }
public void Load(EndianStream stream, MapMetaData mapMetaData) { Offset = stream.Position; Ident = stream.ReadInt32(); Tag = mapMetaData.GetTag(Ident); RunTimeMinimium = stream.ReadByte(); RunTimeMaximium = stream.ReadByte(); CountOnMap = stream.ReadByte(); DesignTimeMaximium = stream.ReadByte(); Cost = stream.ReadFloat(); }
public static bool HasPathToMapFilesStored(MapListItem map) { MapMetaData metaData = LoadMapMetaData(map); if (metaData != null) { return(metaData.FilePaths?.Count > 0); } return(false); }
internal static string GetOriginalImportLocation(MapListItem map) { MapMetaData metaData = LoadMapMetaData(map); if (metaData == null) { return(""); } return(metaData.OriginalImportPath); }
public static MapMetaData CreateMapMetaData(MapListItem map) { MapMetaData metaData = new MapMetaData(); metaData.MapName = map.MapName; metaData.MapFileDirectory = map.DirectoryPath; metaData.FilePaths = new List <string>(); metaData.IsHiddenByUser = map.IsHiddenByUser; metaData.CustomName = map.CustomName; return(metaData); }
/// <summary> /// Gets the meta .json for the map if it exists and updates /// the custom name and IsHiddenByUser property /// </summary> public static void SetCustomPropertiesForMap(MapListItem map, bool createIfNotExists = false) { if (map.IsDefaultMap) { return; } MapMetaData savedMetaData = LoadMapMetaData(map); if (savedMetaData == null) { if (createIfNotExists) { savedMetaData = CreateMapMetaData(map); SaveMapMetaData(savedMetaData); } else { return; } } // grab image from asset store if exists and path not set yet bool hasChanged = false; if (!string.IsNullOrWhiteSpace(savedMetaData.PathToImage) && !File.Exists(savedMetaData.PathToImage)) { // remove image path if file does not exist savedMetaData.PathToImage = ""; hasChanged = true; } if (string.IsNullOrWhiteSpace(savedMetaData.PathToImage) && !string.IsNullOrEmpty(savedMetaData.AssetNameWithoutExtension)) { string pathToStoreThumbnail = Path.Combine(AssetStoreViewModel.AbsolutePathToThumbnails, savedMetaData.AssetNameWithoutExtension); if (File.Exists(pathToStoreThumbnail)) { savedMetaData.PathToImage = pathToStoreThumbnail; hasChanged = true; } } if (hasChanged) { SaveMapMetaData(savedMetaData); } map.IsHiddenByUser = savedMetaData.IsHiddenByUser; map.CustomName = savedMetaData.CustomName; map.PathToImage = savedMetaData.PathToImage; }
/// <summary> /// Downloads selected map asynchronously and updates the loading information /// </summary> /// <param name="map">Map to download</param> /// <param name="loadingProcess">Loading process to update with progress</param> /// <returns>Task</returns> private async Task DownloadMap(MapMetaData map, LoadingPanel.LoadingProcess loadingProcess) { mapBeingDownloaded = map.assetGuid; var progressUpdate = new Progress <Tuple <string, float> >(p => { loadingProcess?.Update($"Downloading {p.Item1} {p.Item2:F}%."); }); map.assetModel = await DownloadManager.GetAsset(BundleConfig.BundleTypes.Environment, map.assetGuid, map.name, progressUpdate); mapBeingDownloaded = null; }
float getDistanceBetweenTwoInclinePoints(InclineMeshData meshData, MapMetaData mapMetaData) { InclineIndexPoint inclinePoint1 = new InclineIndexPoint(1, 1); InclineIndexPoint inclinePoint2 = new InclineIndexPoint(1, 2); Point mapPoint1 = meshData.InclineIndicesToMapIndices(inclinePoint1); Point mapPoint2 = meshData.InclineIndicesToMapIndices(inclinePoint2); Vector3 worldVec1 = mapMetaData.getWorldPos(mapPoint1); Vector3 worldVec2 = mapMetaData.getWorldPos(mapPoint2); return((worldVec2 - worldVec1).magnitude); }
public static void LoadMapData(this EncounterLayerData layerData, EncounterLayerIdentifier encounterLayerIdentifier, DataManager dataManager) { EncounterLayerParent component = MissionControl.MissionControl.Instance.EncounterLayerParent; MapMetaDataExporter mapMetaExporter = component.GetComponent <MapMetaDataExporter>(); AccessTools.Method(typeof(MapMetaDataExporter), "LoadMapMetaDataOnly").Invoke(mapMetaExporter, new object[] { UnityGameInstance.BattleTechGame.Combat.MapMetaData, dataManager }); MapMetaData mapMetaData = mapMetaExporter.mapMetaData; InclineMeshData inclineMeshData = mapMetaExporter.inclineMeshData; string encounterLayerIdentifierPath = encounterLayerIdentifier.path; string encounterLayerDataName = MapMetaDataExporter.GetEncounterLayerDataName(encounterLayerIdentifier.name); MissionControl.Main.LogDebug("[LoadMapData] Borrowing Map Data form Layer Data " + encounterLayerDataName); encounterLayerIdentifierPath = dataManager.ResourceLocator.EntryByID(encounterLayerDataName, BattleTechResourceType.LayerData, false).FilePath; byte[] data = File.ReadAllBytes(encounterLayerIdentifierPath); EncounterLayerData layerByGuid = layerData; Serializer.Deserialize <EncounterLayerData>(data, SerializationTarget.Exported, TargetMaskOperation.HAS_ANY, layerByGuid); layerByGuid.ReattachReferences(); using (SerializationStream serializationStream = new SerializationStream(File.ReadAllBytes(encounterLayerIdentifierPath.Replace(".bin", "_RaycastInfo.bin")))) { layerByGuid.LoadRaycastInfo(serializationStream); } int length = mapMetaData.mapTerrainDataCells.GetLength(1); int length2 = mapMetaData.mapTerrainDataCells.GetLength(0); for (int i = 0; i < length; i++) { for (int j = 0; j < length2; j++) { mapMetaData.mapTerrainDataCells[i, j].MapEncounterLayerDataCell = layerByGuid.mapEncounterLayerDataCells[i, j]; mapMetaData.mapTerrainDataCells[i, j].UpdateCachedValues(); } } string inclineMeshPathFromEncounterLayerDataPath = encounterLayerIdentifierPath.Replace(".bin", "_InclineMesh.IMS"); inclineMeshData = new InclineMeshData(); if (inclineMeshData.LoadFromPath(inclineMeshPathFromEncounterLayerDataPath)) { inclineMeshData.mapMetaData = mapMetaData; layerByGuid.inclineMeshData = inclineMeshData; } else { layerByGuid.inclineMeshData = null; } mapMetaExporter.mapTags = new TagSet(mapMetaData.mapTags); MissionControl.Main.LogDebug("[LoadMapData] Load Complete"); }
public CacheNode(Vector3 worldPosition, MapMetaData mapMetaData) { this.CellIndex = mapMetaData.GetIndex(worldPosition); this.cells = new MapTerrainDataCell[9]; for (int i = 0; i < 9; i++) { this.cells[i] = mapMetaData.GetCellAt(this.CellIndex.X + xDiff[i], this.CellIndex.Z + zDiff[i]); } this.UpdateLocalGrade(); this.UpdateSteepness(); this.UpdateIsPassableTerrain(); this.NeighborLinks = new CacheNodeLink[8]; }
/// <summary> /// Downloads selected map asynchronously and updates the loading information /// </summary> /// <param name="map">Map to download</param> /// <param name="loadingProcess">Loading process to update with progress</param> /// <returns>Task</returns> private async Task DownloadMap(MapMetaData map, LoadingPanel.LoadingProcess loadingProcess) { ScenarioManager.Instance.ReportAssetDownload(map.assetGuid); var progressUpdate = new Progress <Tuple <string, float> >(p => { loadingProcess?.Update($"Downloading {p.Item1} {p.Item2:F}%."); }); map.assetModel = await DownloadManager.GetAsset(BundleConfig.BundleTypes.Environment, map.assetGuid, map.name, progressUpdate); ScenarioManager.Instance.ReportAssetFinishedDownload(map.assetGuid); }
public void UpdateIsPassableTerrain() { switch (MapMetaData.GetPriorityTerrainMaskFlags(this.cells[0])) { case (TerrainMaskFlags.DeepWater): case (TerrainMaskFlags.Impassable): case (TerrainMaskFlags.MapBoundary): this.IsImpassibleTerrain = true; break; default: this.IsImpassibleTerrain = false; break; } }
/// <summary> /// Updates the meta .json files for the maps with the new /// custom names and if it is hidden. /// </summary> public static bool WriteCustomMapPropertiesToFile(MapListItem map) { MapMetaData metaDataToSave = LoadMapMetaData(map); if (metaDataToSave == null) { // metadata is missing from so re-create it metaDataToSave = CreateMapMetaData(map); } metaDataToSave.IsHiddenByUser = map.IsHiddenByUser; metaDataToSave.CustomName = map.CustomName; return(SaveMapMetaData(metaDataToSave)); }
//Constructor public TiledMapPanel(PlayScene parent, PlayParameters parameters) : base(parent) { tileTextures = new Dictionary <string, Sprite>(); tileSetsMetaData = new Dictionary <string, TileSetMetaData>(); mapMetaData = Maploader.Instance.LoadMapMetaData(parameters.mapFileName); foreach (TileSets entry in mapMetaData.tilesets) { TileSetMetaData metaData = Maploader.Instance.LoadTileSetMetaData(entry.source); tileTextures.Add(entry.source, new Sprite(metaData.name, "assets/images/" + metaData.image, 0, 254, 0)); tileTextures[entry.source].SubRect.h = mapMetaData.tileheight; tileTextures[entry.source].SubRect.w = mapMetaData.tilewidth; tileTextures[entry.source].Pos.h = mapMetaData.tileheight; tileTextures[entry.source].Pos.w = mapMetaData.tilewidth; tileSetsMetaData.Add(entry.source, metaData); } }
/// <summary> /// Thread: Main /// Invoked when a level has completed the loading process. /// </summary> /// <param name="mode">Defines what kind of level was just loaded.</param>* public override void OnLevelLoaded(LoadMode mode) { if (mode != LoadMode.NewGame) return; MapMetaData data = new MapMetaData(); Log.Message(String.Format("MapName: {0}", data.mapName)); loadMode = mode; try { UIView v = UIView.GetAView(); uiComponent = (UIComponent)v.AddUIComponent(typeof(ConfigurationPanel)); } catch (Exception ex) { Log.Error("Adding UI Error: " + ex.ToString()); } }
public static List <MapMetaData> GetAllMetaDataForMaps() { List <MapMetaData> maps = new List <MapMetaData>(); CreateMetaDataFolder(); foreach (string file in Directory.GetFiles(FullPathToMetaFolder, "*_meta.json")) { MapMetaData foundMetaData = LoadMapMetaData(file); if (foundMetaData != null) { maps.Add(foundMetaData); } } return(maps); }
/// <summary> /// Deletes the selected asset files from Session folders /// </summary> public void RemoveSelectedAsset() { AssetViewModel assetToRemove = SelectedAsset; BoolWithMessage deleteResult = BoolWithMessage.False(""); if (assetToRemove.AssetCategory == AssetCategory.Maps.Value) { MapMetaData mapToDelete = MetaDataManager.GetAllMetaDataForMaps()?.Where(m => m.AssetName == assetToRemove.Asset.ID).FirstOrDefault(); if (mapToDelete == null) { UserMessage = "Failed to find meta data to delete map files ..."; return; } deleteResult = MetaDataManager.DeleteMapFiles(mapToDelete); } else { TextureMetaData textureToDelete = MetaDataManager.GetTextureMetaDataByName(assetToRemove.Asset.ID); if (textureToDelete == null) { UserMessage = $"Failed to find meta data to delete texture files for {assetToRemove.Asset.ID}..."; return; } deleteResult = MetaDataManager.DeleteTextureFiles(textureToDelete); } UserMessage = deleteResult.Message; if (deleteResult.Result) { RefreshPreviewForSelected(); // refresh list if filtering by installed or uninstalled if (SelectedInstallStatus != defaultInstallStatusValue) { RefreshFilteredAssetList(); } } }
/// <summary> /// Thread: Main /// Invoked when a level has completed the loading process. /// </summary> /// <param name="mode">Defines what kind of level was just loaded.</param>* public override void OnLevelLoaded(LoadMode mode) { if (mode != LoadMode.NewGame) { return; } MapMetaData data = new MapMetaData(); Log.Message(String.Format("MapName: {0}", data.mapName)); loadMode = mode; try { UIView v = UIView.GetAView(); uiComponent = (UIComponent)v.AddUIComponent(typeof(ConfigurationPanel)); } catch (Exception ex) { Log.Error("Adding UI Error: " + ex.ToString()); } }
/// <summary> /// Gets the meta .json for the map if it exists and updates /// the custom name and IsHiddenByUser property /// </summary> public static void SetCustomPropertiesForMap(MapListItem map, bool createIfNotExists = false) { MapMetaData savedMetaData = LoadMapMetaData(map); if (savedMetaData == null) { if (createIfNotExists) { savedMetaData = CreateMapMetaData(map); SaveMapMetaData(savedMetaData); } else { return; } } map.IsHiddenByUser = savedMetaData.IsHiddenByUser; map.CustomName = savedMetaData.CustomName; }
public void Test_CreateMapMetaData_Returns_Correct_FilePaths() { SessionPath.ToSession = TestPaths.ToSessionTestFolder; string pathToMapImporting = Path.Combine(TestPaths.ToTestFilesFolder, "Mock_Map_Files", "cool_valid_map"); MapMetaData expectedResult = new MapMetaData() { FilePaths = new List <string>() { Path.Combine(SessionPath.ToContent, "coolmap.uexp"), Path.Combine(SessionPath.ToContent, "coolmap.umap"), Path.Combine(SessionPath.ToContent, "coolmap_BuiltData.uexp"), Path.Combine(SessionPath.ToContent, "coolmap_BuiltData.uasset"), Path.Combine(SessionPath.ToContent, "coolmap_BuiltData.ubulk") } }; MapMetaData actualResult = MetaDataManager.CreateMapMetaData(pathToMapImporting, true); actualResult.FilePaths.TrueForAll(s => expectedResult.FilePaths.Contains(s)); expectedResult.FilePaths.TrueForAll(s => actualResult.FilePaths.Contains(s)); }
public TagEntry(EndianStream stream, MapMetaData mapMetaData) { Load(stream, mapMetaData); PlacedObjects = new List<ObjectChunk>(); }
private void LoadMapMetaData() { var taglist = VariousFunctions.GZip.Decompress(VariousFunctions.GetTaglistFile(GameId, SandboxHeader.MapID)); SandboxMapMetaData = JsonConvert.DeserializeObject<MapMetaData>(VariousFunctions.ByteArrayToString(taglist, VariousFunctions.EncodingType.ASCII)); }
private static void CreateImageBitmap(MapMetaData imageMd, out WriteableBitmap writeableBitmap) { var format = MapPixelFormat(imageMd.PixelFormat); CreateImageBitmap(imageMd, out writeableBitmap, format); }
private static void CreateImageBitmap(MapMetaData imageMd, out WriteableBitmap writeableBitmap, System.Windows.Media.PixelFormat format) { var bmpWidth = (int)imageMd.FullXRes; var bmpHeight = (int)imageMd.FullYRes; writeableBitmap = new WriteableBitmap(bmpWidth, bmpHeight, 96.0, 96.0, format, null); }
private static void CopyWritableBitmap(MapMetaData imageMd, IntPtr data, WriteableBitmap b) { int dataSize = (int) imageMd.DataSize; var rect = new Int32Rect((int) imageMd.XOffset, (int) imageMd.YOffset, (int) imageMd.XRes, (int) imageMd.YRes); b.WritePixels(rect, data, dataSize, b.BackBufferStride); }