public void TryIcon() { if (!this.IsIcon) { return; } var iconName = this.Elias.Sprite + "_small"; var icon = ImageAssetUtil.SolveFile(Elias.OUTPUT_PATH, "_icon_", false); if (icon == null) { icon = ImageAssetUtil.SolveFile(Elias.OUTPUT_PATH, Node.Attributes.GetNamedItem("name").InnerText, false); } if (icon == null) { var symbol = ImageAssetUtil.SolveSymbolReference(Elias, Node.Attributes.GetNamedItem("name").InnerText); if (symbol != null) { icon = symbol.Item2; } } if (icon != null) { /* Console.ForegroundColor = ConsoleColor.Yellow; * Console.Write("Writing icon: "); * Console.ResetColor(); * Console.WriteLine(iconName); */ File.WriteAllText(Path.Combine(Elias.IMAGE_PATH, iconName + ".txt"), ShockwaveRectanglePoint[0] + "," + ShockwaveRectanglePoint[1]); var iconDestination = Path.Combine(Elias.IMAGE_PATH, iconName + ".png"); if (File.Exists(iconDestination)) { File.Delete(iconDestination); } File.Copy(icon, iconDestination); } }
public void WriteFlippedAssets() { if (IsIcon) { return; } if (IsShadow) { return; } if (FlashSourceAliasName != null) { var flashFile = ImageAssetUtil.SolveFile(Elias.OUTPUT_PATH, FlashSourceAliasName); if (flashFile == null) { var symbolData = ImageAssetUtil.SolveSymbolReference(Elias, FlashSourceAliasName); if (symbolData != null) { var symbolID = symbolData.Item1; var symbolReference = symbolData.Item2; var symbolFileName = Path.GetFileNameWithoutExtension(Path.GetFileName(symbolReference).Replace(symbolID + "_" + Elias.Sprite + "_", "")); var symbolAsset = Elias.Assets.FirstOrDefault(asset => asset.FlashSourceAliasName == symbolFileName && FlashRectanglePoint[0] == asset.FlashRectanglePoint[0] && FlashRectanglePoint[1] == asset.FlashRectanglePoint[1]); if (symbolAsset != null) { IsMemberAlias = true; FlashSourceAliasName = symbolFileName; ShockwaveSourceAliasName = AssetUtil.ConvertName(Elias, this, FlashSourceAliasName); } else { // Copy it over because different regpoints File.Copy(symbolReference, Path.Combine(Elias.OUTPUT_PATH, "images", FlashSourceAliasName + ".png")); } } else { if (!IsMemberAlias) { Bitmap bmp = new Bitmap(1, 1); bmp.Save(Path.Combine(Elias.OUTPUT_PATH, "images", FlashSourceAliasName + ".png"), ImageFormat.Png); bmp.Dispose(); } } } else { //if (!this.IsInverted()) { FlashSourceAliasName = null; ShockwaveSourceAliasName = null; IsMemberAlias = false; } var newPath = Path.Combine(Elias.OUTPUT_PATH, "images", FlashAssetName + ".png"); if (File.Exists(newPath)) { File.Delete(newPath); } File.Copy(flashFile, newPath); if (this.IsInverted()) { this.FlipX = true; var bitmap1 = (Bitmap)Bitmap.FromFile(newPath); bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY); bitmap1.Save(newPath); bitmap1.Dispose(); } } } }
public void WriteAssets() { if (IsIcon) { return; } if (IsShadow) { return; } for (int i = 0; i < Node.Attributes.Count; i++) { var attribute = Node.Attributes.Item(i); if (attribute == null) { continue; } if (attribute.Name == "name") { FlashAssetName = attribute.InnerText; ShockwaveAssetName = AssetUtil.ConvertName(Elias, this, attribute.InnerText); var flashFile = ImageAssetUtil.SolveFile(Elias.OUTPUT_PATH, FlashAssetName); if (flashFile == null) { var symbolData = ImageAssetUtil.SolveSymbolReference(Elias, FlashAssetName); if (symbolData != null) { var symbolID = symbolData.Item1; var symbolReference = symbolData.Item2; var symbolFileName = Path.GetFileNameWithoutExtension(Path.GetFileName(symbolReference).Replace(symbolID + "_" + Elias.Sprite + "_", "")); var symbolAsset = Elias.Assets.FirstOrDefault(asset => asset.FlashAssetName == symbolFileName && FlashRectanglePoint[0] == asset.FlashRectanglePoint[0] && FlashRectanglePoint[1] == asset.FlashRectanglePoint[1]); if (symbolAsset != null) { IsMemberAlias = true; FlashSourceAliasName = symbolFileName; ShockwaveSourceAliasName = AssetUtil.ConvertName(Elias, this, FlashSourceAliasName); } else { // Copy it over because different regpoints File.Copy(symbolReference, Path.Combine(Elias.OUTPUT_PATH, "images", FlashAssetName + ".png")); } } else { if (!IsMemberAlias) { Bitmap bmp = new Bitmap(1, 1); bmp.Save(Path.Combine(Elias.OUTPUT_PATH, "images", FlashAssetName + ".png"), ImageFormat.Png); } } } } } }