Skip to content

Commit e7743ab

Browse files
feat: InMemoryRandomAccessStream
1 parent c94d459 commit e7743ab

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Streams/InMemoryRandomAccessStream.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
#pragma warning disable 114 // new keyword hiding
33
namespace Windows.Storage.Streams
44
{
5-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
5+
#if false || false || false || false || false || false || false
66
[global::Uno.NotImplemented]
77
#endif
88
public partial class InMemoryRandomAccessStream : global::Windows.Storage.Streams.IRandomAccessStream,global::Windows.Storage.Streams.IOutputStream,global::System.IDisposable,global::Windows.Storage.Streams.IInputStream
99
{
10-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
10+
#if false || false || false || false || false || false || false
1111
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
1212
public ulong Size
1313
{
@@ -21,7 +21,7 @@ public ulong Size
2121
}
2222
}
2323
#endif
24-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
24+
#if false || false || false || false || false || false || false
2525
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
2626
public bool CanRead
2727
{
@@ -31,7 +31,7 @@ public bool CanRead
3131
}
3232
}
3333
#endif
34-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
34+
#if false || false || false || false || false || false || false
3535
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
3636
public bool CanWrite
3737
{
@@ -41,7 +41,7 @@ public bool CanWrite
4141
}
4242
}
4343
#endif
44-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
44+
#if false || false || false || false || false || false || false
4545
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
4646
public ulong Position
4747
{
@@ -51,7 +51,7 @@ public ulong Position
5151
}
5252
}
5353
#endif
54-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
54+
#if false || false || false || false || false || false || false
5555
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
5656
public InMemoryRandomAccessStream()
5757
{
@@ -76,14 +76,14 @@ public InMemoryRandomAccessStream()
7676
}
7777
#endif
7878
// Forced skipping of method Windows.Storage.Streams.InMemoryRandomAccessStream.Position.get
79-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
79+
#if false || false || false || false || false || false || false
8080
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
8181
public void Seek( ulong position)
8282
{
8383
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Storage.Streams.InMemoryRandomAccessStream", "void InMemoryRandomAccessStream.Seek(ulong position)");
8484
}
8585
#endif
86-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
86+
#if false || false || false || false || false || false || false
8787
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
8888
public global::Windows.Storage.Streams.IRandomAccessStream CloneStream()
8989
{
@@ -92,7 +92,7 @@ public void Seek( ulong position)
9292
#endif
9393
// Forced skipping of method Windows.Storage.Streams.InMemoryRandomAccessStream.CanRead.get
9494
// Forced skipping of method Windows.Storage.Streams.InMemoryRandomAccessStream.CanWrite.get
95-
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
95+
#if false || false || false || false || false || false || false
9696
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
9797
public void Dispose()
9898
{
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.IO;
2+
3+
namespace Windows.Storage.Streams
4+
{
5+
public partial class InMemoryRandomAccessStream: IStreamWrapper
6+
{
7+
private MemoryStream _stream;
8+
public InMemoryRandomAccessStream() =>
9+
_stream = new();
10+
11+
private InMemoryRandomAccessStream(MemoryStream stream) =>
12+
_stream = stream;
13+
14+
public ulong Size
15+
{
16+
get => (ulong)_stream.Length;
17+
set => _stream.SetLength((long)value);
18+
}
19+
20+
public bool CanRead => _stream.CanRead;
21+
22+
public bool CanWrite => _stream.CanWrite;
23+
24+
public ulong Position => (ulong)_stream.Position;
25+
26+
public void Seek(ulong position) => _stream.Position = (long)position;
27+
28+
public IRandomAccessStream CloneStream()
29+
{
30+
var destination = new MemoryStream();
31+
_stream.Position = 0;
32+
_stream.CopyTo(destination);
33+
return new InMemoryRandomAccessStream(destination);
34+
}
35+
36+
public void Dispose() => _stream.Dispose();
37+
38+
Stream IStreamWrapper.FindStream() => _stream;
39+
}
40+
}

0 commit comments

Comments
 (0)