diff --git a/GUIs/skyscraper8.AnagramViewer/Handlers/PngHandler.cs b/GUIs/skyscraper8.AnagramViewer/Handlers/PngHandler.cs new file mode 100644 index 0000000..a06a9f9 --- /dev/null +++ b/GUIs/skyscraper8.AnagramViewer/Handlers/PngHandler.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using skyscraper5.Skyscraper.IO; + +namespace skyscraper8.AnagramViewer.Handlers +{ + internal class PngHandler : IFileTypeHandler + { + public DataType CheckDataType(Stream input) + { + if (input.ReadUInt32LE() == 1196314761) + return DataType.Image; + return DataType.Unknown; + } + + public Image AsImage(Stream input) + { + return Image.FromStream(input); + } + + public string AsText(Stream input) + { + throw new NotImplementedException(); + } + } +} diff --git a/GUIs/skyscraper8.AnagramViewer/Program.cs b/GUIs/skyscraper8.AnagramViewer/Program.cs index 3eb2b32..a253ac4 100644 --- a/GUIs/skyscraper8.AnagramViewer/Program.cs +++ b/GUIs/skyscraper8.AnagramViewer/Program.cs @@ -61,17 +61,20 @@ namespace skyscraper8.AnagramViewer return; } + Form finalForm = null; switch (determiendDataType) { case DataType.Image: Image asImage = usableHandler.AsImage(bufferedStream); - ImageViewer imageViewer = new ImageViewer(asImage); - Application.Run(imageViewer); - return; + finalForm = new ImageViewer(asImage); + break; default: MessageBox.Show(String.Format("Don't know how to handle files of type {0}", determiendDataType.ToString())); return; } + + finalForm.Text = String.Format("Anagram Viewer - [{0}]", fi.Name); + Application.Run(finalForm); } } } \ No newline at end of file diff --git a/GUIs/skyscraper8.AnagramViewer/Properties/launchSettings.json b/GUIs/skyscraper8.AnagramViewer/Properties/launchSettings.json index d9e6455..bebb17c 100644 --- a/GUIs/skyscraper8.AnagramViewer/Properties/launchSettings.json +++ b/GUIs/skyscraper8.AnagramViewer/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "skyscraper8.AnagramViewer": { "commandName": "Project", - "commandLineArgs": "\"C:\\Users\\Sascha Schiemann\\source\\repos\\skyscraper8\\skyscraper8\\bin\\Debug\\net8.0\\iq.bin\"" + "commandLineArgs": "\"Y:\\data\\outputs\\txt2img-images\\2025-07-20\\00025-394627821.png\"" } } } \ No newline at end of file