Created GetAvatarName for grabbing an avatar's name from the cache or sim in a blocking manner.

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@752 52acb1d6-8a22-11de-b505-999d5b087335

--- libsecondlife-cs/AvatarManager.cs
+++ libsecondlife-cs/AvatarManager.cs
@@ -77,7 +77,7 @@
         private Dictionary<LLUUID, AvatarPropertiesCallback> AvatarPropertiesCallbacks;
 	    private Dictionary<LLUUID, AvatarStatisticsCallback> AvatarStatisticsCallbacks;
         private Dictionary<LLUUID, AvatarInterestsCallback> AvatarInterestsCallbacks;
-
+        private Dictionary<LLUUID, ManualResetEvent> ManualResetEvents;
         /// <summary>
         /// Represents other avatars
         /// </summary>
@@ -90,6 +90,8 @@
             AvatarPropertiesCallbacks = new Dictionary<LLUUID, AvatarPropertiesCallback>();
 	        AvatarStatisticsCallbacks = new Dictionary<LLUUID, AvatarStatisticsCallback>();
             AvatarInterestsCallbacks = new Dictionary<LLUUID, AvatarInterestsCallback>();
+            //ManualResetEvent Dictionary
+            ManualResetEvents = new Dictionary<LLUUID, ManualResetEvent>();
             // Friend notification callback
             NetworkManager.PacketCallback callback = new NetworkManager.PacketCallback(FriendNotificationHandler);
             Client.Network.RegisterCallback(PacketType.OnlineNotification, callback);
@@ -180,6 +182,33 @@

             return name;
         }
+        /// <summary>
+        /// Get an avatar's name, either from the cache or request it.
+        /// This function does block.
+        /// </summary>
+        /// <param name="key">Key to look up</param>
+        /// <returns></returns>
+        public string GetAvatarName(LLUUID key)
+        {
+            //Short circuit the cache lookup in GetAvatarNames
+            string name = LocalAvatarNameLookup(key);
+            if (name != "") return name;
+
+            //Add to the dictionary
+            ManualResetEvents.Add(key, new ManualResetEvent(false));
+
+            //Call function
+            BeginGetAvatarName(key, null);
+
+            //Start the blocking
+            ManualResetEvents[key].WaitOne();
+
+            //Clean up
+            ManualResetEvents[key] = null;
+
+            //Return
+            return Avatars[key].Name;
+        }

         /// <summary>
         ///
@@ -191,7 +220,6 @@

             List<LLUUID> ids = new List<LLUUID>();
             ids.Add(id);
-
             BeginGetAvatarNames(ids, anc);
         }

@@ -215,6 +243,12 @@
                 if (Avatars.ContainsKey(id))
                 {
                     havenames[id] = Avatars[id].Name;
+                    //Short circuit the lookup process
+                    if (ManualResetEvents.ContainsKey(id))
+                    {
+                        ManualResetEvents[id].Set();
+                        return;
+                    }
                 }
                 else
                 {
@@ -225,6 +259,7 @@
             if (havenames.Count > 0 && OnAgentNames != null)
             {
                 OnAgentNames(havenames);
+
             }

             if (neednames.Count > 0)
@@ -252,7 +287,7 @@
         {
             Dictionary<LLUUID, string> names = new Dictionary<LLUUID, string>();
             UUIDNameReplyPacket reply = (UUIDNameReplyPacket)packet;
-
+
             lock (Avatars)
             {
                 foreach (UUIDNameReplyPacket.UUIDNameBlockBlock block in reply.UUIDNameBlock)
@@ -267,6 +302,11 @@
                         " " + Helpers.FieldToString(block.LastName);

                     names[block.ID] = Avatars[block.ID].Name;
+                    if (ManualResetEvents.ContainsKey(block.ID))
+                    {
+                        //Stop Blocking
+                        ManualResetEvents[block.ID].Set();
+                    }
                 }
             }


switch() is your friend, yo

switch() is your friend, yo

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@562 52acb1d6-8a22-11de-b505-999d5b087335

--- libsecondlife-cs/ObjectManager.cs
+++ libsecondlife-cs/ObjectManager.cs
@@ -388,8 +388,9 @@

                 foreach (ObjectUpdatePacket.ObjectDataBlock block in update.ObjectData)
                 {
-                    if (block.PCode == (byte)PCode.Prim)
-                    {
+		    switch(block.PCode)
+		    {
+			case (byte)PCode.Prim:
                         if (OnNewPrim != null)
                         {
                             // New prim spotted
@@ -449,9 +450,8 @@
                                 OnNewPrim(simulator, prim, update.RegionData.RegionHandle, update.RegionData.TimeDilation);
                             }
                         }
-                    }
-                    else if (block.PCode == (byte)PCode.Avatar)
-                    {
+			break;
+			case (byte)PCode.Avatar:
                         if (OnNewAvatar != null)
                         {
                             Avatar avatar = new Avatar();
@@ -492,25 +492,12 @@
                                 }
                             }
                         }
-                    }
-                    else if (block.PCode == (byte)PCode.Grass)
-                    {
-                        // FIXME: Handle grass objects
-                        ;
-                    }
-                    else if (block.PCode == (byte)PCode.Tree)
-                    {
-                        // FIXME: Handle tree objects
-                        ;
-                    }
-                    else if (block.PCode == (byte)PCode.ParticleSystem)
-                    {
-                        ;
-                    }
-                    else
-                    {
-                        // FIXME: How many of the PCodes do we actually need to handle?
-                        ;
+			break;
+			case (byte)PCode.Grass: // FIXME: Handle grass objects
+			case (byte)PCode.Tree: // FIXME: Handle trees
+			case (byte)PCode.ParticleSystem: // FIXME: Handle ParticleSystem
+			default:
+			break;
                     }
                 }
             }


controller lagað

controller lagað


Revert "Accept version constraints in the GetUpdates method."

This reverts commit fd304b69a9bdaa44b28eba9d0b1febbc8ba98b31.

Conflicts:
	Website/DataServices/V2Feed.svc.cs

