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);
}
public bool IsConnected
{
get
{
return this._tcpClient.Connected;
}
}
}
public bool IsConnected
{
get
{
return this._tcpClient.Connected;
}
}
public void Dispose()
{
if (_tcpClient.Connected)
_tcpClient.Close();
}
}
}
}

View file

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