Skip to content

Commit 8bbd30b

Browse files
committed
Cleanup
1 parent 5b1d62a commit 8bbd30b

18 files changed

+91
-99
lines changed

Spark.Interop/ProcessMemoryStream.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ public override bool CanWrite
4646
}
4747
}
4848

49-
public override long Length
50-
{
51-
get { throw new NotSupportedException("Process memory stream does not have a specific length"); }
52-
}
49+
public override long Length => throw new NotSupportedException("Process memory stream does not have a specific length");
5350

5451
public override long Position
5552
{

Spark/App.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ private static IEnumerable<ClientVersion> LoadClientVersionsOrDefaults(string fi
172172
Debug.WriteLine(string.Format("Migrating supported client versions... ({0} -> {1})", fileVersion, latestVersion));
173173

174174
// Perform a migration (union) of the old and new client versions
175-
if (clientVersions != null)
176-
clientVersions = clientVersions.Union(ClientVersion.GetDefaultVersions(), ClientVersion.VersionComparer);
175+
clientVersions = clientVersions?.Union(ClientVersion.GetDefaultVersions(), ClientVersion.VersionComparer);
177176
}
178177
}
179178
}

Spark/Common/Observable.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
1414
{
1515
var handler = PropertyChanged;
1616

17-
if (handler != null)
18-
handler(this, new PropertyChangedEventArgs(propertyName));
17+
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
1918
}
2019
#endregion
2120

@@ -26,8 +25,7 @@ protected virtual void OnPropertyChanging([CallerMemberName] string propertyName
2625
{
2726
var handler = PropertyChanging;
2827

29-
if (handler!=null)
30-
handler(this, new PropertyChangingEventArgs(propertyName));
28+
handler?.Invoke(this, new PropertyChangingEventArgs(propertyName));
3129
}
3230
#endregion
3331

@@ -40,17 +38,15 @@ protected virtual bool SetProperty<T>(ref T backingStore, T newValue, [CallerMem
4038
return false;
4139

4240
// OnChanging acton invoked prior to OnPropertyChanging
43-
if (onChanging != null)
44-
onChanging(newValue);
41+
onChanging?.Invoke(newValue);
4542

4643
OnPropertyChanging(propertyName);
4744

4845
// Replace the existing value with the new value
4946
backingStore = newValue;
5047

5148
// OnChanged action invoked prior to OnPropertyChanged
52-
if (onChanged != null)
53-
onChanged();
49+
onChanged?.Invoke();
5450

5551
OnPropertyChanged(propertyName);
5652
return true;

Spark/Input/AsyncDelegateCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public AsyncDelegateCommand(Func<object, Task> onExecute, Predicate<object> onCa
2525
#region ICommand
2626
public event EventHandler CanExecuteChanged
2727
{
28-
add { CommandManager.RequerySuggested += value; }
29-
remove { CommandManager.RequerySuggested -= value; }
28+
add => CommandManager.RequerySuggested += value;
29+
remove => CommandManager.RequerySuggested -= value;
3030
}
3131

3232
public async void Execute(object parameter)

Spark/Input/DelegateCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public DelegateCommand(Action<object> onExecute, Predicate<object> onCanExecute)
2424
#region ICommand
2525
public event EventHandler CanExecuteChanged
2626
{
27-
add { CommandManager.RequerySuggested += value; }
28-
remove { CommandManager.RequerySuggested -= value; }
27+
add => CommandManager.RequerySuggested += value;
28+
remove => CommandManager.RequerySuggested -= value;
2929
}
3030

3131
public void Execute(object parameter)

Spark/Models/ClientVersion.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public int GetHashCode(ClientVersion version)
3535
public static readonly ClientVersion Version913 = new()
3636
{
3737
Name = "US Zolian 9.13",
38+
Hostname = "66.211.203.116",
39+
Port = 4200,
3840
VersionCode = 913,
3941
Hash = "3244dc0e68cd26f4fb1626da3673fda8",
4042
ServerHostnamePatchAddress = 0x4333C2,
@@ -48,6 +50,8 @@ public int GetHashCode(ClientVersion version)
4850
public static readonly ClientVersion Version741 = new()
4951
{
5052
Name = "US Dark Ages 7.41",
53+
Hostname = "da0.kru.com",
54+
Port = 2610,
5155
VersionCode = 741,
5256
Hash = "3244dc0e68cd26f4fb1626da3673fda8",
5357
ServerHostnamePatchAddress = 0x4333C2,
@@ -62,6 +66,8 @@ public int GetHashCode(ClientVersion version)
6266

6367
#region Properties
6468
public string Name { get; set; }
69+
public string Hostname { get; set; }
70+
public int Port { get; set; }
6571
public int VersionCode { get; set; }
6672
public string Hash { get; set; }
6773
public long ServerHostnamePatchAddress { get; set; }

Spark/Net/NetworkPacket.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
namespace Spark.Net;
88

9-
public class NetworkPacket : INetworkPacket
9+
public sealed class NetworkPacket : INetworkPacket
1010
{
1111
public static readonly int HeaderSize = 4;
1212
public static readonly byte NexonSignature = 0xAA;
1313

1414
#region Properties
15-
public virtual byte Signature { get; protected set; }
16-
public virtual short Size { get; protected set; }
17-
public virtual byte Command { get; protected set; }
18-
public virtual IReadOnlyList<byte> Data { get; protected set; }
15+
public byte Signature { get; protected set; }
16+
public short Size { get; protected set; }
17+
public byte Command { get; protected set; }
18+
public IReadOnlyList<byte> Data { get; protected set; }
1919
#endregion
2020

2121
#region Constructors
@@ -51,7 +51,7 @@ public override string ToString()
5151
}
5252

5353
#region IEnumerable<byte> Methods
54-
public virtual IEnumerator<byte> GetEnumerator()
54+
public IEnumerator<byte> GetEnumerator()
5555
{
5656
yield return Signature;
5757
yield return Size.HiByte();

Spark/Net/NetworkPacketBuffer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public sealed class NetworkPacketBuffer
1313
private Queue<INetworkPacket> packets = new Queue<INetworkPacket>();
1414

1515
#region Properties
16-
public int PacketCount { get { return packets.Count; } }
16+
public int PacketCount => packets.Count;
17+
1718
#endregion
1819

1920
public NetworkPacketBuffer() { }

Spark/Net/ServerTester.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ protected virtual void Dispose(bool isDisposing)
140140

141141
if (isDisposing)
142142
{
143-
if (socket != null)
144-
socket.Dispose();
143+
socket?.Dispose();
145144
}
146145

147146
isDisposed = true;

Spark/Runtime/RuntimePatcher.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ private void Dispose(bool isDisposing)
135135

136136
if (isDisposing)
137137
{
138-
if (writer != null)
139-
writer.Dispose();
138+
writer?.Dispose();
140139
}
141140

142141
isDisposed = true;

0 commit comments

Comments
 (0)