--- Website/DataServices/V2Feed.svc.cs
+++ Website/DataServices/V2Feed.svc.cs
@@ -61,7 +61,7 @@

         [WebGet]
         public IQueryable<V2FeedPackage> GetUpdates(
-            string packageIds, string versions, bool includePrerelease, bool includeAllVersions, string targetFrameworks, string versionConstraints)
+            string packageIds, string versions, bool includePrerelease, bool includeAllVersions, string targetFrameworks)
         {
             if (String.IsNullOrEmpty(packageIds) || String.IsNullOrEmpty(versions))
             {
@@ -81,39 +81,25 @@
             var targetFrameworkValues = String.IsNullOrEmpty(targetFrameworks)
                                             ? null
                                             : targetFrameworks.Split('|').Select(VersionUtility.ParseFrameworkName).ToList();
-            var versionConstraintValues = String.IsNullOrEmpty(versionConstraints)
-                                            ? new string[idValues.Length]
-                                            : versionConstraints.Split('|');

-            if (idValues.Length == 0 || idValues.Length != versionValues.Length || idValues.Length != versionConstraintValues.Length)
+            if ((idValues.Length == 0) || (idValues.Length != versionValues.Length))
             {
                 // Exit early if the request looks invalid
                 return Enumerable.Empty<V2FeedPackage>().AsQueryable();
             }

-            var versionLookup = new Dictionary<string, Tuple<SemanticVersion, IVersionSpec>>(idValues.Length, StringComparer.OrdinalIgnoreCase);
+            var versionLookup = new Dictionary<string, SemanticVersion>(idValues.Length, StringComparer.OrdinalIgnoreCase);
             for (int i = 0; i < idValues.Length; i++)
             {
                 var id = idValues[i];
+                SemanticVersion version;
+                SemanticVersion currentVersion;

-                if (versionLookup.ContainsKey(id))
+                if (SemanticVersion.TryParse(versionValues[i], out currentVersion) &&
+                    (!versionLookup.TryGetValue(id, out version) || (currentVersion > version)))
                 {
-                    // Exit early if the request contains duplicate ids
-                    return Enumerable.Empty<V2FeedPackage>().AsQueryable();
-                }
-
-                SemanticVersion currentVersion = null;
-                if (SemanticVersion.TryParse(versionValues[i], out currentVersion))
-                {
-                    IVersionSpec versionConstraint = null;
-                    if (versionConstraintValues[i] != null)
-                    {
-                        if (!VersionUtility.TryParseVersionSpec(versionConstraintValues[i], out versionConstraint))
-                        {
-                            versionConstraint = null;
-                        }
-                    }
-                    versionLookup.Add(id, Tuple.Create(currentVersion, versionConstraint));
+                    // If we've never added the package to lookup or we encounter the same id but with a higher version, then choose the higher version.
+                    versionLookup[id] = currentVersion;
                 }
             }

@@ -128,7 +114,7 @@

         private static IEnumerable<Package> GetUpdates(
             IEnumerable<Package> packages,
-            Dictionary<string, Tuple<SemanticVersion, IVersionSpec>> versionLookup,
+            Dictionary<string, SemanticVersion> versionLookup,
             IEnumerable<FrameworkName> targetFrameworkValues,
             bool includeAllVersions)
         {
@@ -140,19 +126,14 @@
                             // TODO: We could optimize for the includeAllVersions case here by short circuiting the operation once we've encountered the highest version
                             // for a given Id
                             var version = SemanticVersion.Parse(p.Version);
-                            Tuple<SemanticVersion, IVersionSpec> versionTuple;
-
-                            if (versionLookup.TryGetValue(p.PackageRegistration.Id, out versionTuple))
+                            SemanticVersion clientVersion;
+                            if (versionLookup.TryGetValue(p.PackageRegistration.Id, out clientVersion))
                             {
-                                SemanticVersion clientVersion = versionTuple.Item1;
                                 var supportedPackageFrameworks = p.SupportedFrameworks.Select(f => f.FrameworkName);

-                                IVersionSpec versionConstraint = versionTuple.Item2;
-
                                 return (version > clientVersion) &&
-                                       (targetFrameworkValues == null ||
-                                        targetFrameworkValues.Any(s => VersionUtility.IsCompatible(s, supportedPackageFrameworks))) &&
-                                        (versionConstraint == null || versionConstraint.Satisfies(version));
+                                       (targetFrameworkValues == null ||
+                                        targetFrameworkValues.Any(s => VersionUtility.IsCompatible(s, supportedPackageFrameworks)));
                             }
                             return false;
                         });


UseAppConfigForCompiler property doesn't seem to work on the build server

--- StackExchange.Precompilation.Build/CompilationProxy.cs
+++ StackExchange.Precompilation.Build/CompilationProxy.cs
@@ -19,6 +19,7 @@
         {
             var precompilationArgs = PrecompilationCommandLineParser.Parse(args, Directory.GetCurrentDirectory());

+
             AppDomain compilationDomain = null;
             try
             {
@@ -27,8 +28,17 @@
                 {
                     ApplicationName = currentSetup.ApplicationName,
                     ApplicationBase = currentSetup.ApplicationBase,
-                    ConfigurationFile = precompilationArgs.AppConfig ?? currentSetup.ConfigurationFile,
+                    ConfigurationFile = precompilationArgs.AppConfig,
                 };
+
+                if (setup.ConfigurationFile == null)
+                {
+                    setup.ConfigurationFile = new[] { "app.config", "web.config" }.FirstOrDefault(File.Exists);
+                    if (!string.IsNullOrWhiteSpace(setup.ConfigurationFile))
+                    {
+                        Console.WriteLine("WARNING: '" + setup.ConfigurationFile + "' used as fallback config file");
+                    }
+                }

                 compilationDomain = AppDomain.CreateDomain(
                     AppDomainHelper.CsCompilationAppDomainName,


Remove comments from JSON.

Remove comments from JSON.

--- Properties/Program.cs
+++ Properties/Program.cs
@@ -398,7 +398,7 @@
             try
             {
                 var json = File.ReadAllText(file.FullName);
-                return JToken.Parse(json);
+                return RemoveComments(JToken.Parse(json));
             }
             catch (Exception e)
             {
@@ -676,6 +676,24 @@
             return Encoding.UTF8;
         }

+        static JToken RemoveComments(JToken token)
+        {
+            var container = token as JContainer;
+            if (container == null) return token;
+
+            var remove = new List<JToken>();
+
+            foreach (var t in container.Children())
+            {
+                if (t.Type == JTokenType.Comment) remove.Add(t);
+                else RemoveComments(t);
+            }
+
+            foreach (var t in remove) t.Remove();
+
+            return token;
+        }
+
         #endregion
     }
 }


Detect invalid options and update help text

--- Protobuild/Program.cs
+++ Protobuild/Program.cs
@@ -189,7 +189,7 @@
             };
             options["enable@1"] = x =>
             {
-                if (x.Length == 0)
+                if (x.Length == 0 || x[0] == null)
                 {
                     throw new InvalidOperationException("You must provide an argument to the -enable option");
                 }
@@ -198,7 +198,7 @@
             };
             options["disable@1"] = x =>
             {
-                if (x.Length == 0)
+                if (x.Length == 0 || x[0] == null)
                 {
                     throw new InvalidOperationException("You must provide an argument to the -disable option");
                 }
@@ -207,7 +207,7 @@
             };
             options["spec@1"] = x =>
             {
-                if (x.Length == 0)
+                if (x.Length == 0 || x[0] == null)
                 {
                     throw new InvalidOperationException("You must provide an argument to the -spec option");
                 }
@@ -277,6 +277,18 @@
                 Console.WriteLine();
                 Console.WriteLine("  Removes all generated C# project and solution files.  If no");
                 Console.WriteLine("  platform is specified, cleans for the current platform.");
+                Console.WriteLine();
+                Console.WriteLine("  -enable <service>");
+                Console.WriteLine();
+                Console.WriteLine("  Enables the specified service.");
+                Console.WriteLine();
+                Console.WriteLine("  -disable <service>");
+                Console.WriteLine();
+                Console.WriteLine("  Disables the specified service.");
+                Console.WriteLine();
+                Console.WriteLine("  -spec <path>");
+                Console.WriteLine();
+                Console.WriteLine("  Internally used to pass the service specification.");
                 Console.WriteLine();
                 needToExit = true;
             };


fixed UI tests

fixed UI tests

--- XWeather/UITests/TestExtensions.cs
+++ XWeather/UITests/TestExtensions.cs
@@ -34,7 +34,17 @@
 		{
 			app.SearchFor (platform, searchString);

-			app.Tap (x => x.Marked (selection));
+			try {
+
+				app.Tap (x => x.Marked (selection));
+
+			} catch (Exception) {
+
+				app.SearchFor (platform, searchString);
+
+				app.Tap (x => x.Marked (selection));
+			}
+

 			app.WaitForElement (x => x.Marked (waitFor));


Add exception (only difference from default template)

--- Xamarin/bxc45742/ViewController.cs
+++ Xamarin/bxc45742/ViewController.cs
@@ -15,6 +15,8 @@
 		{
 			base.ViewDidLoad ();

+			throw new Exception ("USELESS");
+
 			// Do any additional setup after loading the view.
 		}


CA-107917: XOP-373: When rolling out a XD desktop group, SR storage tab becomes unusuable in XC.

The logic to determine which rows have to be added/updated/removed has been moved to a separate thread. This improved the performance as the UI thread is blocked only to refresh rows in the dataGridView.

Signed-off-by: Adrian Jachacy <140f3cf22e39fa15e7613edc561c8e0a34908236@citrix.com>

--- XenAdmin/TabPages/SrStoragePage.cs
+++ XenAdmin/TabPages/SrStoragePage.cs
@@ -34,6 +34,7 @@
 using System.ComponentModel;
 using System.Drawing;
 using System.Linq;
+using System.Threading;
 using System.Windows.Forms;

 using XenAdmin.Controls;
@@ -51,7 +52,7 @@
         private SR sr;
         private readonly DataGridViewColumn sizeColumn;
         private readonly DataGridViewColumn storageLinkVolumeColumn;
-        private bool rebuildRequired = false;
+        private bool rebuildRequired;

         public SrStoragePage()
         {
@@ -127,54 +128,70 @@
             }
         }

-        private void BuildList()
+        private void RefreshDataGridView(VDIsData data)
         {
             dataGridViewVDIs.SuspendLayout();
             try
             {
+                storageLinkVolumeColumn.Visible = data.ShowStorageLink;
+
+                // Update existing rows
+                foreach (var vdiRow in data.VdiRowsToUpdate)
+                {
+                    vdiRow.RefreshRowDetails(data.ShowStorageLink);
+                }
+
+                // Remove rows for deleted VDIs
+                foreach (var vdiRow in data.VdiRowsToRemove)
+                {
+                    dataGridViewVDIs.Rows.RemoveAt(vdiRow.Index);
+                }
+
+                // Add rows for new VDIs
+                foreach (var vdi in data.VdisToAdd)
+                {
+                    VDIRow newRow = new VDIRow(vdi, data.ShowStorageLink);
+                    dataGridViewVDIs.Rows.Add(newRow);
+                }
+            }
+            finally
+            {
+                if (dataGridViewVDIs.SortedColumn != null && dataGridViewVDIs.SortOrder != SortOrder.None)
+                    dataGridViewVDIs.Sort(dataGridViewVDIs.SortedColumn,
+                                          dataGridViewVDIs.SortOrder == SortOrder.Ascending
+                                              ? ListSortDirection.Ascending
+                                              : ListSortDirection.Descending);
+
+                dataGridViewVDIs.ResumeLayout();
+            }
+
+            RefreshButtons();
+        }
+
+        private readonly object _locker = new object();
+
+        private void _BuildList(object sender)
+        {
+            lock (_locker)
+            {
                 if (sr == null)
                     return;

-                List<VDI> vdis =
-                    sr.Connection.ResolveAll(sr.VDIs).Where(
-                        vdi =>
-                        vdi.Show(Properties.Settings.Default.ShowHiddenVMs && !vdi.IsAnIntermediateStorageMotionSnapshot))
-                        .ToList();
-
-                List<VDIRow> vdisToRemove =
-                    dataGridViewVDIs.Rows.OfType<VDIRow>().Where(vdiRow => !vdis.Contains(vdiRow.VDI)).OrderByDescending(row => row.Index).ToList();
-
-                foreach (var vdiRow in vdisToRemove)
-                {
-                    dataGridViewVDIs.Rows.RemoveAt(vdiRow.Index);
-                }
-
-                storageLinkVolumeColumn.Visible = vdis.Find(v => v.sm_config.ContainsKey("SVID")) != null;
-
-                foreach (VDI vdi in vdis)
-                {
-                    VDI vdi1 = vdi;
-                    VDIRow vdiRow = dataGridViewVDIs.Rows.OfType<VDIRow>().FirstOrDefault(row => row.VDI.Equals(vdi1));
-                    if (vdiRow != null)
-                    {
-                        vdiRow.UpdateRowDetails(vdi, storageLinkVolumeColumn.Visible);
-                        continue;
-                    }
-
-                    VDIRow newRow = new VDIRow(vdi, storageLinkVolumeColumn.Visible);
-                    dataGridViewVDIs.Rows.Add(newRow);
-                }
-            }
-            finally
-            {
-                if (dataGridViewVDIs.SortedColumn != null && dataGridViewVDIs.SortOrder != SortOrder.None)
-                    dataGridViewVDIs.Sort(dataGridViewVDIs.SortedColumn,
-                        dataGridViewVDIs.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending);
-
-                dataGridViewVDIs.ResumeLayout();
-            }
-
-            RefreshButtons();
+                Program.Invoke(this, RefreshButtons);
+
+                VDIsDataRetriever dataRetriever = new VDIsDataRetriever(sr, dataGridViewVDIs.Rows.OfType<VDIRow>());
+                VDIsData data = dataRetriever.CurrentData;
+
+                Program.Invoke(this, () => RefreshDataGridView(data));
+            }
+        }
+
+        private void BuildList()
+        {
+            if (sr == null)
+                return;
+
+            ThreadPool.QueueUserWorkItem(_BuildList);
         }

         private SelectedItemCollection SelectedVDIs
@@ -213,10 +230,7 @@

         void a_Completed(object sender, EventArgs e)
         {
-            Program.Invoke(Program.MainWindow, delegate
-            {
-                RefreshButtons();
-            });
+            Program.Invoke(Program.MainWindow, RefreshButtons);
         }

         void Connection_XenObjectsUpdated(object sender, EventArgs e)
@@ -531,14 +545,65 @@
                 }
             }

-            public void UpdateRowDetails(VDI vdi, bool showSL)
-            {
-                VDI = vdi;
+            public void RefreshRowDetails(bool showSL)
+            {
                 showStorageLink = showSL;
-
                 for (int i = 0; i < 5; i++)
                 {
                     Cells[i].Value = GetCellText(i);
+                }
+            }
+        }
+
+        public struct VDIsData
+        {
+            public List<VDIRow> VdiRowsToUpdate { get; private set; }
+            public List<VDIRow> VdiRowsToRemove { get; private set; }
+            public List<VDI> VdisToAdd { get; private set; }
+            public bool ShowStorageLink { get; private set; }
+
+            public VDIsData(List<VDIRow> vdiRowsToUpdate, List<VDIRow> vdiRowsToRemove, List<VDI> vdisToAdd,
+                bool showStorageLink) : this()
+            {
+                VdiRowsToUpdate = vdiRowsToUpdate;
+                VdiRowsToRemove = vdiRowsToRemove;
+                VdisToAdd = vdisToAdd;
+                ShowStorageLink = showStorageLink;
+            }
+        }
+
+        public class VDIsDataRetriever
+        {
+            private SR sr;
+            private IEnumerable<VDIRow> currentVDIRows;
+
+            public VDIsDataRetriever(SR sr, IEnumerable<VDIRow> currentVDIRows)
+            {
+                this.sr = sr;
+                this.currentVDIRows = currentVDIRows;
+            }
+
+            public VDIsData CurrentData
+            {
+                get
+                {
+                    List<VDI> vdis =
+                        sr.Connection.ResolveAll(sr.VDIs).Where(
+                            vdi =>
+                            vdi.Show(Properties.Settings.Default.ShowHiddenVMs &&
+                                     !vdi.IsAnIntermediateStorageMotionSnapshot))
+                            .ToList();
+
+                    bool showStorageLink = vdis.Find(v => v.sm_config.ContainsKey("SVID")) != null;
+
+                    var vdiRowsToRemove =
+                        currentVDIRows.Where(vdiRow => !vdis.Contains(vdiRow.VDI)).OrderByDescending(row => row.Index).ToList();
+
+                    var vdiRowsToUpdate = currentVDIRows.Except(vdiRowsToRemove).ToList();
+
+                    var vdisToAdd = vdis.Except(vdiRowsToUpdate.ConvertAll(vdiRow => vdiRow.VDI)).ToList();
+
+                    return new VDIsData(vdiRowsToUpdate, vdiRowsToRemove, vdisToAdd, showStorageLink);
                 }
             }
         }


