AnagramViewer will now gladly display all your PNGs, for great justice.

This commit is contained in:
feyris-tan 2025-07-27 00:04:30 +02:00
parent e020969df0
commit bc9bc35c5b
3 changed files with 36 additions and 4 deletions

View File

@ -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();
}
}
}

View File

@ -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);
}
}
}

View File

@ -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\""
}
}
}