public static List <Section_AHDR> GetAssets(out bool success, out bool overwrite) { ImportTextures a = new ImportTextures(); if (a.ShowDialog() == DialogResult.OK) { ReadFileMethods.treatStuffAsByteArray = true; List <Section_AHDR> AHDRs = new List <Section_AHDR>(); for (int i = 0; i < a.filePaths.Count; i++) { if (Path.GetExtension(a.filePaths[i]).ToLower().Equals(".rwtex")) { byte[] data = ReadFileMethods.ExportRenderWareFile(new TextureDictionary_0016() { textureDictionaryStruct = new TextureDictionaryStruct_0001() { textureCount = 1, unknown = 0 }, textureNativeList = new List <TextureNative_0015>() { new TextureNative_0015().FromBytes(File.ReadAllBytes(a.filePaths[i])) }, textureDictionaryExtension = new Extension_0003() }, ArchiveEditorFunctions.currentTextureVersion); string assetName = Path.GetFileNameWithoutExtension(a.filePaths[i]) + (a.checkBoxRW3.Checked ? ".RW3" : ""); Section_ADBG ADBG = new Section_ADBG(0, assetName, "", 0); Section_AHDR AHDR = new Section_AHDR(Functions.BKDRHash(assetName), AssetType.RWTX, ArchiveEditorFunctions.AHDRFlagsFromAssetType(AssetType.RWTX), ADBG, data); AHDRs.Add(AHDR); } else { AHDRs.Add(ArchiveEditorFunctions.CreateRWTXFromBitmap(a.filePaths[i], a.checkBoxRW3.Checked, a.checkBoxFlipTextures.Checked, a.checkBoxMipmaps.Checked, a.checkBoxCompress.Checked)); } } ReadFileMethods.treatStuffAsByteArray = false; success = true; overwrite = a.checkBoxOverwrite.Checked; return(AHDRs); } else { success = false; overwrite = false; return(null); } }
public static (List <Section_AHDR> AHDRs, bool overwrite) GetAssets(Game game, Platform platform) { ImportTextures a = new ImportTextures(); if (a.ShowDialog() == DialogResult.OK) { ReadFileMethods.treatStuffAsByteArray = true; List <Section_AHDR> AHDRs = new List <Section_AHDR>(); List <string> forBitmap = new List <string>(); for (int i = 0; i < a.filePaths.Count; i++) { if (Path.GetExtension(a.filePaths[i]).ToLower().Equals(".rwtex")) { byte[] data = ReadFileMethods.ExportRenderWareFile(new TextureDictionary_0016() { textureDictionaryStruct = new TextureDictionaryStruct_0001() { textureCount = 1, unknown = 0 }, textureNativeList = new List <TextureNative_0015>() { new TextureNative_0015().FromBytes(File.ReadAllBytes(a.filePaths[i])) }, textureDictionaryExtension = new Extension_0003() }, currentTextureVersion(game)); string assetName = Path.GetFileNameWithoutExtension(a.filePaths[i]) + (a.checkBoxRW3.Checked ? ".RW3" : ""); Section_ADBG ADBG = new Section_ADBG(0, assetName, "", 0); Section_AHDR AHDR = new Section_AHDR(Functions.BKDRHash(assetName), AssetType.RWTX, ArchiveEditorFunctions.AHDRFlagsFromAssetType(AssetType.RWTX), ADBG, data); AHDRs.Add(AHDR); } else { forBitmap.Add(a.filePaths[i]); } } AHDRs.AddRange(CreateRWTXsFromBitmaps(game, platform, forBitmap, a.checkBoxRW3.Checked, a.checkBoxFlipTextures.Checked, a.checkBoxMipmaps.Checked, a.checkBoxCompress.Checked, a.checkBoxTransFix.Checked)); ReadFileMethods.treatStuffAsByteArray = false; if (game == Game.Scooby) { for (int i = 0; i < AHDRs.Count; i++) { byte[] data = AHDRs[i].data; FixTextureForScooby(ref data); AHDRs[i].data = data; } } return(AHDRs, a.checkBoxOverwrite.Checked); } return(null, false); }