Skip to content

Commit 9b41530

Browse files
committed
Do not use new csharp features
1 parent 894b86e commit 9b41530

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

Scripts/Extensions/Extensions.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,16 @@ public static int getHue(this Color color)
223223
return null;
224224
}
225225

226-
#if UNITY_2020_1_OR_NEWER
227226
public static byte[] ReadAllBytes(this Stream stream)
228227
{
229228
if (stream is MemoryStream memoryStream1)
230229
return memoryStream1.ToArray();
231230

232-
using var memoryStream = new MemoryStream();
233-
stream.CopyTo(memoryStream);
234-
return memoryStream.ToArray();
231+
using (var memoryStream = new MemoryStream())
232+
{
233+
stream.CopyTo(memoryStream);
234+
return memoryStream.ToArray();
235+
}
235236
}
236-
#endif
237237
}
238238
}

Scripts/Util/BoxTriangleIntersector.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public FastBox(Bounds bounds)
5353

5454
private static readonly Vector3[] boxNormals =
5555
{
56-
new(1, 0, 0),
57-
new(0, 1, 0),
58-
new(0, 0, 1)
56+
new Vector3(1, 0, 0),
57+
new Vector3(0, 1, 0),
58+
new Vector3(0, 0, 1)
5959
};
6060

6161
public static bool IsIntersecting(FastBox box, FastTriangle fastTriangle)

Scripts/Util/DI/DependencyInjectionUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ElasticSea.Framework.Scripts.Util.DI
88
{
99
public static class DependencyInjectionUtils
1010
{
11-
private static Dictionary<Type, List<(Type fieldType, Action<object, object> action)>> dict = new();
11+
private static Dictionary<Type, List<(Type fieldType, Action<object, object> action)>> dict = new Dictionary<Type, List<(Type fieldType, Action<object, object> action)>>();
1212
private static List<(Type fieldType, Action<object, object> action)> GetSetters(object mb)
1313
{
1414
var fields = mb.GetType()

Scripts/Util/OneShotEvent.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using Blocks;
32

43
namespace ElasticSea.Framework.Scripts.Util
54
{

Scripts/Util/Utils.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,11 @@ public static byte[] ReadAllBytes(string filePath)
963963
Debug.LogException(e);
964964

965965
// In case another program already has write access to this file
966-
using var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
967-
return fs.ReadAllBytes();
966+
967+
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
968+
{
969+
return fs.ReadAllBytes();
970+
}
968971
}
969972
}
970973
}

0 commit comments

Comments
 (0)