scripts
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
|
||||
namespace Hjg.Pngcs.Chunks
|
||||
{
|
||||
// Token: 0x0200002F RID: 47
|
||||
public class PngChunkTEXT : PngChunkTextVar
|
||||
{
|
||||
// Token: 0x060001A7 RID: 423 RVA: 0x00006F71 File Offset: 0x00005171
|
||||
public PngChunkTEXT(ImageInfo info)
|
||||
: base("tEXt", info)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060001A8 RID: 424 RVA: 0x00006F80 File Offset: 0x00005180
|
||||
public override ChunkRaw CreateRawChunk()
|
||||
{
|
||||
if (this.key.Length == 0)
|
||||
{
|
||||
throw new PngjException("Text chunk key must be non empty");
|
||||
}
|
||||
byte[] bytes = PngHelperInternal.charsetLatin1.GetBytes(this.key);
|
||||
byte[] bytes2 = PngHelperInternal.charsetLatin1.GetBytes(this.val);
|
||||
ChunkRaw chunkRaw = base.createEmptyChunk(bytes.Length + bytes2.Length + 1, true);
|
||||
Array.Copy(bytes, 0, chunkRaw.Data, 0, bytes.Length);
|
||||
chunkRaw.Data[bytes.Length] = 0;
|
||||
Array.Copy(bytes2, 0, chunkRaw.Data, bytes.Length + 1, bytes2.Length);
|
||||
return chunkRaw;
|
||||
}
|
||||
|
||||
// Token: 0x060001A9 RID: 425 RVA: 0x0000700C File Offset: 0x0000520C
|
||||
public override void ParseFromRaw(ChunkRaw c)
|
||||
{
|
||||
int num = 0;
|
||||
while (num < c.Data.Length && c.Data[num] != 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
this.key = PngHelperInternal.charsetLatin1.GetString(c.Data, 0, num);
|
||||
num++;
|
||||
this.val = ((num < c.Data.Length) ? PngHelperInternal.charsetLatin1.GetString(c.Data, num, c.Data.Length - num) : "");
|
||||
}
|
||||
|
||||
// Token: 0x060001AA RID: 426 RVA: 0x00007088 File Offset: 0x00005288
|
||||
public override void CloneDataFromRead(PngChunk other)
|
||||
{
|
||||
PngChunkTEXT pngChunkTEXT = (PngChunkTEXT)other;
|
||||
this.key = pngChunkTEXT.key;
|
||||
this.val = pngChunkTEXT.val;
|
||||
}
|
||||
|
||||
// Token: 0x040000E4 RID: 228
|
||||
public const string ID = "tEXt";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user