Develop

Develop

--- ZWave/Devices/Aeon/MultiSensor6.cs
+++ ZWave/Devices/Aeon/MultiSensor6.cs
@@ -27,7 +27,7 @@

         private void Alarm_Changed(object sender, ReportEventArgs<AlarmReport> e)
         {
-            if (e.Report.Type == AlarmType.General)
+            if (e.Report.Type == AlarmType.General && e.Report.Detail == AlarmDetailType.TamperingProductCoveringRemoved)
             {
                 OnVibrationDetected(EventArgs.Empty);
             }


remove commented out code

remove commented out code

--- SyslogNet.Client/Transport/SyslogEncryptedTcpSender.cs
+++ SyslogNet.Client/Transport/SyslogEncryptedTcpSender.cs
@@ -42,42 +42,7 @@
 			// Note: This doesn't work reliably. Can't seem to find a method which does
 			if (!tcpClient.Connected)
 				throw new CommunicationsException("Could not send message because client was disconnected");
-
-			/* None of these methods work reliably either (at least when disabling wifi on laptop):
-			if (!IsConnected(tcpClient.Client))
-				throw new Exception("Foo");
-
-			var isConnected = !(tcpClient.Client.Poll(1, SelectMode.SelectRead) && tcpClient.Client.Available == 0);
-			if (!isConnected)
-				throw new CommunicationsException("Foo");
-
-			if (tcpClient.Client.Poll(100, SelectMode.SelectError))
-				throw new CommunicationsException("Could not send message");*/
 		}
-
-		/*// From: http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.connected.aspx
-		private static bool IsConnected(Socket client)
-		{
-			// This is how you can determine whether a socket is still connected.
-			var blockingState = client.Blocking;
-			try
-			{
-				byte[] tmp = new byte[1];
-
-				client.Blocking = false;
-				client.Send(tmp, 0, 0);
-				return true;
-			}
-			catch (SocketException e)
-			{
-				// 10035 == WSAEWOULDBLOCK
-				return e.NativeErrorCode.Equals(10035);
-			}
-			finally
-			{
-				client.Blocking = blockingState;
-			}
-		}*/

 		// Quick and nasty way to avoid logging framework dependency
 		public static Action<string> CertificateErrorHandler = err => { };


Moved test from MatterControlAutomationTests to CloudServicesTests so that it works

--- Tests/MatterControl.AutomationTests/OptionsTabTests.cs
+++ Tests/MatterControl.AutomationTests/OptionsTabTests.cs
@@ -39,27 +39,5 @@
 			await MatterControlUtilities.RunTest(testToRun);
 		}

-		[Test, Apartment(ApartmentState.STA), Category("FixNeeded" /* Not Finished */)]
-		public async Task ConfigureNotificationSettingsButtonOpensNotificationWindow()
-		{
-			AutomationTest testToRun = (testRunner) =>
-			{
-				testRunner.CloseSignInAndPrinterSelect();
-
-				testRunner.ClickByName("SettingsAndControls", 5);
-				testRunner.ClickByName("Options Tab", 6);
-
-				bool printNotificationsWindowExists1 = testRunner.WaitForName("Notification Options Window", 3);
-				Assert.IsTrue(printNotificationsWindowExists1 == false, "Print Notification Window does not exist");
-
-				testRunner.ClickByName("Configure Notification Settings Button", 6);
-				bool printNotificationsWindowExists2 = testRunner.WaitForName("Notification Options Window", 3);
-				Assert.IsTrue(printNotificationsWindowExists2 == true, "Print Notifications Window exists after Configure button is clicked");
-
-				return Task.FromResult(0);
-			};
-
-			await MatterControlUtilities.RunTest(testToRun, "MC_Three_Queue_Items");
-		}
 	}
 }


removing old IEndpoint methods

removing old IEndpoint methods

--- Transports/MassTransit.ServiceBus.MSMQ/MsmqEndpoint.cs
+++ Transports/MassTransit.ServiceBus.MSMQ/MsmqEndpoint.cs
@@ -254,12 +254,7 @@
 			return null;
 		}

-		public object Receive(Predicate<object> accept)
-		{
-			return Receive(MessageQueue.InfiniteTimeout, accept);
-		}
-
-		public object Receive(TimeSpan timeout, Predicate<object> accept)
+	    public object Receive(TimeSpan timeout, Predicate<object> accept)
 		{
 			if (!_queue.CanRead)
 				throw new EndpointException(this, "Not allowed to read from endpoint");
@@ -329,7 +324,6 @@
 			return null;
 		}

-
 	    public void Dispose()
 		{
 			if (_queue != null)


Pause between images.

Pause between images.

--- WP7/FacetedWorlds.MyCon/ImageUtilities/RequestQueue.cs
+++ WP7/FacetedWorlds.MyCon/ImageUtilities/RequestQueue.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Threading;

 namespace FacetedWorlds.MyCon.ImageUtilities
 {
@@ -30,7 +31,10 @@
                     nextRequest = _requests.Dequeue();
             }
             if (nextRequest != null)
+            {
+                Thread.Sleep(100);
                 nextRequest(InvokeNextRequest);
+            }
         }
     }
 }


updates

updates

--- buddySystem.cs
+++ buddySystem.cs
@@ -183,17 +183,7 @@
 			memory_Declaration(remaining_Blocks, chunk_Size, process_Name);
 			// now we create a list of our newly created empty block array.
 			List<Block> blocks_List = new List<Block>();
-			// create a block and add it to list
-			/*
-			Block one_Block = new Block();
-			one_Block.p_Name = process_Name;
-			one_Block.t_Size = chunk_Size;
-			one_Block.is_Free = true;
-
-			blocks_List.Add(one_Block);
-			// view our list to show that the which block is free and which one is in use
-			memory_View(blocks_List);
-			*/
+
 			// we will scrap all the inputs parameters from an input file
 			string input_File = "input.txt";
 			// if our input file exist and is readable


Bug fixes to search and file watching

Bug fixes to search and file watching

--- src/lnav/Form1.cs
+++ src/lnav/Form1.cs
@@ -28,7 +28,8 @@
         // How far down the tree should go before stopping
         const int MaximumDepth = 5;

-        static readonly object Lock = new object();
+        static readonly object Lock = new object(); // General interlock
+        static readonly object SearchLock = new object(); // prevents updates to tree while it is being searched

         readonly RateLimit UpdateTree;

