Skip to content

Commit

Permalink
SyncService will reopen after outdate
Browse files Browse the repository at this point in the history
  • Loading branch information
wherewhere committed Mar 11, 2024
1 parent 37707f6 commit e1ffbfc
Show file tree
Hide file tree
Showing 4 changed files with 471 additions and 397 deletions.
8 changes: 3 additions & 5 deletions AdvancedSharpAdbClient/DeviceMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,10 @@ public override string ToString() =>
.ToString();

/// <inheritdoc/>
public IDeviceMonitor Clone()
{
return Socket is not ICloneable<IAdbSocket> cloneable
public IDeviceMonitor Clone() =>
Socket is not ICloneable<IAdbSocket> cloneable
? throw new NotSupportedException($"{Socket.GetType()} does not support cloning.")
: (IDeviceMonitor)new DeviceMonitor(cloneable.Clone(), logger);
}
: new DeviceMonitor(cloneable.Clone(), logger);

/// <inheritdoc/>
object ICloneable.Clone() => Clone();
Expand Down
29 changes: 12 additions & 17 deletions AdvancedSharpAdbClient/Models/ShellStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -52,22 +51,22 @@ public ShellStream(Stream inner, bool closeStream = false)
public Stream Inner { get; private set; }

/// <inheritdoc/>
public override bool CanRead => true;
public override bool CanRead => Inner.CanRead;

/// <inheritdoc/>
public override bool CanSeek => false;
public override bool CanSeek => Inner.CanSeek;

/// <inheritdoc/>
public override bool CanWrite => false;
public override bool CanWrite => Inner.CanWrite;

/// <inheritdoc/>
public override long Length => throw new NotImplementedException();
public override long Length => Inner.Length;

/// <inheritdoc/>
public override long Position
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
get => Inner.Position;
set => Inner.Position = value;
}

#if HAS_BUFFERS
Expand Down Expand Up @@ -97,7 +96,7 @@ public override int Read(Span<byte> buffer)
}

// Loop over the data, and find a LF (0x0d) character. If it is
// followed by a CR (0x0a) character, remove the LF chracter and
// followed by a CR (0x0a) character, remove the LF character and
// keep only the LF character intact.
for (int i = 0; i < read - 1; i++)
{
Expand Down Expand Up @@ -192,7 +191,7 @@ public override int Read(byte[] buffer, int offset, int count)
}

// Loop over the data, and find a LF (0x0d) character. If it is
// followed by a CR (0x0a) character, remove the LF chracter and
// followed by a CR (0x0a) character, remove the LF character and
// keep only the LF character intact.
for (int i = offset; i < offset + read - 1; i++)
{
Expand Down Expand Up @@ -461,20 +460,16 @@ async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToke
#endif

/// <inheritdoc/>
[DoesNotReturn]
public override void Flush() => throw new NotImplementedException();
public override void Flush() => Inner.Flush();

/// <inheritdoc/>
[DoesNotReturn]
public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException();
public override long Seek(long offset, SeekOrigin origin) => Inner.Seek(offset, origin);

/// <inheritdoc/>
[DoesNotReturn]
public override void SetLength(long value) => throw new NotImplementedException();
public override void SetLength(long value) => Inner.SetLength(value);

/// <inheritdoc/>
[DoesNotReturn]
public override void Write(byte[] buffer, int offset, int count) => throw new NotImplementedException();
public override void Write(byte[] buffer, int offset, int count) => Inner.Write(buffer, offset, count);

/// <inheritdoc/>
public override string ToString() =>
Expand Down
Loading

0 comments on commit e1ffbfc

Please sign in to comment.