Use expression body syntax
This commit is contained in:
@@ -101,25 +101,13 @@ namespace OpenRA.Network
|
||||
readonly List<ReceivedPacket> receivedPackets = new List<ReceivedPacket>();
|
||||
public ReplayRecorder Recorder { get; private set; }
|
||||
|
||||
public virtual int LocalClientId
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
public virtual int LocalClientId => 1;
|
||||
|
||||
public virtual ConnectionState ConnectionState
|
||||
{
|
||||
get { return ConnectionState.PreConnecting; }
|
||||
}
|
||||
public virtual ConnectionState ConnectionState => ConnectionState.PreConnecting;
|
||||
|
||||
public virtual IPEndPoint EndPoint
|
||||
{
|
||||
get { throw new NotSupportedException("An echo connection doesn't have an endpoint"); }
|
||||
}
|
||||
public virtual IPEndPoint EndPoint => throw new NotSupportedException("An echo connection doesn't have an endpoint");
|
||||
|
||||
public virtual string ErrorMessage
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
public virtual string ErrorMessage => null;
|
||||
|
||||
public virtual void Send(int frame, List<byte[]> orders)
|
||||
{
|
||||
@@ -209,9 +197,9 @@ namespace OpenRA.Network
|
||||
bool disposed;
|
||||
string errorMessage;
|
||||
|
||||
public override IPEndPoint EndPoint { get { return endpoint; } }
|
||||
public override IPEndPoint EndPoint => endpoint;
|
||||
|
||||
public override string ErrorMessage { get { return errorMessage; } }
|
||||
public override string ErrorMessage => errorMessage;
|
||||
|
||||
public NetworkConnection(ConnectionTarget target)
|
||||
{
|
||||
@@ -325,8 +313,8 @@ namespace OpenRA.Network
|
||||
}
|
||||
}
|
||||
|
||||
public override int LocalClientId { get { return clientId; } }
|
||||
public override ConnectionState ConnectionState { get { return connectionState; } }
|
||||
public override int LocalClientId => clientId;
|
||||
public override ConnectionState ConnectionState => connectionState;
|
||||
|
||||
public override void SendSync(int frame, byte[] syncData)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.Network
|
||||
/// <summary>The list of spawnpoints that are disabled for this game</summary>
|
||||
public readonly int[] DisabledSpawnPoints = { };
|
||||
|
||||
public string ModLabel { get { return "{0} ({1})".F(ModTitle, Version); } }
|
||||
public string ModLabel => "{0} ({1})".F(ModTitle, Version);
|
||||
|
||||
static object LoadClients(MiniYaml yaml)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA
|
||||
public bool SuppressVisualFeedback;
|
||||
public ref readonly Target VisualFeedbackTarget => ref visualFeedbackTarget;
|
||||
|
||||
public Player Player { get { return Subject != null ? Subject.Owner : null; } }
|
||||
public Player Player => Subject != null ? Subject.Owner : null;
|
||||
|
||||
readonly Target target;
|
||||
readonly Target visualFeedbackTarget;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Network
|
||||
readonly FrameData frameData = new FrameData();
|
||||
|
||||
public Session LobbyInfo = new Session();
|
||||
public Session.Client LocalClient { get { return LobbyInfo.ClientWithIndex(Connection.LocalClientId); } }
|
||||
public Session.Client LocalClient => LobbyInfo.ClientWithIndex(Connection.LocalClientId);
|
||||
public World World;
|
||||
|
||||
public readonly ConnectionTarget Endpoint;
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Network
|
||||
|
||||
public long LastTickTime = Game.RunTime;
|
||||
|
||||
public bool GameStarted { get { return NetFrameNumber != 0; } }
|
||||
public bool GameStarted => NetFrameNumber != 0;
|
||||
public IConnection Connection { get; private set; }
|
||||
|
||||
internal int GameSaveLastFrame = -1;
|
||||
@@ -170,10 +170,7 @@ namespace OpenRA.Network
|
||||
syncForFrame.Add(frame, packet);
|
||||
}
|
||||
|
||||
public bool IsReadyForNextFrame
|
||||
{
|
||||
get { return GameStarted && frameData.IsReadyForFrame(NetFrameNumber); }
|
||||
}
|
||||
public bool IsReadyForNextFrame => GameStarted && frameData.IsReadyForFrame(NetFrameNumber);
|
||||
|
||||
public IEnumerable<Session.Client> GetClientsNotReadyForNextFrame
|
||||
{
|
||||
|
||||
@@ -30,14 +30,12 @@ namespace OpenRA.Network
|
||||
int ordersFrame;
|
||||
Dictionary<int, int> lastClientsFrame = new Dictionary<int, int>();
|
||||
|
||||
public int LocalClientId { get { return -1; } }
|
||||
public ConnectionState ConnectionState { get { return ConnectionState.Connected; } }
|
||||
public IPEndPoint EndPoint
|
||||
{
|
||||
get { throw new NotSupportedException("A replay connection doesn't have an endpoint"); }
|
||||
}
|
||||
public int LocalClientId => -1;
|
||||
public ConnectionState ConnectionState => ConnectionState.Connected;
|
||||
|
||||
public string ErrorMessage { get { return null; } }
|
||||
public IPEndPoint EndPoint => throw new NotSupportedException("A replay connection doesn't have an endpoint");
|
||||
|
||||
public string ErrorMessage => null;
|
||||
|
||||
public readonly int TickCount;
|
||||
public readonly int FinalGameTick;
|
||||
|
||||
@@ -149,9 +149,9 @@ namespace OpenRA.Network
|
||||
public string Bot; // Bot type, null for real clients
|
||||
public int BotControllerClientIndex; // who added the bot to the slot
|
||||
public bool IsAdmin;
|
||||
public bool IsReady { get { return State == ClientState.Ready; } }
|
||||
public bool IsInvalid { get { return State == ClientState.Invalid; } }
|
||||
public bool IsObserver { get { return Slot == null; } }
|
||||
public bool IsReady => State == ClientState.Ready;
|
||||
public bool IsInvalid => State == ClientState.Invalid;
|
||||
public bool IsObserver => Slot == null;
|
||||
|
||||
// Linked to the online player database
|
||||
public string Fingerprint;
|
||||
@@ -215,7 +215,7 @@ namespace OpenRA.Network
|
||||
public string PreferredValue;
|
||||
|
||||
public bool IsLocked;
|
||||
public bool IsEnabled { get { return Value == "True"; } }
|
||||
public bool IsEnabled => Value == "True";
|
||||
}
|
||||
|
||||
public class Global
|
||||
|
||||
@@ -28,14 +28,9 @@ namespace OpenRA.Network
|
||||
static bool initialized;
|
||||
|
||||
public static IPAddress ExternalIP { get; private set; }
|
||||
public static UPnPStatus Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return initialized ? natDevice != null ?
|
||||
UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled;
|
||||
}
|
||||
}
|
||||
public static UPnPStatus Status =>
|
||||
initialized ? natDevice != null ?
|
||||
UPnPStatus.Enabled : UPnPStatus.NotSupported : UPnPStatus.Disabled;
|
||||
|
||||
public static async Task DiscoverNatDevices(int timeout)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user