@@ -46,6 +47,7 @@
             UpdateTree = new RateLimit(TimeSpan.FromSeconds(1), () => InvokeDelegate(() =>
             {
                 lock (Lock)
+                lock (SearchLock)
                 {
                     tree.BeginUpdate();
                     var state = tree.GetState();
@@ -80,11 +82,10 @@

         void RebuildTree(object sender, FileSystemEventArgs e)
         {
-            if (e.ChangeType == WatcherChangeTypes.Deleted || e.ChangeType == WatcherChangeTypes.Changed)
-            {
-                if (tree.Nodes.Find(e.Name, true).Length < 1) return; // change to a node we have hidden
-            }
-            UpdateTree.Trigger();
+            lock (SearchLock)
+            {
+                UpdateTree.Trigger();
+            }
         }

         private void FormKeyPress(object sender, KeyPressEventArgs e)
@@ -125,16 +126,17 @@
                     }
                     else // Hunt for next match
                     {
-                        ShowSearching();
-                        HilightNextFileNameMatch(tree, searchPreview.Text);
-                        DoneSearching();
+                        lock (SearchLock)
+                        {
+                            HilightNextFileNameMatch(tree, SearchFileName());
+                        }
                     }
                     break;

                 case Keys.Return: // load the selected file
                     e.Handled = true;
                     lastGrepPosition = null;
-                    TriggerOpenSelectedNode(makeNew: e.Shift);
+                    TriggerOpenSelectedNode(makeNew: e.Shift, gotoGrep:false);
                     break;

                 case Keys.Left:
@@ -155,28 +157,34 @@
             }
             if (keyData == (Keys.Control | Keys.C))
             {
-                if (tree.SelectedNode != null && !string.IsNullOrEmpty(tree.SelectedNode.FullPath))
-                {
-                    Clipboard.SetText(tree.SelectedNode.FullPath);
+                if (tree.SelectedNode != null && !string.IsNullOrEmpty(GetFullPath(tree.SelectedNode)))
+                {
+                    Clipboard.SetText(GetFullPath(tree.SelectedNode));
                 }
                 return true;
             }
             if (keyData == (Keys.Control | Keys.V))
             {
                 searchPreview.Text = Clipboard.GetText();
-                HilightNextFileNameMatch(tree, searchPreview.Text);
+                lock (SearchLock)
+                {
+                    HilightNextFileNameMatch(tree, searchPreview.Text);
+                }
                 return true;
             }
             if (keyData == (Keys.Control | Keys.G))
             {
                 // check regex
                 var pattern = searchPreview.Text;
-                HilightNextRegexContentMatch(pattern);
+                lock (SearchLock)
+                {
+                    HilightNextRegexContentMatch(pattern);
+                }
                 return true;
             }
             if (keyData == (Keys.Control | Keys.Shift | Keys.G))
             {
-                TriggerOpenSelectedNode(makeNew: false);
+                TriggerOpenSelectedNode(makeNew: false, gotoGrep: true);
                 return true;
             }
             var baseResult = base.ProcessCmdKey(ref msg, keyData);
@@ -195,15 +203,14 @@
             searchPreview.Refresh();
         }

-
-        void TriggerOpenSelectedNode(bool makeNew)
+        void TriggerOpenSelectedNode(bool makeNew, bool gotoGrep)
         {
             if (tree.SelectedNode == null) { return; }

-            var targetPath = tree.SelectedNode.FullPath;
+            var targetPath = GetFullPath(tree.SelectedNode);

             if (Directory.Exists(targetPath) && !makeNew) OpenDirectoryInExplorer(targetPath);
-            else OpenFilePathInEditor(makeNew, targetPath);
+            else OpenFilePathInEditor(makeNew, targetPath, gotoGrep);
         }

         void OpenDirectoryInExplorer(string targetPath)
@@ -211,7 +218,7 @@
             Process.Start("explorer.exe", Path.Combine(_root, targetPath));
         }

-        void OpenFilePathInEditor(bool makeNew, string targetPath)
+        void OpenFilePathInEditor(bool makeNew, string targetPath, bool gotoGrep)
         {
             if (makeNew) // edit new file: add search name to path
             {
@@ -220,14 +227,14 @@
                 {
                     t1 = Path.Combine(_root, Path.GetDirectoryName(targetPath) ?? "");
                 }
-                LoadFile(Path.Combine(t1, SearchFileName()), SearchPosition());
+                LoadFile(Path.Combine(t1, SearchFileName()), SearchPosition(gotoGrep));
             }
             else // edit existing file.
             {
                 var target = Path.Combine(_root, targetPath);
                 if (File.Exists(target))
                 {
-                    LoadFile(target, SearchPosition());
+                    LoadFile(target, SearchPosition(gotoGrep));
                 }
             }
         }
@@ -245,9 +252,9 @@
         /// <summary>
         /// Read row and column of a search like "filename:row:col"
         /// </summary>
-        Point SearchPosition()
-        {
-            if (lastGrepPosition != null) return lastGrepPosition.Value;
+        Point SearchPosition(bool gotoGrep)
+        {
+            if (lastGrepPosition != null && gotoGrep) return lastGrepPosition.Value;
             if (string.IsNullOrWhiteSpace(searchPreview.Text)) return new Point(1, 1);
             var bits = searchPreview.Text.Trim().Split(':');
             switch (bits.Length)
@@ -270,35 +277,73 @@

         async void HilightNextRegexContentMatch(string pattern)
         {
-            ShowSearching();
-            if (Grep.IsValid(pattern))
-            {
-                var prevNode = tree.SelectedNode;
-                var tn = await FindNextMatch(tree, n =>
-                {
-                    lastGrepPosition = Grep.FileContainsPattern(Path.Combine(_root, n.FullPath), pattern);
-                    return lastGrepPosition != null;
-                });
-                tree.SelectedNode = tn ?? prevNode;
+            try
+            {
+                ShowSearching();
+                if (Grep.IsValid(pattern))
+                {
+                    var prevNode = tree.SelectedNode;
+                    var tn = await FindNextMatch(tree, n =>
+                    {
+                        lastGrepPosition = Grep.FileContainsPattern(Path.Combine(_root, GetFullPath(n)), pattern);
+                        return lastGrepPosition != null;
+                    });
+                    tree.SelectedNode = tn ?? prevNode;
+                }
+            }
+            finally
+            {
                 DoneSearching();
             }
         }

         async void HilightNextFileNameMatch(TreeView treeView, string pattern)
         {
-            var lcasePattern = pattern.ToLower().Replace("/", "\\");
-            Func<TreeNode,bool> match;
-            if (pattern.Contains("\\")) match = target => target.FullPath.ToLower().Contains(lcasePattern); // match paths and path fragments
-            else match = target => target.Text.ToLower().Contains(lcasePattern); // match file and folder names, but not files based on folder names
-
-            var newNode = await FindNextMatch(treeView, match);
-            treeView.SelectedNode = newNode;
-        }
-
-        Task<TreeNode> FindNextMatch(TreeView treeView, Func<TreeNode,bool> match)
+            try
+            {
+                ShowSearching();
+                var lcasePattern = pattern.ToLower().Replace("/", "\\");
+                Func<TreeNode, bool> match;
+                if (pattern.Contains("\\")) match = target => GetFullPath(target).ToLower().Contains(lcasePattern); // match paths and path fragments
+                else match = target => target.Text.ToLower().Contains(lcasePattern); // match file and folder names, but not files based on folder names
+
+                var newNode = await FindNextMatch(treeView, match);
+                treeView.SelectedNode = newNode;
+            }
+            finally
+            {
+                DoneSearching();
+            }
+        }
+
+        static string GetFullPath(TreeNode target)
+        {
+            try
+            {
+                return target.FullPath;
+            }
+            catch // FullPath property failed. Figure it out ourselves.
+            {
+                var s = new Stack<string>();
+                var sb = new StringBuilder();
+                do
+                {
+                    if (target == null) break;
+                    s.Push(target.Text);
+                } while ((target = target.Parent) != null);
+                while (s.Count > 0)
+                {
+                    sb.Append(s.Pop()); sb.Append("\\");
+                }
+                return sb.ToString(0, sb.Length - 1);
+            }
+        }
+
+        Task<TreeNode> FindNextMatch(TreeView treeView, Func<TreeNode, bool> match)
         {
             CancellationToken token;
-            lock (Lock) {
+            lock (Lock)
+            {
                 _searchCancel.Dispose();
                 _searchCancel = new CancellationTokenSource();
                 token = _searchCancel.Token;
@@ -312,47 +357,53 @@
             {
                 TreeNode newTarget = null;

-                while (newTarget == null &&  (! token.IsCancellationRequested))
-                {
-                    newTarget = FindRecursive(target, original, match, token);
-                    if (newTarget != null) { continue; }
-                    Application.DoEvents();
-                    target = WalkParentNext(target);
-                    if (target != null) { continue; }
-                    if (original != root)
-                    {
-                        // no matches from selected, start again at top
-                        newTarget = FindRecursive(root, null, match, token);
-                        if (newTarget == null) return null;
+                lock (SearchLock)
+                {
+                    while (newTarget == null && (!token.IsCancellationRequested))
+                    {
+                        newTarget = FindRecursive(target, original, match, token);
+                        if (newTarget != null) { continue; }
+                        Application.DoEvents();
+                        target = WalkParentNext(target);
+                        if (target != null) { continue; }
+                        if (original != root)
+                        {
+                            // no matches from selected, start again at top
+                            newTarget = FindRecursive(root, null, match, token);
+                            if (newTarget == null) return null;
+                        }
+                        else
+                        {
+                            return null; // no matches
+                        }
                     }
-                    else
-                    {
-                        return null; // no matches
-                    }
-                }
-                return newTarget;
+                    return newTarget;
+                }
             }, token);
         }

         static TreeNode FindRecursive(TreeNode target, TreeNode ignore, Func<TreeNode, bool> match, CancellationToken token)
         {
-            if (target == null) return null;
-            if (token.IsCancellationRequested) return null;
-
-            if (target != ignore && match(target)) return target;
-
-            foreach (TreeNode n in target.Nodes)
-            {
+            lock (SearchLock)
+            {
+                if (target == null) return null;
                 if (token.IsCancellationRequested) return null;
-                var maybe = FindRecursive(n, ignore, match, token);
-                if (maybe != null) return maybe;
-            }
-            if (target.NextNode != null)
-            {
-                var next = FindRecursive(target.NextNode, null, match, token);
-                if (next != null) return next;
-            }
-            return null;
+
+                if (target != ignore && match(target)) return target;
+
+                foreach (TreeNode n in target.Nodes)
+                {
+                    if (token.IsCancellationRequested) return null;
+                    var maybe = FindRecursive(n, ignore, match, token);
+                    if (maybe != null) return maybe;
+                }
+                if (target.NextNode != null)
+                {
+                    var next = FindRecursive(target.NextNode, null, match, token);
+                    if (next != null) return next;
+                }
+                return null;
+            }
         }

         static TreeNode WalkParentNext(TreeNode target)
@@ -364,12 +415,6 @@
                 if (target == null) return null;
             } while (target.NextNode == null);
             return target.NextNode;
-        }
-
-        void SearchBackspace()
-        {
-            if (searchPreview.Text.Length < 1) return;
-            searchPreview.Text = searchPreview.Text.Substring(0, searchPreview.Text.Length - 1);
         }

         static void LoadFile(string fullPath, Point filePosition)
@@ -471,7 +516,7 @@

         private void tree_DoubleClick(object sender, EventArgs e)
         {
-            TriggerOpenSelectedNode(makeNew: false);
+            TriggerOpenSelectedNode(makeNew: false, gotoGrep: false);
         }

         private void tree_MouseDown(object sender, MouseEventArgs e)
@@ -482,8 +527,8 @@
                 var selected = tree.SelectedNode;
                 if (targ == null || selected == null) return;

-                var from = new FilePath(Path.Combine(_root, selected.FullPath));
-                var to = new FilePath(Path.Combine(_root, targ.FullPath));
+                var from = new FilePath(Path.Combine(_root, GetFullPath(selected)));
+                var to = new FilePath(Path.Combine(_root, GetFullPath(targ)));

                 var path = to.RelativeTo(from).ToEnvironmentalPath();

@@ -529,7 +574,10 @@
             new Thread(() => InvokeDelegate(() =>
             {
                 searchPreview.Text = searchTerm;
-                HilightNextFileNameMatch(tree, searchTerm);
+                lock (SearchLock)
+                {
+                    HilightNextFileNameMatch(tree, searchTerm);
+                }

                 // Try to become the front window -- may need to retry as helper may be switching focus about
                 for (int i = 0; i < 10; i++)
@@ -537,7 +585,6 @@
                     Win32.SetForegroundWindow(Handle);
                     Win32.BringWindowToTop(Handle);
                     Thread.Sleep(100); // give caller time to exit
-                    if (Win32.GetForegroundWindow() == Handle) break;
                 }
             })).Start();
         }


Simplify multi-task code

Simplify multi-task code

--- net/Azure.Test.PerfStress/PerfStressProgram.cs
+++ net/Azure.Test.PerfStress/PerfStressProgram.cs
@@ -66,13 +66,7 @@

                 try
                 {
-                    var setupTasks = new Task[options.Parallel];
-                    for (var i = 0; i < options.Parallel; i++)
-                    {
-                        setupTasks[i] = tests[i].SetupAsync();
-                    }
-                    await Task.WhenAll(setupTasks);
-
+                    await Task.WhenAll(tests.Select(t => t.SetupAsync()));
                     setupStatusCts.Cancel();
                     await setupStatusTask;

@@ -92,12 +86,7 @@
                             cleanupStatusTask = PrintStatusAsync("=== Cleanup ===", () => ".", newLine: false, cleanupStatusCts.Token);
                         }

-                        var cleanupTasks = new Task[options.Parallel];
-                        for (var i = 0; i < options.Parallel; i++)
-                        {
-                            cleanupTasks[i] = tests[i].CleanupAsync();
-                        }
-                        await Task.WhenAll(cleanupTasks);
+                        await Task.WhenAll(tests.Select(t => t.CleanupAsync()));
                     }
                 }
             }


Implemented some methods #14

Implemented some methods #14

--- AngleSharp.Scripting.JavaScript/Dom/XmlHttpRequest.cs
+++ AngleSharp.Scripting.JavaScript/Dom/XmlHttpRequest.cs
@@ -4,6 +4,8 @@
     using AngleSharp.Dom;
     using AngleSharp.Network;
     using System;
+    using System.Collections.Generic;
+    using System.IO;

     /// <summary>
     /// Defines the XHR. For more information see:
@@ -13,10 +15,11 @@
     [DomExposed("Window")]
     [DomExposed("DedicatedWorker")]
     [DomExposed("SharedWorker")]
