Normalize line endings

This commit is contained in:
Andres G. Aragoneses 2018-03-04 00:38:51 +08:00
parent c1ce5e25ba
commit 3762664c14
2 changed files with 60 additions and 60 deletions

View file

@ -84,21 +84,21 @@ namespace TLSharp.Core.Network
} }
return new TcpMessage(seq, body); return new TcpMessage(seq, body);
} }
public bool IsConnected public bool IsConnected
{ {
get get
{ {
return this._tcpClient.Connected; return this._tcpClient.Connected;
} }
} }
public void Dispose() public void Dispose()
{ {
if (_tcpClient.Connected) if (_tcpClient.Connected)
_tcpClient.Close(); _tcpClient.Close();
} }
} }
} }

View file

@ -83,13 +83,13 @@ namespace TLSharp.Core
{ {
if (dcOptions == null || !dcOptions.Any()) if (dcOptions == null || !dcOptions.Any())
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first."); throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
TLExportedAuthorization exported = null; TLExportedAuthorization exported = null;
if (_session.TLUser != null) if (_session.TLUser != null)
{ {
TLRequestExportAuthorization exportAuthorization = new TLRequestExportAuthorization() { DcId = dcId }; TLRequestExportAuthorization exportAuthorization = new TLRequestExportAuthorization() { DcId = dcId };
exported = await SendRequestAsync<TLExportedAuthorization>(exportAuthorization); exported = await SendRequestAsync<TLExportedAuthorization>(exportAuthorization);
} }
var dc = dcOptions.First(d => d.Id == dcId); var dc = dcOptions.First(d => d.Id == dcId);
@ -97,21 +97,21 @@ namespace TLSharp.Core
_session.ServerAddress = dc.IpAddress; _session.ServerAddress = dc.IpAddress;
_session.Port = dc.Port; _session.Port = dc.Port;
await ConnectAsync(true); await ConnectAsync(true);
if (_session.TLUser != null) if (_session.TLUser != null)
{ {
TLRequestImportAuthorization importAuthorization = new TLRequestImportAuthorization() { Id = exported.Id, Bytes = exported.Bytes }; TLRequestImportAuthorization importAuthorization = new TLRequestImportAuthorization() { Id = exported.Id, Bytes = exported.Bytes };
var imported = await SendRequestAsync<TLAuthorization>(importAuthorization); var imported = await SendRequestAsync<TLAuthorization>(importAuthorization);
OnUserAuthenticated(((TLUser)imported.User)); OnUserAuthenticated(((TLUser)imported.User));
} }
} }
private async Task RequestWithDcMigration(TLMethod request) private async Task RequestWithDcMigration(TLMethod request)
{ {
if (_sender == null) if (_sender == null)
throw new InvalidOperationException("Not connected!"); throw new InvalidOperationException("Not connected!");
var completed = false; var completed = false;
while(!completed) while(!completed)
{ {
@ -127,7 +127,7 @@ namespace TLSharp.Core
// prepare the request for another try // prepare the request for another try
request.ConfirmReceived = false; request.ConfirmReceived = false;
} }
} }
} }
public bool IsUserAuthorized() public bool IsUserAuthorized()
@ -170,8 +170,8 @@ namespace TLSharp.Core
if (String.IsNullOrWhiteSpace(code)) if (String.IsNullOrWhiteSpace(code))
throw new ArgumentNullException(nameof(code)); throw new ArgumentNullException(nameof(code));
var request = new TLRequestSignIn() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = code }; var request = new TLRequestSignIn() { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = code };
await RequestWithDcMigration(request); await RequestWithDcMigration(request);
OnUserAuthenticated(((TLUser)request.Response.User)); OnUserAuthenticated(((TLUser)request.Response.User));
@ -312,21 +312,21 @@ namespace TLSharp.Core
public async Task SendPingAsync() public async Task SendPingAsync()
{ {
await _sender.SendPingAsync(); await _sender.SendPingAsync();
} }
public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit) public async Task<TLAbsMessages> GetHistoryAsync(TLAbsInputPeer peer, int offset, int max_id, int limit)
{ {
if (!IsUserAuthorized()) if (!IsUserAuthorized())
throw new InvalidOperationException("Authorize user first!"); throw new InvalidOperationException("Authorize user first!");
var req = new TLRequestGetHistory() var req = new TLRequestGetHistory()
{ {
Peer = peer, Peer = peer,
AddOffset = offset, AddOffset = offset,
MaxId = max_id, MaxId = max_id,
Limit = limit Limit = limit
}; };
return await SendRequestAsync<TLAbsMessages>(req); return await SendRequestAsync<TLAbsMessages>(req);
} }
/// <summary> /// <summary>
@ -352,18 +352,18 @@ namespace TLSharp.Core
_session.SessionExpires = int.MaxValue; _session.SessionExpires = int.MaxValue;
_session.Save(); _session.Save();
} }
public bool IsConnected public bool IsConnected
{ {
get get
{ {
if (_transport == null) if (_transport == null)
return false; return false;
return _transport.IsConnected; return _transport.IsConnected;
} }
} }
public void Dispose() public void Dispose()
{ {
if (_transport != null) if (_transport != null)