Skip to content

Commit 84c318e

Browse files
authored
fix: Bump Ephys Link, fix pre/post versioning handling (#638)
1 parent b78d3c0 commit 84c318e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Assets/Scripts/EphysLink/CommunicationManager.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class CommunicationManager : MonoBehaviour
2020

2121
#region Properties
2222

23-
private static readonly int[] EPHYS_LINK_MIN_VERSION = { 1, 1, 0 };
23+
private static readonly int[] EPHYS_LINK_MIN_VERSION = { 1, 2, 1 };
2424

2525
public static readonly string EPHYS_LINK_MIN_VERSION_STRING = "≥ v" + string.Join(".", EPHYS_LINK_MIN_VERSION);
2626

@@ -151,11 +151,12 @@ public void DisconnectFromServer(Action onDisconnected = null)
151151

152152
public void VerifyVersion(Action onSuccess, Action onFailure)
153153
{
154-
GetVersion(version =>
154+
GetVersion(versionString =>
155155
{
156-
var versionNumbers = version.Split(".").Select(versionNumber =>
157-
int.Parse(new string(versionNumber.TakeWhile(char.IsDigit).ToArray()))).ToArray();
158-
156+
var versionNumbers = versionString.Split(".").Select(values =>
157+
values.TakeWhile(char.IsDigit).ToArray()).TakeWhile(numbers => numbers.Length > 0)
158+
.Select(nonEmpty => int.Parse(new string(nonEmpty))).ToArray();
159+
159160
// Fail if major version mismatch (breaking changes).
160161
if (versionNumbers[0] != EPHYS_LINK_MIN_VERSION[0])
161162
{
@@ -177,7 +178,7 @@ public void VerifyVersion(Action onSuccess, Action onFailure)
177178
onFailure.Invoke();
178179
return;
179180
}
180-
181+
181182
// Passed checks.
182183
onSuccess.Invoke();
183184
}, onFailure.Invoke);

0 commit comments

Comments
 (0)