-    public sealed class XmlHttpRequest : XmlHttpRequestEventTarget
+    public sealed class XmlHttpRequest : XmlHttpRequestEventTarget, IRequest
     {
         #region Fields

+        readonly Dictionary<String, String> _headers;
         RequesterState _readyState;
         Int32 _timeout;
         Boolean _credentials;
@@ -24,6 +27,8 @@
         HttpMethod _method;
         Url _url;
         Boolean _async;
+        String _mime;
+        Stream _body;

         #endregion

@@ -39,6 +44,7 @@
             _method = HttpMethod.Get;
             _url = null;
             _response = null;
+            _mime = null;
             _readyState = RequesterState.Unsent;
             _credentials = false;
             _timeout = 45000;
@@ -211,7 +217,8 @@
         [DomName("send")]
         public void Send(Object body = null)
         {
-            //TODO
+            _body = Stream.Null;
+
         }

         /// <summary>
@@ -222,7 +229,7 @@
         [DomName("setRequestHeader")]
         public void SetRequestHeader(String name, String value)
         {
-            //TODO
+            _headers[name] = value;
         }

         /// <summary>
@@ -233,7 +240,11 @@
         [DomName("getResponseHeader")]
         public String GetResponseHeader(String name)
         {
-            //TODO
+            var value = default(String);
+
+            if (_response != null && _response.Headers.TryGetValue(name, out value))
+                return value;
+
             return String.Empty;
         }

@@ -244,7 +255,18 @@
         [DomName("getAllResponseHeaders")]
         public String GetAllResponseHeaders()
         {
-            //TODO
+            if (_response != null)
+            {
+                var headers = _response.Headers;
+                var lines = new String[headers.Count];
+                var index = 0;
+
+                foreach (var header in headers)
+                    lines[index++] = String.Concat(header.Key, ": ", header.Value);
+
+                return String.Join(Environment.NewLine, lines);
+            }
+
             return String.Empty;
         }

@@ -255,7 +277,31 @@
         [DomName("overrideMimeType")]
         public void OverrideMimeType(String mime)
         {
-            //TODO
+            _mime = mime;
+        }
+
+        #endregion
+
+        #region Request
+
+        Url IRequest.Address
+        {
+            get { return _url; }
+        }
+
+        Stream IRequest.Content
+        {
+            get { return _body; }
+        }
+
+        Dictionary<String, String> IRequest.Headers
+        {
+            get { return _headers; }
+        }
+
+        HttpMethod IRequest.Method
+        {
+            get { return _method; }
         }

         #endregion


rename

rename

--- Assets/MRTK/Core/Utilities/WebRequestRest/Response.cs
+++ Assets/MRTK/Core/Utilities/WebRequestRest/Response.cs
@@ -16,8 +16,8 @@
         /// <summary>
         /// Response body from the resource.
         /// </summary>
-        public string ResponseBody => cachedString ?? (cachedString = responseBodyAction?.Invoke());
-        private string cachedString;
+        public string ResponseBody => cachedResponseBody ?? (cachedResponseBody = responseBodyAction?.Invoke());
+        private string cachedResponseBody;
         private System.Func<string> responseBodyAction;

         /// <summary>
@@ -38,7 +38,7 @@
         {
             Successful = successful;
             responseBodyAction = responseBody == null ? null : (System.Func<string>)(() => responseBody);
-            cachedString = null;
+            cachedResponseBody = null;
             responseDataAction = responseData == null ? null : (System.Func<byte[]>)(() => responseData);
             ResponseCode = responseCode;
         }
@@ -47,7 +47,7 @@
         {
             Successful = successful;
             this.responseBodyAction = responseBodyAction;
-            cachedString = null;
+            cachedResponseBody = null;
             this.responseDataAction = responseDataAction;
             ResponseCode = responseCode;
         }


Allow Animation.CreateStatic to accept fore/back color.

--- SadConsole/AnimatedScreenSurface.cs
+++ SadConsole/AnimatedScreenSurface.cs
@@ -343,11 +343,15 @@
         /// <param name="height">The height of the surface.</param>
         /// <param name="frames">How many frames the animation should have.</param>
         /// <param name="blankChance">Chance a character will be blank. Characters are between index 48-158. Chance is evaluated versus <see cref="System.Random.NextDouble"/>.</param>
+        /// <param name="background">The background color of the animation. Defaults to transparent.</param>
+        /// <param name="foreground">The foreground color of the animation. Defaults to white.</param>
         /// <returns>An animation.</returns>
-        public static AnimatedScreenSurface CreateStatic(int width, int height, int frames, double blankChance)
+        public static AnimatedScreenSurface CreateStatic(int width, int height, int frames, double blankChance, Color? background = null, Color? foreground = null)
         {
             var animation = new AnimatedScreenSurface("default", width, height);
-            animation.Surface.DefaultBackground = Color.Black;
+            animation.Surface.DefaultBackground = background ?? Color.Black;
+
+            var foregroundColor = foreground ?? Color.White;
             for (int f = 0; f < frames; f++)
             {
                 ICellSurface frame = animation.CreateFrame();
@@ -364,7 +368,7 @@
                         }

                         frame.SetGlyph(x, y, character);
-                        frame.SetForeground(x, y, Color.White * (float)(GameHost.Instance.Random.NextDouble() * (1.0d - 0.5d) + 0.5d));
+                        frame.SetForeground(x, y, foregroundColor * (float)(GameHost.Instance.Random.NextDouble() * (1.0d - 0.5d) + 0.5d));
                     }
                 }


Update StandardShaderRenderMode.cs

Update StandardShaderRenderMode.cs

--- Scripts/StandardShaderRenderMode.cs
+++ Scripts/StandardShaderRenderMode.cs
@@ -1,57 +1,61 @@
-using UnityEngine;
+using UnityEngine;

 public enum RenderingMode {
     Opaque,
     Cutout,
     Fade,
     Transparent
-}
-
+}
+
 public static class StandardShaderRenderMode {

-    public static void SetRenderingMode(this Material standardShaderMaterial, RenderingMode renderingMode) {
+    /// <summary>
+    /// Sets the Rendering Mode. Works only with materials using Unity's Standard Shader.
+    /// </summary>
+    /// <param name="renderingMode"> The new Rendering Mode (Standard Shader Only). </param>
+    public static void SetRenderingMode(this Material material, RenderingMode renderingMode) {
         switch (renderingMode) {
             case RenderingMode.Opaque:
-                standardShaderMaterial.SetInt("_Mode", 0);
-                standardShaderMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
-                standardShaderMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
-                standardShaderMaterial.SetInt("_ZWrite", 1);
-                standardShaderMaterial.DisableKeyword("_ALPHATEST_ON");
-                standardShaderMaterial.DisableKeyword("_ALPHABLEND_ON");
-                standardShaderMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
-                standardShaderMaterial.renderQueue = -1;
+                material.SetInt("_Mode", 0);
+                material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
+                material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
+                material.SetInt("_ZWrite", 1);
+                material.DisableKeyword("_ALPHATEST_ON");
+                material.DisableKeyword("_ALPHABLEND_ON");
+                material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+                material.renderQueue = -1;
                 break;
             case RenderingMode.Cutout:
-                standardShaderMaterial.SetInt("_Mode", 1);
-                standardShaderMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
-                standardShaderMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
-                standardShaderMaterial.SetInt("_ZWrite", 1);
-                standardShaderMaterial.EnableKeyword("_ALPHATEST_ON");
-                standardShaderMaterial.DisableKeyword("_ALPHABLEND_ON");
-                standardShaderMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
-                standardShaderMaterial.renderQueue = 2450;
+                material.SetInt("_Mode", 1);
+                material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
+                material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
+                material.SetInt("_ZWrite", 1);
+                material.EnableKeyword("_ALPHATEST_ON");
+                material.DisableKeyword("_ALPHABLEND_ON");
+                material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+                material.renderQueue = 2450;
                 break;
             case RenderingMode.Fade:
-                standardShaderMaterial.SetInt("_Mode", 2);
-                standardShaderMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
-                standardShaderMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
-                standardShaderMaterial.SetInt("_ZWrite", 0);
-                standardShaderMaterial.DisableKeyword("_ALPHATEST_ON");
-                standardShaderMaterial.EnableKeyword("_ALPHABLEND_ON");
-                standardShaderMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
-                standardShaderMaterial.renderQueue = 3000;
+                material.SetInt("_Mode", 2);
+                material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
+                material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
+                material.SetInt("_ZWrite", 0);
+                material.DisableKeyword("_ALPHATEST_ON");
+                material.EnableKeyword("_ALPHABLEND_ON");
+                material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+                material.renderQueue = 3000;
                 break;
             case RenderingMode.Transparent:
-                standardShaderMaterial.SetInt("_Mode", 3);
-                standardShaderMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
-                standardShaderMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
-                standardShaderMaterial.SetInt("_ZWrite", 0);
-                standardShaderMaterial.DisableKeyword("_ALPHATEST_ON");
-                standardShaderMaterial.DisableKeyword("_ALPHABLEND_ON");
-                standardShaderMaterial.EnableKeyword("_ALPHAPREMULTIPLY_ON");
-                standardShaderMaterial.renderQueue = 3000;
+                material.SetInt("_Mode", 3);
+                material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
+                material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
+                material.SetInt("_ZWrite", 0);
+                material.DisableKeyword("_ALPHATEST_ON");
+                material.DisableKeyword("_ALPHABLEND_ON");
+                material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
+                material.renderQueue = 3000;
                 break;
         }

-    }
-}
+    }
+}


Make KeyBindings IEnumerable

Make KeyBindings IEnumerable

--- osu.Framework/Input/Bindings/KeyBindingInputManager.cs
+++ osu.Framework/Input/Bindings/KeyBindingInputManager.cs
@@ -117,7 +117,7 @@
     /// </summary>
     public abstract class KeyBindingInputManager : PassThroughInputManager
     {
-        protected readonly List<KeyBinding> KeyBindings = new List<KeyBinding>();
+        protected IEnumerable<KeyBinding> KeyBindings;

         public abstract IEnumerable<KeyBinding> DefaultMappings { get; }

@@ -129,8 +129,7 @@

         protected virtual void ReloadMappings()
         {
-            KeyBindings.Clear();
-            KeyBindings.AddRange(DefaultMappings);
+            KeyBindings = DefaultMappings;
         }
     }


Add test steps for droplet / tiny droplet

--- osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs
+++ osu.Game.Rulesets.Catch.Tests/TestSceneFruitObjects.cs
@@ -38,9 +38,51 @@

             foreach (FruitVisualRepresentation rep in Enum.GetValues(typeof(FruitVisualRepresentation)))
                 AddStep($"show {rep}", () => SetContents(() => createDrawable(rep)));
+
+            AddStep("show droplet", () => SetContents(createDrawableDroplet));
+
+            AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet));
         }

-        private DrawableFruit createDrawable(FruitVisualRepresentation rep)
+        private Drawable createDrawableTinyDroplet()
+        {
+            var droplet = new TinyDroplet
+            {
+                StartTime = Clock.CurrentTime,
+                Scale = 1.5f,
+            };
+
+            return new DrawableTinyDroplet(droplet)
+            {
+                Anchor = Anchor.Centre,
+                RelativePositionAxes = Axes.None,
+                Position = Vector2.Zero,
+                Alpha = 1,
+                LifetimeStart = double.NegativeInfinity,
+                LifetimeEnd = double.PositiveInfinity,
+            };
+        }
+
+        private Drawable createDrawableDroplet()
+        {
+            var droplet = new Droplet
+            {
+                StartTime = Clock.CurrentTime,
+                Scale = 1.5f,
+            };
+
+            return new DrawableDroplet(droplet)
+            {
+                Anchor = Anchor.Centre,
+                RelativePositionAxes = Axes.None,
+                Position = Vector2.Zero,
+                Alpha = 1,
+                LifetimeStart = double.NegativeInfinity,
+                LifetimeEnd = double.PositiveInfinity,
+            };
+        }
+
+        private Drawable createDrawable(FruitVisualRepresentation rep)
         {
             Fruit fruit = new TestCatchFruit(rep)
             {


Refactor LegacySpriteText initialisation

--- osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs
+++ osu.Game.Rulesets.Osu/Skinning/Legacy/LegacySpinner.cs
@@ -76,18 +76,18 @@
                 }
             });

