public List <string> GetLayers() { var layers = MapFiles.SelectMany(x => x.Layers).Distinct().OrderBy(x => x).ToList(); var topLayers = TopLayerOrders.Where(x => layers.Contains(x)).ToList(); var otherLayers = layers.Where(x => !topLayers.Contains(x)).ToList(); return(topLayers.Concat(otherLayers).ToList()); }
public void addMapResult(Dictionary <string, S3ObjectMetadata> mapResult) { foreach (KeyValuePair <string, S3ObjectMetadata> pair in mapResult) { if (MapResult.ContainsKey(pair.Key)) { MapResult[pair.Key].Add(pair.Value); MapFiles.Add(pair.Value); } else { MapResult.Add(pair.Key, new List <S3ObjectMetadata>() { pair.Value }); MapFiles.Add(pair.Value); } } }
// GET: Intel public ActionResult Index() { try { var path = Server.MapPath("~/Maps"); var dInfo = new System.IO.DirectoryInfo(path); var maps = new Dictionary <string, string>(); dInfo.GetFiles().ToList().ForEach(f => maps.Add(f.Name.Replace(".svg", "").Replace("_", " "), f.Name.Replace(".svg", ""))); var viewModel = new MapFiles(); if (SSOUserManager.SiteUser != null && System.IO.Directory.Exists(string.Concat(path, "/", SSOUserManager.SiteUser.GroupName))) { dInfo = new System.IO.DirectoryInfo(string.Concat(path, "/", SSOUserManager.SiteUser.GroupName)); dInfo.GetFiles().ToList().ForEach(f => { maps[f.Name.Replace(".svg", "").Replace("_", " ")] = string.Concat(SSOUserManager.SiteUser.GroupName, "/", f.Name.Replace(".svg", "")); }); } maps.OrderBy(o => o.Key).ForEach(f => viewModel.Add(f.Key.Replace("_", " "), f.Value));; if (SSOUserManager.SiteUser == null) { viewModel.InitialMap = maps["The Citadel"]; } else { viewModel.InitialMap = maps[SSOUserManager.SiteUser.DefaultRegion]; } return(View(viewModel)); } catch { return(RedirectToAction("SSOLogin", "Home")); } }
/// <returns>A <b>new</b> <see cref="Map"/> object containing <b>only</b> the decompiled map files, or <see langword="null"/> if cancelled.</returns> public static Map?DecompileMap(Map map, MapFiles filesToDecompile, BackgroundWorker?worker) { if (!filesToDecompile.IsDefined(allowNoFlags: false)) { throw new InvalidEnumArgumentException(nameof(filesToDecompile), (int)filesToDecompile, typeof(MapFiles)); } if (filesToDecompile.HasFlag(MapFiles.Environment)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.PathingMap)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.PreviewIcons)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.ShadowMap)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.ImportedFiles)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.Info)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.AbilityObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.BuffObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.DestructableObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.DoodadObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.ItemObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.UnitObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.UpgradeObjectData)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.CustomTextTriggers)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.Script)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.TriggerStrings)) { throw new NotImplementedException(); } if (filesToDecompile.HasFlag(MapFiles.Doodads)) { throw new NotImplementedException(); } var decompiler = new JassScriptDecompiler(map); var decompiledMap = new Map(); var decompiledCount = 0; var toDecompileCount = 0; var progress = 0; if (filesToDecompile.HasFlag(MapFiles.Sounds)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Cameras)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Environment)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.PathingMap)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.PreviewIcons)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Regions)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.ShadowMap)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.ImportedFiles)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Info)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.AbilityObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.BuffObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.DestructableObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.DoodadObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.ItemObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.UnitObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.UpgradeObjectData)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.CustomTextTriggers)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Script)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Triggers)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.TriggerStrings)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Doodads)) { toDecompileCount++; } if (filesToDecompile.HasFlag(MapFiles.Units)) { toDecompileCount++; } var gameVersion = map.Info?.GameVersion; var gamePatch = gameVersion is null ? GamePatch.v1_26a : GamePatchVersionProvider.GetGamePatch(gameVersion); var progressState = new ProgressState(); bool StartDecompilingFile(MapFiles mapFile) { if (filesToDecompile.HasFlag(mapFile)) { progressState.MapFile = mapFile; worker?.ReportProgress(progress, progressState); decompiledCount++; progress = (100 * decompiledCount) / toDecompileCount; return(true); } return(false); } bool WaitForCancel() { if (worker is not null) { progressState.Error = true; worker.ReportProgress(progress, progressState); while (progressState.Error) { Thread.Sleep(500); } return(worker.CancellationPending); } return(false); } if (StartDecompilingFile(MapFiles.Sounds)) { var formatVersion = gamePatch >= GamePatch.v1_32_6 ? MapSoundsFormatVersion.ReforgedV3 : gamePatch >= GamePatch.v1_32_0 ? MapSoundsFormatVersion.Reforged : MapSoundsFormatVersion.Normal; if (decompiler.TryDecompileMapSounds(formatVersion, out var decompiledMapSounds)) { decompiledMap.Sounds = decompiledMapSounds; } else if (WaitForCancel()) { return(null); } } if (StartDecompilingFile(MapFiles.Cameras)) { var formatVersion = MapCamerasFormatVersion.Normal; var useNewFormat = gamePatch >= GamePatch.v1_31_0; if (decompiler.TryDecompileMapCameras(formatVersion, useNewFormat, out var decompiledMapCameras)) { decompiledMap.Cameras = decompiledMapCameras; } else if (WaitForCancel()) { return(null); } } if (StartDecompilingFile(MapFiles.Regions)) { var formatVersion = MapRegionsFormatVersion.Normal; if (decompiler.TryDecompileMapRegions(formatVersion, out var decompiledMapRegions)) { decompiledMap.Regions = decompiledMapRegions; } else if (WaitForCancel()) { return(null); } } if (StartDecompilingFile(MapFiles.Triggers)) { var formatVersion = gamePatch >= GamePatch.v1_07 ? MapTriggersFormatVersion.Tft : MapTriggersFormatVersion.RoC; var subVersion = gamePatch >= GamePatch.v1_31_0 ? (MapTriggersSubVersion?)MapTriggersSubVersion.New : null; if (decompiler.TryDecompileMapTriggers(formatVersion, subVersion, out var decompiledMapTriggers)) { decompiledMap.Triggers = decompiledMapTriggers; } else if (WaitForCancel()) { return(null); } } if (StartDecompilingFile(MapFiles.Units)) { var formatVersion = gamePatch >= GamePatch.v1_07 ? MapWidgetsFormatVersion.TFT : MapWidgetsFormatVersion.RoC; var subVersion = gamePatch >= GamePatch.v1_07 ? MapWidgetsSubVersion.V11 : MapWidgetsSubVersion.V9; var useNewFormat = gamePatch >= GamePatch.v1_32_0; if (decompiler.TryDecompileMapUnits(formatVersion, subVersion, useNewFormat, out var decompiledMapUnits)) { decompiledMap.Units = decompiledMapUnits; } else if (WaitForCancel()) { return(null); } } progressState.MapFile = null; worker?.ReportProgress(progress, progressState); return(decompiledMap); }
/// <summary> /// Compile the given XML file to a binary XML file in the given output folder. /// </summary> public void Build() { #if DEBUG //Debugger.Launch(); #endif // Prepare folder var outputFolder = Path.GetDirectoryName(path); if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } // Sign apk? const bool sign = true; // Collect entries var entries = new List <ApkEntry>(); entries.Add(new ApkEntry("AndroidManifest.xml", ManifestPath)); entries.AddRange(DexFiles.Select(dexFile => new ApkEntry(Path.GetFileName(dexFile), dexFile))); // Collect map files var mapFiles = MapFiles.Select(p => new MapFile(p)).ToList(); // Collect resource files var resourceEntries = new List <ApkEntry>(); if (!string.IsNullOrEmpty(ResourcesFolder)) { CollectResources(resourceEntries, ResourcesFolder, ResourcesFolder); entries.AddRange(resourceEntries); } // Collect embedded resources as assets foreach (var assembly in Assemblies) { var assets = new List <ApkEntry>(); CollectAssets(assets, assembly); entries.AddRange(assets); } // Collect native code libs CollectNativeCodeLibs(entries); // Load free apps key (if any) string freeAppKey = null; if (!string.IsNullOrEmpty(FreeAppsKeyPath)) { freeAppKey = File.ReadAllText(FreeAppsKeyPath); } // Build ZIP var manifest = new MetaInfManifestBuilder(); var signature = new MetaInfCertSfBuilder(manifest); var rsa = new MetaInfCertRsaBuilder(signature, PfxFile, PfxPassword, CertificateThumbprint, freeAppKey, PackageName); // Build signatures if (sign) { foreach (var entry in entries) { manifest.AddSha1Digest(entry.Name, entry.Data); signature.AddSha1Digest(entry.Name, entry.Data); } } // Create zip string md5FingerPrint = null; string sha1FingerPrint = null; using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write)) { using (var zipStream = new ZipOutputStream(fileStream) { UseZip64 = UseZip64.Off }) { zipStream.SetLevel(9); zipStream.PutNextEntry(new ZipEntry("META-INF/MANIFEST.MF") { CompressionMethod = CompressionMethod.Deflated }); manifest.WriteTo(zipStream); zipStream.CloseEntry(); if (sign) { zipStream.PutNextEntry(new ZipEntry("META-INF/LE-C0FC2.SF") { CompressionMethod = CompressionMethod.Deflated }); signature.WriteTo(zipStream); zipStream.CloseEntry(); zipStream.PutNextEntry(new ZipEntry("META-INF/LE-C0FC2.RSA") { CompressionMethod = CompressionMethod.Deflated }); rsa.WriteTo(zipStream, out md5FingerPrint, out sha1FingerPrint); zipStream.CloseEntry(); } foreach (var entry in entries) { var entryName = entry.Name.Replace('\\', '/'); zipStream.PutNextEntry(new ZipEntry(entryName) { CompressionMethod = GetCompressionMethod(entryName) }); entry.WriteTo(zipStream); zipStream.CloseEntry(); } } } // Save MD5 fingerprint var md5FingerPrintPath = Path.ChangeExtension(path, ".md5"); File.WriteAllText(md5FingerPrintPath, md5FingerPrint ?? string.Empty); // Save SHA1 fingerprint var sha1FingerPrintPath = Path.ChangeExtension(path, ".sha1"); File.WriteAllText(sha1FingerPrintPath, sha1FingerPrint ?? string.Empty); // Merge map files var mapFile = MergeMapFiles(mapFiles); mapFile.Save(MapFilePath); #if DEBUG // Create RSA using ( var fileStream = new FileStream(Path.Combine(outputFolder, "CERT.RSA"), FileMode.Create, FileAccess.Write)) { rsa.WriteTo(fileStream, out md5FingerPrint, out sha1FingerPrint); } #endif }
public List <MapFile> GetFilesByExtents(Geometry.Extent2D extents) { return(MapFiles.Where(x => x.Extents.IsCrossedBy(extents)).ToList()); }
public List <MapFile> GetFilesByLods(params int[] lods) { return(MapFiles.Where(x => x.Lods.Any(y => lods.Contains(y))).ToList()); }
public List <MapFile> GetFilesByLayers(params string[] layers) { return(MapFiles.Where(x => x.Layers.Any(y => layers.Contains(y))).ToList()); }
public void MapDriveRecursive() { // Start with drives if you have to search the entire computer. string[] drives = System.Environment.GetLogicalDrives(); foreach (string dr in drives) { System.IO.DriveInfo di = new System.IO.DriveInfo(dr); MapFiles mfs = new MapFiles(); // Here we skip the drive if it is not ready to be read. This // is not necessarily the appropriate action in all scenarios. if (!di.IsReady) { Console.WriteLine("The drive {0} could not be read", di.Name); continue; } try { System.IO.DirectoryInfo rootDir = di.RootDirectory; DirectoryInfo fucksake = new DirectoryInfo(@"C:\Temp"); mfs = WalkDirectoryTree(fucksake); } catch (Exception ex) { // This code just writes out the message and continues to recurse. logger.DebugFormat("Unable to process {1}{0}Error: {2}" , Environment.NewLine , GetThisMethodName() , ex.Message); } //using (BulkLoadFiles blc = new BulkLoadFiles(logger)) //{ // var dtc = blc.ConfigureDataTable(); // dtc = blc.LoadDataTableWithFiles(mfs, dtc); // blc.BulkCopy<MapFiles>(dtc, "DCMaperContext"); //} #region ioccontainer //var dt = IOCContainer.Instance.Get<BulkLoadFiles>().ConfigureDataTable(); //dt = IOCContainer.Instance.Get<BulkLoadFiles>().LoadDataTableWithTradingVolume(MapFile, dt); //if (dt == null) //{ // logger.DebugFormat("{0}No data returned on LoadDataTableWithTradingVolume", Environment.NewLine); //} //else //{ // success = IOCContainer.Instance.Get<BulkLoadFiles>().BulkCopy<MapFile>(dt, "ETFContext"); //} //return success; #endregion ioccontainer break; } // Write out all the files that could not be processed. Console.WriteLine("Files with restricted access:"); //foreach (string s in log) //{ // Console.WriteLine(s); //} // Keep the console window open in debug mode. Console.WriteLine("Press any key"); Console.ReadKey(); }
private MapFiles WalkDirectoryTree(System.IO.DirectoryInfo root) { logger.DebugFormat("{0}mapping directory: {1}", Environment.NewLine, root.FullName); MapFiles mfs = new MapFiles(); try { System.IO.FileInfo[] files = null; System.IO.DirectoryInfo[] subDirs = null; // First, process all the files directly under this folder try { files = root.GetFiles("*.*"); } #region catch errors // This is thrown if even one of the files requires permissions greater // than the application provides. catch (UnauthorizedAccessException ex) { // This code just writes out the message and continues to recurse. logger.DebugFormat("Unable to process {1}{0}drive: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , root.FullName , ex.Message); } catch (System.IO.DirectoryNotFoundException ex) { logger.DebugFormat("Unable to process {1}{0}drive: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , root.FullName , ex.Message); } catch (System.IO.PathTooLongException ex) { // This code just writes out the message and continues to recurse. logger.DebugFormat("Unable to process {1}{0}drive: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , root.Name , ex.Message); //Console.ReadKey(); } catch (Exception ex) { // This code just writes out the message and continues to recurse. logger.DebugFormat("Unable to process {1}{0}drive: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , root.FullName , ex.Message); // Console.ReadKey(); } #endregion catch errors if (files != null) { foreach (System.IO.FileInfo fi in files) { try { MapFile mf = new MapFile().LoadData(fi); string json = JsonConvert.SerializeObject(mf); mfs.Add(mf); } #region catch errors catch (System.IO.PathTooLongException ex) { // This code just writes out the message and continues to recurse. logger.DebugFormat("Unable to process {1}{0}drive: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , fi.Name , ex.Message); //Console.ReadKey(); } catch (Exception ex) { // This code just writes out the message and continues to recurse. logger.DebugFormat("Unable to process {1}{0}drive: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , fi.Name , ex.Message); // Console.ReadKey(); } #endregion catch errors } // Now find all the subdirectories under this directory. subDirs = root.GetDirectories(); foreach (System.IO.DirectoryInfo dirInfo in subDirs) { // Resursive call for each subdirectory. var more = WalkDirectoryTree(dirInfo); mfs.AddRange(more); } } } catch (Exception ex) { logger.DebugFormat("Unable to process {1}{0}root: {2}{0}Error: {3}" , Environment.NewLine , GetThisMethodName() , root.FullName , ex.Message); } using (BulkLoadFiles blc = new BulkLoadFiles(logger)) { var dtc = blc.ConfigureDataTable(); dtc = blc.LoadDataTableWithFiles(mfs, dtc); blc.BulkCopy<MapFiles>(dtc, "DCMaperContext"); } return mfs; }
private static MapFiles GetMapFiles(string[] directories) { MapFiles mfs = new MapFiles(); return mfs; }
public MapFileCheckBox(MapFiles mapFile, string fileName) { MapFile = mapFile; Text = $"{mapFile} ({fileName})"; }
protected override void FillWindow(Rect inRect) { Vector2 vector = new Vector2(inRect.width - 16f, 48f); Vector2 vector2 = new Vector2(100f, vector.y - 12f); inRect.height -= 45f; List <FileInfo> list = SaveFiles.AllSaveFiles.ToList <FileInfo>(); float num = vector.y + 8f; float height = (float)list.Count * num; Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, height); Rect position = new Rect(inRect.AtZero()); position.height -= this.bottomAreaHeight; this.scrollPosition = GUI.BeginScrollView(position, this.scrollPosition, viewRect); float num2 = 0f; foreach (FileInfo current in list) { Rect rect = new Rect(0f, num2, vector.x, vector.y); Widgets.DrawMenuSection(rect); Rect innerRect = rect.GetInnerRect(6f); GUI.BeginGroup(innerRect); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(current.Name); if (MapFiles.IsAutoSave(fileNameWithoutExtension)) { GUI.color = DialogList.AutosaveTextColor; } else { GUI.color = DialogList.ManualSaveTextColor; } Rect position2 = new Rect(15f, 0f, innerRect.width, innerRect.height); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GenFont.SetFontSmall(); GUI.Label(position2, fileNameWithoutExtension); GUI.color = Color.white; Rect position3 = new Rect(220f, 0f, innerRect.width, innerRect.height); GenFont.SetFontTiny(); GUI.color = new Color(1f, 1f, 1f, 0.5f); GUI.Label(position3, current.LastWriteTime.ToString()); GUI.color = Color.white; GUI.skin.label.alignment = TextAnchor.UpperLeft; GenFont.SetFontSmall(); float num3 = vector.x - 12f - vector2.x - vector2.y; Rect butRect = new Rect(num3, 0f, vector2.x, vector2.y); if (Widgets.TextButton(butRect, this.interactButLabel)) { this.DoMapEntryInteraction(Path.GetFileNameWithoutExtension(current.Name)); } Rect rect2 = new Rect(num3 + vector2.x + 5f, 0f, vector2.y, vector2.y); if (Widgets.ImageButton(rect2, ButtonText.DeleteX)) { FileInfo localFile = current; Find.UIRoot.layers.Add(new Dialog_Confirm("ConfirmDelete".Translate(new object[] { localFile.Name }), delegate { localFile.Delete(); }, true)); } TooltipHandler.TipRegion(rect2, "DeleteThisSavegame".Translate()); GUI.EndGroup(); num2 += vector.y + 8f; } GUI.EndScrollView(); this.DoSpecialSaveLoadGUI(inRect.AtZero()); }
protected override string[] GenerateArguments() { var builder = new List <string>(); if (Package != null) { builder.Add(ToolOptions.OutputPackage.AsArg()); builder.Add(Package.ItemSpec); } if (Manifest != null) { builder.Add(ToolOptions.InputManifest.AsArg()); builder.Add(Manifest.ItemSpec); } if (Assemblies != null) { foreach (var asm in Assemblies) { builder.Add(ToolOptions.InputAssembly.AsArg()); builder.Add(asm.ItemSpec); } } if (ResourcesFolder != null) { builder.Add(ToolOptions.ResourcesFolder.AsArg()); builder.Add(ResourcesFolder.ItemSpec); } if (DexFiles != null) { foreach (var x in DexFiles.Where(x => x != null)) { builder.Add(ToolOptions.InputCodeFile.AsArg()); builder.Add(x.ItemSpec); } } if (NativeCodeLibraries != null) { foreach (var x in NativeCodeLibraries.Where(x => x != null)) { builder.Add(ToolOptions.NativeCodeLibrary.AsArg()); builder.Add(x.ItemSpec); } } if (MapFiles != null) { foreach (var x in MapFiles.Where(x => x != null)) { builder.Add(ToolOptions.InputMapFile.AsArg()); builder.Add(x.ItemSpec); } } if (Certificate != null) { builder.Add(ToolOptions.CertificatePath.AsArg()); builder.Add(Certificate.ItemSpec); } if (!string.IsNullOrEmpty(CertificatePassword)) { builder.Add(ToolOptions.CertificatePassword.AsArg()); builder.Add(CertificatePassword); } if (!string.IsNullOrEmpty(CertificateThumbprint)) { builder.Add(ToolOptions.CertificateThumbprint.AsArg()); builder.Add(CertificateThumbprint); } if (FreeAppsKeyPath != null) { builder.Add(ToolOptions.FreeAppsKeyPath.AsArg()); builder.Add(FreeAppsKeyPath.ItemSpec); } if (DebugToken != null) { builder.Add(ToolOptions.DebugToken.AsArg()); builder.Add(DebugToken.ItemSpec); } if (!string.IsNullOrEmpty(PackageName)) { builder.Add(ToolOptions.PackageName.AsArg()); builder.Add(PackageName); } builder.AddTarget(); return(builder.ToArray()); }