forked from ReFuel/ReFuel.Gltf
63 lines
1.6 KiB
C#
Executable File
63 lines
1.6 KiB
C#
Executable File
namespace ReFuel.Gltf.IO
|
|
{
|
|
public class GltfUriReader : Stream
|
|
{
|
|
public Uri Uri { get; }
|
|
public string Type { get; }
|
|
public string Encoding { get; }
|
|
|
|
private string data;
|
|
private int index = 0;
|
|
|
|
public GltfUriReader(Uri uri)
|
|
{
|
|
if (uri.Scheme != "data")
|
|
throw new Exception("Expected a URI with 'data:' scheme.");
|
|
|
|
Uri = uri;
|
|
data = uri.AbsolutePath;
|
|
index = data.IndexOf(',') + 1;
|
|
|
|
if (index == 0)
|
|
{
|
|
throw new Exception("No data string.");
|
|
}
|
|
}
|
|
|
|
public override bool CanRead => true;
|
|
|
|
public override bool CanSeek => true;
|
|
|
|
public override bool CanWrite => false;
|
|
|
|
public override long Length => throw new NotImplementedException();
|
|
|
|
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
|
|
|
public override void Flush()
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override int Read(byte[] buffer, int offset, int count)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override long Seek(long offset, SeekOrigin origin)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override void SetLength(long value)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public override void Write(byte[] buffer, int offset, int count)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
}
|