-            bonusCounter = (LegacySpriteText)source.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText));
+            bonusCounter = (source.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText)) as LegacySpriteText)?.With(c =>
+            {
+                c.Alpha = 0f;
+                c.Anchor = Anchor.TopCentre;
+                c.Origin = Anchor.Centre;
+                c.Font = c.Font.With(fixedWidth: false);
+                c.Scale = new Vector2(SPRITE_SCALE);
+                c.Y = SPINNER_TOP_OFFSET + 299;
+            });

             if (bonusCounter != null)
-            {
-                bonusCounter.Alpha = 0f;
-                bonusCounter.Anchor = Anchor.TopCentre;
-                bonusCounter.Origin = Anchor.Centre;
-                bonusCounter.Font = bonusCounter.Font.With(fixedWidth: false);
-                bonusCounter.Scale = new Vector2(SPRITE_SCALE);
-                bonusCounter.Y = SPINNER_TOP_OFFSET + 299;
                 overlayContainer.Add(bonusCounter);
-            }
         }

         private IBindable<double> gainedBonus;


Initial pass of schedule screen design update

--- osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs
+++ osu.Game.Tournament/Screens/Schedule/ScheduleScreen.cs
@@ -3,6 +3,7 @@

 using System;
 using System.Linq;
+using Humanizer;
 using osu.Framework.Allocation;
 using osu.Framework.Bindables;
 using osu.Framework.Graphics;
@@ -18,7 +19,7 @@

 namespace osu.Game.Tournament.Screens.Schedule
 {
-    public class ScheduleScreen : TournamentScreen
+    public class ScheduleScreen : TournamentScreen // IProvidesVideo
     {
         private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
         private Container mainContainer;
@@ -38,10 +39,63 @@
                     RelativeSizeAxes = Axes.Both,
                     Loop = true,
                 },
-                mainContainer = new Container
+                new Container
                 {
                     RelativeSizeAxes = Axes.Both,
-                }
+                    Padding = new MarginPadding(100) { Bottom = 50 },
+                    Children = new Drawable[]
+                    {
+                        new GridContainer
+                        {
+                            RelativeSizeAxes = Axes.Both,
+                            RowDimensions = new[]
+                            {
+                                new Dimension(GridSizeMode.AutoSize),
+                                new Dimension(),
+                            },
+                            Content = new[]
+                            {
+                                new Drawable[]
+                                {
+                                    new FillFlowContainer
+                                    {
+                                        AutoSizeAxes = Axes.Both,
+                                        Direction = FillDirection.Vertical,
+                                        Children = new Drawable[]
+                                        {
+                                            new DrawableTournamentTitleText(),
+                                            new Container
+                                            {
+                                                Margin = new MarginPadding { Top = 40 },
+                                                AutoSizeAxes = Axes.Both,
+                                                Children = new Drawable[]
+                                                {
+                                                    new Box
+                                                    {
+                                                        Colour = Color4.White,
+                                                        Size = new Vector2(50, 10),
+                                                    },
+                                                    new TournamentSpriteTextWithBackground("Schedule")
+                                                    {
+                                                        X = 60,
+                                                        Scale = new Vector2(0.8f)
+                                                    }
+                                                }
+                                            },
+                                        }
+                                    },
+                                },
+                                new Drawable[]
+                                {
+                                    mainContainer = new Container
+                                    {
+                                        RelativeSizeAxes = Axes.Both,
+                                    }
+                                }
+                            }
+                        }
+                    }
+                },
             };

             currentMatch.BindValueChanged(matchChanged);
@@ -91,7 +145,7 @@
                                                                .Take(8)
                                                                .Select(p => new ScheduleMatch(p))
                                 },
-                                new ScheduleContainer("match overview")
+                                new ScheduleContainer("upcoming matches")
                                 {
                                     RelativeSizeAxes = Axes.Both,
                                     Width = 0.6f,
@@ -100,26 +154,45 @@
                             }
                         }
                     },
-                    new ScheduleContainer("current match")
+                    new ScheduleContainer("coming up next")
                     {
                         RelativeSizeAxes = Axes.Both,
                         Height = 0.25f,
                         Children = new Drawable[]
                         {
-                            new TournamentSpriteText
-                            {
-                                Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 },
-                                Spacing = new Vector2(10, 0),
-                                Text = match.NewValue.Round.Value?.Name.Value,
-                                Colour = Color4.Black,
-                                Font = OsuFont.Torus.With(size: 20)
-                            },
-                            new ScheduleMatch(match.NewValue, false),
-                            new TournamentSpriteText
-                            {
-                                Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"),
-                                Colour = Color4.Black,
-                                Font = OsuFont.Torus.With(size: 20)
+                            new FillFlowContainer
+                            {
+                                RelativeSizeAxes = Axes.Both,
+                                Direction = FillDirection.Horizontal,
+                                Spacing = new Vector2(30),
+                                Children = new Drawable[]
+                                {
+                                    new ScheduleMatch(match.NewValue, false)
+                                    {
+                                        Anchor = Anchor.CentreLeft,
+                                        Origin = Anchor.CentreLeft,
+                                    },
+                                    new TournamentSpriteTextWithBackground(match.NewValue.Round.Value?.Name.Value)
+                                    {
+                                        Anchor = Anchor.CentreLeft,
+                                        Origin = Anchor.CentreLeft,
+                                        Scale = new Vector2(0.5f)
+                                    },
+                                    new TournamentSpriteText
+                                    {
+                                        Anchor = Anchor.CentreLeft,
+                                        Origin = Anchor.CentreLeft,
+                                        Text = match.NewValue.Team1.Value?.FullName + " vs " + match.NewValue.Team2.Value?.FullName,
+                                        Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold)
+                                    },
+                                    new TournamentSpriteText
+                                    {
+                                        Anchor = Anchor.CentreLeft,
+                                        Origin = Anchor.CentreLeft,
+                                        Text = $"Starting {match.NewValue.Date.Value.Humanize()}",
+                                        Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
+                                    },
+                                }
                             },
                         }
                     }
@@ -170,29 +243,20 @@

             public ScheduleContainer(string title)
             {
-                Padding = new MarginPadding { Left = 30, Top = 30 };
+                Padding = new MarginPadding { Left = 30, Top = 10 };
                 InternalChildren = new Drawable[]
                 {
-                    new TournamentSpriteText
+                    new TournamentSpriteTextWithBackground(title.ToUpperInvariant())
                     {
                         X = 30,
-                        Text = title,
-                        Colour = Color4.Black,
-                        Spacing = new Vector2(10, 0),
-                        Font = OsuFont.Torus.With(size: 30)
+                        Scale = new Vector2(0.5f)
                     },
                     content = new FillFlowContainer
                     {
                         Direction = FillDirection.Vertical,
                         RelativeSizeAxes = Axes.Both,
-                        Margin = new MarginPadding(40)
+                        Margin = new MarginPadding(10)
                     },
-                    new Circle
-                    {
-                        Colour = new Color4(233, 187, 79, 255),
-                        Width = 5,
-                        RelativeSizeAxes = Axes.Y,
-                    }
                 };
             }
         }


Asyncify statistics load

Asyncify statistics load

--- osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs
+++ osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs
@@ -1,10 +1,12 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

+using System.Threading;
 using osu.Framework.Allocation;
 using osu.Framework.Bindables;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
+using osu.Game.Graphics.UserInterface;
 using osu.Game.Online.Placeholders;
 using osu.Game.Scoring;
 using osuTK;
@@ -20,6 +22,7 @@
         protected override bool StartHidden => true;

         private readonly Container content;
+        private readonly LoadingSpinner spinner;

         public StatisticsPanel()
         {
@@ -33,7 +36,11 @@
                     Top = SIDE_PADDING,
                     Bottom = 50 // Approximate padding to the bottom of the score panel.
                 },
-                Child = content = new Container { RelativeSizeAxes = Axes.Both },
+                Children = new Drawable[]
+                {
+                    content = new Container { RelativeSizeAxes = Axes.Both },
+                    spinner = new LoadingSpinner()
+                }
             };
         }

@@ -43,8 +50,12 @@
             Score.BindValueChanged(populateStatistics, true);
         }

+        private CancellationTokenSource loadCancellation;
+
         private void populateStatistics(ValueChangedEvent<ScoreInfo> score)
         {
+            loadCancellation?.Cancel();
+
             foreach (var child in content)
                 child.FadeOut(150).Expire();

@@ -54,6 +65,8 @@
                 content.Add(new MessagePlaceholder("Score has no statistics :("));
             else
             {
+                spinner.Show();
+
                 var rows = new FillFlowContainer
                 {
                     RelativeSizeAxes = Axes.Both,
@@ -73,7 +86,14 @@
                     });
                 }

-                content.Add(rows);
+                LoadComponentAsync(rows, d =>
+                {
+                    if (Score.Value != newScore)
+                        return;
+
+                    spinner.Hide();
+                    content.Add(d);
+                }, (loadCancellation = new CancellationTokenSource()).Token);
             }
         }


Update

Update


cleanup

cleanup

--- service/DotNetApis.Nuget/NugetPackage.cs
+++ service/DotNetApis.Nuget/NugetPackage.cs
@@ -21,14 +21,14 @@
         {
             Stream = stream;
             _package = new PackageArchiveReaderWithRef(stream, leaveStreamOpen: true);
-            Metadata = new global::DotNetApis.Nuget.NugetPackage.InternalMetadata(_package);
+            Metadata = new InternalMetadata(_package);
             Stream.Position = 0;
         }

         /// <summary>
         /// Metadata contained within the package itself.
         /// </summary>
-        public global::DotNetApis.Nuget.NugetPackage.InternalMetadata Metadata { get; }
+        public InternalMetadata Metadata { get; }

         /// <summary>
         /// Directly access the underlying stream.


Implement NSStream Open

Implement NSStream Open

