From b387d42e5342eb2c3eda941a40f0a2ec922b0677 Mon Sep 17 00:00:00 2001
From: Lucas Nicodemus
Date: Sun, 16 Jul 2017 21:21:42 -0600
Subject: [PATCH 01/15] Add PR template file
---
PULL_REQUEST_TEMPLATE.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 PULL_REQUEST_TEMPLATE.md
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..9e7b1cc8
--- /dev/null
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1 @@
+
From 4216501c458698b2235a185f3912cf6bfd5dcfcc Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Thu, 13 Jul 2017 16:00:40 +0300
Subject: [PATCH 02/15] Make User implement IEquatable for more consistent
comparisons
---
TShockAPI/DB/UserManager.cs | 64 ++++++++++++++++++++++++++++++++++---
1 file changed, 60 insertions(+), 4 deletions(-)
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index e79fb933..88103899 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -363,7 +363,7 @@ namespace TShockAPI.DB
}
/// A database user.
- public class User
+ public class User : IEquatable
{
/// The database ID of the user.
public int ID { get; set; }
@@ -581,10 +581,66 @@ namespace TShockAPI.DB
return HashPassword(Encoding.UTF8.GetBytes(password));
}
- }
+ #region IEquatable
- /// UserManagerException - An exception generated by the user manager.
- [Serializable]
+ /// Indicates whether the current is equal to another .
+ /// true if the is equal to the parameter; otherwise, false.
+ /// An to compare with this .
+ public bool Equals(User other)
+ {
+ if (ReferenceEquals(null, other)) return false;
+ if (ReferenceEquals(this, other)) return true;
+ return ID == other.ID && string.Equals(Name, other.Name);
+ }
+
+ /// Indicates whether the current is equal to another object.
+ /// true if the is equal to the parameter; otherwise, false.
+ /// An to compare with this .
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((User)obj);
+ }
+
+ /// Serves as the hash function.
+ /// A hash code for the current .
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ return (ID * 397) ^ (Name != null ? Name.GetHashCode() : 0);
+ }
+ }
+
+ ///
+ /// Compares equality of two objects.
+ ///
+ /// Left hand of the comparison.
+ /// Right hand of the comparison.
+ /// true if the objects are equal; otherwise, false.
+ public static bool operator ==(User left, User right)
+ {
+ return Equals(left, right);
+ }
+
+ ///
+ /// Compares equality of two objects.
+ ///
+ /// Left hand of the comparison.
+ /// Right hand of the comparison.
+ /// true if the objects aren't equal; otherwise, false.
+ public static bool operator !=(User left, User right)
+ {
+ return !Equals(left, right);
+ }
+
+ #endregion
+ }
+
+ /// UserManagerException - An exception generated by the user manager.
+ [Serializable]
public class UserManagerException : Exception
{
/// Creates a new UserManagerException object.
From c8e31231ba135465160eb43e20858d3c38c41a68 Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Thu, 13 Jul 2017 16:01:47 +0300
Subject: [PATCH 03/15] override ToString of user
---
TShockAPI/DB/UserManager.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index 88103899..f93f9935 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -637,7 +637,12 @@ namespace TShockAPI.DB
}
#endregion
- }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
/// UserManagerException - An exception generated by the user manager.
[Serializable]
From 5e1be5b19b08350d833a96c46917248641b32782 Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Thu, 13 Jul 2017 16:04:17 +0300
Subject: [PATCH 04/15] Fix formatting below IEquatable block
---
TShockAPI/DB/UserManager.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index f93f9935..368c2dae 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -644,8 +644,8 @@ namespace TShockAPI.DB
}
}
- /// UserManagerException - An exception generated by the user manager.
- [Serializable]
+ /// UserManagerException - An exception generated by the user manager.
+ [Serializable]
public class UserManagerException : Exception
{
/// Creates a new UserManagerException object.
@@ -704,4 +704,4 @@ namespace TShockAPI.DB
{
}
}
-}
\ No newline at end of file
+}
From 02be378a2ec5b71ab1e878d22ac14a37b19f3da1 Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Fri, 14 Jul 2017 08:03:16 +0300
Subject: [PATCH 05/15] change doc of Equals
---
TShockAPI/DB/UserManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index 368c2dae..07662b2b 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -595,7 +595,7 @@ namespace TShockAPI.DB
/// Indicates whether the current is equal to another object.
/// true if the is equal to the parameter; otherwise, false.
- /// An to compare with this .
+ /// An to compare with this .
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
From 7768511e6e7a778acbbde7e8c7d02aba2e1e45d6 Mon Sep 17 00:00:00 2001
From: Lucas Nicodemus
Date: Sun, 23 Jul 2017 22:05:55 -0600
Subject: [PATCH 06/15] Update travis ci badge
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2d024912..2ad38b13 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-
+
From 031ef517e3875e7be8edae0ae53b95052daff4a2 Mon Sep 17 00:00:00 2001
From: quake1337
Date: Fri, 4 Aug 2017 12:52:07 +0200
Subject: [PATCH 07/15] Change field visibility
---
TShockAPI/Sockets/LinuxTcpSocket.cs | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/TShockAPI/Sockets/LinuxTcpSocket.cs b/TShockAPI/Sockets/LinuxTcpSocket.cs
index 98df1674..86381237 100644
--- a/TShockAPI/Sockets/LinuxTcpSocket.cs
+++ b/TShockAPI/Sockets/LinuxTcpSocket.cs
@@ -12,23 +12,23 @@ namespace TShockAPI.Sockets
{
public class LinuxTcpSocket : ISocket
{
- private byte[] _packetBuffer = new byte[1024];
+ public byte[] _packetBuffer = new byte[1024];
- private int _packetBufferLength;
+ public int _packetBufferLength;
- private List