public static Dictionary<string, string> ParseParameters(byte[] data) { var encoding = System.Text.Encoding.UTF8; var stream = new System.IO.MemoryStream(data); var index = new Dictionary<string, string>(); for (; stream.Position < stream.Length; ) { var nameLen = ReadLength(stream); var valueLen = ReadLength(stream); index[encoding.GetString(stream.ReadBytes(nameLen))] = encoding.GetString(stream.ReadBytes(valueLen)); } return index; }
public INode GetChildByIndex(long index) { Entry e = GetEntryByIndex(index); if (e == null) { return(null); } if (e.extract_size > e.file_size) { System.IO.MemoryStream outfile = new System.IO.MemoryStream(); long uncompressed_size = utf_tab_sharp.CpkUncompress.uncompress(infile, e.file_offset, e.file_size, outfile); utf_tab_sharp.ErrorStuff.CHECK_ERROR(uncompressed_size != e.extract_size, "uncompressed size != ExtractSize"); outfile.Position = 0; byte[] data = outfile.ReadBytes(outfile.Length); return(new FileContainer.FileFromStream(new HyoutaUtils.Streams.DuplicatableByteArrayStream(data))); } else { return(new FileContainer.FileFromStream(new HyoutaUtils.Streams.PartialStream(infile, e.file_offset, e.file_size))); } }
public static Dictionary <string, string> ParseParameters(byte[] data) { var encoding = System.Text.Encoding.UTF8; var stream = new System.IO.MemoryStream(data); var index = new Dictionary <string, string>(); for (; stream.Position < stream.Length;) { var nameLen = ReadLength(stream); var valueLen = ReadLength(stream); index[encoding.GetString(stream.ReadBytes(nameLen))] = encoding.GetString(stream.ReadBytes(valueLen)); } return(index); }
public ximg(ShaderResourceTexture T) { Prop = new bCAccessorPropertyObject(new eCImageResource2()); header = new ximgHeader(); Prop.Properties.addProperty("Width", "int", T.Width); Prop.Properties.addProperty("Height", "int", T.Height); Prop.Properties.addProperty("SkipMips", "long", 0); Prop.Properties.addProperty("PixelFormat", "bTPropertyContainer<enum eCGfxShared::eEColorFormat>", eCImageResource2_eCGfxShared_eEColorFormat.eEColorFormat_DXT1); System.IO.MemoryStream M = new System.IO.MemoryStream(T.Width * T.Height); M.Position = 0; SlimDX.Result r = SlimDX.Direct3D11.Texture2D.ToStream(T.Device.Context, T.Texture, SlimDX.Direct3D11.ImageFileFormat.Dds, M); long l = M.Position; M.Position = 0; tgaData = M.ReadBytes((int)l); M.Dispose(); }