--- src/foundation.cs
+++ src/foundation.cs
@@ -1847,6 +1847,9 @@

 	[BaseType (typeof (NSObject))]
 	public interface NSStream {
+		[Export ("open")]
+		void Open ();
+
 		[Export ("close")]
 		void Close ();


add useful error messages for validation failure

--- src/main/Renew.cs
+++ src/main/Renew.cs
@@ -362,6 +362,10 @@

                         if (challenge.Status != _authorizationValid)
                         {
+                            if (challenge.Error != null)
+                            {
+                                _log.Error(challenge.Error.ToString());
+                            }
                             _log.Error("Authorization result: {Status}", challenge.Status);
                             return invalid;
                         }


Extract and write function RemoveSelectedItemFromListBox()

--- mp4box/MainForm.cs
+++ mp4box/MainForm.cs
@@ -1427,22 +1427,7 @@

         private void MuxConvertDeleteButton_Click(object sender, EventArgs e)
         {
-            if (MuxConvertItemListBox.Items.Count > 0)
-            {
-                if (MuxConvertItemListBox.SelectedItems.Count > 0)
-                {
-                    int index = MuxConvertItemListBox.SelectedIndex;
-                    MuxConvertItemListBox.Items.RemoveAt(MuxConvertItemListBox.SelectedIndex);
-                    if (index == MuxConvertItemListBox.Items.Count)
-                    {
-                        MuxConvertItemListBox.SelectedIndex = index - 1;
-                    }
-                    if (index >= 0 && index < MuxConvertItemListBox.Items.Count)
-                    {
-                        MuxConvertItemListBox.SelectedIndex = index;
-                    }
-                }
-            }
+            RemoveSelectedItemFromListBox(MuxConvertItemListBox);
         }

         private void MuxConvertClearButton_Click(object sender, EventArgs e)
@@ -2224,22 +2209,7 @@

         private void VideoBatchDeleteButton_Click(object sender, EventArgs e)
         {
-            if (VideoBatchItemListbox.Items.Count > 0)
-            {
-                if (VideoBatchItemListbox.SelectedItems.Count > 0)
-                {
-                    int index = VideoBatchItemListbox.SelectedIndex;
-                    VideoBatchItemListbox.Items.RemoveAt(VideoBatchItemListbox.SelectedIndex);
-                    if (index == VideoBatchItemListbox.Items.Count)
-                    {
-                        VideoBatchItemListbox.SelectedIndex = index - 1;
-                    }
-                    if (index >= 0 && index < VideoBatchItemListbox.Items.Count && VideoBatchItemListbox.Items.Count > 0)
-                    {
-                        VideoBatchItemListbox.SelectedIndex = index;
-                    }
-                }
-            }
+            RemoveSelectedItemFromListBox(VideoBatchItemListbox);
         }

         private void VideoBatchAddButton_Click(object sender, EventArgs e)
@@ -2560,22 +2530,7 @@

         private void AudioBatchDeleteButton_Click(object sender, EventArgs e)
         {
-            if (AudioBatchItemListBox.Items.Count > 0)
-            {
-                if (AudioBatchItemListBox.SelectedItems.Count > 0)
-                {
-                    int index = AudioBatchItemListBox.SelectedIndex;
-                    AudioBatchItemListBox.Items.RemoveAt(AudioBatchItemListBox.SelectedIndex);
-                    if (index == AudioBatchItemListBox.Items.Count)
-                    {
-                        AudioBatchItemListBox.SelectedIndex = index - 1;
-                    }
-                    if (index >= 0 && index < AudioBatchItemListBox.Items.Count && AudioBatchItemListBox.Items.Count > 0)
-                    {
-                        AudioBatchItemListBox.SelectedIndex = index;
-                    }
-                }
-            }
+            RemoveSelectedItemFromListBox(AudioBatchItemListBox);
         }

         private void AudioBatchClearButton_Click(object sender, EventArgs e)
@@ -3568,6 +3523,24 @@
                 ((TextBoxBase)sender).SelectAll();  // using TextBoxBase to include TextBox, RichTextBox and MaskedTextBox
         }

+        private void RemoveSelectedItemFromListBox(ListBox listBox)
+        {
+            if (listBox.Items.Count > 0 && listBox.SelectedItems.Count > 0)
+            {
+                int index = listBox.SelectedIndex;
+                listBox.Items.RemoveAt(listBox.SelectedIndex);
+                if (listBox.Items.Count == 0)   // nothing left in the list
+                    return;
+                else
+                {
+                    if (index == listBox.Items.Count)   // selectIndex is beyond the last item
+                        listBox.SelectedIndex = listBox.Items.Count - 1;
+                    else
+                        listBox.SelectedIndex = index;
+                }
+            }
+        }
+
         #region MediaInfo Tab

         public string GetMediaInfoString(string mediaFileName)


AxisScaling example

AxisScaling example

--- ApiExamples/CSharp/ApiExamples/ExCharts.cs
+++ ApiExamples/CSharp/ApiExamples/ExCharts.cs
@@ -115,5 +115,42 @@
             return chart;
         }
         //ExEnd
+
+        [Test]
+        public void AxisScaling()
+        {
+            //ExStart
+            //ExFor:Charts.AxisScaleType
+            //ExFor:Charts.AxisScaling
+            //ExFor:Charts.AxisScaling.LogBase
+            //ExFor:Charts.AxisScaling.Type
+            //ExSummary:Shows how to set up logarithmic axis scaling.
+            Document doc = new Document();
+            DocumentBuilder builder = new DocumentBuilder(doc);
+
+            // Insert a scatter chart and clear its default data series
+            Shape chartShape = builder.InsertChart(ChartType.Scatter, 450, 300);
+            Chart chart = chartShape.Chart;
+            chart.Series.Clear();
+
+            // Insert a series with X/Y coordinates for 5 points
+            // Note that, because of the erratic Y values, a graph with linear Y-axis scaling may not produce a satisfactory result
+            chart.Series.Add("Series 1", new[] { 1.0, 2.0, 3.0, 4.0, 5.0 }, new[] { 1.0, 10.0, 100.0, 1000.0, 10000.0 });
+
+            // The scaling of the X axis is linear,
+            // which means that the X value goes up by the same amount (in this case, 1) at each vertical line
+            // This X-axis ruler will display "1  2  3.."
+            Assert.AreEqual(AxisScaleType.Linear, chart.AxisX.Scaling.Type);
+
+            // As for the Y axis, we can set the scaling to Logarithmic,
+            // which means that the Y-values go up by an order of magnitude at each horizontal line
+            // The order of magnitude is decided by the LogBase attribute, which we will leave at 10, its default value
+            // This Y-axis ruler will display "1  10  100..."
+            chart.AxisY.Scaling.Type = AxisScaleType.Logarithmic;
+            Assert.AreEqual(10.0, chart.AxisX.Scaling.LogBase);
+
+            doc.Save(ArtifactsDir + "Charts.AxisScaling.docx");
+            //ExEnd
+        }
     }
 }


Change DeltaMaxTeamSize to int32 instead of byte. Some replay had a value of 999.

--- RReplay/Model/Game.cs
+++ RReplay/Model/Game.cs
@@ -182,7 +182,7 @@
         }

         [JsonProperty]
-        public byte DeltaMaxTeamSize
+        public Int32 DeltaMaxTeamSize
         {
             get;
             private set;


bug fixed

bug fixed

--- Assets/CatLib/Lib/Buffer/BufferProvider.cs
+++ Assets/CatLib/Lib/Buffer/BufferProvider.cs
@@ -18,7 +18,7 @@
     {
         public override void Register()
         {
-            App.Bind<BufferBuilder>().Alias<IBufferBuilder>().Alias("network.package.base");
+            App.Bind<BufferBuilder>().Alias<IBufferBuilder>().Alias("buffer");
         }
     }
 }


Bugfix: ObjectCache在设备上导致Mono内存泄漏问题

Bugfix: ObjectCache在设备上导致Mono内存泄漏问题

--- Assets/Plugins/Slua_Managed/ObjectCache.cs
+++ Assets/Plugins/Slua_Managed/ObjectCache.cs
@@ -21,6 +21,8 @@
 // THE SOFTWARE.

+using System.Runtime.CompilerServices;
+
 namespace SLua
 {
 	using System;
@@ -132,8 +134,21 @@
 		}

 		FreeList cache = new FreeList();
-
-		Dictionary<object, int> objMap = new Dictionary<object, int>();
+        public class ObjEqualityComparer : IEqualityComparer<object>
+        {
+            public bool Equals(object x, object y)
+            {
+
+                return ReferenceEquals(x, y);
+            }
+
+            public int GetHashCode(object obj)
+            {
+                return RuntimeHelpers.GetHashCode(obj);
+            }
+        }
+
+		Dictionary<object, int> objMap = new Dictionary<object, int>(new ObjEqualityComparer());
 		int udCacheRef = 0;


Fixed buggy left arrows in game setup screen

--- Assets/scripts/ui/GameSelectionMenuUGUI.cs
+++ Assets/scripts/ui/GameSelectionMenuUGUI.cs
@@ -50,13 +50,13 @@
     public void BackButton(string selectionType)
     {
         indexLength = loadAssets.GetCount(selectionType) - 1;
-        if (currentIndex[selectionType] < indexLength)
+        if (currentIndex[selectionType] > 0)
         {
-            currentIndex[selectionType] = indexLength;
+            currentIndex[selectionType]--;
         }
         else
         {
-            currentIndex[selectionType]--;
+            currentIndex[selectionType] = indexLength;
         }
         SetSelectionText(selectionType, loadAssets.GetName(selectionType, currentIndex[selectionType]));
     }


acually _really_ calling saveXslt :D

acually _really_ calling saveXslt :D

--- BSXmlReshaper/BSReshaper/BSReshaperForm.cs
+++ BSXmlReshaper/BSReshaper/BSReshaperForm.cs
@@ -112,7 +112,10 @@
                 return;
             }
             Reshaper reshaper = new Reshaper(gstPath, getCatPaths(), log);
-            Task.Run(new Action(reshaper.RegenerateIds));
+            Task.Run(new Action(() => {
+                reshaper.RegenerateIds();
+                saveXsltThreadSafe(reshaper);
+            }));
         }

         private void transformButton_Click(object sender, EventArgs e)


Addl debug logging

Addl debug logging

--- BandRemoteApp/BandRemoteApp/BandManager.cs
+++ BandRemoteApp/BandRemoteApp/BandManager.cs
@@ -27,6 +27,7 @@

             // Connect to Microsoft Band.
             _bandClient = await BandClientManager.Instance.ConnectAsync(pairedBands.First());
+            Debug.WriteLine("Band found");

             var sensors = _bandClient.SensorManager;

@@ -40,7 +41,8 @@
             //SensorStatusTextBlock.Text = "Initialized!";
             //Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Green);

-            await sensors.Gyroscope.StartReadingsAsync(Microsoft.Band.Portable.Sensors.BandSensorSampleRate.Ms16);
+            await sensors.Accelerometer.StartReadingsAsync(Microsoft.Band.Portable.Sensors.BandSensorSampleRate.Ms16);
+            Debug.WriteLine("Sensor reads requested");

             return 0;
         }


Get prime numbers

Get prime numbers

