aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-11 12:37:11 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-11 12:37:11 +0300
commitbd49bdcb109a227130d7db6856e659b435d16530 (patch)
treedb55cfdc5dae423ccdba5c7efb1162d33bdcdc48 /Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs
parentd65e5f1a23374de2872a73034e430e4a70ee4269 (diff)
downloadTango-bd49bdcb109a227130d7db6856e659b435d16530.tar.gz
Tango-bd49bdcb109a227130d7db6856e659b435d16530.zip
Embedded Tango.AnimatedGif !
Diffstat (limited to 'Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs')
-rw-r--r--Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs b/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs
new file mode 100644
index 000000000..cde458d0f
--- /dev/null
+++ b/Software/Visual_Studio/Tango.AnimatedGif/Decoding/GifCommentExtension.cs
@@ -0,0 +1,37 @@
+using System.IO;
+using System.Text;
+
+namespace Tango.AnimatedGif.Decoding
+{
+ internal class GifCommentExtension : GifExtension
+ {
+ internal const int ExtensionLabel = 0xFE;
+
+ public string Text { get; private set; }
+
+ private GifCommentExtension()
+ {
+ }
+
+ internal override GifBlockKind Kind
+ {
+ get { return GifBlockKind.SpecialPurpose; }
+ }
+
+ internal static GifCommentExtension ReadComment(Stream stream)
+ {
+ var comment = new GifCommentExtension();
+ comment.Read(stream);
+ return comment;
+ }
+
+ private void Read(Stream stream)
+ {
+ // Note: at this point, the label (0xFE) has already been read
+
+ var bytes = GifHelpers.ReadDataBlocks(stream, false);
+ if (bytes != null)
+ Text = Encoding.ASCII.GetString(bytes);
+ }
+ }
+}