Agent.cs: Let this throw an AIWolfAgentException in case of negative index.

--- AIWolfLibCommon/Data/Agent.cs
+++ AIWolfLibCommon/Data/Agent.cs
@@ -14,41 +14,35 @@
 namespace AIWolf.Common.Data
 {
     /// <summary>
-    /// Player agent of AIWolf game.
+    /// Agent class.
     /// </summary>
-    /// <remarks>
-    /// Each player can identify other players as Agent.
-    /// Each agent has a unique index number.
-    /// </remarks>
     [DataContract]
     public sealed class Agent : IComparable<Agent>
     {
-        static Dictionary<int, Agent> agentIndexMap = new Dictionary<int, Agent>();
+        static Dictionary<int, Agent> agentMap = new Dictionary<int, Agent>();

         /// <summary>
-        /// The agent of given index number.
+        /// Returns the agent of given index.
         /// </summary>
         /// <param name="idx">Agent's index number.</param>
         /// <returns>The agent of given index number.</returns>
-        /// <remarks></remarks>
         public static Agent GetAgent(int idx)
         {
             if (idx < 0)
             {
-                return null;
+                throw new AIWolfAgentException("Agent.GetAgent: Invalid index " + idx + ".");
             }
-            if (!agentIndexMap.ContainsKey(idx))
+            if (!agentMap.ContainsKey(idx))
             {
-                agentIndexMap[idx] = new Agent(idx);
+                agentMap[idx] = new Agent(idx);
             }
-            return agentIndexMap[idx];
+            return agentMap[idx];
         }

         /// <summary>
         /// The index number of this agent.
         /// </summary>
         /// <value>The index number of this agent.</value>
-        /// <remarks></remarks>
         [DataMember(Name = "agentIdx")]
         public int AgentIdx { get; }

@@ -56,7 +50,6 @@
         /// Initializes a new instance of Agent class with given index number.
         /// </summary>
         /// <param name="idx">The index number of this agent.</param>
-        /// <remarks></remarks>
         private Agent(int idx)
         {
             AgentIdx = idx;
@@ -66,7 +59,6 @@
         /// Returns a string that represents the current object.
         /// </summary>
         /// <returns>A string that represents the current object.</returns>
-        /// <remarks></remarks>
         public override string ToString()
         {
             return string.Format("Agent[{0:00}]", AgentIdx);
@@ -76,7 +68,6 @@
         /// Serves as the default hash function.
         /// </summary>
         /// <returns>A hash code for the current object.</returns>
-        /// <remarks></remarks>
         public override int GetHashCode()
         {
             const int prime = 31;
@@ -89,8 +80,7 @@
         /// Determines whether the specified object is equal to the current object.
         /// </summary>
         /// <param name="obj">The object to compare with the current object.</param>
-        /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
-        /// <remarks></remarks>
+        /// <returns>True if the specified object is equal to the current object; otherwise, false.</returns>
         public override bool Equals(object obj)
         {
             if (this == obj)


Ensure connect buttons reflect active state when (re)loaded

--- ActionBar/PrinterActionRow.cs
+++ ActionBar/PrinterActionRow.cs
@@ -72,6 +72,7 @@
             }
             connectPrinterButton.VAnchor = VAnchor.ParentTop;
             connectPrinterButton.Cursor = Cursors.Hand;
+            connectPrinterButton.Visible = !PrinterConnectionAndCommunication.Instance.PrinterIsConnected;

             string disconnectString = "Disconnect".Localize().ToUpper();
             disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png");
@@ -84,7 +85,7 @@
                 disconnectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
             }
             disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
-            disconnectPrinterButton.Visible = false;
+            disconnectPrinterButton.Visible = PrinterConnectionAndCommunication.Instance.PrinterIsConnected;
             disconnectPrinterButton.Cursor = Cursors.Hand;

             selectActivePrinterButton = new PrinterSelectButton();


Move the correction into the method for clarity

--- PlayerRank/Scoring/Elo/EloScoringStrategy.cs
+++ PlayerRank/Scoring/Elo/EloScoringStrategy.cs
@@ -88,9 +88,7 @@
                     }

                     var didPlayerAWin = PlayerAWon(playerAResult, playerBResult);
-                    var ratingChange = RatingChange(chanceOfPlayerAWinning, didPlayerAWin);
-                    // adjust for the fact that we're playing against multiple people
-                    var adjustedRatingChange = ratingChange / results.Count;
+                    var adjustedRatingChange = RatingChange(chanceOfPlayerAWinning, didPlayerAWin, results.Count);
                     var integerRatingChange = Math.Round(adjustedRatingChange, MidpointRounding.AwayFromZero);

                     playerA.AddPoints(new Points(integerRatingChange));
@@ -127,10 +125,10 @@

         }

-        private Points RatingChange(double expectedToWin, bool actuallyWon)
+        private double RatingChange(double expectedToWin, bool actuallyWon, int totalPlayers)
         {
             var w = (actuallyWon) ? 1 : 0;
-            return m_RatingChangeBaseMultiplier * new Points(w - expectedToWin);
+            return m_MaxRatingChange * new Points(w - expectedToWin) / totalPlayers;
         }

         /// <summary>


Reduce scope of locking in RunFrame

Reduce scope of locking in RunFrame

--- Plugins/Steamworks.NET/CallbackDispatcher.cs
+++ Plugins/Steamworks.NET/CallbackDispatcher.cs
@@ -122,41 +122,43 @@
 			HSteamPipe hSteamPipe = (HSteamPipe)(isGameServer ? NativeMethods.SteamGameServer_GetHSteamPipe() : NativeMethods.SteamAPI_GetHSteamPipe());
 			NativeMethods.SteamAPI_ManualDispatch_RunFrame(hSteamPipe);
 			var callbacksRegistry = isGameServer ? m_registeredGameServerCallbacks : m_registeredCallbacks;
-			lock (m_sync) {
-				while (NativeMethods.SteamAPI_ManualDispatch_GetNextCallback(hSteamPipe, m_pCallbackMsg.AddrOfPinnedObject())) {
-					try {
-						// Check for dispatching API call results
-						if (m_callbackMsg.m_iCallback == SteamAPICallCompleted_t.k_iCallback) {
-							SteamAPICallCompleted_t callCompletedCb;
-							Marshal.PtrToStructure(m_callbackMsg.m_pubParam, callCompletedCb);
-							IntPtr pTmpCallResult = Marshal.AllocHGlobal(callCompletedCb.m_cubParam);
-							bool bFailed;
-							try {
-								if (NativeMethods.SteamAPI_ManualDispatch_GetAPICallResult(hSteamPipe, callCompletedCb.m_hAsyncCall, pTmpCallResult, callCompletedCb.m_cubParam, callCompletedCb.m_iCallback, out bFailed)) {
-									if (m_registeredCallResults.TryGetValue((ulong)callCompletedCb.m_hAsyncCall, out CallResult cr)) {
-										cr.OnRunCallResult(pTmpCallResult, bFailed, (ulong)callCompletedCb.m_hAsyncCall);
-									}
-								}
-							} finally {
-								Marshal.FreeHGlobal(pTmpCallResult);
-								m_dispatchedApiCalls.Add((ulong)callCompletedCb.m_hAsyncCall);
-							}
-						} else {
-							if (callbacksRegistry.TryGetValue(m_callbackMsg.m_iCallback, out var callbacks)) {
-								foreach (var callback in callbacks) {
-									callback.OnRunCallback(m_callbackMsg.m_pubParam);
+			while (NativeMethods.SteamAPI_ManualDispatch_GetNextCallback(hSteamPipe, m_pCallbackMsg.AddrOfPinnedObject())) {
+				try {
+					// Check for dispatching API call results
+					if (m_callbackMsg.m_iCallback == SteamAPICallCompleted_t.k_iCallback) {
+						SteamAPICallCompleted_t callCompletedCb;
+						Marshal.PtrToStructure(m_callbackMsg.m_pubParam, callCompletedCb);
+						IntPtr pTmpCallResult = Marshal.AllocHGlobal(callCompletedCb.m_cubParam);
+						bool bFailed;
+						try {
+							if (NativeMethods.SteamAPI_ManualDispatch_GetAPICallResult(hSteamPipe, callCompletedCb.m_hAsyncCall, pTmpCallResult, callCompletedCb.m_cubParam, callCompletedCb.m_iCallback, out bFailed)) {
+								if (m_registeredCallResults.TryGetValue((ulong)callCompletedCb.m_hAsyncCall, out CallResult cr)) {
+									cr.OnRunCallResult(pTmpCallResult, bFailed, (ulong)callCompletedCb.m_hAsyncCall);
 								}
 							}
+						} finally {
+							Marshal.FreeHGlobal(pTmpCallResult);
+							m_dispatchedApiCalls.Add((ulong)callCompletedCb.m_hAsyncCall);
 						}
-					} catch (Exception e) {
-						ExceptionHandler(e);
-					} finally {
-						NativeMethods.SteamAPI_ManualDispatch_FreeLastCallback(hSteamPipe);
-						foreach (var call in m_dispatchedApiCalls) {
-							m_registeredCallResults.Remove(call);
+					} else {
+						if (callbacksRegistry.TryGetValue(m_callbackMsg.m_iCallback, out var callbacks)) {
+							List<Callback> callbacksCopy;
+							lock (m_sync) {
+								callbacksCopy = new List<Callback>(callbacks);
+							}
+							foreach (var callback in callbacksCopy) {
+								callback.OnRunCallback(m_callbackMsg.m_pubParam);
+							}
 						}
-						m_dispatchedApiCalls.Clear();
 					}
+				} catch (Exception e) {
+					ExceptionHandler(e);
+				} finally {
+					NativeMethods.SteamAPI_ManualDispatch_FreeLastCallback(hSteamPipe);
+					foreach (var call in m_dispatchedApiCalls) {
+						m_registeredCallResults.Remove(call);
+					}
+					m_dispatchedApiCalls.Clear();
 				}
 			}
 		}


Stripped ShortcutHelper of unneeded p/invoke methods

--- Plugins/Wox.Plugin.Program/ShortcutHelper.cs
+++ Plugins/Wox.Plugin.Program/ShortcutHelper.cs
@@ -11,20 +11,6 @@
     public class ShortcutHelper
     {
         #region Signatures
-        [DllImport("shfolder.dll", CharSet = CharSet.Auto)]
-        internal static extern int SHGetFolderPath(IntPtr hwndOwner, int nFolder, IntPtr hToken, int dwFlags, StringBuilder lpszPath);
-
-        [Flags()]
-        enum SLGP_FLAGS
-        {
-            /// Retrieves the standard short (8.3 format) file name
-            SLGP_SHORTPATH = 0x1,
-            /// Retrieves the Universal Naming Convention (UNC) path name of the file
-            SLGP_UNCPRIORITY = 0x2,
-            /// Retrieves the raw path name. A raw path is something that might not exist and may include environment variables that need to be expanded
-            SLGP_RAWPATH = 0x4
-        }
-
         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
         struct WIN32_FIND_DATAW
         {
@@ -42,93 +28,17 @@
             public string cAlternateFileName;
         }

-        [Flags()]
-        enum SLR_FLAGS
-        {
-            ///
-            /// Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set,
-            /// the high-order word of fFlags can be set to a time-out value that specifies the
-            /// maximum amount of time to be spent resolving the link. The function returns if the
-            /// link cannot be resolved within the time-out duration. If the high-order word is set
-            /// to zero, the time-out duration will be set to the default value of 3,000 milliseconds
-            /// (3 seconds). To specify a value, set the high word of fFlags to the desired time-out
-            /// duration, in milliseconds.
-            ///
-            SLR_NO_UI = 0x1,
-            /// Obsolete and no longer used
-            SLR_ANY_MATCH = 0x2,
-            /// If the link object has changed, update its path and list of identifiers.
-            /// If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine
-            /// whether or not the link object has changed.
-            SLR_UPDATE = 0x4,
-            /// Do not update the link information
-            SLR_NOUPDATE = 0x8,
-            /// Do not execute the search heuristics
-            SLR_NOSEARCH = 0x10,
-            /// Do not use distributed link tracking
-            SLR_NOTRACK = 0x20,
-            /// Disable distributed link tracking. By default, distributed link tracking tracks
-            /// removable media across multiple devices based on the volume name. It also uses the
-            /// Universal Naming Convention (UNC) path to track remote file systems whose drive letter
-            /// has changed. Setting SLR_NOLINKINFO disables both types of tracking.
-            SLR_NOLINKINFO = 0x40,
-            /// Call the Microsoft Windows Installer
-            SLR_INVOKE_MSI = 0x80
-        }
-
-
         /// The IShellLink interface allows Shell links to be created, modified, and resolved
         [ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")]
         interface IShellLinkW
         {
             /// Retrieves the path and file name of a Shell link object
-            void GetPath([Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out WIN32_FIND_DATAW pfd, SLGP_FLAGS fFlags);
-            /// Retrieves the list of item identifiers for a Shell link object
-            void GetIDList(out IntPtr ppidl);
-            /// Sets the pointer to an item identifier list (PIDL) for a Shell link object.
-            void SetIDList(IntPtr pidl);
-            /// Retrieves the description string for a Shell link object
-            void GetDescription([Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName);
-            /// Sets the description for a Shell link object. The description can be any application-defined string
-            void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
-            /// Retrieves the name of the working directory for a Shell link object
-            void GetWorkingDirectory([Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
-            /// Sets the name of the working directory for a Shell link object
-            void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
-            /// Retrieves the command-line arguments associated with a Shell link object
-            void GetArguments([Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
-            /// Sets the command-line arguments for a Shell link object
-            void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
-            /// Retrieves the hot key for a Shell link object
-            void GetHotkey(out short pwHotkey);
-            /// Sets a hot key for a Shell link object
-            void SetHotkey(short wHotkey);
-            /// Retrieves the show command for a Shell link object
-            void GetShowCmd(out int piShowCmd);
-            /// Sets the show command for a Shell link object. The show command sets the initial show state of the window.
-            void SetShowCmd(int iShowCmd);
-            /// Retrieves the location (path and index) of the icon for a Shell link object
-            void GetIconLocation([Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
-                int cchIconPath, out int piIcon);
-            /// Sets the location (path and index) of the icon for a Shell link object
-            void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
-            /// Sets the relative path to the Shell link object
-            void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved);
-            /// Attempts to find the target of a Shell link, even if it has been moved or renamed
-            void Resolve(IntPtr hwnd, SLR_FLAGS fFlags);
-            /// Sets the path and file name of a Shell link object
-            void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
-
+            void GetPath([Out(), MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out WIN32_FIND_DATAW pfd, uint fFlags);
         }

         [ComImport, Guid("0000010c-0000-0000-c000-000000000046"),
         InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-        public interface IPersist
-        {
-            [PreserveSig]
-            void GetClassID(out Guid pClassID);
-        }
-
+        public interface IPersist { }

         [ComImport, Guid("0000010b-0000-0000-C000-000000000046"),
         InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
@@ -136,21 +46,7 @@
         {
             new void GetClassID(out Guid pClassID);
             [PreserveSig]
-            int IsDirty();
-
-            [PreserveSig]
-            void Load([In, MarshalAs(UnmanagedType.LPWStr)]
-    string pszFileName, uint dwMode);
-
-            [PreserveSig]
-            void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName,
-                [In, MarshalAs(UnmanagedType.Bool)] bool fRemember);
-
-            [PreserveSig]
-            void SaveCompleted([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName);
-
-            [PreserveSig]
-            void GetCurFile([In, MarshalAs(UnmanagedType.LPWStr)] string ppszFileName);
+            void Load([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName, uint dwMode);
         }

         const uint STGM_READ = 0;


Enchanced EscrotToPosition Script to get the escort NPC if we died or lost it : Use ExtraInt (Id of npc we have to gossip to start the escort), ExtraPoint (Position of the NPC) and GossipOptionsInteractWith...

--- Profiles/Quester/Scripts/EscortToPosition.cs
+++ Profiles/Quester/Scripts/EscortToPosition.cs
@@ -1,8 +1,15 @@
+/*
+Check code at the end to set where to get the NPC if you die
+
+*/
+
 WoWUnit unit = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.Entry, questObjective.IsDead), questObjective.IgnoreNotSelectable, questObjective.IgnoreBlackList,
 	questObjective.AllowPlayerControlled);
 Point pos = ObjectManager.Me.Position; /* Initialize or getting an error */
 int q = QuestID; /* not used but otherwise getting warning QuestID not used */
 uint baseAddress = 0;
+
+questObjective.Range = questObjective.Range == 0 ? 5 : questObjective.Range;

 /* If Entry found continue*/
 if (unit.IsValid)
@@ -69,4 +76,34 @@

 	return true;
 }
+else //Npc Dead probably get him back, use ExtraPoint for the position of the NPC and Extra ID to get it back. Gossip too if necessary
+{
+	if(questObjective.ExtraInt == 0)
+		return false;
+
+	WoWUnit npc = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.ExtraInt, questObjective.IsDead), questObjective.IgnoreNotSelectable, questObjective.IgnoreBlackList,
+		questObjective.AllowPlayerControlled);
+
+	MovementManager.GoToLocationFindTarget(questObjective.ExtraPoint);
+
+	if(npc.IsValid && npc.GetDistance <= questObjective.Range)
+	{
+		/* Target Reached */
+		MovementManager.StopMove();
+	}
+	else
+	{
+		if (MovementManager.InMovement)
+			return false;
+		if (baseAddress <= 0)
+			return false;
+		if (baseAddress > 0 && (npc.IsValid && npc.GetDistance > questObjective.Range))
+			return false;
+	}
+	Interact.InteractWith(npc.GetBaseAddress);
+
+	Thread.Sleep(500);
+
+	nManager.Wow.Helpers.Quest.SelectGossipOption(questObjective.GossipOptionsInteractWith);
+}
 return true;


Add Football-API's testing key complete.

Signed-off-by: Sakul Jaruthanaset <17b4bfe9c570ddd7d4345ec4b3617835712513c0@perfenterprise.com>

--- DailySoccer2015/ApiApp/Repositories/FootballService.cs
+++ DailySoccer2015/ApiApp/Repositories/FootballService.cs
@@ -25,7 +25,9 @@
         public IEnumerable<MatchAPIInformation> GetMatchesByLeagueId(string leagueId, DateTime fromDate, DateTime toDate)
         {
             const string dateFormat = "dd.MM.yyyy";
-            const string APIKey = "d7946ce1-b897-975e-d462b1899cd6";
+            //const string APIKey = "d7946ce1-b897-975e-d462b1899cd6"; // miolynet fot Joker azure
+            const string APIKey = "fb8e4d95-d176-b433-7a10ecb4ebe7"; // perawatt fot localhost
+
             const string urlFormat = "/api/?Action=fixtures&APIKey={0}&comp_id={1}&from_date={2}&to_date={3}";
             var url = string.Format(urlFormat, APIKey, leagueId, fromDate.ToString(dateFormat), toDate.ToString(dateFormat));


Changed how start data is selected in systemGen

No it is all selected using a single random number. Should get us saner
results.

--- Pulsar4X/Pulsar4X.Lib/SystemGen/SystemGen.cs
+++ Pulsar4X/Pulsar4X.Lib/SystemGen/SystemGen.cs
@@ -406,12 +406,13 @@
             double maxStarAge = GalaxyGen.StarAgeBySpectralType[spectralType]._max;

             StarData data = new StarData();
+            double randomSelection = m_RNG.NextDouble(); // we will use the one random number to select from all the spectral type ranges. Should give us saner numbers for stars.
             data._SpectralType = spectralType;
-            data._Radius = RNG_NextDoubleRange(GalaxyGen.StarRadiusBySpectralType[spectralType]);
-            data._Temp = (uint)m_RNG.Next((int)GalaxyGen.StarTemperatureBySpectralType[spectralType]._min, (int)GalaxyGen.StarTemperatureBySpectralType[spectralType]._max);
-            data._Luminosity = (float)RNG_NextDoubleRange(GalaxyGen.StarLuminosityBySpectralType[spectralType]);
-            data._Mass = RNG_NextDoubleRange(GalaxyGen.StarMassBySpectralType[spectralType]);
-            data._Age = (1 - data._Mass / GalaxyGen.StarMassBySpectralType[spectralType]._max) * maxStarAge; // note the fiddle math at the start here is to make more massive stars younger.
+            data._Radius = SelectFromRange(GalaxyGen.StarRadiusBySpectralType[spectralType], randomSelection);
+            data._Temp = (uint)Math.Round(SelectFromRange(GalaxyGen.StarTemperatureBySpectralType[spectralType], randomSelection));
+            data._Luminosity = (float)SelectFromRange(GalaxyGen.StarLuminosityBySpectralType[spectralType], randomSelection);
+            data._Mass = SelectFromRange(GalaxyGen.StarMassBySpectralType[spectralType], randomSelection);
+            data._Age = (1 - data._Mass / GalaxyGen.StarMassBySpectralType[spectralType]._max) * maxStarAge; // note the fiddly math at the start here is to make more massive stars younger.

             // create star and populate data:
             Star star = new Star(name, data._Radius, data._Temp, data._Luminosity, data._SpectralType, system);
@@ -1462,17 +1463,6 @@
         {
             return RNG_NextDoubleRange(minMax._min, minMax._max);
         }
-
-        /// <summary>
-        /// Returns the next Double from m_RNG adjusted to be between the min and max range times by a constant value (e.g. a unit of some sort).
-        /// </summary>
-        /// <param name="constant"> A constant which will be multiplied agains min and max, use for units etc.</param>
-        /// <returns>Random value between min and max adjusted according to the constant value provided.</returns>
-        public static double RNG_NextDoubleRange(double min, double max, double constant)
-        {
-            min *= constant;
-            return min + m_RNG.NextDouble() * ((max * constant) - min);
-        }

         /// <summary>
         /// Raises the random number generated to the power provided to produce a non-uniform selection from the range.
@@ -1491,19 +1481,19 @@
         }

         /// <summary>
-        /// Version of RNG_NextDoubleRange(double min, double max, double constant) that takes GalaxyGen.MinMaxStruct directly.
-        /// </summary>
-        public static double RNG_NextDoubleRange(GalaxyGen.MinMaxStruct minMax, double constant)
-        {
-            return RNG_NextDoubleRange(minMax._min, minMax._max, constant);
-        }
-
-        /// <summary>
         /// Returns a value between the min and max.
         /// </summary>
         public static uint RNG_NextRange(GalaxyGen.MinMaxStruct minMax)
         {
             return (uint)m_RNG.Next((int)minMax._min, (int)minMax._max);
+        }
+
+        /// <summary>
+        /// Selects a number from a range based on the selection percentage provided.
+        /// </summary>
+        public static double SelectFromRange(GalaxyGen.MinMaxStruct minMax, double selection)
+        {
+            return minMax._min + selection * (minMax._max - minMax._min); ;
         }

         /// <summary>


Fixeds #18

Fixeds #18

--- PushSharp.Android/C2dm/AndroidPushChannel.cs
+++ PushSharp.Android/C2dm/AndroidPushChannel.cs
@@ -54,6 +54,11 @@
 				//Device subscription is no good!
 				this.Events.RaiseDeviceSubscriptionExpired(PlatformType.AndroidC2dm, response.Message.RegistrationId);
 			}
+			else if (response.ResponseStatus == MessageTransportResponseStatus.NotRegistered)
+			{
+				//Device must have uninstalled app
+				this.Events.RaiseDeviceSubscriptionExpired(PlatformType.AndroidC2dm, response.Message.RegistrationId);
+			}
 			else
 			{
 				//TODO: Raise error response


Check more nulls

Check more nulls


start-video waits until connected

start-video waits until connected

--- src/csharp/start-video.cs
+++ src/csharp/start-video.cs
@@ -15,17 +15,32 @@
     return LyncClient.GetClient().ConversationManager.Conversations.FirstOrDefault();
   }

-  public IList<Conversation> GetAllConversations()
+  public Task WaitToConnect()
   {
-    return LyncClient.GetClient().ConversationManager.Conversations;
+    var conversation = GetConversation();
+    var avModality = ((AVModality)conversation.Modalities[ModalityTypes.AudioVideo]);
+
+    var handler = (sender, e) => {
+      if (e.NewState != ModalityState.Connected) return;
+      avModality.ModalityStateChanged -= handler;
+      tcs.TrySetResult(true);
+    };
+
+    avModality.ModalityStateChanged += handler;
+    return tcs.Task;
   }

   public async Task<VideoChannel> GetVideoChannel()
   {
     var conversation = GetConversation();
     if (conversation == null) throw new System.InvalidOperationException("Cannot start video on non-extant conversation");
+
     var avModality = ((AVModality)conversation.Modalities[ModalityTypes.AudioVideo]);
+    var tcs = new TaskCompletionSource<bool>();

+    if (avModality.State != ModalityState.Connected) {
+      await WaitToConnect()
+    }
     return avModality.VideoChannel;
   }


Fixed issue when no Result node returned from Aras Server

--- Aras.Model/IO/SOAPResponse.cs
+++ Aras.Model/IO/SOAPResponse.cs
@@ -51,13 +51,28 @@
             {
                 List<Item> ret = new List<Item>();

-                XmlNodeList itemnodes = this.Result.SelectNodes("Item");
+                if (this.Result != null)
+                {
+                    XmlNodeList itemnodes = this.Result.SelectNodes("Item");

-                if (itemnodes != null)
+                    if (itemnodes != null)
+                    {
+                        foreach (XmlNode itemnode in itemnodes)
+                        {
+                            ret.Add(new Item(this.Doc, itemnode));
+                        }
+                    }
+                }
+                else
                 {
-                    foreach(XmlNode itemnode in itemnodes)
+                    XmlNodeList itemnodes = this.Doc.SelectNodes("Item");
+
+                    if (itemnodes != null)
                     {
-                        ret.Add(new Item(this.Doc, itemnode));
+                        foreach (XmlNode itemnode in itemnodes)
+                        {
+                            ret.Add(new Item(this.Doc, itemnode));
+                        }
                     }
                 }


CardsFarmer: Greatly reduce time spent on checking pages and hours

--- ArchiSteamFarm/CardsFarmer.cs
+++ ArchiSteamFarm/CardsFarmer.cs
@@ -140,119 +140,17 @@
 		internal async Task StartFarming() {
 			await Semaphore.WaitAsync().ConfigureAwait(false);

-			if (NowFarming) {
-				Semaphore.Release();
-				return;
-			}
-
-			if (await Bot.ArchiWebHandler.ReconnectIfNeeded().ConfigureAwait(false)) {
-				Semaphore.Release();
-				return;
-			}
-
-			Logging.LogGenericInfo(Bot.BotName, "Checking badges...");
-
-			// Find the number of badge pages
-			Logging.LogGenericInfo(Bot.BotName, "Checking page: 1/?");
-			HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(1).ConfigureAwait(false);
-			if (htmlDocument == null) {
-				Logging.LogGenericWarning(Bot.BotName, "Could not get badges information, will try again later!");
-				Semaphore.Release();
-				return;
-			}
-
-			byte maxPages = 1;
-			HtmlNodeCollection htmlNodeCollection = htmlDocument.DocumentNode.SelectNodes("//a[@class='pagelink']");
-			if (htmlNodeCollection != null && htmlNodeCollection.Count > 0) {
-				HtmlNode htmlNode = htmlNodeCollection[htmlNodeCollection.Count - 1];
-				if (!byte.TryParse(htmlNode.InnerText, out maxPages)) {
-					maxPages = 1; // Should never happen
-				}
-			}
-
-			GamesToFarm.Clear();
-
-			// Find APPIDs we need to farm
-			for (byte page = 1; page <= maxPages; page++) {
-				if (page > 1) { // Because we fetched page number 1 already
-					Logging.LogGenericInfo(Bot.BotName, "Checking page: " + page + "/" + maxPages);
-					htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(page).ConfigureAwait(false);
-					if (htmlDocument == null) {
-						break;
-					}
-				}
-
-				htmlNodeCollection = htmlDocument.DocumentNode.SelectNodes("//a[@class='btn_green_white_innerfade btn_small_thin']");
-				if (htmlNodeCollection == null) {
-					continue;
-				}
-
-				foreach (HtmlNode htmlNode in htmlNodeCollection) {
-					string steamLink = htmlNode.GetAttributeValue("href", null);
-					if (steamLink == null) {
-						continue;
-					}
-
-					uint appID = (uint) Utilities.OnlyNumbers(steamLink);
-					if (appID == 0) {
-						continue;
-					}
-
-					if (Bot.GlobalBlacklist.Contains(appID) || Bot.Blacklist.Contains(appID)) {
-						continue;
-					}
-
-					// We assume that every game has at least 2 hours played, until we actually check them
-					GamesToFarm[appID] = 2;
-				}
-			}
-
-			if (GamesToFarm.Count == 0) {
-				Logging.LogGenericInfo(Bot.BotName, "No games to farm!");
-				Semaphore.Release();
-				return;
-			}
-
-			// If we have restricted card drops, actually do check hours of all games that are left to farm
-			if (Bot.CardDropsRestricted) {
-				foreach (uint appID in GamesToFarm.Keys) {
-					Logging.LogGenericInfo(Bot.BotName, "Checking hours of appID: " + appID);
-					htmlDocument = await Bot.ArchiWebHandler.GetGameCardsPage(appID).ConfigureAwait(false);
-					if (htmlDocument == null) {
-						continue;
-					}
-
-					HtmlNode htmlNode = htmlDocument.DocumentNode.SelectSingleNode("//div[@class='badge_title_stats_playtime']");
-					if (htmlNode == null) {
-						continue;
-					}
-
-					string hoursString = htmlNode.InnerText;
-					if (string.IsNullOrEmpty(hoursString)) {
-						continue;
-					}
-
-					hoursString = Regex.Match(hoursString, @"[0-9\.,]+").Value;
-					double hours;
-
-					if (string.IsNullOrEmpty(hoursString)) {
-						hours = 0;
-					} else {
-						hours = double.Parse(hoursString, CultureInfo.InvariantCulture);
-					}
-
-					GamesToFarm[appID] = hours;
-				}
-			}
-
-			Logging.LogGenericInfo(Bot.BotName, "Farming in progress...");
-
+			if (!await IsAnythingToFarm().ConfigureAwait(false)) {
+				Semaphore.Release(); // We have nothing to do, don't forget to release semaphore
+				return;
+			}
+
+			Logging.LogGenericInfo(Bot.BotName, "We have a total of " + GamesToFarm.Count + " games to farm on this account, farming in progress...");
 			NowFarming = true;
 			Semaphore.Release(); // From this point we allow other calls to shut us down

 			// Now the algorithm used for farming depends on whether account is restricted or not
-			if (Bot.CardDropsRestricted) {
-				// If we have restricted card drops, we use complex algorithm, which prioritizes farming solo titles >= 2 hours, then all at once, until any game hits mentioned 2 hours
+			if (Bot.CardDropsRestricted) { // If we have restricted card drops, we use complex algorithm
 				Logging.LogGenericInfo(Bot.BotName, "Chosen farming algorithm: Complex");
 				while (GamesToFarm.Count > 0) {
 					List<uint> gamesToFarmSolo = GetGamesToFarmSolo(GamesToFarm);
@@ -276,8 +174,7 @@
 						}
 					}
 				}
-			} else {
-				// If we have unrestricted card drops, we use simple algorithm and farm cards one-by-one
+			} else { // If we have unrestricted card drops, we use simple algorithm
 				Logging.LogGenericInfo(Bot.BotName, "Chosen farming algorithm: Simple");
 				while (GamesToFarm.Count > 0) {
 					uint appID = GetAnyGameToFarm(GamesToFarm);
@@ -315,6 +212,145 @@
 			Semaphore.Release();
 		}

+		private async Task<bool> IsAnythingToFarm() {
+			if (NowFarming) {
+				return false;
+			}
+
+			if (await Bot.ArchiWebHandler.ReconnectIfNeeded().ConfigureAwait(false)) {
+				return false;
+			}
+
+			Logging.LogGenericInfo(Bot.BotName, "Checking badges...");
+
+			// Find the number of badge pages
+			Logging.LogGenericInfo(Bot.BotName, "Checking first page...");
+			HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(1).ConfigureAwait(false);
+			if (htmlDocument == null) {
+				Logging.LogGenericWarning(Bot.BotName, "Could not get badges information, will try again later!");
+				return false;
+			}
+
+			byte maxPages = 1;
+			HtmlNodeCollection htmlNodeCollection = htmlDocument.DocumentNode.SelectNodes("//a[@class='pagelink']");
+			if (htmlNodeCollection != null && htmlNodeCollection.Count > 0) {
+				HtmlNode htmlNode = htmlNodeCollection[htmlNodeCollection.Count - 1];
+				if (!byte.TryParse(htmlNode.InnerText, out maxPages)) {
+					maxPages = 1; // Should never happen
+				}
+			}
+
+			GamesToFarm.Clear();
+
+			// Find APPIDs we need to farm
+			Logging.LogGenericInfo(Bot.BotName, "Checking other pages...");
+
+			List<Task> checkPagesTasks = new List<Task>();
+			for (byte page = 1; page <= maxPages; page++) {
+				if (page == 1) {
+					CheckPage(htmlDocument); // Because we fetched page number 1 already
+				} else {
+					checkPagesTasks.Add(Task.Run(async () => await CheckPage(page).ConfigureAwait(false)));
+				}
+			}
+			await Task.WhenAll(checkPagesTasks).ConfigureAwait(false);
+
+			if (GamesToFarm.Count == 0) {
+				Logging.LogGenericInfo(Bot.BotName, "No games to farm!");
+				return false;
+			}
+
+			// If we have restricted card drops, actually do check hours of all games that are left to farm
+			if (Bot.CardDropsRestricted) {
+				List<Task> checkHoursTasks = new List<Task>();
+				Logging.LogGenericInfo(Bot.BotName, "Checking hours...");
+				foreach (uint appID in GamesToFarm.Keys) {
+					checkHoursTasks.Add(Task.Run(async () => await CheckHours(appID).ConfigureAwait(false)));
+				}
+				await Task.WhenAll(checkHoursTasks).ConfigureAwait(false);
+			}
+
+			return true;
+		}
+
+		private void CheckPage(HtmlDocument htmlDocument) {
+			if (htmlDocument == null) {
+				return;
+			}
+
+			HtmlNodeCollection htmlNodeCollection = htmlDocument.DocumentNode.SelectNodes("//a[@class='btn_green_white_innerfade btn_small_thin']");
+			if (htmlNodeCollection == null) {
+				return;
+			}
+
+			foreach (HtmlNode htmlNode in htmlNodeCollection) {
+				string steamLink = htmlNode.GetAttributeValue("href", null);
+				if (steamLink == null) {
+					continue;
+				}
+
+				uint appID = (uint) Utilities.OnlyNumbers(steamLink);
+				if (appID == 0) {
+					continue;
+				}
+
+				if (Bot.GlobalBlacklist.Contains(appID) || Bot.Blacklist.Contains(appID)) {
+					continue;
+				}
+
+				// We assume that every game has at least 2 hours played, until we actually check them
+				GamesToFarm[appID] = 2;
+			}
+		}
+
+		private async Task CheckPage(byte page) {
+			if (page == 0) {
+				return;
+			}
+
+			HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(page).ConfigureAwait(false);
+			if (htmlDocument == null) {
+				return;
+			}
+
+			CheckPage(htmlDocument);
+		}
+
+		private async Task CheckHours(uint appID) {
+			if (appID == 0) {
+				return;
+			}
+
+			HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetGameCardsPage(appID).ConfigureAwait(false);
+			if (htmlDocument == null) {
+				Logging.LogNullError(Bot.BotName, "htmlDocument");
+				return;
+			}
+
+			HtmlNode htmlNode = htmlDocument.DocumentNode.SelectSingleNode("//div[@class='badge_title_stats_playtime']");
+			if (htmlNode == null) {
+				Logging.LogNullError(Bot.BotName, "htmlNode");
+				return;
+			}
+
+			string hoursString = htmlNode.InnerText;
+			if (string.IsNullOrEmpty(hoursString)) {
+				Logging.LogNullError(Bot.BotName, "hoursString");
+				return;
+			}
+
+			hoursString = Regex.Match(hoursString, @"[0-9\.,]+").Value;
+			double hours;
+
+			if (string.IsNullOrEmpty(hoursString)) {
+				hours = 0;
+			} else {
+				hours = double.Parse(hoursString, CultureInfo.InvariantCulture);
+			}
+
+			GamesToFarm[appID] = hours;
+		}
+
 		private async Task CheckGamesForFarming() {
 			if (NowFarming || GamesToFarm.Count > 0 || !Bot.SteamClient.IsConnected) {
 				return;


Restore code accidentally removed in 0b27c7f

--- R7.News/ViewModels/NewsEntryViewModelBase.cs
+++ R7.News/ViewModels/NewsEntryViewModelBase.cs
@@ -22,6 +22,7 @@
 using System;
 using System.Collections.Generic;
 using System.Web;
+using DotNetNuke.Common;
 using DotNetNuke.Entities.Content;
 using DotNetNuke.Entities.Modules;
 using DotNetNuke.Entities.Portals;
@@ -154,6 +155,10 @@
         public string Link
         {
             get {
+                if (!string.IsNullOrWhiteSpace (Url)) {
+                    return Globals.LinkClick (Url, Context.Module.TabId, Context.Module.ModuleId);
+                }
+
                 return this.GetPermalink (PermalinkMode.Friendly,
                                           NewsDataProvider.Instance.ModuleController,
                                           PortalSettings.Current.PortalAlias,


adding DisplayPanel()

adding DisplayPanel()

--- Assets/PanelDisplayControl.cs
+++ Assets/PanelDisplayControl.cs
@@ -19,9 +19,29 @@
 		return selected.isOn;
 	}

+	void DisplayPanel(int idx_st1, bool doShow)
+	{
+		GameObject panel = GameObject.Find ("Panel" + idx_st1.ToString ());
+		if (panel == null) {
+			return;
+		}
+
+		RectTransform rect = panel.GetComponent (typeof(RectTransform)) as RectTransform;
+		Vector2 size = rect.sizeDelta;
+		if (doShow) {
+			// TODO: how to get original size (x,y)
+			size.x = 50;
+			size.y = 50;
+		} else {
+			size.x = 1;
+			size.y = 1;
+		}
+		rect.sizeDelta = size;
+	}
+
 	public void ToggleValueChanged(int idx_st1) {
 		bool isOn = getIsOn (idx_st1);
-
+		DisplayPanel (idx_st1, isOn);
 		Debug.Log (isOn.ToString ());
 	}


Implemented persistent card actions

Implemented persistent card actions

--- Assets/Scripts/Game/Player.cs
+++ Assets/Scripts/Game/Player.cs
@@ -34,16 +34,20 @@
         {
             ActionsAvailable = 0;
             //TODO: Player => InPlay AfterTurnAction happens here
+            _InPlay.Cards.ForEach(card => (card as PersistentCard).OnInPlayAfterTurnAction());
             _OppositePlayer.InitTurn();
         }
     }

     public void InitTurn()
     {
-        //Opposite player => InPlay BeforeTurnAction happens here
+        //player => InPlay BeforeTurnAction happens here
+        _InPlay.Cards.ForEach(card => (card as PersistentCard).OnInPlayBeforeTurnAction());
         _Deck.DrawCard();
         ActionsAvailable += 2;
+
         //creatures do damage here
+        _InPlay.GetCreaturesInPlay().ForEach(card => _OppositePlayer.TakeDamage((card as GenericCreature).DamagePerTurn));
     }

     public bool CanUseAction()


Fixed a bug in layering logic

Fixed a bug in layering logic

--- Assets/src/ui/ClothingArea.cs
+++ Assets/src/ui/ClothingArea.cs
@@ -48,12 +48,10 @@

 		// Move through the list and see where it fits
 		foreach (ClothingSlot current in slots) {
-			if (!current.Equals(slot)) {
-				if (slot.Layer < current.Layer) {
-					slot.image.transform.SetSiblingIndex(current.image.transform.GetSiblingIndex());
-					placed = true;
-					break;
-				}
+			if (slot.Layer <= current.Layer) {
+				slot.image.transform.SetSiblingIndex(current.image.transform.GetSiblingIndex());
+				placed = true;
+				break;
 			}
 		}


Call InitLoggers from application start and return all errors to client

--- AzureFunctions/Global.asax.cs
+++ AzureFunctions/Global.asax.cs
@@ -29,9 +29,11 @@
             var container = InitAutofacContainer();

             var config = GlobalConfiguration.Configuration;
+            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
             config.DependencyResolver = new AutofacWebApiDependencyResolver(container);

             GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
+            InitLogging(container);
             RegisterRoutes(config);
         }


Remove more references

Remove more references

--- Reverb/Reverb.Data/UnitOfWork/SaveContext.cs
+++ Reverb/Reverb.Data/UnitOfWork/SaveContext.cs
@@ -1,5 +1,4 @@
-using Bytes2you.Validation;
-using Reverb.Data.Contracts;
+using Reverb.Data.Contracts;

 namespace Reverb.Data.SaveChanges
 {
@@ -9,7 +8,7 @@

         public SaveContext(IReverbDbContext context)
         {
-            Guard.WhenArgument(context, "context").IsNull().Throw();
+            //Guard.WhenArgument(context, "context").IsNull().Throw();

             this.context = context;
         }


Added first weapon to equipment tab

Added first weapon to equipment tab

--- SOE_SRAM_Editor/Forms/MainWindow.Designer.cs
+++ SOE_SRAM_Editor/Forms/MainWindow.Designer.cs
@@ -52,8 +52,10 @@
             this.DogNameTextBox = new System.Windows.Forms.TextBox();
             this.BoyNameLabel = new System.Windows.Forms.Label();
             this.DogNameLabel = new System.Windows.Forms.Label();
+            this.BoneCheckBox = new System.Windows.Forms.CheckBox();
             this.SaveTab.SuspendLayout();
             this.StatsTab.SuspendLayout();
+            this.EquipmentTab.SuspendLayout();
             this.MenuStrip.SuspendLayout();
             this.SuspendLayout();
             //
@@ -67,7 +69,7 @@
             this.SaveTab.Location = new System.Drawing.Point(12, 27);
             this.SaveTab.Name = "SaveTab";
             this.SaveTab.SelectedIndex = 0;
-            this.SaveTab.Size = new System.Drawing.Size(592, 325);
+            this.SaveTab.Size = new System.Drawing.Size(592, 331);
             this.SaveTab.TabIndex = 0;
             //
             // StatsTab
@@ -79,17 +81,18 @@
             this.StatsTab.Location = new System.Drawing.Point(4, 22);
             this.StatsTab.Name = "StatsTab";
             this.StatsTab.Padding = new System.Windows.Forms.Padding(3);
-            this.StatsTab.Size = new System.Drawing.Size(584, 299);
+            this.StatsTab.Size = new System.Drawing.Size(584, 305);
             this.StatsTab.TabIndex = 0;
             this.StatsTab.Text = "Stats";
             this.StatsTab.UseVisualStyleBackColor = true;
             //
             // EquipmentTab
             //
+            this.EquipmentTab.Controls.Add(this.BoneCheckBox);
             this.EquipmentTab.Location = new System.Drawing.Point(4, 22);
             this.EquipmentTab.Name = "EquipmentTab";
             this.EquipmentTab.Padding = new System.Windows.Forms.Padding(3);
-            this.EquipmentTab.Size = new System.Drawing.Size(584, 299);
+            this.EquipmentTab.Size = new System.Drawing.Size(584, 305);
             this.EquipmentTab.TabIndex = 1;
             this.EquipmentTab.Text = "Equipment";
             this.EquipmentTab.UseVisualStyleBackColor = true;
@@ -98,7 +101,7 @@
             //
             this.AlchemyTab.Location = new System.Drawing.Point(4, 22);
             this.AlchemyTab.Name = "AlchemyTab";
-            this.AlchemyTab.Size = new System.Drawing.Size(584, 299);
+            this.AlchemyTab.Size = new System.Drawing.Size(584, 305);
             this.AlchemyTab.TabIndex = 2;
             this.AlchemyTab.Text = "Alchemy";
             this.AlchemyTab.UseVisualStyleBackColor = true;
@@ -107,7 +110,7 @@
             //
             this.InventoryTab.Location = new System.Drawing.Point(4, 22);
             this.InventoryTab.Name = "InventoryTab";
-            this.InventoryTab.Size = new System.Drawing.Size(584, 299);
+            this.InventoryTab.Size = new System.Drawing.Size(584, 305);
             this.InventoryTab.TabIndex = 3;
             this.InventoryTab.Text = "Inventory";
             this.InventoryTab.UseVisualStyleBackColor = true;
@@ -116,7 +119,7 @@
             //
             this.Pouch.Location = new System.Drawing.Point(4, 22);
             this.Pouch.Name = "Pouch";
-            this.Pouch.Size = new System.Drawing.Size(584, 299);
+            this.Pouch.Size = new System.Drawing.Size(584, 305);
             this.Pouch.TabIndex = 4;
             this.Pouch.Text = "Trading Items";
             this.Pouch.UseVisualStyleBackColor = true;
@@ -256,11 +259,21 @@
             this.DogNameLabel.TabIndex = 3;
             this.DogNameLabel.Text = "Dog Name";
             //
+            // BoneCheckBox
+            //
+            this.BoneCheckBox.AutoSize = true;
+            this.BoneCheckBox.Location = new System.Drawing.Point(3, 6);
+            this.BoneCheckBox.Name = "BoneCheckBox";
+            this.BoneCheckBox.Size = new System.Drawing.Size(51, 17);
+            this.BoneCheckBox.TabIndex = 0;
+            this.BoneCheckBox.Text = "Bone";
+            this.BoneCheckBox.UseVisualStyleBackColor = true;
+            //
             // MainWindow
             //
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(616, 364);
+            this.ClientSize = new System.Drawing.Size(616, 370);
             this.Controls.Add(this.SaveTab);
             this.Controls.Add(this.MenuStrip);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -270,6 +283,8 @@
             this.SaveTab.ResumeLayout(false);
             this.StatsTab.ResumeLayout(false);
             this.StatsTab.PerformLayout();
+            this.EquipmentTab.ResumeLayout(false);
+            this.EquipmentTab.PerformLayout();
             this.MenuStrip.ResumeLayout(false);
             this.MenuStrip.PerformLayout();
             this.ResumeLayout(false);
@@ -302,6 +317,7 @@
         private System.Windows.Forms.Label BoyNameLabel;
         private System.Windows.Forms.TextBox DogNameTextBox;
         private System.Windows.Forms.TextBox BoyNameTextBox;
+        private System.Windows.Forms.CheckBox BoneCheckBox;
     }
 }


recover constants

recover constants


release 1.45 close #174 close #175

release 1.45 close #174 close #175

--- SRNicoNico/ViewModels/MainWindowViewModel.cs
+++ SRNicoNico/ViewModels/MainWindowViewModel.cs
@@ -14,7 +14,7 @@
         //現在のバージョン
         public double CurrentVersion {

-            get { return 1.44; }
+            get { return 1.45; }
         }

         #region Title変更通知プロパティ


Fixed folder name bug

Fixed folder name bug

--- ScanMonitorApp/ScanMonitorApp/ScanDocInfo.cs
+++ ScanMonitorApp/ScanMonitorApp/ScanDocInfo.cs
@@ -81,7 +81,7 @@
             // Get a subfolder name to use for processing the images from the file
             // Assuming the uniq name is the date in YYYYMMDD format the subfolder will be YYYYMM
             string subFolderName = uniqName;
-            subFolderName.Replace("_", "");
+            subFolderName = subFolderName.Replace("_", "");
             subFolderName = subFolderName.Substring(0, 6);
             string imgFolder = Path.Combine(baseFolderForImages, subFolderName).Replace('\\', '/');


Added reference to ApplicationUser

Added reference to ApplicationUser

--- CmsEngine.Ui/Areas/Cms/Views/_ViewImports.cshtml
+++ CmsEngine.Ui/Areas/Cms/Views/_ViewImports.cshtml
@@ -1,5 +1,6 @@
 @using Microsoft.AspNetCore.Identity
 @using CmsEngine
+@using CmsEngine.Data.Models
 @using CmsEngine.Data.ViewModels
 @using CmsEngine.Data.ViewModels.AccountViewModels
 @using CmsEngine.Data.ViewModels.ManageViewModels


Reorder constructors so if a ctor calls another ctor, the called ctor is below (basically more generic should be below more specific).

--- ClosedXML/Excel/XLWorkbook.cs
+++ ClosedXML/Excel/XLWorkbook.cs
@@ -665,6 +665,60 @@
             : this(XLEventTracking.Enabled)
         {
             LoadSheetsFromTemplate(file);
+        }
+
+        /// <summary>
+        ///   Opens an existing workbook from a file.
+        /// </summary>
+        /// <param name = "file">The file to open.</param>
+        public XLWorkbook(String file)
+            : this(file, XLEventTracking.Enabled)
+        {
+        }
+
+        public XLWorkbook(String file, LoadOptions loadOptions)
+            : this(file, loadOptions.EventTracking)
+        {
+            if (loadOptions.RecalculateAllFormulas)
+                this.RecalculateAllFormulas();
+        }
+
+        public XLWorkbook(String file, XLEventTracking eventTracking)
+            : this(eventTracking)
+        {
+            _loadSource = XLLoadSource.File;
+            _originalFile = file;
+            _spreadsheetDocumentType = GetSpreadsheetDocumentType(_originalFile);
+            Load(file);
+        }
+
+        /// <summary>
+        ///   Opens an existing workbook from a stream.
+        /// </summary>
+        /// <param name = "stream">The stream to open.</param>
+        public XLWorkbook(Stream stream)
+            : this(stream, XLEventTracking.Enabled)
+        {
+        }
+
+        public XLWorkbook(Stream stream, LoadOptions loadOptions)
+            : this(stream, loadOptions.EventTracking)
+        {
+            if (loadOptions.RecalculateAllFormulas)
+                this.RecalculateAllFormulas();
+        }
+
+        public XLWorkbook(Stream stream, XLEventTracking eventTracking)
+            : this(eventTracking)
+        {
+            _loadSource = XLLoadSource.Stream;
+            _originalStream = stream;
+            Load(stream);
+        }
+
+        public XLWorkbook(LoadOptions loadOptions)
+            : this(loadOptions.EventTracking)
+        {
         }

         public XLWorkbook(XLEventTracking eventTracking)
@@ -697,60 +751,6 @@
             Author = Environment.UserName;
         }

-        public XLWorkbook(LoadOptions loadOptions)
-            : this(loadOptions.EventTracking)
-        {
-        }
-
-        /// <summary>
-        ///   Opens an existing workbook from a file.
-        /// </summary>
-        /// <param name = "file">The file to open.</param>
-        public XLWorkbook(String file)
-            : this(file, XLEventTracking.Enabled)
-        {
-        }
-
-        public XLWorkbook(String file, XLEventTracking eventTracking)
-            : this(eventTracking)
-        {
-            _loadSource = XLLoadSource.File;
-            _originalFile = file;
-            _spreadsheetDocumentType = GetSpreadsheetDocumentType(_originalFile);
-            Load(file);
-        }
-
-        public XLWorkbook(String file, LoadOptions loadOptions)
-            : this(file, loadOptions.EventTracking)
-        {
-            if (loadOptions.RecalculateAllFormulas)
-                this.RecalculateAllFormulas();
-        }
-
-        /// <summary>
-        ///   Opens an existing workbook from a stream.
-        /// </summary>
-        /// <param name = "stream">The stream to open.</param>
-        public XLWorkbook(Stream stream)
-            : this(stream, XLEventTracking.Enabled)
-        {
-        }
-
-        public XLWorkbook(Stream stream, XLEventTracking eventTracking)
-            : this(eventTracking)
-        {
-            _loadSource = XLLoadSource.Stream;
-            _originalStream = stream;
-            Load(stream);
-        }
-
-        public XLWorkbook(Stream stream, LoadOptions loadOptions)
-            : this(stream, loadOptions.EventTracking)
-        {
-            if (loadOptions.RecalculateAllFormulas)
-                this.RecalculateAllFormulas();
-        }
-
         #endregion Constructor

         #region Nested type: UnsupportedSheet


[changes] + Small tweak to minimap MCM scribing to not save unneeded/game level informaion

--- DLL_Project/ModConfigurationMenus/MCM_MiniMap.cs
+++ DLL_Project/ModConfigurationMenus/MCM_MiniMap.cs
@@ -147,21 +147,21 @@
                     #region Handle all MiniMap Overlays
                     foreach( var overlay in minimap.overlayWorkers )
                     {
-                        #region Overlay Header
-                        Scribe.EnterNode( overlay.overlayDef.defName );
-                        #endregion
-
-                        #region Handle Overlay IConfigurable
                         var iOverlay = overlay as IConfigurable;
                         if( iOverlay != null )
                         {
+                            #region Overlay Header
+                            Scribe.EnterNode( overlay.overlayDef.defName );
+                            #endregion
+
+                            #region Handle Overlay IConfigurable
                             iOverlay.ExposeData();
+                            #endregion
+
+                            #region Finalize Overlay
+                            Scribe.ExitNode();
+                            #endregion
                         }
-                        #endregion
-
-                        #region Finalize Overlay
-                        Scribe.ExitNode();
-                        #endregion
                     }
                     #endregion


TSI-950 Improved error handling in CdApiLocalizationResolver.

--- Sdl.Web.Tridion/CdApiLocalizationResolver.cs
+++ Sdl.Web.Tridion/CdApiLocalizationResolver.cs
@@ -39,17 +39,18 @@
         {
             using (new Tracer(url))
             {
-                IPublicationMapping mapping;
+                IPublicationMapping mapping = null;
                 try
                 {
                     // NOTE: we're not using UrlToLocalizationMapping here, because we may match too eagerly on a base URL when there is a matching mapping with a more specific URL.
                     mapping = _mappingsRetriever.GetPublicationMapping(url.ToString());
                 }
-                catch (Exception)
+                catch (Exception ex)
                 {
-                    throw new DxaUnknownLocalizationException(string.Format("No matching Localization found for URL '{0}'", url));
+                    Log.Warn("Exception occurred in DynamicMappingsRetriever.GetPublicationMapping: {0}", ex.ToString());
+                    // Let mapping be null, we'll handle it below.
                 }
-                if (mapping == null)
+                if (mapping == null || mapping.Port != url.Port.ToString()) // See CRQ-1195
                 {
                     throw new DxaUnknownLocalizationException(string.Format("No matching Localization found for URL '{0}'", url));
                 }


- v3.2.12

- v3.2.12

--- Shuttle.Core.Data/Properties/AssemblyInfo.cs
+++ Shuttle.Core.Data/Properties/AssemblyInfo.cs
@@ -25,10 +25,10 @@
 [assembly: AssemblyTitle("Shuttle.Core.Data for .NET Framework 4.6.1")]
 #endif

-[assembly: AssemblyVersion("3.2.11.0")]
+[assembly: AssemblyVersion("3.2.12.0")]
 [assembly: AssemblyCopyright("Copyright © Eben Roux 2016")]
 [assembly: AssemblyProduct("Shuttle.Core")]
 [assembly: AssemblyCompany("Shuttle")]
 [assembly: AssemblyConfiguration("Release")]
-[assembly: AssemblyInformationalVersion("3.2.11")]
+[assembly: AssemblyInformationalVersion("3.2.12")]
 [assembly: ComVisible(false)]


emitHandlerBinding for oot template

emitHandlerBinding for oot template

--- src/Instantiator.cs
+++ src/Instantiator.cs
@@ -750,10 +750,19 @@
 		}

 		void emitHandlerBinding (Context ctx, EventInfo sourceEvent, string expression){
-			string[] bindingExp = expression.Split ('/');
-
-			if (bindingExp.Length == 1) {
-				//datasource handler
+			string memberName, namedNode;
+			NodeAddress currentNode = ctx.CurrentNodeAddress, targetNA;
+
+			splitBindingExp (currentNode, expression, out targetNA, out memberName, out namedNode);
+
+			string bindOnEventName = null;
+
+			if (targetNA == null)//datasource handler
+				bindOnEventName = "DataSourceChanged";
+			else if (targetNA.Count == 0)//out of tree template handler
+				bindOnEventName = "ParentChanged";
+
+			if (!string.IsNullOrEmpty(bindOnEventName)){
 				//we need to bind datasource method to source event
 				DynamicMethod dm = new DynamicMethod ("dyn_dschangedForHandler",
 					typeof (void),
@@ -768,7 +777,7 @@
 				//fetch method in datasource and test if it exist
 				il.Emit (OpCodes.Ldarg_2);//load new datasource
 				il.Emit (OpCodes.Ldfld, CompilerServices.fiDSCNewDS);
-				il.Emit (OpCodes.Ldstr, bindingExp[0]);//load handler method name
+				il.Emit (OpCodes.Ldstr, memberName);//load handler method name
 				il.Emit (OpCodes.Call, typeof(CompilerServices).GetMethod("getMethodInfoWithReflexion", BindingFlags.Static | BindingFlags.Public));
 				il.Emit (OpCodes.Stloc_0);//save MethodInfo
 				il.Emit (OpCodes.Ldloc_0);//push mi for test if null
@@ -795,8 +804,7 @@
 				int delDSIndex = cachedDelegates.Count;
 				cachedDelegates.Add(dm.CreateDelegate (CompilerServices.ehTypeDSChange, this));

-				ctx.emitCachedDelegateHandlerAddition(delDSIndex, typeof(GraphicObject).GetEvent("DataSourceChanged"));
-				return;
+				ctx.emitCachedDelegateHandlerAddition(delDSIndex, typeof(GraphicObject).GetEvent(bindOnEventName));
 			}
 		}


Fixed loading of loadbalancer

Fixed loading of loadbalancer

--- ConDep.Dsl/IoCBootstrapper.cs
+++ ConDep.Dsl/IoCBootstrapper.cs
@@ -24,15 +24,8 @@
             var container = TinyIoCContainer.Current;

             container.Register(_envConfig);
-            if(_envConfig.LoadBalancer != null)
-            {
-                container.Register(new LoadBalancerLookup(_envConfig.LoadBalancer).GetLoadBalancer());
-                container.Register(_envConfig.LoadBalancer);
-            }
-            else
-            {
-                container.Register<ILoadBalance, DefaultLoadBalancer>();
-            }
+            container.Register(_envConfig.LoadBalancer);
+            container.Register(new LoadBalancerLookup(_envConfig.LoadBalancer).GetLoadBalancer());
             //container.Register<ISetupWebDeploy, WebDeploySetup>().AsMultiInstance();
             //container.Register<ISetupConDep, ConDepSetup>().AsMultiInstance();


Fix crash on null Feature value

Fix crash on null Feature value

Fix #137

--- Confuser.CLI/ObfAttrParser.cs
+++ Confuser.CLI/ObfAttrParser.cs
@@ -65,6 +65,9 @@
 		}

 		public void ParseProtectionString(ProtectionSettings settings, string str) {
+			if (str == null)
+				return;
+
 			this.str = str;
 			this.index = 0;

@@ -201,6 +204,12 @@
 		}

 		public void ParsePackerString(string str, out Packer packer, out Dictionary<string, string> packerParams) {
+			packer = null;
+			packerParams = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+
+			if (str == null)
+				return;
+
 			this.str = str;
 			this.index = 0;

@@ -208,9 +217,6 @@
 			var buffer = new StringBuilder();
 			var ret = new ProtectionSettings();

-			packer = null;
-			packerParams = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
-
 			while (state != ParseState.End) {
 				switch (state) {
 					case ParseState.ReadItemName:


Enable journal monitor

Enable journal monitor

--- EDDiscovery/EliteDangerous/EDJournalClass.cs
+++ EDDiscovery/EliteDangerous/EDJournalClass.cs
@@ -248,7 +248,7 @@

         public void StartMonitor()
         {
-            return;
+            //return;

             // BUGS in scanning.. basically the reader does not know the commander ID if it has just reopened the file.


Fix a bug where RequiredFieldChecker skipped fields of a value type if those were not marked with the RequiredAttribute.

--- Eco/SettingsVisitors/RequiredFieldChecker.cs
+++ Eco/SettingsVisitors/RequiredFieldChecker.cs
@@ -19,7 +19,7 @@

         public  override void Visit(string settingsNamesapce, string fieldPath, FieldInfo refinedSettingsField, object refinedSettings, FieldInfo rawSettingsField, object rawSettings)
         {
-            if (!refinedSettingsField.IsDefined<RequiredAttribute>()) return;
+            if (!rawSettingsField.IsDefined<RequiredAttribute>()) return;

             bool fieldInitialized =
                 rawSettingsField != null && rawSettingsField.GetValue(rawSettings) != null ||


Files last attempt 70/100 - in need of other solution.

--- ExamPreparation/Exam1June2016/Files/Files.cs
+++ ExamPreparation/Exam1June2016/Files/Files.cs
@@ -38,19 +38,29 @@
         {
             bool flag = true;
             List<string> printed = new List<string>();
+            string extension = command[0];
             List<RunnableFile> filesList = rootFiles[command[2]];
-            string extension = command[0];
-            foreach (var file in filesList
-                .OrderByDescending(f => f.Size)
-                .ThenBy(f => f.Name)
+            Dictionary<string, long> uniqueList = new Dictionary<string, long>();
+            for (int i = 0; i < filesList.Count; i++)
+            {
+                if (filesList[i].Extension.Equals(extension))
+                {
+                    if (!uniqueList.ContainsKey(filesList[i].Name))
+                    {
+                        uniqueList.Add(filesList[i].Name, 0);
+                    }
+                    uniqueList[filesList[i].Name] = filesList[i].Size;
+                }
+
+            }
+
+            foreach (var file in uniqueList
+                .OrderByDescending(f => f.Value)
+                .ThenBy(f => f.Key)
                 .Distinct())
             {
-                if (file.Extension.Equals(extension) && !printed.Contains(file.Name))
-                {
-                    Console.WriteLine($"{file.Name}.{file.Extension} - {file.Size} KB");
-                    printed.Add(file.Name);
-                    flag = false;
-                }
+                Console.WriteLine($"{file.Key}.{extension} - {file.Value} KB");
+                flag = false;
             }
             if (flag)
             {


Change View to feed in XmlDataExtractorFactory

--- ExpenditureAppWPFView/ExpenditureApp.xaml.cs
+++ ExpenditureAppWPFView/ExpenditureApp.xaml.cs
@@ -30,7 +30,7 @@
             InitializeComponent();
             Action<string, string> messageForUser = ((message, caption) => System.Windows.MessageBox.Show(message, caption));
             Func<string, string, bool> decisionForUser = (message, caption) => System.Windows.MessageBox.Show(message, caption, MessageBoxButton.YesNo) == MessageBoxResult.Yes;
-            viewModel = new ExpenditureAppViewModel.ViewModel(messageForUser, decisionForUser, new RecordExpenditureDataFactory());
+            viewModel = new ExpenditureAppViewModel.ViewModel(messageForUser, decisionForUser, new ExpenditureDataRecorderFactory(), new ExpenditureDataProviderFactory());
             DataContext = viewModel;

             AssociatedTagsListView.SelectionChanged += (s,e) => OnAssociatedTagsListViewSelectionChanged(s,e);


fixed #14

fixed #14

--- ExplorerWindowCleaner/NotifyIconContainer.cs
+++ ExplorerWindowCleaner/NotifyIconContainer.cs
@@ -50,7 +50,7 @@
                     {
                         notifyIcon.ShowBalloonTip(3000,
                             string.Format("{0} Windows Closed.", args.CloseInfos.Count),
-                            string.Format("{0}", string.Join("\n", args.CloseInfos)), ToolTipIcon.Info);
+                            string.Format("{0}", string.Join("\n", args.CloseInfos.Select(x => string.Format("{0} [{1}]", x.WindowTitle, x.CloseReason.ToString())))), ToolTipIcon.Info);
                     }
                     _mainWindow.NowWindowCount = args.WindowCount;
                     _mainWindow.MaxWindowCount = args.MaxWindowCount;


Oxide: Add TryUnwrap to Option.

Oxide: Add TryUnwrap to Option.

--- src/Oxide/Option.cs
+++ src/Oxide/Option.cs
@@ -63,6 +63,12 @@
             => IsSome ? value : throw new Exception(msg);
         public T Unwrap()
             => IsSome ? value : throw new Exception(UnwrapMessage);
+
+        public bool TryUnwrap(out T value) {
+            value = this.value;
+            return IsSome;
+        }
+
         public T UnwrapOr(T def = default(T))
             => IsSome ? value : def;
         public T UnwrapOr(Func<T> provider)


Added handling for NotImplementedException

--- Framework/Cqrs/Configuration/BusRegistrar.cs
+++ Framework/Cqrs/Configuration/BusRegistrar.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Reflection;
 using System.Security;
+using cdmdotnet.Logging;
 using Cqrs.Bus;
 using Cqrs.Commands;
 using Cqrs.Events;
@@ -105,7 +106,15 @@
 			var del = new Action<dynamic>(x =>
 				{
 					dynamic handler = DependencyResolver.Resolve(executorType);
-					handler.Handle(x);
+					try
+					{
+						handler.Handle(x);
+					}
+					catch (NotImplementedException exception)
+					{
+						var logger = DependencyResolver.Resolve<ILogger>();
+						logger.LogInfo(string.Format("An event message arrived of the type '{0}' went to a handler of type '{1}' but was not implemented.", x.GetType().FullName, handler.GetType().FullName), exception: exception);
+					}
 				}
 			);


Fix credential handler

Fix credential handler

--- GitMind/RepositoryViews/CredentialHandler.cs
+++ GitMind/RepositoryViews/CredentialHandler.cs
@@ -90,7 +90,7 @@
 			{
 				dialog.Confirm(true);
 			}
-			else
+			else if (dialog.SaveChecked)
 			{
 				try
 				{
@@ -98,7 +98,7 @@
 				}
 				catch (ApplicationException e)
 				{
-					Log.Warn($"Error {e}");
+					Log.Warn($"Error {e.Message}");
 				}
 			}
 		}


~ GetDbModelGraph refactoring

~ GetDbModelGraph refactoring

--- GraphXTests/GraphXSampleDbLib/GraphDbInfo.cs
+++ GraphXTests/GraphXSampleDbLib/GraphDbInfo.cs
@@ -34,8 +34,9 @@

             foreach (var vertice in dbGraph.Vertices)
             {
-                var tableFKs = dbInfo.ReadTableFks(vertice.TableName);
-                dbGraph.AddEdgeRange(tableFKs.Select(fk => new DbDataEdge(vertice, vertices[fk])));
+                var tableFkEdgess = dbInfo.ReadTableFks(vertice.TableName)
+                                        .Select(fk => new DbDataEdge(vertice, vertices[fk]));
+                dbGraph.AddEdgeRange(tableFkEdgess);
             }

             return dbGraph;


git-svn-id: https://jumony.svn.codeplex.com/svn/trunk@66451 2327b42d-5241-43d6-9e2a-de5ac946f064

--- Ivony.Html/Selectors/CssCascadingSelector.cs
+++ Ivony.Html/Selectors/CssCascadingSelector.cs
@@ -26,6 +26,40 @@
     /// 创建选择器
     /// </summary>
     /// <param name="expression">选择器表达式</param>
+    /// <returns></returns>
+    public static ICssSelector Create( string expression )
+    {
+      var match = cssSelectorRegex.Match( expression );
+      if ( !match.Success )
+        throw new FormatException();
+
+
+      ICssSelector selector = CssElementSelector.Create( match.Groups["elementSelector"].Value );
+
+      foreach ( var extraExpression in match.Groups["extra"].Captures.Cast<Capture>().Select( c => c.Value ) )
+      {
+        var extraMatch = extraRegex.Match( extraExpression );
+
+        if ( !extraMatch.Success )
+          throw new FormatException();
+
+        var relative = extraMatch.Groups["relative"].Value.Trim();
+        var elementSelector = extraMatch.Groups["elementSelector"].Value.Trim();
+
+        var newPartSelector = new CssCasecadingSelector( CssElementSelector.Create( elementSelector ), relative, selector );
+        selector = newPartSelector;
+
+      }
+
+
+      return selector;
+    }
+
+
+    /// <summary>
+    /// 创建选择器
+    /// </summary>
+    /// <param name="expression">选择器表达式</param>
     /// <param name="scope">范畴限定，上溯时不超出此范畴</param>
     /// <returns></returns>
     public static ICssSelector Create( string expression, IHtmlContainer scope )
@@ -41,43 +75,6 @@

-    /// <summary>
-    /// 创建选择器
-    /// </summary>
-    /// <param name="expression">选择器表达式</param>
-    /// <returns></returns>
-    public static ICssSelector Create( string expression )
-    {
-      var match = cssSelectorRegex.Match( expression );
-      if ( !match.Success )
-        throw new FormatException();
-
-
-      ICssSelector selector;
-
-
-
-      selector = CssElementSelector.Create( match.Groups["elementSelector"].Value );
-
-      foreach ( var extraExpression in match.Groups["extra"].Captures.Cast<Capture>().Select( c => c.Value ) )
-      {
-        var extraMatch = extraRegex.Match( extraExpression );
-
-        if ( !extraMatch.Success )
-          throw new FormatException();
-
-        var relative = extraMatch.Groups["relative"].Value.Trim();
-        var elementSelector = extraMatch.Groups["elementSelector"].Value.Trim();
-
-        var newPartSelector = new CssCasecadingSelector( CssElementSelector.Create( elementSelector ), relative, selector );
-        selector = newPartSelector;
-
-      }
-
-
-      return selector;
-
-    }

@@ -92,7 +89,7 @@

     private readonly ICssSelector _right;
     /// <summary>
-    /// 元素选择器
+    /// 子级选择器
     /// </summary>
     public ICssSelector RightSelector
     {


GSF.IO: Corrected MultipleDestinationExporter to handle "zero" export destinations.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/gsf/Main;C88689

--- Source/Libraries/GSF.Core/IO/MultipleDestinationExporter.cs
+++ Source/Libraries/GSF.Core/IO/MultipleDestinationExporter.cs
@@ -966,7 +966,7 @@
                 // Dereference file bytes to be exported
                 byte[] fileData = state as byte[];

-                if (m_enabled && (object)fileData != null)
+                if (m_enabled && (object)fileData != null && m_exportDestinations.Count > 0)
                 {
                     string filename = null;
                     ExportState[] exportStates = null;


Fix ranged attack glitch due to related bug fix for animation frame timings

--- EndlessClient/Rendering/Character/CharacterAnimator.cs
+++ EndlessClient/Rendering/Character/CharacterAnimator.cs
@@ -58,7 +58,9 @@
             if (_otherPlayerStartAttackingTimes.Any(HasActionForMainCharacter))
                 return;

-            var startAttackingTime = new RenderFrameActionTime(_characterRepository.MainCharacter.ID, GetStartingAnimationTime(ATTACK_FRAME_TIME_MS));
+            var isRangedWeapon = GetCurrentCharacterFromRepository(new RenderFrameActionTime(_characterRepository.MainCharacter.ID, Optional<DateTime>.Empty))
+                .RenderProperties.IsRangedWeapon;
+            var startAttackingTime = new RenderFrameActionTime(_characterRepository.MainCharacter.ID, GetStartingAnimationTime(ATTACK_FRAME_TIME_MS, isRangedWeapon));
             _otherPlayerStartAttackingTimes.Add(startAttackingTime);
         }

@@ -90,7 +92,9 @@
                 _otherPlayerStartAttackingTimes.Remove(existingStartTime);
             }

-            var startAttackingTimeAndID = new RenderFrameActionTime(characterID, GetStartingAnimationTime(ATTACK_FRAME_TIME_MS));
+            var isRangedWeapon = GetCurrentCharacterFromRepository(new RenderFrameActionTime(characterID, Optional<DateTime>.Empty))
+                .RenderProperties.IsRangedWeapon;
+            var startAttackingTimeAndID = new RenderFrameActionTime(characterID, GetStartingAnimationTime(ATTACK_FRAME_TIME_MS, isRangedWeapon));
             _otherPlayerStartAttackingTimes.Add(startAttackingTimeAndID);
         }

@@ -229,12 +233,12 @@
             _currentMapStateRepository.Characters.Add(newCharacter);
         }

-        private static DateTime GetStartingAnimationTime(int frameTimer)
+        private static DateTime GetStartingAnimationTime(int frameTimer, bool isRangedWeapon = false)
         {
             // make the first frame very short for animation
             // this works around a bug where the first frame is delayed for (seemingly) no good reason
             // maybe I will eventually figure out why that was happening but this seems to work just fine for now
-            return DateTime.Now.AddMilliseconds(-frameTimer);
+            return DateTime.Now.AddMilliseconds(isRangedWeapon ? 0 : -frameTimer);
         }
     }


Modernizing MemoryErrorLog

Modernizing MemoryErrorLog

--- src/Elmah/MemoryErrorLog.cs
+++ src/Elmah/MemoryErrorLog.cs
@@ -28,13 +28,12 @@
     #region Imports

     using System;
-
+    using System.Collections.Generic;
+    using System.Collections.ObjectModel;
     using ReaderWriterLock = System.Threading.ReaderWriterLock;
     using Timeout = System.Threading.Timeout;
-    using NameObjectCollectionBase = System.Collections.Specialized.NameObjectCollectionBase;
     using IDictionary = System.Collections.IDictionary;
     using CultureInfo = System.Globalization.CultureInfo;
-    using System.Collections.Generic;

     #endregion

@@ -152,18 +151,16 @@
             //

             error = (Error) ((ICloneable) error).Clone();
-            error.ApplicationName = this.ApplicationName;
-            Guid newId = Guid.NewGuid();
-            ErrorLogEntry entry = new ErrorLogEntry(this, newId.ToString(), error);
+            error.ApplicationName = ApplicationName;
+            var newId = Guid.NewGuid();
+            var entry = new ErrorLogEntry(this, newId.ToString(), error);

             _lock.AcquireWriterLock(Timeout.Infinite);

             try
             {
-                if (_entries == null)
-                    _entries = new EntryCollection(_size);
-
-                _entries.Add(entry);
+                var entries = _entries ?? (_entries = new EntryCollection(_size));
+                entries.Add(entry);
             }
             finally
             {
@@ -203,7 +200,7 @@
             // Return a copy that the caller can party on.
             //

-            Error error = (Error) ((ICloneable) entry.Error).Clone();
+            var error = (Error) ((ICloneable) entry.Error).Clone();
             return new ErrorLogEntry(this, entry.Id, error);
         }

@@ -214,11 +211,8 @@

         public override int GetErrors(int pageIndex, int pageSize, ICollection<ErrorLogEntry> errorEntryList)
         {
-            if (pageIndex < 0)
-                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);
-
-            if (pageSize < 0)
-                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);
+            if (pageIndex < 0) throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);
+            if (pageSize < 0) throw new ArgumentOutOfRangeException("pageSize", pageSize, null);

             //
             // To minimize the time for which we hold the lock, we'll first
@@ -240,16 +234,16 @@

                 totalCount = _entries.Count;

-                int startIndex = pageIndex * pageSize;
-                int endIndex = Math.Min(startIndex + pageSize, totalCount);
-                int count = Math.Max(0, endIndex - startIndex);
+                var startIndex = pageIndex * pageSize;
+                var endIndex = Math.Min(startIndex + pageSize, totalCount);
+                var count = Math.Max(0, endIndex - startIndex);

                 if (count > 0)
                 {
                     selectedEntries = new ErrorLogEntry[count];

-                    int sourceIndex = endIndex;
-                    int targetIndex = 0;
+                    var sourceIndex = endIndex;
+                    var targetIndex = 0;

                     while (sourceIndex > startIndex)
                         selectedEntries[targetIndex++] = _entries[--sourceIndex];
@@ -269,7 +263,7 @@

                 foreach (ErrorLogEntry entry in selectedEntries)
                 {
-                    Error error = (Error)((ICloneable)entry.Error).Clone();
+                    var error = (Error)((ICloneable)entry.Error).Clone();
                     errorEntryList.Add(new ErrorLogEntry(this, entry.Id, error));
                 }
             }
@@ -277,41 +271,25 @@
             return totalCount;
         }

-        private class EntryCollection : NameObjectCollectionBase
+        sealed class EntryCollection : KeyedCollection<string, ErrorLogEntry>
         {
             private readonly int _size;

-            public EntryCollection(int size) : base(size)
+            public EntryCollection(int size)
             {
                 _size = size;
             }

-            public ErrorLogEntry this[int index]
-            {
-                get { return (ErrorLogEntry) BaseGet(index); }
-            }
-
-            public ErrorLogEntry this[Guid id]
-            {
-                get { return (ErrorLogEntry) BaseGet(id.ToString()); }
-            }
-
-            public ErrorLogEntry this[string id]
-            {
-                get { return this[new Guid(id)]; }
-            }
-
-            public void Add(ErrorLogEntry entry)
-            {
-                Debug.Assert(entry != null);
-                Debug.AssertStringNotEmpty(entry.Id);
-
-                Debug.Assert(this.Count <= _size);
-
-                if (this.Count == _size)
-                    BaseRemoveAt(0);
-
-                BaseAdd(entry.Id, entry);
+            protected override string GetKeyForItem(ErrorLogEntry item)
+            {
+                return item.Id;
+            }
+
+            protected override void InsertItem(int index, ErrorLogEntry item)
+            {
+                if (Count == _size)
+                    RemoveAt(0);
+                base.InsertItem(index, item);
             }
         }
     }


Made some OrderedBiDirectionalDictionary fields static

--- Src/Enums.NET/Collections/OrderedBiDirectionalDictionary.cs
+++ Src/Enums.NET/Collections/OrderedBiDirectionalDictionary.cs
@@ -34,6 +34,12 @@
     [DebuggerDisplay("Count = {Count}")]
     internal sealed class OrderedBiDirectionalDictionary<TFirst, TSecond> : IList<Pair<TFirst, TSecond>>
     {
+        #region Static
+        private static readonly bool _cannotUseIndexIndexer = typeof(TFirst) == typeof(int) || typeof(TSecond) == typeof(int);
+        private static readonly bool _cannotUseFirstIndexer = typeof(TFirst) == typeof(int) || typeof(TSecond) == typeof(TFirst);
+        private static readonly bool _cannotUseSecondIndexer = typeof(TFirst) == typeof(TSecond) || typeof(TSecond) == typeof(int);
+        #endregion
+
         #region Fields
         private int[] _firstBuckets;
         private int[] _secondBuckets;
@@ -42,9 +48,6 @@
         private SecondCollection _secondItems;
         private ForwardDictionary _forward;
         private ReverseDictionary _reverse;
-        private readonly bool _cannotUseIndexIndexer;
-        private readonly bool _cannotUseFirstIndexer;
-        private readonly bool _cannotUseSecondIndexer;
         private int _version;
         #endregion

@@ -182,15 +185,6 @@
             Count = 0;
             FirstComparer = firstComparer ?? EqualityComparer<TFirst>.Default;
             SecondComparer = secondComparer ?? EqualityComparer<TSecond>.Default;
-            var firstType = typeof(TFirst);
-            var secondType = typeof(TSecond);
-            var intType = typeof(int);
-            var typesMatch = firstType == secondType;
-            var firstIsInt = firstType == intType;
-            var secondIsInt = secondType == intType;
-            _cannotUseIndexIndexer = firstIsInt || secondIsInt;
-            _cannotUseFirstIndexer = firstIsInt || typesMatch;
-            _cannotUseSecondIndexer = secondIsInt || typesMatch;
         }
         #endregion


show error instead of message for async throws (#892)

Show error instead of message for async throws

--- Src/FluentAssertions/Specialized/AsyncFunctionAssertions.cs
+++ Src/FluentAssertions/Specialized/AsyncFunctionAssertions.cs
@@ -73,15 +73,12 @@
             }
             catch (Exception exception)
             {
-                while (exception is AggregateException)
-                {
-                    exception = exception.InnerException;
-                }
+                Exception nonAggregateException = GetFirstNonAggregateException(exception);

                 Execute.Assertion
                     .BecauseOf(because, becauseArgs)
                     .FailWith("Did not expect any exception{reason}, but found a {0} with message {1}.",
-                        exception.GetType(), exception.Message);
+                        nonAggregateException.GetType(), nonAggregateException.ToString());
             }
         }

@@ -104,20 +101,28 @@
             }
             catch (Exception exception)
             {
-                while (exception is AggregateException)
-                {
-                    exception = exception.InnerException;
-                }
+                Exception nonAggregateException = GetFirstNonAggregateException(exception);

-                if (exception != null)
+                if (nonAggregateException != null)
                 {
                     Execute.Assertion
-                        .ForCondition(!(exception is TException))
+                        .ForCondition(!(nonAggregateException is TException))
                         .BecauseOf(because, becauseArgs)
                         .FailWith("Did not expect {0}{reason}, but found one with message {1}.",
-                            typeof(TException), exception.Message);
+                            typeof(TException), nonAggregateException.ToString());
                 }
             }
+        }
+
+        private static Exception GetFirstNonAggregateException(Exception exception)
+        {
+            Exception nonAggregateException = exception;
+            while (nonAggregateException is AggregateException)
+            {
+                nonAggregateException = nonAggregateException.InnerException;
+            }
+
+            return nonAggregateException;
         }

         private Exception InvokeSubjectWithInterception()


Switch PostBuildCommandLineDialog to Update()

In Unity 5.6 there is no OnGUI() callback after the AppDomain is
reset unless the user interacts with the window, e.g. by clicking
on it. This is the case on both Mac and Windows.

Switch the AppDomain reset check to Update() which is called more
often and works for Unity 5.6.

--- GooglePlayInstant/Editor/PostBuildCommandLineDialog.cs
+++ GooglePlayInstant/Editor/PostBuildCommandLineDialog.cs
@@ -12,8 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.

-using System;
-using System.Collections.Generic;
 using GooglePlayInstant.Editor.GooglePlayServices;
 using UnityEngine;

@@ -42,7 +40,7 @@
             _serializedField = false;
         }

-        protected override void OnGUI()
+        protected override void Update()
         {
             // This block is entered twice: when the window is initially shown and later after the AppDomain is reset.
             if (!_nonserializedField)
@@ -60,7 +58,7 @@
                 }
             }

-            base.OnGUI();
+            base.Update();
         }

         private void RunCommandAsync()


Handle nullable types.

Handle nullable types.

--- Gu.State/EqualBy/Comparers/EquatableEqualByComparer.cs
+++ Gu.State/EqualBy/Comparers/EquatableEqualByComparer.cs
@@ -11,9 +11,19 @@
             if (settings.IsEquatable(type) &&
                 type.Name != "ImmutableArray`1")
             {
-                comparer = (EqualByComparer)typeof(Comparer<>).MakeGenericType(type)
-                                                              .GetField(nameof(Comparer<int>.Default), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)
-                                                              .GetValue(null);
+                if (type.IsNullable())
+                {
+                    comparer = (EqualByComparer)typeof(NullableComparer<>).MakeGenericType(type.GenericTypeArguments)
+                                                                  .GetField(nameof(NullableComparer<int>.Default), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)
+                                                                  .GetValue(null);
+                }
+                else
+                {
+                    comparer = (EqualByComparer)typeof(Comparer<>).MakeGenericType(type)
+                                                                  .GetField(nameof(Comparer<int>.Default), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)
+                                                                  .GetValue(null);
+                }
+
                 return true;
             }

@@ -22,7 +32,6 @@
         }

         private class Comparer<T> : EqualByComparer
-            where T : IEquatable<T>
         {
             public static Comparer<T> Default = new Comparer<T>(EqualityComparer<T>.Default);
             private readonly EqualityComparer<T> comparer;
@@ -37,5 +46,20 @@
                 return this.comparer.Equals((T)x, (T)y);
             }
         }
+
+        private class NullableComparer<T> : EqualByComparer
+            where T : struct
+        {
+            public static NullableComparer<T> Default = new NullableComparer<T>();
+
+            private NullableComparer()
+            {
+            }
+
+            public override bool Equals(object x, object y, MemberSettings settings, ReferencePairCollection referencePairs)
+            {
+                return Nullable.Equals((T?)x, (T?)y);
+            }
+        }
     }
 }


Enclosed all HTTPClient relevant code in using statements so they will be properly disposed of. Made all Get, Post and Delete methods async and return their respective tasks.

--- src/HelpScoutClientAsync.cs
+++ src/HelpScoutClientAsync.cs
@@ -444,112 +444,118 @@
         #endregion

-        private T Get<T>(string endpoint, IRequest request) where T : class
-        {
-            var client = InitHttpClient();
-
+        private async Task<T> Get<T>(string endpoint, IRequest request) where T : class
+        {
             string debug = BaseUrl + endpoint + ToQueryString(request);
-            HttpResponseMessage response = client.GetAsync(BaseUrl + endpoint + ToQueryString(request)).Result;
-            string body = response.Content.ReadAsStringAsync().Result;
-
-            if (response.IsSuccessStatusCode)
-            {
-                T result = JsonConvert.DeserializeObject<T>(body, _serializerSettings);
-
-                return result;
-            }
-
-            var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
-            throw new HelpScoutApiException(error, body);
-        }
-
-        private string PostAttachment(string endpoint, CreateAttachmentRequest request)
-        {
-            var client = InitHttpClient();
-
-            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
-
-            var jsonPayload = JsonConvert.SerializeObject(request, _serializerSettings);
-
-            HttpResponseMessage response = client.PostAsync(BaseUrl + endpoint, new StringContent(jsonPayload, Encoding.UTF8, "application/json")).Result;
-            string body = response.Content.ReadAsStringAsync().Result;
-
-            if (response.IsSuccessStatusCode)
-            {
-                dynamic file = JsonConvert.DeserializeObject(body);
-
-                return file.item.hash;
-            }
-
-            var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
-            throw new HelpScoutApiException(error, body);
-        }
-
-        private T Post<T>(string endpoint, T payload, IPostOrPutRequest request)
-        {
-            var client = InitHttpClient();
-
-            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
-            var jsonPayload = JsonConvert.SerializeObject(payload, _serializerSettings);
-
-            HttpResponseMessage response = client.PostAsync(BaseUrl + endpoint + ToQueryString(request), new StringContent(jsonPayload, Encoding.UTF8, "application/json")).Result;
-            string body = response.Content.ReadAsStringAsync().Result;
-
-            if (response.IsSuccessStatusCode)
-            {
-                if (request.Reload)
+
+            using (HttpClient client = InitHttpClient())
+            {
+                HttpResponseMessage response = await client.GetAsync(BaseUrl + endpoint + ToQueryString(request));
+                string body = await response.Content.ReadAsStringAsync();
+
+                if (response.IsSuccessStatusCode)
                 {
-                    T result = JsonConvert.DeserializeObject<SingleItem<T>>(body).Item;
+                    T result = JsonConvert.DeserializeObject<T>(body, _serializerSettings);
+
                     return result;
                 }
-                else
-                {
-                    return payload;
-                }
-            }
-
-            var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
-            throw new HelpScoutApiException(error, body);
-        }
-
-        private T Put<T>(string endpoint, T payload, IPostOrPutRequest request)
-        {
-            var client = InitHttpClient();
-
-            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
-            var jsonPayload = JsonConvert.SerializeObject(payload, _serializerSettings);
-
-            HttpResponseMessage response = client.PutAsync(BaseUrl + endpoint + ToQueryString(request), new StringContent(jsonPayload, Encoding.UTF8, "application/json")).Result;
-            string body = response.Content.ReadAsStringAsync().Result;
-
-            if (response.IsSuccessStatusCode)
-            {
-                if (request.Reload)
-                {
-                    T result = JsonConvert.DeserializeObject<SingleItem<T>>(body).Item;
-                    return result;
-                }
-                else
-                {
-                    return payload;
-                }
-            }
-
-            var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
-            throw new HelpScoutApiException(error, body);
-        }
-
-        private void Delete(string endpoint)
-        {
-            var client = InitHttpClient();
-
-            var response = client.DeleteAsync(BaseUrl + endpoint).Result;
-
-            if (!response.IsSuccessStatusCode)
-            {
-                string body = response.Content.ReadAsStringAsync().Result;
+
                 var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
                 throw new HelpScoutApiException(error, body);
+            }
+        }
+
+        private async Task<string> PostAttachment(string endpoint, CreateAttachmentRequest request)
+        {
+            using (HttpClient client = InitHttpClient())
+            {
+                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+
+                var jsonPayload = JsonConvert.SerializeObject(request, _serializerSettings);
+
+                HttpResponseMessage response = await client.PostAsync(BaseUrl + endpoint, new StringContent(jsonPayload, Encoding.UTF8, "application/json"));
+                string body = await response.Content.ReadAsStringAsync();
+
+                if (response.IsSuccessStatusCode)
+                {
+                    dynamic file = JsonConvert.DeserializeObject(body);
+
+                    return file.item.hash;
+                }
+
+                var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
+                throw new HelpScoutApiException(error, body);
+            }
+        }
+
+        private async Task<T> Post<T>(string endpoint, T payload, IPostOrPutRequest request)
+        {
+            using (HttpClient client = InitHttpClient())
+            {
+                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                var jsonPayload = JsonConvert.SerializeObject(payload, _serializerSettings);
+
+                HttpResponseMessage response = await client.PostAsync(BaseUrl + endpoint + ToQueryString(request), new StringContent(jsonPayload, Encoding.UTF8, "application/json"));
+                string body = await response.Content.ReadAsStringAsync();
+
+                if (response.IsSuccessStatusCode)
+                {
+                    if (request.Reload)
+                    {
+                        T result = JsonConvert.DeserializeObject<SingleItem<T>>(body).Item;
+                        return result;
+                    }
+                    else
+                    {
+                        return payload;
+                    }
+                }
+
+                var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
+                throw new HelpScoutApiException(error, body);
+            }
+        }
+
+        private T Put<T>(string endpoint, T payload, IPostOrPutRequest request)
+        {
+            using (HttpClient client = InitHttpClient())
+            {
+                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                var jsonPayload = JsonConvert.SerializeObject(payload, _serializerSettings);
+
+                HttpResponseMessage response = client.PutAsync(BaseUrl + endpoint + ToQueryString(request), new StringContent(jsonPayload, Encoding.UTF8, "application/json")).Result;
+                string body = response.Content.ReadAsStringAsync().Result;
+
+                if (response.IsSuccessStatusCode)
+                {
+                    if (request.Reload)
+                    {
+                        T result = JsonConvert.DeserializeObject<SingleItem<T>>(body).Item;
+                        return result;
+                    }
+                    else
+                    {
+                        return payload;
+                    }
+                }
+
+                var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
+                throw new HelpScoutApiException(error, body);
+            }
+        }
+
+        private async void Delete(string endpoint)
+        {
+            using (HttpClient client = InitHttpClient())
+            {
+                HttpResponseMessage response = await client.DeleteAsync(BaseUrl + endpoint);
+
+                if (!response.IsSuccessStatusCode)
+                {
+                    string body = await response.Content.ReadAsStringAsync();
+                    var error = JsonConvert.DeserializeObject<HelpScoutError>(body);
+                    throw new HelpScoutApiException(error, body);
+                }
             }
         }

@@ -581,9 +587,4 @@
             return "?" + string.Join("&", array);
         }
     }
-
-    //internal class SingleItem<T>
-    //{
-    //    public T Item { get; set; }
-    //}
 }


Update SettingsServiceTests.cs

Update SettingsServiceTests.cs

--- TIKSN.Framework.Core.Tests/Settings/SettingsServiceTests.cs
+++ TIKSN.Framework.Core.Tests/Settings/SettingsServiceTests.cs
@@ -9,7 +9,7 @@
     {
         partial void SetupDenepdencies()
         {
-            PlatformDependencyRegistration.Register(services);
+            services.AddFrameworkPlatform();
             services.AddSingleton<ISettingsService, FileSettingsService>();
             services.AddSingleton(new KnownFoldersConfiguration(GetType().Assembly, KnownFolderVersionConsideration.None));