--- BasicSample/PrimeNumbersConsole/Program.cs
+++ BasicSample/PrimeNumbersConsole/Program.cs
@@ -1,8 +1,7 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;

 namespace PrimeNumbersConsole
 {
@@ -10,6 +9,56 @@
     {
         static void Main(string[] args)
         {
+            var stopwatch = Stopwatch.StartNew();
+            var result = GetPrimeNumbers(1000000, 1001000).ToArray();
+            stopwatch.Stop();
+
+            Array.ForEach(result, Console.WriteLine);
+            Console.WriteLine("{0} seconds", stopwatch.Elapsed.TotalSeconds);
+        }
+
+        static readonly Func<int, int, IEnumerable<int>> GetPrimeNumbers_Org = (minValue, maxValue)
+            => new[] { new List<int>() }
+                .SelectMany(primes => Enumerable2.Range2(2, maxValue)
+                    .Select(i => new { primes, i }))
+                .Where(_ => _.primes
+                    .All(p => _.i % p != 0))
+                .Do(_ => _.primes.Add(_.i))
+                .Select(_ => _.i)
+                .SkipWhile(i => i < minValue);
+
+        static readonly Func<int, int, IEnumerable<int>> GetPrimeNumbers = (minValue, maxValue)
+            => new[] { new List<int>() }
+                .SelectMany(primes => Enumerable2.Range2(2, maxValue)
+                    .Select(i => new { primes, i, root = Math.Sqrt(i) }))
+                .Where(_ => _.primes
+                    .TakeWhile(p => p <= _.root)
+                    .All(p => _.i % p != 0))
+                .Do(_ => _.primes.Add(_.i))
+                .Select(_ => _.i)
+                .SkipWhile(i => i < minValue);
+    }
+
+    public static class Enumerable2
+    {
+        public static IEnumerable<int> Range2(int minValue, int maxValue)
+        {
+            for (int i = minValue; i <= maxValue; i++)
+            {
+                yield return i;
+            }
+        }
+
+        public static IEnumerable<T> Do<T>(this IEnumerable<T> source, Action<T> action)
+        {
+            if (source == null) throw new ArgumentNullException("source");
+            if (action == null) throw new ArgumentNullException("action");
+
+            foreach (var item in source)
+            {
+                action(item);
+                yield return item;
+            }
         }
     }
 }


Twitter連携の場合はTwitter情報をもとにユーザ情報を構築する

Twitter連携の場合はTwitter情報をもとにユーザ情報を構築する

--- BbsSample/Controllers/AccountController.cs
+++ BbsSample/Controllers/AccountController.cs
@@ -151,7 +151,11 @@
         {
             if (ModelState.IsValid)
             {
-                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
+                var user = new ApplicationUser
+                {
+                    UserName = model.Email,
+                    Email = model.Email
+                };
                 var result = await UserManager.CreateAsync(user, model.Password);
                 if (result.Succeeded)
                 {
@@ -367,7 +371,18 @@
                 {
                     return View("ExternalLoginFailure");
                 }
-                var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
+
+                // ユーザ生成
+                var user = new ApplicationUser
+                {
+                    UserName = model.Email,
+                    Email = model.Email
+                };
+                if (info.Login.LoginProvider == "Twitter") // Twitter連携の場合はTwitter情報を被せる
+                {
+                    user.UserName = "@" + info.DefaultUserName;
+                    user.TwitterAccount = info.DefaultUserName;
+                }
                 var result = await UserManager.CreateAsync(user);
                 if (result.Succeeded)
                 {


Test: udt mapping convertion from string to enum

--- src/Cassandra.IntegrationTests/Core/UdtMappingsTests.cs
+++ src/Cassandra.IntegrationTests/Core/UdtMappingsTests.cs
@@ -33,7 +33,7 @@

             base.OneTimeSetUp();

-            const string cqlType1 = "CREATE TYPE phone (alias text, number text, country_code int)";
+            const string cqlType1 = "CREATE TYPE phone (alias text, number text, country_code int, verified_at timestamp, phone_type text)";
             const string cqlType2 = "CREATE TYPE contact (first_name text, last_name text, birth_date timestamp, phones set<frozen<phone>>, emails set<text>)";
             const string cqlTable1 = "CREATE TABLE users (id int PRIMARY KEY, main_phone frozen<phone>)";
             const string cqlTable2 = "CREATE TABLE users_contacts (id int PRIMARY KEY, contacts list<frozen<contact>>)";
@@ -53,8 +53,11 @@
                     .Map(v => v.Alias, "alias")
                     .Map(v => v.CountryCode, "country_code")
                     .Map(v => v.Number, "number")
+                    .Map(v => v.VerifiedAt, "verified_at")
+                    .Map(v => v.PhoneType, "phone_type")
             );
-            localSession.Execute("INSERT INTO users (id, main_phone) values (1, {alias: 'home phone', number: '123', country_code: 34})");
+            var date = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(100000);
+            localSession.Execute($"INSERT INTO users (id, main_phone) values (1, {{alias: 'home phone', number: '123', country_code: 34, verified_at: '100000', phone_type: 'Home'}})");
             var rs = localSession.Execute("SELECT * FROM users WHERE id = 1");
             var row = rs.First();
             var value = row.GetValue<Phone>("main_phone");
@@ -62,6 +65,8 @@
             Assert.AreEqual("home phone", value.Alias);
             Assert.AreEqual("123", value.Number);
             Assert.AreEqual(34, value.CountryCode);
+            Assert.AreEqual(date, value.VerifiedAt);
+            Assert.AreEqual(PhoneType.Home, value.PhoneType);
         }

         [Test]
@@ -380,6 +385,10 @@

             public int CountryCode { get; set; }

+            public DateTime VerifiedAt { get; set; }
+
+            public PhoneType PhoneType { get; set; }
+
             public override bool Equals(object obj)
             {
                 if (!(obj is Phone))
@@ -389,7 +398,9 @@
                 var phoneValue = (Phone)obj;
                 if (phoneValue.Alias == this.Alias &&
                     phoneValue.Number == this.Number &&
-                    phoneValue.CountryCode == this.CountryCode)
+                    phoneValue.CountryCode == this.CountryCode &&
+                    phoneValue.VerifiedAt == this.VerifiedAt &&
+                    phoneValue.PhoneType == this.PhoneType)
                 {
                     return true;
                 }
@@ -406,5 +417,10 @@
         {

         }
+
+        private enum PhoneType
+        {
+            Mobile, Home, Work
+        }
     }
 }


(GH-137) Removed unneeded new line

(GH-137) Removed unneeded new line

--- src/Chocolatey.Language.Server/Parsers/PackageParser.cs
+++ src/Chocolatey.Language.Server/Parsers/PackageParser.cs
@@ -12,7 +12,6 @@
     /// </summary>
     public static class PackageParser
     {
-
         /// <summary>
         /// Responsible for parsing the passed in nuspec xml document. This will then result in a
         /// parsed package from that xml.


Fix getting price per unit

Fix getting price per unit

--- RohlikAPI/Products.cs
+++ RohlikAPI/Products.cs
@@ -134,13 +134,18 @@
             var priceNode = productNode.SelectSingleNode(".//div/strong[contains(@class,'font-15')]");
             product.Price = priceParser.ParsePrice(priceNode.InnerText);

-            var pricePerUnitNode = productNode.SelectSingleNode(".//span[@class='grey font-11']/text()");
+            var pricePerUnitNode = productNode.SelectSingleNode(".//div[contains(@class,'product__price')]//span/span/text()");
+            if (pricePerUnitNode == null)
+            {
+                pricePerUnitNode = productNode.SelectSingleNode(".//div[contains(@class,'product__price')]//span/text()");
+            }
+
             var pricePerUnitString = pricePerUnitNode.InnerText.Trim().Trim('(', ')');

             product.PricePerUnit = priceParser.ParsePrice(pricePerUnitString);
             product.Unit = pricePerUnitString.Split(new[] {" "}, StringSplitOptions.None).Last();

-            var discountPriceNode = productNode.SelectSingleNode(".//span[@class='grey font-11']/del");
+            var discountPriceNode = productNode.SelectSingleNode(".//div[contains(@class,'product__price')]//del");

             if (discountPriceNode != null)
             {


Remove proto constants

Remove proto constants

--- floobits-vsp/FlooConstants.cs
+++ floobits-vsp/FlooConstants.cs
@@ -1,15 +0,0 @@
-namespace Floobits.Constants
-{
-    namespace hosts {
-        class Standard {
-            public const string host = "floobits.com";
-            public const int port = 3448;
-            public const bool secure = true;
-        }
-        class Proxy {
-            public const string host = "proxy.floobits.com";
-            public const int port = 443;
-            public const bool secure = true;
-        }
-    }
-}


soft cleaning

soft cleaning

--- RuleEvaluator/Cell.cs
+++ RuleEvaluator/Cell.cs
@@ -7,26 +7,26 @@
         /// <summary>
         /// IoC injected validate module
         /// </summary>
-        private readonly ICellValidateModule _CellValidateModuleModule;
+        private readonly ICellValidateModule _CellValidateModule;
         /// <summary>
         /// Cell filter value
         /// </summary>
         public object FilterValue { get; set; }
         /// <summary>
-        /// Input cell value (used for looking in Validate method. Output cell is used for getting data from Validated RuleItem
+        /// Input cell value means used for looking in Validate method. Output cell means used for getting data from Validated RuleItem
         /// </summary>
         public CellInputOutputType InputOutputType { get; set; }

-        public Cell(ICellValidateModule p_CellValidateModuleModule)
+        public Cell(ICellValidateModule p_CellValidateModule)
         {
-            _CellValidateModuleModule = p_CellValidateModuleModule;
+            _CellValidateModule = p_CellValidateModule;
         }

         public bool Validate(object p_Value)
         {
             if (FilterValue == null) throw new ArgumentNullException(nameof(FilterValue));

-            bool? res = _CellValidateModuleModule.Validate(FilterValue, p_Value);
+            bool? res = _CellValidateModule.Validate(FilterValue, p_Value);
             if (!res.HasValue)
             {
                 throw new Exception("Uknown validate result from ICellValidateModule instances");


Ensure Gui control is created before async invoking delegate.

--- Rusty/Core/Gui/Gui.cs
+++ Rusty/Core/Gui/Gui.cs
@@ -1620,6 +1620,16 @@
             if (ctrl == null)
                 return;

+            if (!ctrl.Created)
+            {
+                var vis = ctrl.Parent.Visible;
+
+                ctrl.Parent.Show();
+
+                if (!vis)
+                    ctrl.Parent.Hide();
+            }
+
             ctrl.Invoke((SimpleDelegate)delegate { GuiControlAsync(ctrl, Command, Param3); });
         }


Part2 - Allow Gui,+LastFound `n hwnd:=WinExist()

--- Rusty/Cores/Window.cs
+++ Rusty/Cores/Window.cs
@@ -511,6 +511,11 @@
         /// <returns></returns>
         public static long WinExist(string title = null, string text = null, string excludeTitle = null, string excludeText = null)
         {
+            if (title == string.Empty)
+            {
+                if (LastFoundForm != 0)
+                    return LastFoundForm;
+            }
             var win = windowManager.FindWindow(title, text, excludeTitle, excludeText);
             return win.Handle.ToInt64();
         }


Fixed an issue with the memory storage module not setting itself as default storage unit

--- Ceen.Security/Login/MemoryStorageModule.cs
+++ Ceen.Security/Login/MemoryStorageModule.cs
@@ -37,6 +37,14 @@
 		private AsyncLock m_lock;

 		/// <summary>
+		/// Initializes a new instance of the <see cref="T:Ceen.Security.Login.MemoryStorageModule"/> class.
+		/// </summary>
+		public MemoryStorageModule()
+		{
+			new LoginSettingsModule().ShortTermStorage = this;
+		}
+
+		/// <summary>
 		/// Adds a new session record
 		/// </summary>
 		/// <returns>An awaitable task.</returns>