Minor changes

Minor changes

--- Tests/AbbreviatedIdTests.cs
+++ Tests/AbbreviatedIdTests.cs
@@ -36,12 +36,8 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+using System;
 using NUnit.Framework;
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;

 namespace GitSharp.Tests
 {
@@ -52,8 +48,7 @@
         [Test]
         public void testEmpty_FromByteArray()
         {
-            AbbreviatedObjectId i;
-            i = AbbreviatedObjectId.FromString(new byte[] { }, 0, 0);
+        	AbbreviatedObjectId i = AbbreviatedObjectId.FromString(new byte[] { }, 0, 0);
             Assert.IsNotNull(i);
             Assert.AreEqual(0, i.Length);
             Assert.IsFalse(i.isComplete());
@@ -73,7 +68,7 @@
         [Test]
         public void testFull_FromByteArray()
         {
-            String s = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            const string s = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
             byte[] b = Constants.encodeASCII(s);
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(b, 0, b.Length);
             Assert.IsNotNull(i);
@@ -90,7 +85,7 @@
         [Test]
         public void testFull_FromString()
         {
-            String s = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            const string s = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -106,7 +101,7 @@
         [Test]
         public void test1_FromString()
         {
-            String s = "7";
+            const string s = "7";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -118,7 +113,7 @@
         [Test]
         public void test2_FromString()
         {
-            String s = "7b";
+            const string s = "7b";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -130,7 +125,7 @@
         [Test]
         public void test3_FromString()
         {
-            String s = "7b6";
+            const string s = "7b6";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -142,7 +137,7 @@
         [Test]
         public void test4_FromString()
         {
-            String s = "7b6e";
+            const string s = "7b6e";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -154,7 +149,7 @@
         [Test]
         public void test5_FromString()
         {
-            String s = "7b6e8";
+            const string s = "7b6e8";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -166,7 +161,7 @@
         [Test]
         public void test6_FromString()
         {
-            String s = "7b6e80";
+            const string s = "7b6e80";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -178,7 +173,7 @@
         [Test]
         public void test7_FromString()
         {
-            String s = "7b6e806";
+            const string s = "7b6e806";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -190,7 +185,7 @@
         [Test]
         public void test8_FromString()
         {
-            String s = "7b6e8067";
+            const string s = "7b6e8067";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -202,7 +197,7 @@
         [Test]
         public void test9_FromString()
         {
-            String s = "7b6e8067e";
+            const string s = "7b6e8067e";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -214,7 +209,7 @@
         [Test]
         public void test17_FromString()
         {
-            String s = "7b6e8067ec96acef9";
+            const string s = "7b6e8067ec96acef9";
             AbbreviatedObjectId i = AbbreviatedObjectId.FromString(s);
             Assert.IsNotNull(i);
             Assert.AreEqual(s.Length, i.Length);
@@ -226,7 +221,7 @@
         [Test]
         public void testEquals_Short()
         {
-            String s = "7b6e8067";
+            const string s = "7b6e8067";
             AbbreviatedObjectId a = AbbreviatedObjectId.FromString(s);
             AbbreviatedObjectId b = AbbreviatedObjectId.FromString(s);
             Assert.AreNotSame(a, b);
@@ -238,7 +233,7 @@
         [Test]
         public void testEquals_Full()
         {
-            String s = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            const string s = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
             AbbreviatedObjectId a = AbbreviatedObjectId.FromString(s);
             AbbreviatedObjectId b = AbbreviatedObjectId.FromString(s);
             Assert.AreNotSame(a, b);
@@ -250,8 +245,8 @@
         [Test]
         public void testNotEquals_SameLength()
         {
-            String sa = "7b6e8067";
-            String sb = "7b6e806e";
+            const string sa = "7b6e8067";
+            const string sb = "7b6e806e";
             AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
             AbbreviatedObjectId b = AbbreviatedObjectId.FromString(sb);
             Assert.IsFalse(a.Equals(b));
@@ -261,8 +256,8 @@
         [Test]
         public void testNotEquals_DiffLength()
         {
-            String sa = "7b6e8067abcd";
-            String sb = "7b6e8067";
+            const string sa = "7b6e8067abcd";
+            const string sb = "7b6e8067";
             AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
             AbbreviatedObjectId b = AbbreviatedObjectId.FromString(sb);
             Assert.IsFalse(a.Equals(b));
@@ -272,18 +267,18 @@
         [Test]
         public void testPrefixCompare_Full()
         {
-            String s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            const string s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
             AbbreviatedObjectId a = AbbreviatedObjectId.FromString(s1);
             ObjectId i1 = ObjectId.FromString(s1);
             Assert.AreEqual(0, a.prefixCompare(i1));
             Assert.IsTrue(i1.startsWith(a));

-            String s2 = "7b6e8067ec96acef9a4184b43210d583b6d2f99b";
-            ObjectId i2 = ObjectId.FromString(s2);
-            Assert.IsTrue(a.prefixCompare(i2) < 0);
-            Assert.IsFalse(i2.startsWith(a));
-
-            String s3 = "7b6e8067ec96acef9a4184b43210d583b6d2f999";
+            const string s2 = "7b6e8067ec96acef9a4184b43210d583b6d2f99b";
+            ObjectId i2 = ObjectId.FromString(s2);
+            Assert.IsTrue(a.prefixCompare(i2) < 0);
+            Assert.IsFalse(i2.startsWith(a));
+
+            const string s3 = "7b6e8067ec96acef9a4184b43210d583b6d2f999";
             ObjectId i3 = ObjectId.FromString(s3);
             Assert.IsTrue(a.prefixCompare(i3) > 0);
             Assert.IsFalse(i3.startsWith(a));
@@ -292,20 +287,20 @@
         [Test]
         public void testPrefixCompare_1()
         {
-            String sa = "7";
-            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
-
-            String s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
-            ObjectId i1 = ObjectId.FromString(s1);
-            Assert.AreEqual(0, a.prefixCompare(i1));
-            Assert.IsTrue(i1.startsWith(a));
-
-            String s2 = "8b6e8067ec96acef9a4184b43210d583b6d2f99a";
-            ObjectId i2 = ObjectId.FromString(s2);
-            Assert.IsTrue(a.prefixCompare(i2) < 0);
-            Assert.IsFalse(i2.startsWith(a));
-
-            String s3 = "6b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            const string sa = "7";
+            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
+
+            const string s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            ObjectId i1 = ObjectId.FromString(s1);
+            Assert.AreEqual(0, a.prefixCompare(i1));
+            Assert.IsTrue(i1.startsWith(a));
+
+            const string s2 = "8b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            ObjectId i2 = ObjectId.FromString(s2);
+            Assert.IsTrue(a.prefixCompare(i2) < 0);
+            Assert.IsFalse(i2.startsWith(a));
+
+            const string s3 = "6b6e8067ec96acef9a4184b43210d583b6d2f99a";
             ObjectId i3 = ObjectId.FromString(s3);
             Assert.IsTrue(a.prefixCompare(i3) > 0);
             Assert.IsFalse(i3.startsWith(a));
@@ -314,20 +309,20 @@
         [Test]
         public void testPrefixCompare_7()
         {
-            String sa = "7b6e806";
-            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
-
-            String s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
-            ObjectId i1 = ObjectId.FromString(s1);
-            Assert.AreEqual(0, a.prefixCompare(i1));
-            Assert.IsTrue(i1.startsWith(a));
-
-            String s2 = "7b6e8167ec86acef9a4184b43210d583b6d2f99a";
-            ObjectId i2 = ObjectId.FromString(s2);
-            Assert.IsTrue(a.prefixCompare(i2) < 0);
-            Assert.IsFalse(i2.startsWith(a));
-
-            String s3 = "7b6e8057eca6acef9a4184b43210d583b6d2f99a";
+            const string sa = "7b6e806";
+            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
+
+            const string s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            ObjectId i1 = ObjectId.FromString(s1);
+            Assert.AreEqual(0, a.prefixCompare(i1));
+            Assert.IsTrue(i1.startsWith(a));
+
+            const string s2 = "7b6e8167ec86acef9a4184b43210d583b6d2f99a";
+            ObjectId i2 = ObjectId.FromString(s2);
+            Assert.IsTrue(a.prefixCompare(i2) < 0);
+            Assert.IsFalse(i2.startsWith(a));
+
+            const string s3 = "7b6e8057eca6acef9a4184b43210d583b6d2f99a";
             ObjectId i3 = ObjectId.FromString(s3);
             Assert.IsTrue(a.prefixCompare(i3) > 0);
             Assert.IsFalse(i3.startsWith(a));
@@ -336,20 +331,20 @@
         [Test]
         public void testPrefixCompare_8()
         {
-            String sa = "7b6e8067";
-            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
-
-            String s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
-            ObjectId i1 = ObjectId.FromString(s1);
-            Assert.AreEqual(0, a.prefixCompare(i1));
-            Assert.IsTrue(i1.startsWith(a));
-
-            String s2 = "7b6e8167ec86acef9a4184b43210d583b6d2f99a";
-            ObjectId i2 = ObjectId.FromString(s2);
-            Assert.IsTrue(a.prefixCompare(i2) < 0);
-            Assert.IsFalse(i2.startsWith(a));
-
-            String s3 = "7b6e8057eca6acef9a4184b43210d583b6d2f99a";
+            const string sa = "7b6e8067";
+            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
+
+            const string s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            ObjectId i1 = ObjectId.FromString(s1);
+            Assert.AreEqual(0, a.prefixCompare(i1));
+            Assert.IsTrue(i1.startsWith(a));
+
+            const string s2 = "7b6e8167ec86acef9a4184b43210d583b6d2f99a";
+            ObjectId i2 = ObjectId.FromString(s2);
+            Assert.IsTrue(a.prefixCompare(i2) < 0);
+            Assert.IsFalse(i2.startsWith(a));
+
+            const string s3 = "7b6e8057eca6acef9a4184b43210d583b6d2f99a";
             ObjectId i3 = ObjectId.FromString(s3);
             Assert.IsTrue(a.prefixCompare(i3) > 0);
             Assert.IsFalse(i3.startsWith(a));
@@ -358,20 +353,20 @@
         [Test]
         public void testPrefixCompare_9()
         {
-            String sa = "7b6e8067e";
-            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
-
-            String s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
-            ObjectId i1 = ObjectId.FromString(s1);
-            Assert.AreEqual(0, a.prefixCompare(i1));
-            Assert.IsTrue(i1.startsWith(a));
-
-            String s2 = "7b6e8167ec86acef9a4184b43210d583b6d2f99a";
-            ObjectId i2 = ObjectId.FromString(s2);
-            Assert.IsTrue(a.prefixCompare(i2) < 0);
-            Assert.IsFalse(i2.startsWith(a));
-
-            String s3 = "7b6e8057eca6acef9a4184b43210d583b6d2f99a";
+            const string sa = "7b6e8067e";
+            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
+
+            const string s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            ObjectId i1 = ObjectId.FromString(s1);
+            Assert.AreEqual(0, a.prefixCompare(i1));
+            Assert.IsTrue(i1.startsWith(a));
+
+            const string s2 = "7b6e8167ec86acef9a4184b43210d583b6d2f99a";
+            ObjectId i2 = ObjectId.FromString(s2);
+            Assert.IsTrue(a.prefixCompare(i2) < 0);
+            Assert.IsFalse(i2.startsWith(a));
+
+            const string s3 = "7b6e8057eca6acef9a4184b43210d583b6d2f99a";
             ObjectId i3 = ObjectId.FromString(s3);
             Assert.IsTrue(a.prefixCompare(i3) > 0);
             Assert.IsFalse(i3.startsWith(a));
@@ -380,24 +375,23 @@
         [Test]
         public void testPrefixCompare_17()
         {
-            String sa = "7b6e8067ec96acef9";
-            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
-
-            String s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
-            ObjectId i1 = ObjectId.FromString(s1);
-            Assert.AreEqual(0, a.prefixCompare(i1));
-            Assert.IsTrue(i1.startsWith(a));
-
-            String s2 = "7b6e8067eca6acef9a4184b43210d583b6d2f99a";
-            ObjectId i2 = ObjectId.FromString(s2);
-            Assert.IsTrue(a.prefixCompare(i2) < 0);
-            Assert.IsFalse(i2.startsWith(a));
-
-            String s3 = "7b6e8067ec86acef9a4184b43210d583b6d2f99a";
-            ObjectId i3 = ObjectId.FromString(s3);
-            Assert.IsTrue(a.prefixCompare(i3) > 0);
-            Assert.IsFalse(i3.startsWith(a));
-        }
-
+            const string sa = "7b6e8067ec96acef9";
+            AbbreviatedObjectId a = AbbreviatedObjectId.FromString(sa);
+
+            const string s1 = "7b6e8067ec96acef9a4184b43210d583b6d2f99a";
+            ObjectId i1 = ObjectId.FromString(s1);
+            Assert.AreEqual(0, a.prefixCompare(i1));
+            Assert.IsTrue(i1.startsWith(a));
+
+            const string s2 = "7b6e8067eca6acef9a4184b43210d583b6d2f99a";
+            ObjectId i2 = ObjectId.FromString(s2);
+            Assert.IsTrue(a.prefixCompare(i2) < 0);
+            Assert.IsFalse(i2.startsWith(a));
+
+            const string s3 = "7b6e8067ec86acef9a4184b43210d583b6d2f99a";
+            ObjectId i3 = ObjectId.FromString(s3);
+            Assert.IsTrue(a.prefixCompare(i3) > 0);
+            Assert.IsFalse(i3.startsWith(a));
+        }
     }
-}
+}


Fixed race condition

Fixed race condition

--- Client/VesselStore/VesselsProtoStore.cs
+++ Client/VesselStore/VesselsProtoStore.cs
@@ -1,5 +1,4 @@
-using LunaClient.Base;
-using LunaClient.Systems.VesselEvaSys;
+using LunaClient.Systems.VesselEvaSys;
 using LunaClient.Systems.VesselFlightStateSys;
 using LunaClient.VesselUtilities;
 using LunaCommon.Message.Data.Vessel;
@@ -24,17 +23,16 @@
         /// </summary>
         public static void HandleVesselProtoData(byte[] vesselData, int numBytes, Guid vesselId)
         {
-            SystemBase.TaskFactory.StartNew(() =>
-            {
-                if (AllPlayerVessels.TryGetValue(vesselId, out var vesselUpdate))
-                {
-                    vesselUpdate.Update(vesselData, numBytes, vesselId);
-                }
-                else
-                {
-                    AllPlayerVessels.TryAdd(vesselId, new VesselProtoUpdate(vesselData, numBytes, vesselId));
-                }
-            });
+            //Do not do this logic in another thread as race conditions might appear as the byte[]
+            //is a reference type and the message might have been recycled!
+            if (AllPlayerVessels.TryGetValue(vesselId, out var vesselUpdate))
+            {
+                vesselUpdate.Update(vesselData, numBytes, vesselId);
+            }
+            else
+            {
+                AllPlayerVessels.TryAdd(vesselId, new VesselProtoUpdate(vesselData, numBytes, vesselId));
+            }
         }

         /// <summary>


missing using namespace

missing using namespace

--- src/nunit.xamarin/App.xaml.cs
+++ src/nunit.xamarin/App.xaml.cs
@@ -21,6 +21,7 @@
 // ***********************************************************************

 using System.Reflection;
+using System.Collections.Generic;

 using NUnit.Runner.Services;
 using NUnit.Runner.View;


Fix floor tile lattice bug (#8653)

Fix floor tile lattice bug (#8653)

--- Content.Server/Tiles/FloorTileSystem.cs
+++ Content.Server/Tiles/FloorTileSystem.cs
@@ -56,16 +56,14 @@
                             continue;

                         PlaceAt(mapGrid, location, currentTileDefinition.TileId, component.PlaceTileSound);
-                        return;
                     }
                 }
-                if (HasBaseTurf(currentTileDefinition, "space"))
+                else if (HasBaseTurf(currentTileDefinition, "space"))
                 {
                     mapGrid = _mapManager.CreateGrid(locationMap.MapId);
                     mapGrid.WorldPosition = locationMap.Position;
                     location = new EntityCoordinates(mapGrid.GridEntityId, Vector2.Zero);
                     PlaceAt(mapGrid, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, mapGrid.TileSize / 2f);
-                    return;
                 }
             }
         }


Minor multijump thing in AI.

Minor multijump thing in AI.

--- Corvus/Corvus/Components/AIComponent.cs
+++ Corvus/Corvus/Components/AIComponent.cs
@@ -116,7 +116,7 @@
         private Vector2 _OffSet = new Vector2();
         private EntityClassification _EntitiesToSearchFor;
         private bool _IsReacting = false;
-        private bool _AllowMultiJump = true;
+        private bool _AllowMultiJump = false;
         private bool _AIEnabled = true;
         private DateTime _StartOfDeath;
         private bool _DeathStarted;
@@ -336,7 +336,6 @@
         private void FollowEntity(Entity e, GameTime Time)
         {
             var entity = this.Parent;
-            var AllowMultiJump = false;
             Random r = new Random();
             float attackRange = AttributesComponent.MeleeAttackRange.X;


Additional test coverage for no-op asynchronous service invocation.

--- Dargon.Services.Impl.Test/AsyncTests.cs
+++ Dargon.Services.Impl.Test/AsyncTests.cs
@@ -67,12 +67,19 @@
             AssertEquals(123, oneTwoThreeBoxBox.Item1.value);
             AssertEquals(234, twoThreeFour);
          }
+
+         for (var i = 0; i < 5; i++) {
+            stopwatch.Restart();
+            Async(() => remoteService.DoNothing()).Wait();
+            Trace.WriteLine($"No-op invocation #{i} took {stopwatch.ElapsedMilliseconds} ms!");
+         }
       }

       [Guid("4EEBA55A-26A3-4143-95F5-4C84708070C7")]
       public interface ExampleInterface {
          string Greet(string name, int age, int incorrectAge, bool trueValue, bool otherTrueValue);
          int Three { get; }
+         void DoNothing();
       }

       public class IntBox {
@@ -82,6 +89,7 @@
       public class ExampleImplementation : ExampleInterface {
          public string Greet(string name, int age, int incorrectAge, bool trueValue, bool otherTrueValue) => $"Hello, {name} who is {age} and not {incorrectAge}... Here's two trues: {trueValue} {otherTrueValue}!";
          public int Three => 3;
+         public void DoNothing() { }
       }
    }
 }


made randomgenerator as default generator for names if not specified otherwise

--- DataGenerator/Types/Name/NameFactory.cs
+++ DataGenerator/Types/Name/NameFactory.cs
@@ -10,8 +10,8 @@
         private readonly IGenerator _generator;
         private readonly IEnumerable<NameRepository> _nameRepositories;

-        public NameFactory(IGenerator generator) {
-            _generator = generator;
+        public NameFactory(IGenerator generator = null) {
+            _generator = generator ?? new RandomGenerator();
             _nameRepositories = JsonConvert.DeserializeObject<IEnumerable<NameRepository>>(File.ReadAllText(FilePath));
         }


Fix string values in Cells

Fix string values in Cells

--- src/Spreadsheet.cs
+++ src/Spreadsheet.cs
@@ -239,7 +239,7 @@
             else
             {
                 xml.WriteAttributeString("office:value-type", "string");
-                xml.WriteAttributeString("office:value", value);
+                xml.WriteElementString("text:p", value);
             }
         }
         xml.WriteEndElement();  // </table:table-cell>


Startup try/catch.

Startup try/catch.

--- src/TWCore/Core.cs
+++ src/TWCore/Core.cs
@@ -51,7 +51,7 @@
         [ThreadStatic]
         static Dictionary<object, object> threadObjectData = new Dictionary<object, object>();
         volatile static bool _initialized = false;
-        static ConcurrentQueue<Action> _oninitActions = new ConcurrentQueue<Action>();
+        static Queue<Action> _oninitActions = new Queue<Action>();

         #region Properties
         /// <summary>
@@ -228,31 +228,38 @@
                     Status.Enabled = GlobalSettings.StatusEnabled;
                 }

-                var allAssemblies = Factory.GetAllAssemblies();
-                var types = allAssemblies.SelectMany(a =>
-                {
-                    try
-                    {
-                        return a.DefinedTypes;
-                    }
-                    catch {}
-                    return new TypeInfo[0];
-                }).Where(t => !t.IsAbstract && t.IsClass && t.ImplementedInterfaces.Contains(typeof(ICoreStart))).ToArray();
-                if (types?.Any() == true)
-                {
-                    foreach (var type in types)
+                try
+                {
+                    var allAssemblies = Factory.GetAllAssemblies();
+                    var types = allAssemblies.SelectMany(a =>
                     {
                         try
                         {
-                            var instance = (ICoreStart)Activator.CreateInstance(type.AsType());
-                            Log.Debug("Loading CoreStart from: {0}", instance);
-                            instance.CoreInit(factories);
+                            return a.DefinedTypes;
                         }
-                        catch (Exception ex)
+                        catch { }
+                        return new TypeInfo[0];
+                    }).Where(t => !t.IsAbstract && t.IsClass && t.ImplementedInterfaces.Contains(typeof(ICoreStart))).ToArray();
+                    if (types?.Any() == true)
+                    {
+                        foreach (var type in types)
                         {
-                            Log.Write(ex);
+                            try
+                            {
+                                var instance = (ICoreStart)Activator.CreateInstance(type.AsType());
+                                Log.Debug("Loading CoreStart from: {0}", instance);
+                                instance.CoreInit(factories);
+                            }
+                            catch (Exception ex)
+                            {
+                                Log.Write(ex);
+                            }
                         }
                     }
+                }
+                catch (Exception ex)
+                {
+                    Core.Log.Write(ex);
                 }

                 Status.Attach(() =>
@@ -269,15 +276,31 @@
                     return null;
                 });

-                while (_oninitActions.Count > 0)
-                    if (_oninitActions.TryDequeue(out var result))
-                        result();
+                bool onError = false;
+                lock (_oninitActions)
+                {
+                    while (_oninitActions.Count > 0)
+                    {
+                        try
+                        {
+                            _oninitActions.Dequeue()();
+                        }
+                        catch (Exception ex)
+                        {
+                            Core.Log.Write(ex);
+                            onError = true;
+                        }
+                    }
+                }
                 Log.Start();

                 factories.Thread.Sleep(25);
                 var dlog = (Log as DefaultLogEngine);
                 if (dlog != null)
                     dlog.LogDoneTask.WaitAsync();
+
+                if (onError)
+                    throw new Exception("Error initializing the application.");
             }
         }

@@ -405,7 +428,8 @@
             if (_initialized)
                 action();
             else
-                _oninitActions.Enqueue(action);
+                lock (_oninitActions)
+                    _oninitActions.Enqueue(action);
         }
         #endregion


edit cashier repo

edit cashier repo

--- AirlineTicketOffice.Repository/Repositories/CashierRepository.cs
+++ AirlineTicketOffice.Repository/Repositories/CashierRepository.cs
@@ -11,7 +11,7 @@

 namespace AirlineTicketOffice.Repository.Repositories
 {
-    public sealed class CashierRepository : BaseModelRepository<Cashier>, ICashierRepository
+    public sealed class CashierRepository : BaseModelRepository<CashierModel>, ICashierRepository
     {
         public IEnumerable<CashierModel> GetAll()
         {


Revert "Remove RuntimeArgumentHandle from netstandard"

This reverts commit 455687a1c8f86a54fbd7da4f056333290411021c.

--- netstandard/ref/mscorlib.cs
+++ netstandard/ref/mscorlib.cs
@@ -2825,6 +2825,10 @@
         public System.Reflection.Assembly RequestingAssembly { get { throw null; } }
     }
     public delegate System.Reflection.Assembly ResolveEventHandler(object sender, System.ResolveEventArgs args);
+    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+    public partial struct RuntimeArgumentHandle
+    {
+    }
     [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
     public partial struct RuntimeFieldHandle : System.Runtime.Serialization.ISerializable
     {


Fixed bug in getting OneDrive root folder where it would return the wrong item type and in GetFolderOrCreate where it would crash if it was used against the root folder

--- Api/OneDriveApi.cs
+++ Api/OneDriveApi.cs
@@ -223,9 +223,9 @@
         /// <summary>
         /// Retrieves the OneDrive root folder
         /// </summary>
-        public async Task<OneDriveItemCollection> GetDriveRoot()
-        {
-            return await GetData<OneDriveItemCollection>("drive/root");
+        public async Task<OneDriveItem> GetDriveRoot()
+        {
+            return await GetData<OneDriveItem>("drive/root");
         }

         /// <summary>
@@ -284,7 +284,7 @@

             // Folder not found, create it
             var folderName = path.Contains("/") ? path.Remove(0, path.LastIndexOf("/", StringComparison.Ordinal) + 1) : path;
-            var parentPath = path.Remove(path.Length - folderName.Length - 1);
+            var parentPath = path.Contains("/") ? path.Remove(path.Length - folderName.Length - 1) : "";
             folder = await CreateFolder(parentPath, folderName);

             return folder;


Update request and response handling to store anonymous session access token

--- Assets/StomtAPI.cs
+++ Assets/StomtAPI.cs
@@ -40,6 +40,7 @@
 		[Tooltip("The name of your game's target on stomt.")]
 		string _targetName = "";
 		#endregion
+		string _accessToken = "";

 		/// <summary>
 		/// The application identifier for your game.
@@ -191,6 +192,11 @@
 			request.UserAgent = string.Format("Unity/{0} ({1})", Application.unityVersion, Application.platform);
 			request.Headers["appid"] = _appId;

+			if (!string.IsNullOrEmpty(_accessToken))
+			{
+				request.Headers["accesstoken"] = _accessToken;
+			}
+
 			return request;
 		}
 		IEnumerator LoadFeedAsync(string target, FeedCallback callback, int offset, int limit)
@@ -217,6 +223,9 @@
 				Debug.LogException(ex);
 				yield break;
 			}
+
+			// Store access token
+			_accessToken = response.Headers["accesstoken"];

 			// Read response stream
 			using (var responseStream = response.GetResponseStream())
@@ -297,7 +306,32 @@
 			catch (WebException ex)
 			{
 				Debug.LogException(ex);
-			}
+				yield break;
+			}
+
+			// Wait for response
+			var async2 = request.BeginGetResponse(null, null);
+
+			while (!async2.IsCompleted)
+			{
+				yield return null;
+			}
+
+			HttpWebResponse response;
+			var responseDataText = string.Empty;
+
+			try
+			{
+				response = (HttpWebResponse)request.EndGetResponse(async2);
+			}
+			catch (WebException ex)
+			{
+				Debug.LogException(ex);
+				yield break;
+			}
+
+			// Store access token
+			_accessToken = response.Headers["accesstoken"];
 		}
 		IEnumerator CreateStomtWithImageAsync(string jsonImage, string jsonStomt)
 		{
@@ -348,6 +382,9 @@
 				yield break;
 			}

+			// Store access token
+			_accessToken = response.Headers["accesstoken"];
+
 			// Read response stream
 			using (var responseStream = response.GetResponseStream())
 			{


#12 Fix condition

#12 Fix condition

--- Validator.cs
+++ Validator.cs
@@ -101,7 +101,7 @@
 			if (!string.IsNullOrWhiteSpace (sd [key]) && !string.IsNullOrWhiteSpace (td [key])) {
 				var sourceLastChar = sd [key] [sd [key].Length - 1];
 				var translationLastChar = td [key] [td [key].Length - 1];
-				if (!char.IsLetter (sourceLastChar) && !char.IsLetter (translationLastChar)) {
+				if (!(char.IsLetter (sourceLastChar) && char.IsLetter (translationLastChar))) {
 					if (sourceLastChar != translationLastChar) {
 						Console.WriteLine ("Warning: {0} {1} - different ending chars '{2}' and '{3}'.",
 							sourceFile, key, VisibleWhiteSpace (sourceLastChar), VisibleWhiteSpace (translationLastChar));


added constraint to TVertex so that TVertex must implement IEquatable<TVertex>

--- YAGL/Edge.cs
+++ YAGL/Edge.cs
@@ -7,7 +7,7 @@
     /// The class <see cref="Edge{TVertex}"/> models the fundamental unit of wich graphs are formed in Graph Theory.
     /// </summary>
     /// <typeparam name="TVertex">The type of the vertices.</typeparam>
-    public class Edge<TVertex>
+    public class Edge<TVertex> where TVertex : IEquatable<TVertex>
     {
         /// <summary>
         /// The field that store the first of the two <see cref="Edge{TVertex}"/> ends.


sqlresult is implemented

sqlresult is implemented

--- platform/wp7/RhoRubyLib/db/SqliteResult.cs
+++ platform/wp7/RhoRubyLib/db/SqliteResult.cs
@@ -1,116 +1,178 @@
 using System;
 using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
 using System.Windows.Shapes;
 using Community.CsharpSqlite;
+using System.Collections;
 using rho.common;

 namespace rho.db
 {
     public class CSqliteResult : IDBResult
     {
-
+        private Sqlite3.Vdbe m_st;
+        //private SqliteCopyResult m_resCopy;
+        private boolean m_bNonUnique = false;
         public CSqliteResult()
         {
         }

         public CSqliteResult(Sqlite3.Vdbe stmt)
         {
+            m_st = stmt;
+            if (m_st != null)
+                executeStatement(stmt);
         }

         public int getColCount()
         {
-            return 1;
+            return Sqlite3.sqlite3_data_count(m_st);
         }

         public String getColName(int nCol)
         {
-            return null;
+            return Sqlite3.sqlite3_column_name(m_st, nCol);
         }

         public String getOrigColName(int nCol)
         {
-            return null;
+            return Sqlite3.sqlite3_column_name(m_st, nCol);
         }

         //New
         public boolean isEnd()
         {
-            return true;
+            return m_st == null;
         }

         public boolean isOneEnd()
         {
-            return true;
+            return m_st == null;
         }

         public void next()
         {
+            if (m_st != null)
+                executeStatement(m_st);
         }

         public String getStringByIdx(int nCol)
         {
-            return null;
+            return Sqlite3.sqlite3_column_text(m_st, nCol);
         }

         public int getIntByIdx(int nCol)
         {
-            return 1;
+            return Sqlite3.sqlite3_column_int(m_st, nCol);
         }

         public long getLongByIdx(int nCol)
         {
-            return 1;
+            return Sqlite3.sqlite3_column_int64(m_st, nCol);
         }

         public String getUInt64ByIdx(int nCol)
         {
-            return null;
+            return getStringByIdx(nCol);
         }

         public Object /*RubyValue*/ getRubyValueByIdx(int nCol)
         {
-            return null;
+            return Sqlite3.sqlite3_column_value(m_st, nCol);
         }

         public boolean isNullByIdx(int nCol)
         {
-            return true;
+            return Sqlite3.sqlite3_column_type(m_st, nCol) == Sqlite3.SQLITE_NULL;
         }

         public Object /*RubyValue*/ getRubyValue(String colname)
         {
-            return null;
+            return getRubyValueByIdx( findColIndex(colname) );
         }

         public int getInt(String colname)
         {
-            return 1;
+            return getIntByIdx(findColIndex(colname));
         }

         public String getString(String colname)
         {
-            return null;
+            return getStringByIdx(findColIndex(colname));
         }

         public Object[] getCurData()
         {
-            return null;
+            String[] cols = getColumnNames();
+            Object[] res = new Object[cols.Length];
+            for (int i = 0; i < cols.Length; i++)
+                res[i] = Sqlite3.sqlite3_column_name(m_st, i);
+
+            return res;
         }

         public boolean isNonUnique()
         {
-            return true;
+            return m_bNonUnique;
         }

         public void close()
         {
+            if (m_st != null)
+            {
+                int res = Sqlite3.sqlite3_finalize( ref m_st );
+                if (res != Sqlite3.SQLITE_OK)
+                    throw new DBException(res, DBLastError());
+
+                m_st = null;
+            }
         }
+
+        #region Helpers
+
+        private String[] getColumnNames()
+        {
+            int cnt = Sqlite3.sqlite3_data_count(m_st);
+            String[] res = new String[cnt];
+            for (int i = 0; i < cnt; i++)
+            {
+                res[i] = Sqlite3.sqlite3_column_name(m_st, i);
+            }
+
+            return res;
+        }
+
+        private string DBLastError()
+        {
+            return Sqlite3.sqlite3_errmsg(m_st.db);
+        }
+
+        private bool executeStatement(Sqlite3.Vdbe pStmt)
+        {
+            int res = Sqlite3.sqlite3_step(pStmt);
+
+            if (res != Sqlite3.SQLITE_ROW)
+            {
+                close();
+                if (res != Sqlite3.SQLITE_OK && res != Sqlite3.SQLITE_ROW && res != Sqlite3.SQLITE_DONE)
+                    throw new DBException(res, DBLastError());
+            }
+
+            return res == Sqlite3.SQLITE_ROW;
+        }
+
+        private int findColIndex(String colname)
+        {
+            int cnt = Sqlite3.sqlite3_data_count(m_st);
+
+            for (int i = 0; i < cnt; i++)
+            {
+                if (colname == Sqlite3.sqlite3_column_name(m_st, i))
+                    return i;
+            }
+
+            return - 1;
+        }
+
+        #endregion
     }
 }


plugin: FateOpcodes CN 5.57 (#3634)

plugin: FateOpcodes CN 5.57 (#3634)

--- plugin/CactbotEventSource/FateWatcher.cs
+++ plugin/CactbotEventSource/FateWatcher.cs
@@ -66,6 +66,7 @@
     // v5.45            0x009e
     // v5.50            0x0308
     // v5.55            0xc0
+    // v5.57            0x16f
     //
     // KR
     // v5.35            0x347
@@ -81,7 +82,7 @@

     private static readonly CEDirectorOPCodes cedirector_cn = new CEDirectorOPCodes(
       0x30,
-      0xc0
+      0x16f
     );

     private static readonly CEDirectorOPCodes cedirector_intl = new CEDirectorOPCodes(


plugin: update bozja intl opcode for 6.08h (#4179)

--- plugin/CactbotEventSource/FateWatcher.cs
+++ plugin/CactbotEventSource/FateWatcher.cs
@@ -64,6 +64,7 @@
     // v6.01            0x3CC
     // v6.05            0x1f8
     // v6.08            0x126
+    // v6.08h           0x10a
     //
     // CN
     // v5.35            0x144
@@ -94,7 +95,7 @@

     private static readonly CEDirectorOPCodes cedirector_intl = new CEDirectorOPCodes(
       0x30,
-      0x126
+      0x10a
     );

     private struct ActorControlSelf {


Added indexes to test tokens

Added indexes to test tokens

--- test/Serilog.Tests/Parsing/MessageTemplateParserTests.cs
+++ test/Serilog.Tests/Parsing/MessageTemplateParserTests.cs
@@ -32,42 +32,42 @@
         public void AMessageWithoutPropertiesIsASingleTextToken()
         {
             AssertParsedAs("Hello, world!",
-                new TextToken("Hello, world!"));
+                new TextToken("Hello, world!", 0, 13));
         }

         [Test]
         public void AMessageWithPropertyOnlyIsASinglePropertyToken()
         {
             AssertParsedAs("{Hello}",
-                new PropertyToken("Hello", "{Hello}"));
+                new PropertyToken("Hello", "{Hello}", 0, 7));
         }

         [Test]
         public void DoubledLeftBracketsAreParsedAsASingleBracket()
         {
             AssertParsedAs("{{ Hi! }",
-                new TextToken("{ Hi! }"));
+                new TextToken("{ Hi! }", 0, 8));
         }

         [Test]
         public void DoubledLeftBracketsAreParsedAsASingleBracketInsideText()
         {
             AssertParsedAs("Well, {{ Hi!",
-                new TextToken("Well, { Hi!"));
+                new TextToken("Well, { Hi!", 0, 12));
         }

         [Test]
         public void DoubledRightBracketsAreParsedAsASingleBracket()
         {
             AssertParsedAs("Nice }}-: mo",
-                new TextToken("Nice }-: mo"));
+                new TextToken("Nice }-: mo", 0, 12));
         }

         [Test]
         public void AMalformedPropertyTagIsParsedAsText()
         {
             AssertParsedAs("{0 space}",
-                new TextToken("{0 space}"));
+                new TextToken("{0 space}", 0, 9));
         }

         [Test]
@@ -89,36 +89,36 @@
         public void ZeroValuesAlignmentIsParsedAsText()
         {
             AssertParsedAs("{Hello,-0}",
-                new TextToken("{Hello,-0}"));
+                new TextToken("{Hello,-0}", 0, 10));

             AssertParsedAs("{Hello,0}",
-                new TextToken("{Hello,0}"));
+                new TextToken("{Hello,0}", 0, 9));
         }

         [Test]
         public void NonNumberAlignmentIsParsedAsText()
         {
             AssertParsedAs("{Hello,-aa}",
-                new TextToken("{Hello,-aa}"));
+                new TextToken("{Hello,-aa}", 0, 11));

             AssertParsedAs("{Hello,aa}",
-                new TextToken("{Hello,aa}"));
+                new TextToken("{Hello,aa}", 0, 10));

             AssertParsedAs("{Hello,-10-1}",
-                new TextToken("{Hello,-10-1}"));
+                new TextToken("{Hello,-10-1}", 0, 13));

             AssertParsedAs("{Hello,10-1}",
-                new TextToken("{Hello,10-1}"));
+                new TextToken("{Hello,10-1}", 0, 12));
         }

         [Test]
         public void EmptyAlignmentIsParsedAsText()
         {
             AssertParsedAs("{Hello,}",
-                new TextToken("{Hello,}"));
+                new TextToken("{Hello,}", 0, 8));

             AssertParsedAs("{Hello,:format}",
-                new TextToken("{Hello,:format}"));
+                new TextToken("{Hello,:format}", 0, 15));
         }
     }
 }


fix mapimpl

fix mapimpl

--- dix-nez-lande/dix-nez-lande/Implem/MapImpl.cs
+++ dix-nez-lande/dix-nez-lande/Implem/MapImpl.cs
@@ -35,7 +35,7 @@
             set { size = value; }
         }

-        List<Tile> Map.tiles
+        public List<Tile> tiles
         {
             get { return tiles; }
             set { tiles = value; }


(doc) Corrected spelling mistake

(doc) Corrected spelling mistake

--- docs/input/docs/index.cshtml
+++ docs/input/docs/index.cshtml
@@ -2,7 +2,7 @@
 Title: Documentation
 ---

This user guide, like Cake.CakeMail itself, is under very active development. Some parts of it aren't
-documented as completely as they need to be, but we glady accept your contributions.

+documented as completely as they need to be, but we gladly accept your contributions.

We need your help to improve the documentation for Cake.CakeMail, so if there is something that you
 would like to add then you can edit the content directly on GitHub.


Fixed new user being PUT instead of POST

--- web/clublife/src/skeleton/Controllers/UsersController.cs
+++ web/clublife/src/skeleton/Controllers/UsersController.cs
@@ -27,7 +27,7 @@
       return Repo.GetUserById(new ObjectId(id));
     }
     // PUT api/users/new
-    [HttpPost("new")]
+    [HttpPut("new")]
     public void CreateNewUser([FromBody] User user) {
       Repo.CreateNewUserAsync(user);
     }


Added another function lol

Added another function lol

--- Bot/Bot/Program.cs
+++ Bot/Bot/Program.cs
@@ -94,6 +94,10 @@
                 case "commands":
                     client.SendMessage("Available commands are: !request <song>, !spot, !remove, !list, !next, !currentsong, !change");
                     break;
+                //specific rules for this streamer, feel free to change to suit your needs lol
+                case "rules":
+                    client.SendMessage("Song/loop must be under 90 seconds. Please try to only use youtube/soundcloud urls");
+                    break;
                 case "change":
                     client.SendMessage(username + "-> " + songs.ChangeRequest(username, args));
                     break;


test upload

test upload

--- CodeJudge/Judge.cs
+++ CodeJudge/Judge.cs
@@ -1,550 +1,550 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using CCWin;
-using System.IO;
-using System.Net;
-using System.Threading;
-using Qiniu.Conf;
-using Qiniu.RS;
-using System.Diagnostics;
-
-namespace CodeJudge
-{
-    public partial class Judge : Skin_Mac
-    {
-        public  String Problem_ID = "";
-        public  String Code = "";
-        public String CodeType="cpp"; //代码类型初始化为C++
-        public String CpuTime = "";
-        public String MemoryMax = "";
-        public String QiniuAK = "";
-        public String QiniuSK = "";
-        bool Cloud_type = true; //默认七牛云
-
-        String Cloud_flag = "D:\\CodeJudge_Studio\\cloud_flag.dat";  //自定义云的标致符号
-        String CloudScriptUrl = "";
-        //设计几个文件路径  部分在show事件中初始化
-        String rootDir="D:\\CodeJudge_Studio\\Run_Data\\"; //根目录
-        String problemDir = "";  //根目录下的题目目录
-        String SourceDir = "";//题目目录下的源代码目录
-        String JudgeStd = ""; //题目目录下的网络标准评测数据目录
-        String JudgeCompile = "";//题目目录下的编译目录
-        String JudgeRunTemp = "";//题目目录下的程序运行结果目录
-        String CodeFile_Location = "";//源码文件完整路径
-        String CloudDataUrl = "http://7xl54r.dl1.z0.glb.clouddn.com/data/";
-        String JudgeStdFile = "";//云端数据文件本地保存路径
-        String JudgeStdInDir = ""; //云端数据分割后的in数据文件夹
-        String JudgeStdOutDir = "";//云端数据分割后的out数据文件夹
-        Process compiler = new Process();  //定义编译器对象
-        Process ExeRunner=null;  //定义程序执行体对象
-        String ExeRunner_state = "ok";//实例运行后的状态
-        DateTime ExeRunner_start_time ;//实例开始运行时间
-        DateTime ExeRunner_end_time ;//实例终止运行时间
-        TimeSpan ExeRunner_total_time;//实例实际运行时间
-        double ExeRunner_max_time;//实例运行的最大时间
-        double ExeRunner_sum_time;
-        double ExeRunner_avg_time;
-        double ExeRunner_min_time;
-
-        long  ExeRunner_memory ; //获取进程内存大小
-
-        public int TotalCkeckTime = 0; //系统总共需要评测的次数
-
-        String Compiler_Error_output = "";//定义进程异常输出
-        String compileTotalTime = "";
-
-        int CheckCloudFileExist(String ApiRequestUrl) //检测脚本网页API接口是否完整
-        {
-
-            try
-            {
-                //Creating the HttpWebRequest
-                HttpWebRequest request = WebRequest.Create(ApiRequestUrl) as HttpWebRequest;
-                request.Timeout = 800;
-                //Setting the Request method HEAD, you can also use GET too.
-                request.Method = "HEAD";
-                //Getting the Web Response.
-                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
-                //Returns TRUE if the Status code == 200
-
-                if (response.StatusCode == HttpStatusCode.OK)
-                { //有文件存在响应 开始读文件
-                    WebClient wc1 = new WebClient();
-                    String WebSource = wc1.DownloadString(ApiRequestUrl); //获取请求后的网页源码
-                    WebSource = WebSource.Trim();
-                    if (WebSource == "yes")
-                        return 3; //云端所有文件均存在
-                    else
-                        return 2; //云端文件不全存在
-                }
-                else
-                {
-                    return 1;//1 云端请求无法响应
-                }
-
-
-            }
-            catch
-            {
-                //Any exception will returns false.
-                return 0; //0 云端请求无法响应
-            }
-        }
-
-
-        void saveCode()
-        {
-            //MessageBox.Show(CodeFile_Location);
-            File.WriteAllText(CodeFile_Location, Code,Encoding.Default);
-            toolStripStatusLabel2.Text = "源码保存完毕！";
-        }
-
-        void JudgeDataComper() {
-            int i;
-            String RunOutFile = "";
-            String StdOutFile = "";
-            int flag = 1;
-            for (i = 0; i < TotalCkeckTime; i++) //开启文件序号递归
-            {
-                flag = 1;//文件比对标志变量 初值1 代表文件相同
-                RunOutFile = JudgeRunTemp + i.ToString() + ".out";
-                StdOutFile = JudgeStdOutDir + i.ToString() + ".out";
-                if (File.Exists(RunOutFile) && File.Exists(StdOutFile))// step1：两个文件均存在
-                {
-                    skinProgressBar1.Value = 86;
-                    String[] RunOutData = File.ReadAllLines(RunOutFile); //获取用户out行数据
-                    String[] StdOutData = File.ReadAllLines(StdOutFile);//获取标准out行数据
-                    if (RunOutData.Length == StdOutData.Length) //两个数据数组条目数一样
-                    {
-                        int i2;
-                        for (i2 = 0; i2 < RunOutData.Length; i2++) //比较文档内容是否相同
-                        {
-                            skinProgressBar1.Value = 96;
-                            if (RunOutData[i2].Trim() != StdOutData[i2].Trim())
-                                break;
-                        }
-                        if (i2 >= RunOutData.Length)
-                            flag = 1;
-                        else
-                            flag = 0;
-                    }
-                    else
-                    {
-                        flag=0;
-                    }
-
-                }
-                else {
-                    flag = 0;
-                }
-                if (flag == 0)
-                {
-                    pictureBox5.Image = Image.FromFile("./res_pic/error.png");
-                    toolStripStatusLabel2.Text = "数据匹配失败，错误点:" + i.ToString();
-                    break;
-                }
-            }
-            if (flag == 1)
-            {
-                pictureBox5.Image = Image.FromFile("./res_pic/ok.png");
-                toolStripStatusLabel2.Text = "数据匹配完毕，评测通过！"+"  CPU时间消耗："+ExeRunner_avg_time.ToString("0.000")+"ms"+"  内存消耗:"+ (ExeRunner_memory/1024).ToString()+"KB";
-                skinProgressBar1.Value = skinProgressBar1.Maximum;
-                //MessageBox.Show("MEMORY: "+ExeRunner_memory.ToString());
-            }
-        }
-
-        void downloadDataFile()
-        {
-           // MessageBox.Show(JudgeStdFile);
-            //MessageBox.Show(CloudDataUrl);
-            //必须要进行云端文件判断 才能构成评测独立模块
-            Qiniu.Conf.Config.ACCESS_KEY = QiniuAK;
-            Qiniu.Conf.Config.SECRET_KEY = QiniuSK;
-            String bucket = "codejudge";
-            String bucketFileName = "data/" + Problem_ID + ".dat";
-            RSClient client = new RSClient();
-            Entry CloudJudgeInfoEntry = client.Stat(new EntryPath(bucket, bucketFileName));
-
-            if (Cloud_type&&CloudJudgeInfoEntry.OK) //如果云端文件存在 且为 七牛云
-            {
-                WebClient wc1 = new WebClient();
-                wc1.DownloadFileCompleted += new AsyncCompletedEventHandler(wc1_DownloadFileCompleted);
-                wc1.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc1_DownloadProgressChanged);
-                wc1.DownloadFileAsync(new Uri(CloudDataUrl), JudgeStdFile);
-            }
-            else if ((!Cloud_type) && (CheckCloudFileExist(CloudScriptUrl + "?problemid=" + Problem_ID.ToString()) == 3))
-            {
-              //  MessageBox.Show(CloudDataUrl);
-                WebClient wc1 = new WebClient();
-                wc1.DownloadFileCompleted += new AsyncCompletedEventHandler(wc1_DownloadFileCompleted);
-                wc1.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc1_DownloadProgressChanged);
-                wc1.DownloadFileAsync(new Uri(CloudDataUrl), JudgeStdFile);
-            }
-            else
-            {  //云端无文件
-                pictureBox6.Image = Image.FromFile("./res_pic/error.png");
-                toolStripStatusLabel2.Text = "云端不存在此题号文件...";
-                MessageBox.Show("云端不存在此序号的评测数据\n请与管理员联系！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-            }
-        }
-
-        void wc1_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
-        {
-            pictureBox6.Image = Image.FromFile("./res_pic/run.png");
-            skinProgressBar1.Maximum = (int)e.TotalBytesToReceive;
-            skinProgressBar1.Value = (int)e.BytesReceived;
-            toolStripStatusLabel2.Text = "正在同步云端数据...";
-        }
-
-        void wc1_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
-        {
-           // Thread.Sleep(200);
-            pictureBox6.Image = Image.FromFile("./res_pic/ok.png");
-            skinProgressBar1.Value = 15;
-            toolStripStatusLabel2.Text = "云端数据同步完毕！";
-
-            toolStripStatusLabel2.Text = "开始分割数据块！";
-            Thread.Sleep(120); //时间上缓冲一下文件I/O
-            //云端数据同步完毕，开始分割数据；
-            String[] data = File.ReadAllLines(JudgeStdFile, Encoding.Default);
-            int arrayLen = data.Length;
-            String strIdList = "";
-            String temp = "";
-            for (int i = 0; i < arrayLen; i++)
-            {
-                temp = data[i];
-                temp = temp.Trim();
-                if (temp == "#") //如果为标识符号 则添加数字进入数组 以空格分开
-                {
-                    strIdList += (" " + i.ToString());
-                }
-            }
-            strIdList=strIdList.Trim();
-            String[] arrIdList = strIdList.Split(new char[1] {' '}); //获取#号所在的行号 注意内容所在地址
-
-            arrayLen = arrIdList.Length;
-            if (arrayLen % 4 != 0)  //判断文件结构中#数量是否为4的倍数，如果为则文件结构正确 否则文件结构错误
-            {
-                pictureBox2.Image = Image.FromFile("./res_pic/error.png");
-                toolStripStatusLabel2.Text = "云端数据存在结构错误！";
-                MessageBox.Show("云端数据存在结构错误！\n请与管理员联系！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-            }
-            else
-            {
-                TotalCkeckTime = arrayLen / 4; //获取需要程序载入数据评测的次数
-                pictureBox2.Image = Image.FromFile("./res_pic/run.png");
-                for (int i1 = 0; i1 < TotalCkeckTime; i1++)  //文件分割操作 开始
-                {
-                    int[] i = new int[4];
-                    for (int i2 = 0; i2 < 4; i2++)
-                        i[i2] = Convert.ToInt32(arrIdList[i1 * 4 + i2]);
-                    temp = JudgeStdInDir + i1.ToString() + ".in"; //构造out文件路径 带序号
-                    //i[0] i[1] i[2] i[3]
-                    String temp2 = "";
-                    for (int i3 = i[0] + 1; i3 < i[1]; i3++)
-                    {
-                        if (temp2 == "") //此处判断 是为了去除开头换行
-                            temp2 = data[i3];
-                        else
-                            temp2 += ("\r\n" + data[i3]);
-                    }
-                    File.WriteAllText(temp, temp2); //写入in文件
-
-                    temp = JudgeStdOutDir + i1.ToString() + ".out"; //构造out文件路径 带序号
-                    temp2 = "";
-                    for (int i3 = i[2] + 1; i3 < i[3]; i3++)
-                    {
-                        if (temp2 == "")  //此处判断 是为了去除开头换行
-                            temp2 = data[i3];
-                        else
-                            temp2 += ("\r\n" + data[i3]);
-                    }
-                    File.WriteAllText(temp, temp2); //写入out文件
-                }  //文件分割操作 结束
-                pictureBox2.Image = Image.FromFile("./res_pic/ok.png");
-                skinProgressBar1.Value = 30;
-                toolStripStatusLabel2.Text = "数据分割完毕！";
-
-                //开始编译程序
-                if (!File.Exists(CodeFile_Location)) //如果源码文件不存在
-                {
-                    pictureBox3.Image = Image.FromFile("./res_pic/error.png");
-                    MessageBox.Show("源码文件不存在，无法执行编译操作！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                }
-                else
-                {
-                    if (File.Exists(JudgeCompile + "\\" + Problem_ID + ".exe")) //清空编译缓存文件
-                        File.Delete(JudgeCompile + "\\" + Problem_ID + ".exe");
-
-                    compiler.EnableRaisingEvents = true;
-                    compiler.StartInfo.UseShellExecute = false;
-                    compiler.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
-                    compiler.StartInfo.CreateNoWindow = true;
-                    compiler.StartInfo.RedirectStandardError= true;//开启进程错误信息输出重定向
-                    compiler.Exited += new EventHandler(compiler_Exited); //添加进程退出事件
-                    compiler.StartInfo.Arguments = CodeFile_Location + " -o " + JudgeCompile + "\\" + Problem_ID + ".exe"; //运行参数
-                    compiler.StartInfo.FileName = "D:\\CodeJudge_Studio\\GCC\\bin\\g++.exe "; //程序本体
-                    compiler.Start();
-                    Compiler_Error_output = compiler.StandardError.ReadToEnd().ToString(); //获取编译异常信息
-                }
-
-
-              //  MessageBox.Show("CPU时间："+compiler.TotalProcessorTime.TotalMilliseconds.ToString());
-            }
-        }
-
-        void compiler_Exited(object sender, EventArgs e)
-        {
-            if (!File.Exists(JudgeCompile + "\\" + Problem_ID + ".exe"))
-            {
-                pictureBox3.Image = Image.FromFile("./res_pic/error.png");
-                toolStripStatusLabel2.Text = "源代码编译失败,点击图标查看详情！";
-                pictureBox3.Click += new EventHandler(pictureBox3_Click);
-            }
-            else
-            {
-                pictureBox3.Image = Image.FromFile("./res_pic/ok.png");
-                toolStripStatusLabel2.Text = "源代码编译完成！";
-                skinProgressBar1.Value = 50;
-                compileTotalTime = compiler.TotalProcessorTime.TotalMilliseconds.ToString();//获取编译总共花费时间
-
-                //编译完成 开始载入数据到程序中
-                ExeRunner_sum_time = 0;
-                ExeRunner_max_time = 0; //初始化实例运行最大时间
-                ExeRunner_min_time = 10000;//初始化实例运行最小时间
-                ExeRunner_memory = 0;//初始化实例运行最大内存
-
-                for (int i = 0; i < TotalCkeckTime; i++) //根据此数字标识 判断程序执行几次 并载入数据
-                {
-                    //构造参数 传统运行方式 不可行
-                    //ExeRunner.StartInfo.Arguments = " << " + JudgeStdInDir + i.ToString() + ".in >>" + JudgeRunTemp + i.ToString()+".out";
-                    //MessageBox.Show(ExeRunner.StartInfo.Arguments);
-                    // ExeRunner.StartInfo.Arguments = " <" + JudgeStdInDir + i.ToString() + ".in ";
-
-                    //清理以前程序运行所产生的out文件
-
-                    if (ExeRunner_state == "ok")
-                    {
-                        toolStripStatusLabel2.Text = "正在运行第" + (i + 1).ToString() + "个实例！";
-                        pictureBox4.Image = Image.FromFile("./res_pic/" + i.ToString() + ".png");
-                        if (File.Exists(JudgeRunTemp + i.ToString() + ".out"))
-                            File.Delete(JudgeRunTemp + i.ToString() + ".out");
-                        ExeRunner = new Process();//创建数据管理进程
-                        ExeRunner.StartInfo.UseShellExecute = false;
-                        ExeRunner.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
-                        ExeRunner.StartInfo.CreateNoWindow = true;
-                        ExeRunner.StartInfo.FileName = JudgeCompile + "\\" + Problem_ID + ".exe"; //构造程序执行本体
-                        ExeRunner.EnableRaisingEvents = true; //允许开启事件监听
-                        ExeRunner.StartInfo.RedirectStandardOutput = true;
-                        ExeRunner.StartInfo.RedirectStandardInput = true;
-                        ExeRunner.Exited += new EventHandler(ExeRunner_Exited);
-                        //ExeRunner.;
-                        ExeRunner.Start();
-                        skinProgressBar1.Value = 60;
-
-                          if (ExeRunner.WorkingSet64 > ExeRunner_memory) //获取物理内存使用情况 内存大小
-                              ExeRunner_memory = ExeRunner.WorkingSet64;
-
-                        String input = File.ReadAllText(JudgeStdInDir + i.ToString() + ".in");
-                        ExeRunner.StandardInput.WriteLine(input);  //向进程标准输入系统中写入数据
-                        ExeRunner_start_time = DateTime.Now;  //获取进程开始运行的时间
-                        if (!ExeRunner.WaitForExit(Convert.ToInt32(CpuTime.ToString())))//超时 无文件输出
-                        {
-                            // ExeRunner_state = "chaoshi"; //超时标记
-
-                            if (!ExeRunner.HasExited)
-                            {
-                                ExeRunner.Kill();
-                            }
-
-                        }
-                        else
-                        {
-
-                            String output = ExeRunner.StandardOutput.ReadToEnd().ToString(); //获取控制台标准输出
-                            if(output.Trim()!="")
-                                 File.WriteAllText(JudgeRunTemp + i.ToString() + ".out", output); //把数据写入文件中
-
-                        }
-
-
-                        if (File.Exists(JudgeRunTemp + i.ToString() + ".out") && ExeRunner_state == "ok")
-                        {
-                            pictureBox4.Image = Image.FromFile("./res_pic/ok.png");
-                            // ExeRunner_state = "ok";
-                        }
-                        else if ((!File.Exists(JudgeRunTemp + i.ToString() + ".out")) && ExeRunner_state == "ok")
-                        {
-                            //运行时错误
-                            ExeRunner_state = "runtimeerror"; //运行时错误
-                            pictureBox4.Image = Image.FromFile("./res_pic/error.png");
-                            break;
-                        }
-                        else
-                        {
-                            pictureBox4.Image = Image.FromFile("./res_pic/error.png");
-                            break;
-                        }
-                    }
-                    else
-                    {
-                        break; //不是OK状态了
-                    }
-                }
-
-
-                while (!ExeRunner.HasExited) ;  //此空循环 是为了等待 进程关闭事件处理完毕 ExeRunner_state数据同步 千万不可以删除
-                if (ExeRunner_state == "ok")
-                {
-                    skinProgressBar1.Value = 65;
-                    //ExeRunner_avg_time = ExeRunner_sum_time / TotalCkeckTime;
-                    if (TotalCkeckTime - 2 > 0)
-                    {
-                        ExeRunner_avg_time = (ExeRunner_sum_time - ExeRunner_max_time - ExeRunner_min_time) / (TotalCkeckTime - 2);
-                        // MessageBox.Show("AVG Time：" + ExeRunner_avg_time.ToString("0.000"));
-
-                    //数据生成完毕 开始批对数据
-                        JudgeDataComper();
-
-                    }
-                    else {
-                        MessageBox.Show("错误：此评测数据量不足，请与管理员联系！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                    }
-                }
-                else if (ExeRunner_state == "chaoshi")
-                {
-                    //  MessageBox.Show(ExeRunner_max_time.ToString());
-                    toolStripStatusLabel2.Text = "错误：程序实例运行【超时】！";
-                    MessageBox.Show("程序实例运行【超时】！", "运行超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                }
-                else
-                {
-                    //MessageBox.Show(ExeRunner_state);
-                    toolStripStatusLabel2.Text = "程序与系统环境发生【冲突】，请检查源码中【变量定义】部分！";
-                    MessageBox.Show("错误：程序与系统环境发生【冲突】！", "系统冲突", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                }
-
-
-            }
-
-        }
-
-        void ExeRunner_Exited(object sender, EventArgs e)
-        {
-          //  throw new NotImplementedException();
-
-           // MessageBox.Show("cpu time:" + CpuTime);
-            if (ExeRunner.TotalProcessorTime.TotalMilliseconds > Convert.ToDouble(CpuTime)-30)
-            {
-                ExeRunner_state = "chaoshi"; //更新超时状态
-             //   MessageBox.Show("run time:" + ExeRunner.TotalProcessorTime.TotalMilliseconds.ToString());
-            }else  if (ExeRunner_state == "ok") //如果当前实例完美执行完后
-                {
-                    ExeRunner_end_time = DateTime.Now;
-                    ExeRunner_total_time = ExeRunner_end_time - ExeRunner_start_time; //计算总共时间
-                    ExeRunner_sum_time += Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString());
-                    // toolStripStatusLabel1.Text += (" "+ExeRunner_total_time.TotalMilliseconds.ToString("0.000"));
-                    if (Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString()) > ExeRunner_max_time)//获取实例运行最大时间
-                    {
-                        // MessageBox.Show(ExeRunner_max_time.ToString("0.000"));
-                        ExeRunner_max_time = Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString());
-                    }
-                    if (Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString()) < ExeRunner_min_time)//获取实例运行最小时间
-                    {
-                        // MessageBox.Show(ExeRunner_max_time.ToString("0.000"));
-                        ExeRunner_min_time = Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString());
-                    }
-
-
-                }
-            }
-
-
-        void pictureBox3_Click(object sender, EventArgs e)
-        {
-
-         //   MessageBox.Show(Compiler_Error_output);
-            frm_Info frmInfo = new frm_Info();
-            frmInfo.infoType = "compileError";
-            frmInfo.info = Compiler_Error_output;
-            frmInfo.ShowDialog();
-        }
-
-
-
-
-        //初始化函数
-        void Init()
-        {
-            saveCode();  //保存源码
-            skinProgressBar1.Value = 5;
-            downloadDataFile();
-        }
-        public Judge()
-        {
-            InitializeComponent();
-        }
-
-        private void Judge_Load(object sender, EventArgs e)
-        {
-            //获取云类型
-            if (!File.Exists(Cloud_flag))
-                Cloud_type = true; //默认七牛云
-            else
-            {
-                Cloud_type = false;//自定义 私有云
-                String[] temp = File.ReadAllLines(Cloud_flag, Encoding.Default);
-                CloudDataUrl = temp[0].ToString()+"data/"; // 获取文件中保存的云URL链接
-                CloudScriptUrl = temp[1].ToString();// 获取文件中保存的云端脚本URL链接
-
-            }
-        }
-
-        private void Frm_Judge_unload(object sender, FormClosedEventArgs e)
-        {
-
-        }
-
-        private void frm_Judge_Show(object sender, EventArgs e)
-        {
-            //构造工作必须目录 并创建目录
-            problemDir = rootDir + Problem_ID+"\\"; //题目目录
-            SourceDir = problemDir + "source\\";  //源码目录
-            JudgeStd = problemDir + "judge_std\\";//网络标准评测数据目录
-            JudgeCompile = problemDir + "judge_compile\\";//源码编译目录
-            JudgeRunTemp = problemDir + "judge_runtemp\\";
-            CodeFile_Location = SourceDir + Problem_ID + "." + CodeType; //构造源码文件保存完整路径
-            CloudDataUrl = CloudDataUrl + Problem_ID + ".dat";//构造云端数据完整路径
-            JudgeStdFile = JudgeStd + Problem_ID + ".dat";//标准评测数据完整本地路径 格式为.dat
-            JudgeStdInDir = JudgeStd + "in\\"; //创建标准评测数据分割IN文件夹
-            JudgeStdOutDir = JudgeStd + "out\\";//创建标准评测数据分割OUT文件夹
-
-
-            if (!Directory.Exists(rootDir))
-                Directory.CreateDirectory(rootDir);
-            if (!Directory.Exists(problemDir))
-                Directory.CreateDirectory(problemDir);
-            if (!Directory.Exists(SourceDir))
-                Directory.CreateDirectory(SourceDir);
-            if (!Directory.Exists(JudgeStd))
-                Directory.CreateDirectory(JudgeStd);
-            if (!Directory.Exists(JudgeCompile))
-                Directory.CreateDirectory(JudgeCompile);
-            if (!Directory.Exists(JudgeRunTemp))
-                Directory.CreateDirectory(JudgeRunTemp);
-            if (!Directory.Exists(JudgeStdInDir))
-                Directory.CreateDirectory(JudgeStdInDir);
-            if (!Directory.Exists(JudgeStdOutDir))
-                Directory.CreateDirectory(JudgeStdOutDir);
-
-            //初始化环境
-            Init();
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using CCWin;
+using System.IO;
+using System.Net;
+using System.Threading;
+using Qiniu.Conf;
+using Qiniu.RS;
+using System.Diagnostics;
+
+namespace CodeJudge
+{
+    public partial class Judge : Skin_Mac
+    {
+        public  String Problem_ID = "";
+        public  String Code = "";
+        public String CodeType="cpp"; //代码类型初始化为C++
+        public String CpuTime = "";
+        public String MemoryMax = "";
+        public String QiniuAK = "";
+        public String QiniuSK = "";
+        bool Cloud_type = true; //默认七牛云
+
+        String Cloud_flag = "D:\\CodeJudge_Studio\\cloud_flag.dat";  //自定义云的标致符号
+        String CloudScriptUrl = "";
+        //设计几个文件路径  部分在show事件中初始化
+        String rootDir="D:\\CodeJudge_Studio\\Run_Data\\"; //根目录
+        String problemDir = "";  //根目录下的题目目录
+        String SourceDir = "";//题目目录下的源代码目录
+        String JudgeStd = ""; //题目目录下的网络标准评测数据目录
+        String JudgeCompile = "";//题目目录下的编译目录
+        String JudgeRunTemp = "";//题目目录下的程序运行结果目录
+        String CodeFile_Location = "";//源码文件完整路径
+        String CloudDataUrl = "http://7xl54r.dl1.z0.glb.clouddn.com/data/";
+        String JudgeStdFile = "";//云端数据文件本地保存路径
+        String JudgeStdInDir = ""; //云端数据分割后的in数据文件夹
+        String JudgeStdOutDir = "";//云端数据分割后的out数据文件夹
+        Process compiler = new Process();  //定义编译器对象
+        Process ExeRunner=null;  //定义程序执行体对象
+        String ExeRunner_state = "ok";//实例运行后的状态
+        DateTime ExeRunner_start_time ;//实例开始运行时间
+        DateTime ExeRunner_end_time ;//实例终止运行时间
+        TimeSpan ExeRunner_total_time;//实例实际运行时间
+        double ExeRunner_max_time;//实例运行的最大时间
+        double ExeRunner_sum_time;
+        double ExeRunner_avg_time;
+        double ExeRunner_min_time;
+
+        long  ExeRunner_memory ; //获取进程内存大小
+
+        public int TotalCkeckTime = 0; //系统总共需要评测的次数
+
+        String Compiler_Error_output = "";//定义进程异常输出
+        String compileTotalTime = "";
+
+        int CheckCloudFileExist(String ApiRequestUrl) //检测脚本网页API接口是否完整
+        {
+
+            try
+            {
+                //Creating the HttpWebRequest
+                HttpWebRequest request = WebRequest.Create(ApiRequestUrl) as HttpWebRequest;
+                request.Timeout = 800;
+                //Setting the Request method HEAD, you can also use GET too.
+                request.Method = "HEAD";
+                //Getting the Web Response.
+                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
+                //Returns TRUE if the Status code == 200
+
+                if (response.StatusCode == HttpStatusCode.OK)
+                { //有文件存在响应 开始读文件
+                    WebClient wc1 = new WebClient();
+                    String WebSource = wc1.DownloadString(ApiRequestUrl); //获取请求后的网页源码
+                    WebSource = WebSource.Trim();
+                    if (WebSource == "yes")
+                        return 3; //云端所有文件均存在
+                    else
+                        return 2; //云端文件不全存在
+                }
+                else
+                {
+                    return 1;//1 云端请求无法响应
+                }
+
+
+            }
+            catch
+            {
+                //Any exception will returns false.
+                return 0; //0 云端请求无法响应
+            }
+        }
+
+
+        void saveCode()
+        {
+            //MessageBox.Show(CodeFile_Location);
+            File.WriteAllText(CodeFile_Location, Code,Encoding.Default);
+            toolStripStatusLabel2.Text = "源码保存完毕！";
+        }
+
+        void JudgeDataComper() {
+            int i;
+            String RunOutFile = "";
+            String StdOutFile = "";
+            int flag = 1;
+            for (i = 0; i < TotalCkeckTime; i++) //开启文件序号递归
+            {
+                flag = 1;//文件比对标志变量 初值1 代表文件相同
+                RunOutFile = JudgeRunTemp + i.ToString() + ".out";
+                StdOutFile = JudgeStdOutDir + i.ToString() + ".out";
+                if (File.Exists(RunOutFile) && File.Exists(StdOutFile))// step1：两个文件均存在
+                {
+                    skinProgressBar1.Value = 86;
+                    String[] RunOutData = File.ReadAllLines(RunOutFile); //获取用户out行数据
+                    String[] StdOutData = File.ReadAllLines(StdOutFile);//获取标准out行数据
+                    if (RunOutData.Length == StdOutData.Length) //两个数据数组条目数一样
+                    {
+                        int i2;
+                        for (i2 = 0; i2 < RunOutData.Length; i2++) //比较文档内容是否相同
+                        {
+                            skinProgressBar1.Value = 96;
+                            if (RunOutData[i2].Trim() != StdOutData[i2].Trim())
+                                break;
+                        }
+                        if (i2 >= RunOutData.Length)
+                            flag = 1;
+                        else
+                            flag = 0;
+                    }
+                    else
+                    {
+                        flag=0;
+                    }
+
+                }
+                else {
+                    flag = 0;
+                }
+                if (flag == 0)
+                {
+                    pictureBox5.Image = Image.FromFile("./res_pic/error.png");
+                    toolStripStatusLabel2.Text = "数据匹配失败，错误点:" + i.ToString();
+                    break;
+                }
+            }
+            if (flag == 1)
+            {
+                pictureBox5.Image = Image.FromFile("./res_pic/ok.png");
+                toolStripStatusLabel2.Text = "数据匹配完毕，评测通过！"+"  CPU时间消耗："+ExeRunner_avg_time.ToString("0.000")+"ms"+"  内存消耗:"+ (ExeRunner_memory/1024).ToString()+"KB";
+                skinProgressBar1.Value = skinProgressBar1.Maximum;
+                //MessageBox.Show("MEMORY: "+ExeRunner_memory.ToString());
+            }
+        }
+
+        void downloadDataFile()
+        {
+           // MessageBox.Show(JudgeStdFile);
+            //MessageBox.Show(CloudDataUrl);
+            //必须要进行云端文件判断 才能构成评测独立模块
+            Qiniu.Conf.Config.ACCESS_KEY = QiniuAK;
+            Qiniu.Conf.Config.SECRET_KEY = QiniuSK;
+            String bucket = "codejudge";
+            String bucketFileName = "data/" + Problem_ID + ".dat";
+            RSClient client = new RSClient();
+            Entry CloudJudgeInfoEntry = client.Stat(new EntryPath(bucket, bucketFileName));
+
+            if (Cloud_type&&CloudJudgeInfoEntry.OK) //如果云端文件存在 且为 七牛云
+            {
+                WebClient wc1 = new WebClient();
+                wc1.DownloadFileCompleted += new AsyncCompletedEventHandler(wc1_DownloadFileCompleted);
+                wc1.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc1_DownloadProgressChanged);
+                wc1.DownloadFileAsync(new Uri(CloudDataUrl), JudgeStdFile);
+            }
+            else if ((!Cloud_type) && (CheckCloudFileExist(CloudScriptUrl + "?problemid=" + Problem_ID.ToString()) == 3))
+            {
+              //  MessageBox.Show(CloudDataUrl);
+                WebClient wc1 = new WebClient();
+                wc1.DownloadFileCompleted += new AsyncCompletedEventHandler(wc1_DownloadFileCompleted);
+                wc1.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc1_DownloadProgressChanged);
+                wc1.DownloadFileAsync(new Uri(CloudDataUrl), JudgeStdFile);
+            }
+            else
+            {  //云端无文件
+                pictureBox6.Image = Image.FromFile("./res_pic/error.png");
+                toolStripStatusLabel2.Text = "云端不存在此题号文件...";
+                MessageBox.Show("云端不存在此序号的评测数据\n请与管理员联系！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+            }
+        }
+
+        void wc1_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
+        {
+            pictureBox6.Image = Image.FromFile("./res_pic/run.png");
+            skinProgressBar1.Maximum = (int)e.TotalBytesToReceive;
+            skinProgressBar1.Value = (int)e.BytesReceived;
+            toolStripStatusLabel2.Text = "正在同步云端数据...";
+        }
+
+        void wc1_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
+        {
+           // Thread.Sleep(200);
+            pictureBox6.Image = Image.FromFile("./res_pic/ok.png");
+            skinProgressBar1.Value = 15;
+            toolStripStatusLabel2.Text = "云端数据同步完毕！";
+
+            toolStripStatusLabel2.Text = "开始分割数据块！";
+            Thread.Sleep(120); //时间上缓冲一下文件I/O
+            //云端数据同步完毕，开始分割数据；
+            String[] data = File.ReadAllLines(JudgeStdFile, Encoding.Default);
+            int arrayLen = data.Length;
+            String strIdList = "";
+            String temp = "";
+            for (int i = 0; i < arrayLen; i++)
+            {
+                temp = data[i];
+                temp = temp.Trim();
+                if (temp == "#") //如果为标识符号 则添加数字进入数组 以空格分开
+                {
+                    strIdList += (" " + i.ToString());
+                }
+            }
+            strIdList=strIdList.Trim();
+            String[] arrIdList = strIdList.Split(new char[1] {' '}); //获取#号所在的行号 注意内容所在地址
+
+            arrayLen = arrIdList.Length;
+            if (arrayLen % 4 != 0)  //判断文件结构中#数量是否为4的倍数，如果为则文件结构正确 否则文件结构错误
+            {
+                pictureBox2.Image = Image.FromFile("./res_pic/error.png");
+                toolStripStatusLabel2.Text = "云端数据存在结构错误！";
+                MessageBox.Show("云端数据存在结构错误！\n请与管理员联系！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+            }
+            else
+            {
+                TotalCkeckTime = arrayLen / 4; //获取需要程序载入数据评测的次数
+                pictureBox2.Image = Image.FromFile("./res_pic/run.png");
+                for (int i1 = 0; i1 < TotalCkeckTime; i1++)  //文件分割操作 开始
+                {
+                    int[] i = new int[4];
+                    for (int i2 = 0; i2 < 4; i2++)
+                        i[i2] = Convert.ToInt32(arrIdList[i1 * 4 + i2]);
+                    temp = JudgeStdInDir + i1.ToString() + ".in"; //构造out文件路径 带序号
+                    //i[0] i[1] i[2] i[3]
+                    String temp2 = "";
+                    for (int i3 = i[0] + 1; i3 < i[1]; i3++)
+                    {
+                        if (temp2 == "") //此处判断 是为了去除开头换行
+                            temp2 = data[i3];
+                        else
+                            temp2 += ("\r\n" + data[i3]);
+                    }
+                    File.WriteAllText(temp, temp2); //写入in文件
+
+                    temp = JudgeStdOutDir + i1.ToString() + ".out"; //构造out文件路径 带序号
+                    temp2 = "";
+                    for (int i3 = i[2] + 1; i3 < i[3]; i3++)
+                    {
+                        if (temp2 == "")  //此处判断 是为了去除开头换行
+                            temp2 = data[i3];
+                        else
+                            temp2 += ("\r\n" + data[i3]);
+                    }
+                    File.WriteAllText(temp, temp2); //写入out文件
+                }  //文件分割操作 结束
+                pictureBox2.Image = Image.FromFile("./res_pic/ok.png");
+                skinProgressBar1.Value = 30;
+                toolStripStatusLabel2.Text = "数据分割完毕！";
+
+                //开始编译程序
+                if (!File.Exists(CodeFile_Location)) //如果源码文件不存在
+                {
+                    pictureBox3.Image = Image.FromFile("./res_pic/error.png");
+                    MessageBox.Show("源码文件不存在，无法执行编译操作！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
+                else
+                {
+                    if (File.Exists(JudgeCompile + "\\" + Problem_ID + ".exe")) //清空编译缓存文件
+                        File.Delete(JudgeCompile + "\\" + Problem_ID + ".exe");
+
+                    compiler.EnableRaisingEvents = true;
+                    compiler.StartInfo.UseShellExecute = false;
+                    compiler.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+                    compiler.StartInfo.CreateNoWindow = true;
+                    compiler.StartInfo.RedirectStandardError= true;//开启进程错误信息输出重定向
+                    compiler.Exited += new EventHandler(compiler_Exited); //添加进程退出事件
+                    compiler.StartInfo.Arguments = CodeFile_Location + " -o " + JudgeCompile + "\\" + Problem_ID + ".exe"; //运行参数
+                    compiler.StartInfo.FileName = "D:\\CodeJudge_Studio\\GCC\\bin\\g++.exe "; //程序本体
+                    compiler.Start();
+                    Compiler_Error_output = compiler.StandardError.ReadToEnd().ToString(); //获取编译异常信息
+                }
+
+
+              //  MessageBox.Show("CPU时间："+compiler.TotalProcessorTime.TotalMilliseconds.ToString());
+            }
+        }
+
+        void compiler_Exited(object sender, EventArgs e)
+        {
+            if (!File.Exists(JudgeCompile + "\\" + Problem_ID + ".exe"))
+            {
+                pictureBox3.Image = Image.FromFile("./res_pic/error.png");
+                toolStripStatusLabel2.Text = "源代码编译失败,点击图标查看详情！";
+                pictureBox3.Click += new EventHandler(pictureBox3_Click);
+            }
+            else
+            {
+                pictureBox3.Image = Image.FromFile("./res_pic/ok.png");
+                toolStripStatusLabel2.Text = "源代码编译完成！";
+                skinProgressBar1.Value = 50;
+                compileTotalTime = compiler.TotalProcessorTime.TotalMilliseconds.ToString();//获取编译总共花费时间
+
+                //编译完成 开始载入数据到程序中
+                ExeRunner_sum_time = 0;
+                ExeRunner_max_time = 0; //初始化实例运行最大时间
+                ExeRunner_min_time = 10000;//初始化实例运行最小时间
+                ExeRunner_memory = 0;//初始化实例运行最大内存
+
+                for (int i = 0; i < TotalCkeckTime; i++) //根据此数字标识 判断程序执行几次 并载入数据
+                {
+                    //构造参数 传统运行方式 不可行
+                    //ExeRunner.StartInfo.Arguments = " << " + JudgeStdInDir + i.ToString() + ".in >>" + JudgeRunTemp + i.ToString()+".out";
+                    //MessageBox.Show(ExeRunner.StartInfo.Arguments);
+                    // ExeRunner.StartInfo.Arguments = " <" + JudgeStdInDir + i.ToString() + ".in ";
+
+                    //清理以前程序运行所产生的out文件
+
+                    if (ExeRunner_state == "ok")
+                    {
+                        toolStripStatusLabel2.Text = "正在运行第" + (i + 1).ToString() + "个实例！";
+                        pictureBox4.Image = Image.FromFile("./res_pic/" + i.ToString() + ".png");
+                        if (File.Exists(JudgeRunTemp + i.ToString() + ".out"))
+                            File.Delete(JudgeRunTemp + i.ToString() + ".out");
+                        ExeRunner = new Process();//创建数据管理进程
+                        ExeRunner.StartInfo.UseShellExecute = false;
+                        ExeRunner.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+                        ExeRunner.StartInfo.CreateNoWindow = true;
+                        ExeRunner.StartInfo.FileName = JudgeCompile + "\\" + Problem_ID + ".exe"; //构造程序执行本体
+                        ExeRunner.EnableRaisingEvents = true; //允许开启事件监听
+                        ExeRunner.StartInfo.RedirectStandardOutput = true;
+                        ExeRunner.StartInfo.RedirectStandardInput = true;
+                        ExeRunner.Exited += new EventHandler(ExeRunner_Exited);
+                        //ExeRunner.;
+                        ExeRunner.Start();
+                        skinProgressBar1.Value = 60;
+
+                          if (ExeRunner.WorkingSet64 > ExeRunner_memory) //获取物理内存使用情况 内存大小
+                              ExeRunner_memory = ExeRunner.WorkingSet64;
+
+                        String input = File.ReadAllText(JudgeStdInDir + i.ToString() + ".in");
+                        ExeRunner.StandardInput.WriteLine(input);  //向进程标准输入系统中写入数据
+                        ExeRunner_start_time = DateTime.Now;  //获取进程开始运行的时间
+                        if (!ExeRunner.WaitForExit(Convert.ToInt32(CpuTime.ToString())))//超时 无文件输出
+                        {
+                            // ExeRunner_state = "chaoshi"; //超时标记
+
+                            if (!ExeRunner.HasExited)
+                            {
+                                ExeRunner.Kill();
+                            }
+
+                        }
+                        else
+                        {
+
+                            String output = ExeRunner.StandardOutput.ReadToEnd().ToString(); //获取控制台标准输出
+                            if(output.Trim()!="")
+                                 File.WriteAllText(JudgeRunTemp + i.ToString() + ".out", output); //把数据写入文件中
+
+                        }
+
+
+                        if (File.Exists(JudgeRunTemp + i.ToString() + ".out") && ExeRunner_state == "ok")
+                        {
+                            pictureBox4.Image = Image.FromFile("./res_pic/ok.png");
+                            // ExeRunner_state = "ok";
+                        }
+                        else if ((!File.Exists(JudgeRunTemp + i.ToString() + ".out")) && ExeRunner_state == "ok")
+                        {
+                            //运行时错误
+                            ExeRunner_state = "runtimeerror"; //运行时错误
+                            pictureBox4.Image = Image.FromFile("./res_pic/error.png");
+                            break;
+                        }
+                        else
+                        {
+                            pictureBox4.Image = Image.FromFile("./res_pic/error.png");
+                            break;
+                        }
+                    }
+                    else
+                    {
+                        break; //不是OK状态了
+                    }
+                }
+
+
+                while (!ExeRunner.HasExited) ;  //此空循环 是为了等待 进程关闭事件处理完毕 ExeRunner_state数据同步 千万不可以删除
+                if (ExeRunner_state == "ok")
+                {
+                    skinProgressBar1.Value = 65;
+                    //ExeRunner_avg_time = ExeRunner_sum_time / TotalCkeckTime;
+                    if (TotalCkeckTime - 2 > 0)
+                    {
+                        ExeRunner_avg_time = (ExeRunner_sum_time - ExeRunner_max_time - ExeRunner_min_time) / (TotalCkeckTime - 2);
+                        // MessageBox.Show("AVG Time：" + ExeRunner_avg_time.ToString("0.000"));
+
+                    //数据生成完毕 开始批对数据
+                        JudgeDataComper();
+
+                    }
+                    else {
+                        MessageBox.Show("错误：此评测数据量不足，请与管理员联系！\n电子邮箱:admin@icore.com", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    }
+                }
+                else if (ExeRunner_state == "chaoshi")
+                {
+                    //  MessageBox.Show(ExeRunner_max_time.ToString());
+                    toolStripStatusLabel2.Text = "错误：程序实例运行【超时】！";
+                    MessageBox.Show("程序实例运行【超时】！", "运行超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
+                else
+                {
+                    //MessageBox.Show(ExeRunner_state);
+                    toolStripStatusLabel2.Text = "程序与系统环境发生【冲突】，请检查源码中【变量定义】部分！";
+                    MessageBox.Show("错误：程序与系统环境发生【冲突】！", "系统冲突", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
+
+
+            }
+
+        }
+
+        void ExeRunner_Exited(object sender, EventArgs e)
+        {
+          //  throw new NotImplementedException();
+
+           // MessageBox.Show("cpu time:" + CpuTime);
+            if (ExeRunner.TotalProcessorTime.TotalMilliseconds > Convert.ToDouble(CpuTime)-30)
+            {
+                ExeRunner_state = "chaoshi"; //更新超时状态
+             //   MessageBox.Show("run time:" + ExeRunner.TotalProcessorTime.TotalMilliseconds.ToString());
+            }else  if (ExeRunner_state == "ok") //如果当前实例完美执行完后
+                {
+                    ExeRunner_end_time = DateTime.Now;
+                    ExeRunner_total_time = ExeRunner_end_time - ExeRunner_start_time; //计算总共时间
+                    ExeRunner_sum_time += Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString());
+                    // toolStripStatusLabel1.Text += (" "+ExeRunner_total_time.TotalMilliseconds.ToString("0.000"));
+                    if (Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString()) > ExeRunner_max_time)//获取实例运行最大时间
+                    {
+                        // MessageBox.Show(ExeRunner_max_time.ToString("0.000"));
+                        ExeRunner_max_time = Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString());
+                    }
+                    if (Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString()) < ExeRunner_min_time)//获取实例运行最小时间
+                    {
+                        // MessageBox.Show(ExeRunner_max_time.ToString("0.000"));
+                        ExeRunner_min_time = Convert.ToDouble(ExeRunner_total_time.TotalMilliseconds.ToString());
+                    }
+
+
+                }
+            }
+
+
+        void pictureBox3_Click(object sender, EventArgs e)
+        {
+
+         //   MessageBox.Show(Compiler_Error_output);
+            frm_Info frmInfo = new frm_Info();
+            frmInfo.infoType = "compileError";
+            frmInfo.info = Compiler_Error_output;
+            frmInfo.ShowDialog();
+        }
+
+
+
+
+        //初始化函数
+        void Init()
+        {
+            saveCode();  //保存源码
+            skinProgressBar1.Value = 5;
+            downloadDataFile();
+        }
+        public Judge()
+        {
+            InitializeComponent();
+        }
+
+        private void Judge_Load(object sender, EventArgs e)
+        {
+            //获取云类型
+            if (!File.Exists(Cloud_flag))
+                Cloud_type = true; //默认七牛云
+            else
+            {
+                Cloud_type = false;//自定义 私有云
+                String[] temp = File.ReadAllLines(Cloud_flag, Encoding.Default);
+                CloudDataUrl = temp[0].ToString()+"data/"; // 获取文件中保存的云URL链接
+                CloudScriptUrl = temp[1].ToString();// 获取文件中保存的云端脚本URL链接
+                //MessageBox.Show("ok");
+            }
+        }
+
+        private void Frm_Judge_unload(object sender, FormClosedEventArgs e)
+        {
+
+        }
+
+        private void frm_Judge_Show(object sender, EventArgs e)
+        {
+            //构造工作必须目录 并创建目录
+            problemDir = rootDir + Problem_ID+"\\"; //题目目录
+            SourceDir = problemDir + "source\\";  //源码目录
+            JudgeStd = problemDir + "judge_std\\";//网络标准评测数据目录
+            JudgeCompile = problemDir + "judge_compile\\";//源码编译目录
+            JudgeRunTemp = problemDir + "judge_runtemp\\";
+            CodeFile_Location = SourceDir + Problem_ID + "." + CodeType; //构造源码文件保存完整路径
+            CloudDataUrl = CloudDataUrl + Problem_ID + ".dat";//构造云端数据完整路径
+            JudgeStdFile = JudgeStd + Problem_ID + ".dat";//标准评测数据完整本地路径 格式为.dat
+            JudgeStdInDir = JudgeStd + "in\\"; //创建标准评测数据分割IN文件夹
+            JudgeStdOutDir = JudgeStd + "out\\";//创建标准评测数据分割OUT文件夹
+
+
+            if (!Directory.Exists(rootDir))
+                Directory.CreateDirectory(rootDir);
+            if (!Directory.Exists(problemDir))
+                Directory.CreateDirectory(problemDir);
+            if (!Directory.Exists(SourceDir))
+                Directory.CreateDirectory(SourceDir);
+            if (!Directory.Exists(JudgeStd))
+                Directory.CreateDirectory(JudgeStd);
+            if (!Directory.Exists(JudgeCompile))
+                Directory.CreateDirectory(JudgeCompile);
+            if (!Directory.Exists(JudgeRunTemp))
+                Directory.CreateDirectory(JudgeRunTemp);
+            if (!Directory.Exists(JudgeStdInDir))
+                Directory.CreateDirectory(JudgeStdInDir);
+            if (!Directory.Exists(JudgeStdOutDir))
+                Directory.CreateDirectory(JudgeStdOutDir);
+
+            //初始化环境
+            Init();
+        }
+    }
+}


Bug fix for line directives.

Bug fix for line directives.

--- src/Cake.Core/Scripting/ScriptProcessor.cs
+++ src/Cake.Core/Scripting/ScriptProcessor.cs
@@ -76,14 +76,19 @@
             _log.Debug("Processing {0}...", path.GetFilename().FullPath);
             var lines = ReadSource(path);

-            // Append the line directive for the script.
-            context.AppendScriptLine(string.Format(CultureInfo.InvariantCulture, "#line 1 \"{0}\"", path.GetFilename().FullPath));
-
             // Iterate all lines in the script.
+            var firstLine = true;
             foreach (var line in lines)
             {
                 if (!_lineProcessors.Any(p => p.Process(this, context, path, line)))
                 {
+                    if (firstLine)
+                    {
+                        // Append the line directive for the script.
+                        context.AppendScriptLine(string.Format(CultureInfo.InvariantCulture, "#line 1 \"{0}\"", path.GetFilename().FullPath));
+                        firstLine = false;
+                    }
+
                     context.AppendScriptLine(line);
                 }
             }


Fix Rune.ToUpper / ToLower under GlobalizationMode.Invariant (#21203)

Signed-off-by: dotnet-bot <03c4cb6107ae99956a7681f2c97ff7104809a2bd@microsoft.com>

--- src/Common/src/CoreLib/System/Text/Rune.cs
+++ src/Common/src/CoreLib/System/Text/Rune.cs
@@ -161,14 +161,10 @@
         /// </summary>
         public int Value => (int)_value;

-        private static Rune ChangeCase(Rune rune, CultureInfo culture, bool toUpper)
-        {
-            if (culture == null)
-            {
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.culture);
-            }
-
-            var textInfo = culture.TextInfo;
+        private static Rune ChangeCaseCultureAware(Rune rune, TextInfo textInfo, bool toUpper)
+        {
+            Debug.Assert(!GlobalizationMode.Invariant, "This should've been checked by the caller.");
+            Debug.Assert(textInfo != null, "This should've been checked by the caller.");

             Span<char> original = stackalloc char[2]; // worst case scenario = 2 code units (for a surrogate pair)
             Span<char> modified = stackalloc char[2]; // case change should preserve UTF-16 code unit count
@@ -727,42 +723,90 @@
             return IsCategorySeparator(GetUnicodeCategoryNonAscii(value));
         }

-        public static Rune ToLower(Rune value, CultureInfo culture) => ChangeCase(value, culture, toUpper: false);
+        public static Rune ToLower(Rune value, CultureInfo culture)
+        {
+            if (culture is null)
+            {
+                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.culture);
+            }
+
+            // We don't want to special-case ASCII here since the specified culture might handle
+            // ASCII characters differently than the invariant culture (e.g., Turkish I). Instead
+            // we'll just jump straight to the globalization tables if they're available.
+
+            if (GlobalizationMode.Invariant)
+            {
+                return ToLowerInvariant(value);
+            }
+
+            return ChangeCaseCultureAware(value, culture.TextInfo, toUpper: false);
+        }

         public static Rune ToLowerInvariant(Rune value)
         {
             // Handle the most common case (ASCII data) first. Within the common case, we expect
             // that there'll be a mix of lowercase & uppercase chars, so make the conversion branchless.

-            if (value.IsAscii || GlobalizationMode.Invariant)
+            if (value.IsAscii)
             {
                 // It's ok for us to use the UTF-16 conversion utility for this since the high
                 // 16 bits of the value will never be set so will be left unchanged.
                 return UnsafeCreate(Utf16Utility.ConvertAllAsciiCharsInUInt32ToLowercase(value._value));
             }

+            if (GlobalizationMode.Invariant)
+            {
+                // If the value isn't ASCII and if the globalization tables aren't available,
+                // case changing has no effect.
+                return value;
+            }
+
             // Non-ASCII data requires going through the case folding tables.

-            return ToLower(value, CultureInfo.InvariantCulture);
-        }
-
-        public static Rune ToUpper(Rune value, CultureInfo culture) => ChangeCase(value, culture, toUpper: true);
+            return ChangeCaseCultureAware(value, TextInfo.Invariant, toUpper: false);
+        }
+
+        public static Rune ToUpper(Rune value, CultureInfo culture)
+        {
+            if (culture is null)
+            {
+                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.culture);
+            }
+
+            // We don't want to special-case ASCII here since the specified culture might handle
+            // ASCII characters differently than the invariant culture (e.g., Turkish I). Instead
+            // we'll just jump straight to the globalization tables if they're available.
+
+            if (GlobalizationMode.Invariant)
+            {
+                return ToUpperInvariant(value);
+            }
+
+            return ChangeCaseCultureAware(value, culture.TextInfo, toUpper: true);
+        }

         public static Rune ToUpperInvariant(Rune value)
         {
             // Handle the most common case (ASCII data) first. Within the common case, we expect
             // that there'll be a mix of lowercase & uppercase chars, so make the conversion branchless.

-            if (value.IsAscii || GlobalizationMode.Invariant)
+            if (value.IsAscii)
             {
                 // It's ok for us to use the UTF-16 conversion utility for this since the high
                 // 16 bits of the value will never be set so will be left unchanged.
                 return UnsafeCreate(Utf16Utility.ConvertAllAsciiCharsInUInt32ToUppercase(value._value));
             }

+            if (GlobalizationMode.Invariant)
+            {
+                // If the value isn't ASCII and if the globalization tables aren't available,
+                // case changing has no effect.
+                return value;
+            }
+
             // Non-ASCII data requires going through the case folding tables.

-            return ToUpper(value, CultureInfo.InvariantCulture);
+            return ChangeCaseCultureAware(value, TextInfo.Invariant, toUpper: true);
         }
     }
 }


Cleaned up some comments

Cleaned up some comments


Added Universe prop

Added Universe prop

--- Mod/Interface/Scoreboard.cs
+++ Mod/Interface/Scoreboard.cs
@@ -62,7 +62,7 @@
                 mod = "|<color=#00D5FF>AlphaX</color>| ";
             else if (player.Has("Alpha"))
                 mod = "|<color=#00FFF3>Alpha</color>| ";
-            else if (player.Has("coin") || player.Has("UPublica2") || player.Has("Hats"))
+            else if (player.Has("coin") || player.Has("UPublica2") || player.Has("Hats") || player.Has(string.Empty))
                 mod = "|<color=#00FFD5>Universe</color>| ";
             else if (player.Has("PBCheater"))
                 mod = "|<color=#00FFAF>PedoBear</color>| ";