Bug fix: make m_HypergridLinker static.

Bug fix: make m_HypergridLinker static.

--- OpenSim/Services/GridService/GridService.cs
+++ OpenSim/Services/GridService/GridService.cs
@@ -1,567 +1,535 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the OpenSimulator Project nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Reflection;
-using Nini.Config;
-using log4net;
-using OpenSim.Framework;
-using OpenSim.Framework.Console;
-using OpenSim.Data;
-using OpenSim.Server.Base;
-using OpenSim.Services.Interfaces;
-using GridRegion = OpenSim.Services.Interfaces.GridRegion;
-using OpenMetaverse;
-
-namespace OpenSim.Services.GridService
-{
-    public class GridService : GridServiceBase, IGridService
-    {
-        private static readonly ILog m_log =
-                LogManager.GetLogger(
-                MethodBase.GetCurrentMethod().DeclaringType);
-
-        private bool m_DeleteOnUnregister = true;
-        private static GridService m_RootInstance = null;
-        protected IConfigSource m_config;
-        protected HypergridLinker m_HypergridLinker;
-
-        protected IAuthenticationService m_AuthenticationService = null;
-        protected bool m_AllowDuplicateNames = false;
-        protected bool m_AllowHypergridMapSearch = false;
-
-        public GridService(IConfigSource config)
-            : base(config)
-        {
-            //m_log.DebugFormat("[GRID SERVICE]: Starting...");
-
-            m_config = config;
-            IConfig gridConfig = config.Configs["GridService"];
-            if (gridConfig != null)
-            {
-                m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
-
-                string authService = gridConfig.GetString("AuthenticationService", String.Empty);
-
-                if (authService != String.Empty)
-                {
-                    Object[] args = new Object[] { config };
-                    m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
-                }
-                m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
-                m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
-            }
-
-            if (m_RootInstance == null)
-            {
-                m_RootInstance = this;
-
-                if (MainConsole.Instance != null)
-                {
-                    MainConsole.Instance.Commands.AddCommand("grid", true,
-                            "show region",
-                            "show region <Region name>",
-                            "Show details on a region",
-                            String.Empty,
-                            HandleShowRegion);
-
-                    MainConsole.Instance.Commands.AddCommand("grid", true,
-                            "set region flags",
-                            "set region flags <Region name> <flags>",
-                            "Set database flags for region",
-                            String.Empty,
-                            HandleSetFlags);
-                }
-                m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
-            }
-        }
-
-        #region IGridService
-
-        public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
-        {
-            IConfig gridConfig = m_config.Configs["GridService"];
-            // This needs better sanity testing. What if regionInfo is registering in
-            // overlapping coords?
-            RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
-            if (region != null)
-            {
-                // There is a preexisting record
-                //
-                // Get it's flags
-                //
-                OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]);
-
-                // Is this a reservation?
-                //
-                if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0)
-                {
-                    // Regions reserved for the null key cannot be taken.
-                    if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
-                        return "Region location is reserved";
-
-                    // Treat it as an auth request
-                    //
-                    // NOTE: Fudging the flags value here, so these flags
-                    //       should not be used elsewhere. Don't optimize
-                    //       this with the later retrieval of the same flags!
-                    rflags |= OpenSim.Data.RegionFlags.Authenticate;
-                }
-
-                if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0)
-                {
-                    // Can we authenticate at all?
-                    //
-                    if (m_AuthenticationService == null)
-                        return "No authentication possible";
-
-                    if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30))
-                        return "Bad authentication";
-                }
-            }
-
-            if ((region != null) && (region.RegionID != regionInfos.RegionID))
-            {
-                m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
-                    regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
-                return "Region overlaps another region";
-            }
-            if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
-                ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
-            {
-                if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0)
-                    return "Can't move this region," +region.posX + "," + region.posY;
-
-                // Region reregistering in other coordinates. Delete the old entry
-                m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
-                    regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
-
-                try
-                {
-                    m_Database.Delete(regionInfos.RegionID);
-                }
-                catch (Exception e)
-                {
-                    m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
-                }
-            }
-
-            if (!m_AllowDuplicateNames)
-            {
-                List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
-                if (dupe != null && dupe.Count > 0)
-                {
-                    foreach (RegionData d in dupe)
-                    {
-                        if (d.RegionID != regionInfos.RegionID)
-                        {
-                            m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
-                                regionInfos.RegionName, regionInfos.RegionID);
-                            return "Duplicate region name";
-                        }
-                    }
-                }
-            }
-
-            // Everything is ok, let's register
-            RegionData rdata = RegionInfo2RegionData(regionInfos);
-            rdata.ScopeID = scopeID;
-
-            if (region != null)
-            {
-                int oldFlags = Convert.ToInt32(region.Data["flags"]);
-                if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
-                    return "Region locked out";
-
-                oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation;
-
-                rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags
-            }
-            else
-            {
-                rdata.Data["flags"] = "0";
-                if ((gridConfig != null) && rdata.RegionName != string.Empty)
-                {
-                    int newFlags = 0;
-                    string regionName = rdata.RegionName.Trim().Replace(' ', '_');
-                    newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty));
-                    newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty));
-                    rdata.Data["flags"] = newFlags.ToString();
-                }
-            }
-
-            int flags = Convert.ToInt32(rdata.Data["flags"]);
-            flags |= (int)OpenSim.Data.RegionFlags.RegionOnline;
-            rdata.Data["flags"] = flags.ToString();
-
-            try
-            {
-                rdata.Data["last_seen"] = Util.UnixTimeSinceEpoch();
-                m_Database.Store(rdata);
-            }
-            catch (Exception e)
-            {
-                m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
-            }
-
-            //m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
-            //    regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
-
-            return String.Empty;
-        }
-
-        public bool DeregisterRegion(UUID regionID)
-        {
-            m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
-            RegionData region = m_Database.Get(regionID, UUID.Zero);
-            if (region == null)
-                return false;
-
-            int flags = Convert.ToInt32(region.Data["flags"]);
-
-            if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0)
-            {
-                flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline;
-                region.Data["flags"] = flags.ToString();
-                region.Data["last_seen"] = Util.UnixTimeSinceEpoch();
-                try
-                {
-                    m_Database.Store(region);
-                }
-                catch (Exception e)
-                {
-                    m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
-                }
-
-                return true;
-
-            }
-
-            return m_Database.Delete(regionID);
-        }
-
-        public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
-        {
-            List<GridRegion> rinfos = new List<GridRegion>();
-            RegionData region = m_Database.Get(regionID, scopeID);
-            if (region != null)
-            {
-                // Not really? Maybe?
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of the OpenSimulator Project nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Reflection;
+using Nini.Config;
+using log4net;
+using OpenSim.Framework;
+using OpenSim.Framework.Console;
+using OpenSim.Data;
+using OpenSim.Server.Base;
+using OpenSim.Services.Interfaces;
+using GridRegion = OpenSim.Services.Interfaces.GridRegion;
+using OpenMetaverse;
+
+namespace OpenSim.Services.GridService
+{
+    public class GridService : GridServiceBase, IGridService
+    {
+        private static readonly ILog m_log =
+                LogManager.GetLogger(
+                MethodBase.GetCurrentMethod().DeclaringType);
+
+        private bool m_DeleteOnUnregister = true;
+        private static GridService m_RootInstance = null;
+        protected IConfigSource m_config;
+        protected static HypergridLinker m_HypergridLinker;
+
+        protected IAuthenticationService m_AuthenticationService = null;
+        protected bool m_AllowDuplicateNames = false;
+        protected bool m_AllowHypergridMapSearch = false;
+
+        public GridService(IConfigSource config)
+            : base(config)
+        {
+            m_log.DebugFormat("[GRID SERVICE]: Starting...");
+
+            m_config = config;
+            IConfig gridConfig = config.Configs["GridService"];
+            if (gridConfig != null)
+            {
+                m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
+
+                string authService = gridConfig.GetString("AuthenticationService", String.Empty);
+
+                if (authService != String.Empty)
+                {
+                    Object[] args = new Object[] { config };
+                    m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
+                }
+                m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
+                m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
+            }
+
+            if (m_RootInstance == null)
+            {
+                m_RootInstance = this;
+
+                if (MainConsole.Instance != null)
+                {
+                    MainConsole.Instance.Commands.AddCommand("grid", true,
+                            "show region",
+                            "show region <Region name>",
+                            "Show details on a region",
+                            String.Empty,
+                            HandleShowRegion);
+
+                    MainConsole.Instance.Commands.AddCommand("grid", true,
+                            "set region flags",
+                            "set region flags <Region name> <flags>",
+                            "Set database flags for region",
+                            String.Empty,
+                            HandleSetFlags);
+                }
+                m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
+            }
+        }
+
+        #region IGridService
+
+        public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
+        {
+            IConfig gridConfig = m_config.Configs["GridService"];
+            // This needs better sanity testing. What if regionInfo is registering in
+            // overlapping coords?
+            RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
+            if (region != null)
+            {
+                // There is a preexisting record
+                //
+                // Get it's flags
+                //
+                OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]);
+
+                // Is this a reservation?
+                //
+                if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0)
+                {
+                    // Regions reserved for the null key cannot be taken.
+                    if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
+                        return "Region location us reserved";
+
+                    // Treat it as an auth request
+                    //
+                    // NOTE: Fudging the flags value here, so these flags
+                    //       should not be used elsewhere. Don't optimize
+                    //       this with the later retrieval of the same flags!
+                    rflags |= OpenSim.Data.RegionFlags.Authenticate;
+                }
+
+                if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0)
+                {
+                    // Can we authenticate at all?
+                    //
+                    if (m_AuthenticationService == null)
+                        return "No authentication possible";
+
+                    if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30))
+                        return "Bad authentication";
+                }
+            }
+
+            if ((region != null) && (region.RegionID != regionInfos.RegionID))
+            {
+                m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
+                    regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
+                return "Region overlaps another region";
+            }
+            if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
+                ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
+            {
+                if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0)
+                    return "Can't move this region";
+
+                // Region reregistering in other coordinates. Delete the old entry
+                m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
+                    regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
+
+                try
+                {
+                    m_Database.Delete(regionInfos.RegionID);
+                }
+                catch (Exception e)
+                {
+                    m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
+                }
+            }
+
+            if (!m_AllowDuplicateNames)
+            {
+                List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
+                if (dupe != null && dupe.Count > 0)
+                {
+                    foreach (RegionData d in dupe)
+                    {
+                        if (d.RegionID != regionInfos.RegionID)
+                        {
+                            m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
+                                regionInfos.RegionName, regionInfos.RegionID);
+                            return "Duplicate region name";
+                        }
+                    }
+                }
+            }
+
+            // Everything is ok, let's register
+            RegionData rdata = RegionInfo2RegionData(regionInfos);
+            rdata.ScopeID = scopeID;
+
+            if (region != null)
+            {
+                int oldFlags = Convert.ToInt32(region.Data["flags"]);
+                if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
+                    return "Region locked out";
+
+                oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation;
+
+                rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags
+            }
+            else
+            {
+                rdata.Data["flags"] = "0";
+                if ((gridConfig != null) && rdata.RegionName != string.Empty)
+                {
+                    int newFlags = 0;
+                    string regionName = rdata.RegionName.Trim().Replace(' ', '_');
+                    newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty));
+                    newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty));
+                    rdata.Data["flags"] = newFlags.ToString();
+                }
+            }
+
+            int flags = Convert.ToInt32(rdata.Data["flags"]);
+            flags |= (int)OpenSim.Data.RegionFlags.RegionOnline;
+            rdata.Data["flags"] = flags.ToString();
+
+            try
+            {
+                rdata.Data["last_seen"] = Util.UnixTimeSinceEpoch();
+                m_Database.Store(rdata);
+            }
+            catch (Exception e)
+            {
+                m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
+            }
+
+            m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}",
+                regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
+
+            return String.Empty;
+        }
+
+        public bool DeregisterRegion(UUID regionID)
+        {
+            m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
+            RegionData region = m_Database.Get(regionID, UUID.Zero);
+            if (region == null)
+                return false;
+
+            int flags = Convert.ToInt32(region.Data["flags"]);
+
+            if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0)
+            {
+                flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline;
+                region.Data["flags"] = flags.ToString();
+                region.Data["last_seen"] = Util.UnixTimeSinceEpoch();
+                try
+                {
+                    m_Database.Store(region);
+                }
+                catch (Exception e)
+                {
+                    m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
+                }
+
+                return true;
+
+            }
+
+            return m_Database.Delete(regionID);
+        }
+
+        public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
+        {
+            List<GridRegion> rinfos = new List<GridRegion>();
+            RegionData region = m_Database.Get(regionID, scopeID);
+            if (region != null)
+            {
+                // Not really? Maybe?
                 List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1,
                     region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID);
-
-                foreach (RegionData rdata in rdatas)
-                    if (rdata.RegionID != regionID)
-                        rinfos.Add(RegionData2RegionInfo(rdata));
-
-            }
+
+                foreach (RegionData rdata in rdatas)
+                    if (rdata.RegionID != regionID)
+                    {
+                        int flags = Convert.ToInt32(rdata.Data["flags"]);
+                        if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
+                            rinfos.Add(RegionData2RegionInfo(rdata));
+                    }
+
+            }
             m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count);
-            return rinfos;
-        }
-
-        public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
-        {
-            RegionData rdata = m_Database.Get(regionID, scopeID);
-            if (rdata != null)
-                return RegionData2RegionInfo(rdata);
-
-            return null;
-        }
-
-        public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
-        {
-            int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
-            int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize;
-            RegionData rdata = m_Database.Get(snapX, snapY, scopeID);
-            if (rdata != null)
-                return RegionData2RegionInfo(rdata);
-
-            return null;
-        }
-
-        public GridRegion GetRegionByName(UUID scopeID, string regionName)
-        {
-            List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID);
-            if ((rdatas != null) && (rdatas.Count > 0))
-                return RegionData2RegionInfo(rdatas[0]); // get the first
-
-            return null;
-        }
-
-        public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
-        {
-            m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
-
-            int count = 0;
-            List<GridRegion> rinfos = new List<GridRegion>();
-            List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID);
-
-            if (rdatas != null)
-            {
-                //Sort to find the region with the exact name that was given
-                rdatas.Sort(new RegionDataComparison(name));
-                //Results are backwards... so it needs reversed
-                rdatas.Reverse();
-                foreach (RegionData rdata in rdatas)
-                {
-                    if (count++ < maxNumber)
-                        rinfos.Add(RegionData2RegionInfo(rdata));
-                }
-            }
-
-            if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")))
-            {
-                GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
-                if (r != null)
-                    rinfos.Add(r);
-            }
-
-            return rinfos;
-        }
-
-        public class RegionDataComparison : IComparer<RegionData>
-        {
-            string RegionName;
-            public RegionDataComparison(string regionName)
-            {
-                RegionName = regionName;
-            }
-
-            int IComparer<RegionData>.Compare(RegionData x, RegionData y)
-            {
-                if (x.RegionName == RegionName)
-                    return 1;
-                else if (y.RegionName == RegionName)
-                    return -1;
-                else
-                    return 0;
-            }
-        }
-
-        public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
-        {
-            int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
-            int xmaxSnap = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
-            int yminSnap = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
-            int ymaxSnap = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
-
-            List<RegionData> rdatas = m_Database.Get(xminSnap, yminSnap, xmaxSnap, ymaxSnap, scopeID);
-            List<GridRegion> rinfos = new List<GridRegion>();
-            foreach (RegionData rdata in rdatas)
-                rinfos.Add(RegionData2RegionInfo(rdata));
-
-            return rinfos;
-        }
-
-        #endregion
-
-        #region Data structure conversions
-
-        public RegionData RegionInfo2RegionData(GridRegion rinfo)
-        {
-            RegionData rdata = new RegionData();
-            rdata.posX = (int)rinfo.RegionLocX;
-            rdata.posY = (int)rinfo.RegionLocY;
-            rdata.RegionID = rinfo.RegionID;
-            rdata.RegionName = rinfo.RegionName;
-            rdata.Data = rinfo.ToKeyValuePairs();
-            rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY);
-            rdata.Data["owner_uuid"] = rinfo.EstateOwner.ToString();
-            return rdata;
-        }
-
-        public GridRegion RegionData2RegionInfo(RegionData rdata)
-        {
-            GridRegion rinfo = new GridRegion(rdata.Data);
-            rinfo.RegionLocX = rdata.posX;
-            rinfo.RegionLocY = rdata.posY;
-            rinfo.RegionID = rdata.RegionID;
-            rinfo.RegionName = rdata.RegionName;
-            rinfo.ScopeID = rdata.ScopeID;
-
-            return rinfo;
-        }
-
-        #endregion
-
-        public List<GridRegion> GetDefaultRegions(UUID scopeID)
-        {
-            List<GridRegion> ret = new List<GridRegion>();
-
-            List<RegionData> regions = m_Database.GetDefaultRegions(scopeID);
-
-            foreach (RegionData r in regions)
-            {
-                if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
-                    ret.Add(RegionData2RegionInfo(r));
-            }
-
-            m_log.DebugFormat("[GRID SERVICE]: GetDefaultRegions returning {0} regions", ret.Count);
-            return ret;
-        }
-
-        public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
-        {
-            List<GridRegion> ret = new List<GridRegion>();
-
-            List<RegionData> regions = m_Database.GetFallbackRegions(scopeID, x, y);
-
-            foreach (RegionData r in regions)
-            {
-                if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
-                    ret.Add(RegionData2RegionInfo(r));
-            }
-
-            m_log.DebugFormat("[GRID SERVICE]: Fallback returned {0} regions", ret.Count);
-            return ret;
-        }
-
-        public int GetRegionFlags(UUID scopeID, UUID regionID)
-        {
-            RegionData region = m_Database.Get(regionID, scopeID);
-
-            if (region != null)
-            {
-                int flags = Convert.ToInt32(region.Data["flags"]);
-                //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags);
-                return flags;
-            }
-            else
-                return -1;
-        }
-
-        private void HandleShowRegion(string module, string[] cmd)
-        {
-            if (cmd.Length != 3)
-            {
-                MainConsole.Instance.Output("Syntax: show region <region name>");
-                return;
-            }
-            List<RegionData> regions = m_Database.Get(cmd[2], UUID.Zero);
-            if (regions == null || regions.Count < 1)
-            {
-                MainConsole.Instance.Output("Region not found");
-                return;
-            }
-
-            foreach (RegionData r in regions)
-            {
-                MainConsole.Instance.Output("-------------------------------------------------------------------------------");
-                OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
-                MainConsole.Instance.Output("Region Name: " + r.RegionName);
-                MainConsole.Instance.Output("Region UUID: " + r.RegionID);
-                MainConsole.Instance.Output("Region Location: " + String.Format("{0},{1}", r.posX, r.posY));
-                MainConsole.Instance.Output("Region URI: " + "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString());
-                MainConsole.Instance.Output("Region Owner: " + r.Data["owner_uuid"].ToString());
-                MainConsole.Instance.Output("Region Flags: " + flags);
-                MainConsole.Instance.Output("-------------------------------------------------------------------------------");
-            }
-            return;
-        }
-
-        private int ParseFlags(int prev, string flags)
-        {
-            OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev;
-
-            string[] parts = flags.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
-
-            foreach (string p in parts)
-            {
-                int val;
-
-                try
-                {
-                    if (p.StartsWith("+"))
-                    {
-                        val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1));
-                        f |= (OpenSim.Data.RegionFlags)val;
-                    }
-                    else if (p.StartsWith("-"))
-                    {
-                        val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1));
-                        f &= ~(OpenSim.Data.RegionFlags)val;
-                    }
-                    else
-                    {
-                        val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p);
-                        f |= (OpenSim.Data.RegionFlags)val;
-                    }
-                }
-                catch (Exception)
-                {
-                    MainConsole.Instance.Output("Error in flag specification: " + p);
-                }
-            }
-
-            return (int)f;
-        }
-
-        private void HandleSetFlags(string module, string[] cmd)
-        {
-            if (cmd.Length < 5)
-            {
-                MainConsole.Instance.Output("Syntax: set region flags <region name> <flags>");
-                return;
-            }
-
-            List<RegionData> regions = m_Database.Get(cmd[3], UUID.Zero);
-            if (regions == null || regions.Count < 1)
-            {
-                MainConsole.Instance.Output("Region not found");
-                return;
-            }
-
-            foreach (RegionData r in regions)
-            {
-                int flags = Convert.ToInt32(r.Data["flags"]);
-                flags = ParseFlags(flags, cmd[4]);
-                r.Data["flags"] = flags.ToString();
-                OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags;
-
-                MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f));
-                m_Database.Store(r);
-            }
-        }
-
-        #region IGridService Members
-
-
-        public GridRegion IncomingNewRegion(GridRegion region)
-        {
-            throw new NotImplementedException();
-        }
-
-        public void ClosingRegion(GridRegion region)
-        {
-            throw new NotImplementedException();
-        }
-
-        #endregion
-    }
-}
+            return rinfos;
+        }
+
+        public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
+        {
+            RegionData rdata = m_Database.Get(regionID, scopeID);
+            if (rdata != null)
+                return RegionData2RegionInfo(rdata);
+
+            return null;
+        }
+
+        public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
+        {
+            int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
+            int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize;
+            RegionData rdata = m_Database.Get(snapX, snapY, scopeID);
+            if (rdata != null)
+                return RegionData2RegionInfo(rdata);
+
+            return null;
+        }
+
+        public GridRegion GetRegionByName(UUID scopeID, string regionName)
+        {
+            List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID);
+            if ((rdatas != null) && (rdatas.Count > 0))
+                return RegionData2RegionInfo(rdatas[0]); // get the first
+
+            return null;
+        }
+
+        public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
+        {
+            m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name);
+
+            List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID);
+
+            int count = 0;
+            List<GridRegion> rinfos = new List<GridRegion>();
+
+            if (rdatas != null)
+            {
+                m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
+                foreach (RegionData rdata in rdatas)
+                {
+                    if (count++ < maxNumber)
+                        rinfos.Add(RegionData2RegionInfo(rdata));
+                }
+            }
+
+            if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains("."))
+            {
+                GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
+                if (r != null)
+                    rinfos.Add(r);
+            }
+
+            return rinfos;
+        }
+
+        public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
+        {
+            int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
+            int xmaxSnap = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
+            int yminSnap = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
+            int ymaxSnap = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
+
+            List<RegionData> rdatas = m_Database.Get(xminSnap, yminSnap, xmaxSnap, ymaxSnap, scopeID);
+            List<GridRegion> rinfos = new List<GridRegion>();
+            foreach (RegionData rdata in rdatas)
+                rinfos.Add(RegionData2RegionInfo(rdata));
+
+            return rinfos;
+        }
+
+        #endregion
+
+        #region Data structure conversions
+
+        public RegionData RegionInfo2RegionData(GridRegion rinfo)
+        {
+            RegionData rdata = new RegionData();
+            rdata.posX = (int)rinfo.RegionLocX;
+            rdata.posY = (int)rinfo.RegionLocY;
+            rdata.RegionID = rinfo.RegionID;
+            rdata.RegionName = rinfo.RegionName;
+            rdata.Data = rinfo.ToKeyValuePairs();
+            rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY);
+            rdata.Data["owner_uuid"] = rinfo.EstateOwner.ToString();
+            return rdata;
+        }
+
+        public GridRegion RegionData2RegionInfo(RegionData rdata)
+        {
+            GridRegion rinfo = new GridRegion(rdata.Data);
+            rinfo.RegionLocX = rdata.posX;
+            rinfo.RegionLocY = rdata.posY;
+            rinfo.RegionID = rdata.RegionID;
+            rinfo.RegionName = rdata.RegionName;
+            rinfo.ScopeID = rdata.ScopeID;
+
+            return rinfo;
+        }
+
+        #endregion
+
+        public List<GridRegion> GetDefaultRegions(UUID scopeID)
+        {
+            List<GridRegion> ret = new List<GridRegion>();
+
+            List<RegionData> regions = m_Database.GetDefaultRegions(scopeID);
+
+            foreach (RegionData r in regions)
+            {
+                if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
+                    ret.Add(RegionData2RegionInfo(r));
+            }
+
+            m_log.DebugFormat("[GRID SERVICE]: GetDefaultRegions returning {0} regions", ret.Count);
+            return ret;
+        }
+
+        public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
+        {
+            List<GridRegion> ret = new List<GridRegion>();
+
+            List<RegionData> regions = m_Database.GetFallbackRegions(scopeID, x, y);
+
+            foreach (RegionData r in regions)
+            {
+                if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
+                    ret.Add(RegionData2RegionInfo(r));
+            }
+
+            m_log.DebugFormat("[GRID SERVICE]: Fallback returned {0} regions", ret.Count);
+            return ret;
+        }
+
+        public int GetRegionFlags(UUID scopeID, UUID regionID)
+        {
+            RegionData region = m_Database.Get(regionID, scopeID);
+
+            if (region != null)
+            {
+                int flags = Convert.ToInt32(region.Data["flags"]);
+                //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags);
+                return flags;
+            }
+            else
+                return -1;
+        }
+
+        private void HandleShowRegion(string module, string[] cmd)
+        {
+            if (cmd.Length != 3)
+            {
+                MainConsole.Instance.Output("Syntax: show region <region name>");
+                return;
+            }
+            List<RegionData> regions = m_Database.Get(cmd[2], UUID.Zero);
+            if (regions == null || regions.Count < 1)
+            {
+                MainConsole.Instance.Output("Region not found");
+                return;
+            }
+
+            MainConsole.Instance.Output("Region Name          Region UUID");
+            MainConsole.Instance.Output("Location             URI");
+            MainConsole.Instance.Output("Owner ID                                Flags");
+            MainConsole.Instance.Output("-------------------------------------------------------------------------------");
+            foreach (RegionData r in regions)
+            {
+                OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
+                MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n",
+                        r.RegionName, r.RegionID,
+                        String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(),
+                        r.Data["owner_uuid"].ToString(), flags.ToString()));
+            }
+            return;
+        }
+
+        private int ParseFlags(int prev, string flags)
+        {
+            OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev;
+
+            string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
+
+            foreach (string p in parts)
+            {
+                int val;
+
+                try
+                {
+                    if (p.StartsWith("+"))
+                    {
+                        val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1));
+                        f |= (OpenSim.Data.RegionFlags)val;
+                    }
+                    else if (p.StartsWith("-"))
+                    {
+                        val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1));
+                        f &= ~(OpenSim.Data.RegionFlags)val;
+                    }
+                    else
+                    {
+                        val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p);
+                        f |= (OpenSim.Data.RegionFlags)val;
+                    }
+                }
+                catch (Exception)
+                {
+                    MainConsole.Instance.Output("Error in flag specification: " + p);
+                }
+            }
+
+            return (int)f;
+        }
+
+        private void HandleSetFlags(string module, string[] cmd)
+        {
+            if (cmd.Length < 5)
+            {
+                MainConsole.Instance.Output("Syntax: set region flags <region name> <flags>");
+                return;
+            }
+
+            List<RegionData> regions = m_Database.Get(cmd[3], UUID.Zero);
+            if (regions == null || regions.Count < 1)
+            {
+                MainConsole.Instance.Output("Region not found");
+                return;
+            }
+
+            foreach (RegionData r in regions)
+            {
+                int flags = Convert.ToInt32(r.Data["flags"]);
+                flags = ParseFlags(flags, cmd[4]);
+                r.Data["flags"] = flags.ToString();
+                OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags;
+
+                MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f));
+                m_Database.Store(r);
+            }
+        }
+    }
+}


Changed GetRegionByHandle to GetRegionByPosition -- more generic.

--- OpenSim/Services/Interfaces/IGridService.cs
+++ OpenSim/Services/Interfaces/IGridService.cs
@@ -59,7 +59,7 @@

         SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID);

-        SimpleRegionInfo GetRegionByHandle(UUID scopeID, ulong regionHandle);
+        SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y);

         SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName);


Fix possible exceptions in Reflection helper.

--- TwitchPlaysAssembly/Src/Helpers/ReflectionHelper.cs
+++ TwitchPlaysAssembly/Src/Helpers/ReflectionHelper.cs
@@ -1,15 +1,33 @@
 using System;
+using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;

 public static class ReflectionHelper
 {
     public static Type FindType(string fullName)
     {
-        return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).FirstOrDefault(t => t.FullName.Equals(fullName));
+        return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetSafeTypes()).FirstOrDefault(t => t.FullName != null && t.FullName.Equals(fullName));
     }

     public static Type FindType(string fullName, string assemblyName)
     {
-        return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).FirstOrDefault(t => t.FullName.Equals(fullName) && t.Assembly.GetName().Name.Equals(assemblyName));
+        return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetSafeTypes()).FirstOrDefault(t => t.FullName != null && t.FullName.Equals(fullName) && t.Assembly.GetName().Name.Equals(assemblyName));
     }
+
+	private static IEnumerable<Type> GetSafeTypes(this Assembly assembly)
+	{
+		try
+		{
+			return assembly.GetTypes();
+		}
+		catch (ReflectionTypeLoadException e)
+		{
+			return e.Types.Where(x => x != null);
+		}
+		catch (Exception)
+		{
+			return new List<Type>();
+		}
+	}
 }


Added a new constructor taking a string as an argument


Change Functions for Methods in labels

Change Functions for Methods in labels

--- UnitTestUsefullFunctions/UnitTestFunctionsString.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionsString.cs
@@ -19,21 +19,21 @@
 */

 using Microsoft.VisualStudio.TestTools.UnitTesting;
-using StringFunc = FonctionsUtiles.Fred.Csharp.FunctionsString;
-using MathFunc = FonctionsUtiles.Fred.Csharp.FunctionsMath;
-using UsefulFunc = FonctionsUtiles.Fred.Csharp.FunctionsDateTime;
+using StringFunc = FonctionsUtiles.Fred.Csharp.MethodsString;
+using MathFunc = FonctionsUtiles.Fred.Csharp.MethodsMath;
+using UsefulFunc = FonctionsUtiles.Fred.Csharp.MethodsDateTime;
 using System.Collections.Generic;
 using System;
 using System.Globalization;

-namespace UnitTestUsefullFunctions
+namespace UnitTestUsefullMethods
 {
   [TestClass]
-  public class UnitTestFunctionsString
+  public class UnitTestMethodsString
   {

-    #region Math functions
-    #region Math functions - Factorial
+    #region Math Methods
+    #region Math Methods - Factorial
     [TestMethod]
     public void TestMethod_Factorial_one()
     {
@@ -208,8 +208,8 @@
       long result = MathFunc.Factorial(10, 8);
       Assert.IsTrue(result == 90);
     }
-    #endregion Math functions - Factorial
-    #region Math functions - Recursive Factorial
+    #endregion Math Methods - Factorial
+    #region Math Methods - Recursive Factorial
     // **********************Recursive Factorial****************
     [TestMethod]
     public void TestMethod_RecursiveFactorial_one()
@@ -371,8 +371,8 @@
       ulong result = MathFunc.RecursiveFactorial(0);
       Assert.IsTrue(result == 0);
     }
-    #endregion Math functions - Recursive Factorial
-    #region Math functions - Sommielle
+    #endregion Math Methods - Recursive Factorial
+    #region Math Methods - Sommielle
     // **********************Sommielle****************
     [TestMethod]
     public void TestMethod_Sommielle_zero()
@@ -443,8 +443,8 @@
       long result = MathFunc.Sommielle(0, 150);
       Assert.IsTrue(result == 11325);
     }
-    #endregion Math functions - Sommielle
-    #region Math functions - Sommielle Recursive
+    #endregion Math Methods - Sommielle
+    #region Math Methods - Sommielle Recursive
     // **********************Sommielle Recursive****************
     [TestMethod]
     public void TestMethod_SommielleRecursive_zero()
@@ -508,11 +508,11 @@
       long result = MathFunc.SommielleRecursive(0, 100);
       Assert.IsTrue(result == 5050);
     }
-    #endregion Math functions - Sommielle Recursive
+    #endregion Math Methods - Sommielle Recursive
     #endregion
-    #region String Functions
-
-    //**********************String Functions***************
+    #region String Methods
+
+    //**********************String Methods***************
     [TestMethod]
     public void TestMethod_HasDuplicate_no_on_One_item()
     {
@@ -3478,12 +3478,12 @@
     }
     #endregion

-    #region Files Functions
-    #endregion Files Functions
-
-    #region Useful Functions
-    #region IsMorning Functions
-    //**********************IsMorning Functions***************
+    #region Files Methods
+    #endregion Files Methods
+
+    #region Useful Methods
+    #region IsMorning Methods
+    //**********************IsMorning Methods***************
     [TestMethod]
     public void TestMethod_IsMorning_true()
     {
@@ -3510,9 +3510,9 @@
       bool result = UsefulFunc.IsMorning(source);
       Assert.AreEqual(result, expected);
     }
-    #endregion IsMorning Functions
-    #region OutsideWeekEnd Functions
-    //**********************OutsideWeekEnd Functions***************
+    #endregion IsMorning Methods
+    #region OutsideWeekEnd Methods
+    //**********************OutsideWeekEnd Methods***************

     [TestMethod]
     public void TestMethod_OutsideWeekEnd_false()
@@ -3560,7 +3560,7 @@
     }

     //**********************IsWeekEnd Methods***************
-    #region IsWeekEnd Functions
+    #region IsWeekEnd Methods
     [TestMethod]
     public void TestMethod_IsWeekEnd_true()
     {
@@ -3605,10 +3605,10 @@
       bool result = UsefulFunc.IsWeekEnd(source);
       Assert.AreEqual(result, expected);
     }
-    #endregion IsWeekEnd Functions
-    //**********************DateToByteArray Functions***************
-
-    #endregion OutsideWeekEnd Functions
-    #endregion Useful Functions
+    #endregion IsWeekEnd Methods
+    //**********************DateToByteArray Methods***************
+
+    #endregion OutsideWeekEnd Methods
+    #endregion Useful Methods
   }
 }


Fixed test ToIEnumTest that had failing condition

--- UnitTests/Core/Extensions/InteropExtensionsTests.cs
+++ UnitTests/Core/Extensions/InteropExtensionsTests.cs
@@ -205,7 +205,7 @@
 			Assert.That(v, Is.EqualTo(14));

 			Assert.That(((IntPtr)h).ToIEnum<int>(0, i), Is.Empty);
-			Assert.That(IntPtr.Zero.ToIEnum<int>(3, i), Is.Empty);
+			Assert.That(IntPtr.Zero.ToIEnum<int>(0, i), Is.Empty);
 		}

 		[Test()]


20071121 Foole

20071121 Foole

- MpqArchive.Init now handles invalid blocktable sizes better (Issue 10)


Enable possibility to add multiple spawn points

--- Unity/zapper-shooter/Assets/Scripts/EnemySpawner.cs
+++ Unity/zapper-shooter/Assets/Scripts/EnemySpawner.cs
@@ -31,9 +31,18 @@
     }

     bool canSpawnHere (Transform point) {
-        //Debug code. TODO loop all monsters and check that their location is over threshold from point
+        // Make sure we don't spawn two monsters to same spawn position
         //TODO make sure we don't spawn enemies when we can see them.
-        return m_zombies.Count < 1;
+        Vector3 pos = point.position;
+        foreach (GameObject zombie in m_zombies) {
+            Vector3 zombiePos = zombie.transform.position;
+            float distance = (zombiePos - pos).magnitude;
+            if ( distance < 0.1) {
+                Debug.Log("Cannot spawn zombie to " + pos + " since nearest zombie distance is " + distance);
+                return false;
+            }
+        }
+        return true;
     }

     void createRandomZombie() {


In hands plasma refill

In hands plasma refill


Change clamptoedge to repeat for entity textures

--- Voxalia/ClientGame/GraphicsSystems/TextureEngine.cs
+++ Voxalia/ClientGame/GraphicsSystems/TextureEngine.cs
@@ -256,8 +256,8 @@
             bmp.UnlockBits(bmp_data);
             GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
             GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
-            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
-            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
+            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
+            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);
             GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureCompareMode, (int)TextureCompareMode.CompareRefToTexture);
         }


Added JavaScript Syntax Highlighting Added ComboBox Menu

--- WindowsEnhancmentSuite/Factories/CodeHighlighter.cs
+++ WindowsEnhancmentSuite/Factories/CodeHighlighter.cs
@@ -42,12 +42,39 @@
             var contextMenuStrip = new ContextMenuStrip();
             contextMenuStrip.Items.Add("Select all", null, (sender, args) => scintilla.SelectAll());
             contextMenuStrip.Items.Add("-");
+            contextMenuStrip.Items.Add("Cut", null, (sender, args) => scintilla.Cut());
+            contextMenuStrip.Items.Add("Copy", null, (sender, args) => scintilla.Copy());
+            contextMenuStrip.Items.Add("Paste", null, (sender, args) => scintilla.Paste());
+            contextMenuStrip.Items.Add("-");

             // Syntax-Highlight-Sprachen hinzufügen
-            contextMenuStrip.Items.Add("None", null, (sender, args) => scintilla.SetNone());
-            contextMenuStrip.Items.Add("C# / C++", null, (sender, args) => scintilla.SetCpp());
-            contextMenuStrip.Items.Add("Delphi", null, (sender, args) => scintilla.SetDelphi());
+            var lexerSelectorMenu = new ToolStripComboBox("Syntax") {DropDownStyle = ComboBoxStyle.DropDownList};
+            lexerSelectorMenu.Items.Add("None");
+            lexerSelectorMenu.Items.Add("C# / C++");
+            lexerSelectorMenu.Items.Add("Delphi");
+            lexerSelectorMenu.Items.Add("JavaScript");

+            lexerSelectorMenu.SelectedIndex = 0;
+            lexerSelectorMenu.DropDownClosed += (sender, args) =>
+            {
+                switch (lexerSelectorMenu.SelectedIndex)
+                {
+                    case 0:
+                        scintilla.SetNone();
+                        break;
+                    case 1:
+                        scintilla.SetCpp();
+                        break;
+                    case 2:
+                        scintilla.SetDelphi();
+                        break;
+                    case 3:
+                        scintilla.SetJs();
+                        break;
+                }
+            };
+
+            contextMenuStrip.Items.Add(lexerSelectorMenu);
             scintilla.ContextMenuStrip = contextMenuStrip;
         }

@@ -60,21 +87,57 @@
             scintilla.StyleClearAll();
         }

-        private static void ConfigureLexer(this Scintilla scintilla)
+        private static void ConfigureLexer(this Scintilla scintilla, LexerStyle lexerStyle)
         {
-            scintilla.Styles[Style.Cpp.Default].ForeColor = Color.Black;
-            scintilla.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0);
-            scintilla.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0);
-            scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128);
-            scintilla.Styles[Style.Cpp.Number].ForeColor = Color.LightSeaGreen;
-            scintilla.Styles[Style.Cpp.Word].ForeColor = Color.Blue;
-            scintilla.Styles[Style.Cpp.Word2].ForeColor = Color.LightSkyBlue;
-            scintilla.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21);
-            scintilla.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21);
-            scintilla.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21);
-            scintilla.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
-            scintilla.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
-            scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Crimson;
+            switch (lexerStyle)
+            {
+                case LexerStyle.CSharp:
+                    scintilla.Styles[Style.Cpp.Default].ForeColor = Color.Black;
+                    scintilla.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0);
+                    scintilla.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0);
+                    scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128);
+                    scintilla.Styles[Style.Cpp.Number].ForeColor = Color.LightSeaGreen;
+                    scintilla.Styles[Style.Cpp.Word].ForeColor = Color.Blue;
+                    scintilla.Styles[Style.Cpp.Word2].ForeColor = Color.LightSkyBlue;
+                    scintilla.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
+                    scintilla.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
+                    scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Crimson;
+                    break;
+                case LexerStyle.Delphi:
+                    scintilla.Styles[Style.Cpp.Default].ForeColor = Color.Black;
+                    scintilla.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0);
+                    scintilla.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0);
+                    scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128);
+                    scintilla.Styles[Style.Cpp.Number].ForeColor = Color.LightSeaGreen;
+                    scintilla.Styles[Style.Cpp.Word].ForeColor = Color.DarkBlue;
+                    scintilla.Styles[Style.Cpp.Word2].ForeColor = Color.Blue;
+                    scintilla.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
+                    scintilla.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
+                    scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Crimson;
+                    break;
+                case LexerStyle.JavaScript:
+                    scintilla.Styles[Style.Cpp.Default].ForeColor = Color.Black;
+                    scintilla.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0);
+                    scintilla.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0);
+                    scintilla.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128);
+                    scintilla.Styles[Style.Cpp.Number].ForeColor = Color.LightSeaGreen;
+                    scintilla.Styles[Style.Cpp.Word].ForeColor = Color.DarkOrange;
+                    scintilla.Styles[Style.Cpp.Word2].ForeColor = Color.Gold;
+                    scintilla.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21);
+                    scintilla.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
+                    scintilla.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
+                    scintilla.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Crimson;
+                    break;
+            }
+
         }

         private static void SetNone(this Scintilla scintilla)
@@ -85,21 +148,36 @@

         private static void SetCpp(this Scintilla scintilla)
         {
-            scintilla.ConfigureLexer();
+            scintilla.ConfigureLexer(LexerStyle.CSharp);
             scintilla.Lexer = Lexer.Cpp;

-            scintilla.SetKeywords(0, "abstract as base break case catch checked continue default delegate do else enum event explicit extern false finally fixed for foreach goto if implicit in interface internal is lock namespace new null object operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw true try typeof unchecked unsafe using virtual void while");
-            scintilla.SetKeywords(1, "bool byte char class const decimal double float int long sbyte short static string struct uint ulong ushort var");
+            scintilla.SetKeywords(0, "abstract as base bool break byte case catch char checked class const continue default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void volatile while");
+            scintilla.SetKeywords(1, "decimal var");
         }

         private static void SetDelphi(this Scintilla scintilla)
         {
-            scintilla.ConfigureLexer();
+            scintilla.ConfigureLexer(LexerStyle.Delphi);
             scintilla.Lexer = Lexer.Cpp;
-            //scintilla.LexerLanguage = "pascal";

-            scintilla.SetKeywords(0, "begin break case checked continue create default delegate do else end except false finally for goto if implementation in interface is nil of overload private protected public published return self true try type unit uses var with");
-            scintilla.SetKeywords(1, "array bool byte char class const decimal double float integer string");
+            scintilla.SetKeywords(0, "and array as begin case class const constructor destructor div do downto else end except file finally for function goto if implementation in inherited interface is mod not object of on or packed procedure program property raise record repeat set shl shr then threadvar to try type unit until uses var while with xor");
+            scintilla.SetKeywords(1, "bool byte double float integer string");
+        }
+
+        private static void SetJs(this Scintilla scintilla)
+        {
+            scintilla.ConfigureLexer(LexerStyle.JavaScript);
+            scintilla.Lexer = Lexer.Cpp;
+
+            scintilla.SetKeywords(0, "abstract arguments boolean break byte case catch char class const continue debugger default delete do double else enum eval export extends false final finally float for function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with yield");
+            scintilla.SetKeywords(1, "array date hasOwnProperty infinity isFinite isNaN isPrototypeOf length math NaN name number object prototype string toString undefined valueOf");
+        }
+
+        private enum LexerStyle
+        {
+            CSharp,
+            Delphi,
+            JavaScript
         }
     }
 }


Change SkillTooltip width to 430 (KMS 1.2.341)

--- WzComparerR2/CharaSimControl/SkillTooltipRender2.cs
+++ WzComparerR2/CharaSimControl/SkillTooltipRender2.cs
@@ -38,14 +38,14 @@

             int picHeight;
             Bitmap originBmp = RenderSkill(out picHeight);
-            Bitmap tooltip = new Bitmap(290, picHeight);
+            Bitmap tooltip = new Bitmap(430, picHeight);
             Graphics g = Graphics.FromImage(tooltip);

             //绘制背景区域
             GearGraphics.DrawNewTooltipBack(g, 0, 0, tooltip.Width, tooltip.Height);

             //复制图像
-            g.DrawImage(originBmp, 0, 0, new Rectangle(0, 0, 290, picHeight), GraphicsUnit.Pixel);
+            g.DrawImage(originBmp, 0, 0, new Rectangle(0, 0, 430, picHeight), GraphicsUnit.Pixel);

             //左上角
             g.DrawImage(Resource.UIToolTip_img_Item_Frame2_cover, 3, 3);
@@ -64,7 +64,7 @@

         private Bitmap RenderSkill(out int picH)
         {
-            Bitmap bitmap = new Bitmap(290, DefaultPicHeight);
+            Bitmap bitmap = new Bitmap(430, DefaultPicHeight);
             Graphics g = Graphics.FromImage(bitmap);
             StringFormat format = (StringFormat)StringFormat.GenericDefault.Clone();
             picH = 0;
@@ -94,21 +94,21 @@
             //绘制desc
             picH = 35;
             if (Skill.HyperStat)
-                GearGraphics.DrawString(g, "[최대 레벨 : " + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, 10, 274, ref picH, 16);
+                GearGraphics.DrawString(g, "[최대 레벨 : " + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, 10, 414, ref picH, 16);
             else if (!Skill.PreBBSkill)
-                GearGraphics.DrawString(g, "[마스터 레벨 : " + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, 92, 274, ref picH, 16);
+                GearGraphics.DrawString(g, "[마스터 레벨 : " + Skill.MaxLevel + "]", GearGraphics.ItemDetailFont2, 92, 414, ref picH, 16);

             if (sr.Desc != null)
             {
                 string hdesc = SummaryParser.GetSkillSummary(sr.Desc, Skill.Level, Skill.Common, SummaryParams.Default);
                 //string hStr = SummaryParser.GetSkillSummary(skill, skill.Level, sr, SummaryParams.Default);
-                GearGraphics.DrawString(g, hdesc, GearGraphics.ItemDetailFont2, Skill.Icon.Bitmap == null ? 10 : 92, 274, ref picH, 16);
+                GearGraphics.DrawString(g, hdesc, GearGraphics.ItemDetailFont2, Skill.Icon.Bitmap == null ? 10 : 92, 414, ref picH, 16);
             }
             if (Skill.TimeLimited)
             {
                 DateTime time = DateTime.Now.AddDays(7d);
                 string expireStr = time.ToString("유효기간 : yyyy년 M월 d일 HH시 mm분");
-                GearGraphics.DrawString(g, "#c" + expireStr + "#", GearGraphics.ItemDetailFont2, Skill.Icon.Bitmap == null ? 10 : 92, 274, ref picH, 16);
+                GearGraphics.DrawString(g, "#c" + expireStr + "#", GearGraphics.ItemDetailFont2, Skill.Icon.Bitmap == null ? 10 : 92, 414, ref picH, 16);
             }
             if (Skill.RelationSkill != null)
             {
@@ -120,7 +120,7 @@
                 }
                 DateTime time = DateTime.Now.AddMinutes(Skill.RelationSkill.Item2);
                 string expireStr = time.ToString("유효기간 : yyyy년 M월 d일 H시 m분");
-                GearGraphics.DrawString(g, "#c" + sr2.Name + "의 " + expireStr + "#", GearGraphics.ItemDetailFont2, Skill.Icon.Bitmap == null ? 10 : 92, 274, ref picH, 16);
+                GearGraphics.DrawString(g, "#c" + sr2.Name + "의 " + expireStr + "#", GearGraphics.ItemDetailFont2, Skill.Icon.Bitmap == null ? 10 : 92, 414, ref picH, 16);
             }
             /*if (Skill.ReqLevel > 0)
             {
@@ -133,43 +133,43 @@

             //分割线
             picH = Math.Max(picH, 114);
-            g.DrawLine(Pens.White, 6, picH, 283, picH);
+            g.DrawLine(Pens.White, 6, picH, 423, picH);
             picH += 9;

             if (Skill.Level > 0)
             {
                 string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level, sr, SummaryParams.Default);
-                GearGraphics.DrawString(g, "[현재레벨 " + Skill.Level + "]", GearGraphics.ItemDetailFont, 10, 272, ref picH, 16);
+                GearGraphics.DrawString(g, "[현재레벨 " + Skill.Level + "]", GearGraphics.ItemDetailFont, 10, 412, ref picH, 16);
                 if (Skill.SkillID / 10000 / 1000 == 10 && Skill.Level == 1 && Skill.ReqLevel > 0)
                 {
-                    GearGraphics.DrawPlainText(g, "[필요 레벨: " + Skill.ReqLevel.ToString() + "레벨 이상]", GearGraphics.ItemDetailFont2, GearGraphics.skillYellowColor, 10, 272, ref picH, 16);
+                    GearGraphics.DrawPlainText(g, "[필요 레벨: " + Skill.ReqLevel.ToString() + "레벨 이상]", GearGraphics.ItemDetailFont2, GearGraphics.skillYellowColor, 10, 412, ref picH, 16);
                 }
                 if (hStr != null)
                 {
-                    GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 10, 272, ref picH, 16);
+                    GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 10, 412, ref picH, 16);
                 }
             }

             if (Skill.Level < Skill.MaxLevel && !Skill.DisableNextLevelInfo)
             {
                 string hStr = SummaryParser.GetSkillSummary(Skill, Skill.Level + 1, sr, SummaryParams.Default);
-                GearGraphics.DrawString(g, "[다음레벨 " + (Skill.Level + 1) + "]", GearGraphics.ItemDetailFont, 10, 272, ref picH, 16);
+                GearGraphics.DrawString(g, "[다음레벨 " + (Skill.Level + 1) + "]", GearGraphics.ItemDetailFont, 10, 412, ref picH, 16);
                 if (Skill.SkillID / 10000 / 1000 == 10 && (Skill.Level + 1) == 1 && Skill.ReqLevel > 0)
                 {
-                    GearGraphics.DrawPlainText(g, "[필요 레벨: " + Skill.ReqLevel.ToString() + "레벨 이상]", GearGraphics.ItemDetailFont2, GearGraphics.skillYellowColor, 10, 272, ref picH, 16);
+                    GearGraphics.DrawPlainText(g, "[필요 레벨: " + Skill.ReqLevel.ToString() + "레벨 이상]", GearGraphics.ItemDetailFont2, GearGraphics.skillYellowColor, 10, 412, ref picH, 16);
                 }
                 if (hStr != null)
                 {
-                    GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 10, 272, ref picH, 16);
+                    GearGraphics.DrawString(g, hStr, GearGraphics.ItemDetailFont2, 10, 412, ref picH, 16);
                 }
             }
             picH += 3;

             if (Skill.AddAttackToolTipDescSkill != 0)
             {
-                g.DrawLine(Pens.White, 6, picH, 283, picH);
+                g.DrawLine(Pens.White, 6, picH, 423, picH);
                 picH += 9;
-                GearGraphics.DrawPlainText(g, "[콤비네이션 스킬]", GearGraphics.ItemDetailFont, Color.FromArgb(119, 204, 255), 10, 272, ref picH, 16);
+                GearGraphics.DrawPlainText(g, "[콤비네이션 스킬]", GearGraphics.ItemDetailFont, Color.FromArgb(119, 204, 255), 10, 412, ref picH, 16);
                 BitmapOrigin icon = new BitmapOrigin();
                 Wz_Node skillNode = PluginBase.PluginManager.FindWz(string.Format(@"Skill\{0}.img\skill\{1}", Skill.AddAttackToolTipDescSkill / 10000, Skill.AddAttackToolTipDescSkill));
                 if (skillNode != null)
@@ -191,16 +191,16 @@
                     skillName = Skill.AddAttackToolTipDescSkill.ToString();
                 }
                 picH += 10;
-                GearGraphics.DrawString(g, skillName, GearGraphics.ItemDetailFont, 46, 272, ref picH, 16);
+                GearGraphics.DrawString(g, skillName, GearGraphics.ItemDetailFont, 46, 412, ref picH, 16);
                 picH += 6;
                 picH += 8;
             }

             if (Skill.AssistSkillLink != 0)
             {
-                g.DrawLine(Pens.White, 6, picH, 283, picH);
+                g.DrawLine(Pens.White, 6, picH, 423, picH);
                 picH += 9;
-                GearGraphics.DrawPlainText(g, "[어시스트 스킬]", GearGraphics.ItemDetailFont, ((SolidBrush)GearGraphics.OrangeBrush).Color, 10, 272, ref picH, 16);
+                GearGraphics.DrawPlainText(g, "[어시스트 스킬]", GearGraphics.ItemDetailFont, ((SolidBrush)GearGraphics.OrangeBrush).Color, 10, 412, ref picH, 16);
                 BitmapOrigin icon = new BitmapOrigin();
                 Wz_Node skillNode = PluginBase.PluginManager.FindWz(string.Format(@"Skill\{0}.img\skill\{1}", Skill.AssistSkillLink / 10000, Skill.AssistSkillLink));
                 if (skillNode != null)
@@ -222,7 +222,7 @@
                     skillName = Skill.AssistSkillLink.ToString();
                 }
                 picH += 10;
-                GearGraphics.DrawString(g, skillName, GearGraphics.ItemDetailFont, 46, 272, ref picH, 16);
+                GearGraphics.DrawString(g, skillName, GearGraphics.ItemDetailFont, 46, 412, ref picH, 16);
                 picH += 6;
                 picH += 8;
             }
@@ -289,11 +289,11 @@

             if (skillDescEx.Count > 0)
             {
-                g.DrawLine(Pens.White, 6, picH, 283, picH);
+                g.DrawLine(Pens.White, 6, picH, 423, picH);
                 picH += 9;
                 foreach (var descEx in skillDescEx)
                 {
-                    GearGraphics.DrawString(g, descEx, GearGraphics.ItemDetailFont, 10, 272, ref picH, 16);
+                    GearGraphics.DrawString(g, descEx, GearGraphics.ItemDetailFont, 10, 412, ref picH, 16);
                 }
                 picH += 3;
             }


Improving lyrics video blacklist

Improving lyrics video blacklist

--- YouTubePlaylistBuilder.Services/YouTubeApiHelper.cs
+++ YouTubePlaylistBuilder.Services/YouTubeApiHelper.cs
@@ -22,11 +22,12 @@
         private static readonly List<string> IgnoreList = new List<string>
         {
             "(Audio)",
+            "(Lyric Video)",
+            "(Official Lyric Video)",
+            "(official lyric video)",
             "[AUDIO]",
             "(ШУРЫГИНА ПАРОДИЯ)",
             "лирик-видео",
-            "(official lyric video)",
-            "(Lyric Video)",
         };

         public async Task<Chart> GetYouTubeVideoIds(Chart chart)


not delay new session start if first session info

--- acplugins4net/acPlugins4net/AcServerPluginManager.cs
+++ acplugins4net/acPlugins4net/AcServerPluginManager.cs
@@ -927,7 +927,8 @@
             {
                 this.nextSessionStarting = msg;

-                if (NewSessionStartDelay > 0)
+                bool firstSessionInfo = this.currentSession.SessionType == 0;
+                if (!firstSessionInfo && NewSessionStartDelay > 0)
                 {
                     ThreadPool.QueueUserWorkItem(o =>
                     {


Fix: HasChanges is set to true after adding a new folder asset.


remove bst

remove bst

--- VisualTree/TreeConsole/Program.cs
+++ VisualTree/TreeConsole/Program.cs
@@ -9,23 +9,23 @@
 {
     class Program
     {
-        static readonly int numberOfNumbers = 1000;
+        static readonly int numberOfNumbers = 100000;
         static void Main(string[] args)
         {
             int[] inputArray = new int[numberOfNumbers];
-            BinarySearchTree bst = new BinarySearchTree();
+            //BinarySearchTree bst = new BinarySearchTree();
             AvlTree<int, int> avlTree = new AvlTree<int, int>();
             RedBlackTree redBlackTree = new RedBlackTree("rbTree");
             TwoThreeTree twoThreeTree = new TwoThreeTree(numberOfNumbers);
             for (int i = 1; i <= numberOfNumbers; i++)
             {
-                bst.Add(i);
+                //bst.Add(i);
                 avlTree.Insert(i, i);
                 redBlackTree.Add(i, i);
                 twoThreeTree.InsertTwoThree(i.ToString());
             }
-            bst.Contains(0);
-            Console.WriteLine("Binary seach tree has {0} comparison steps for {1} items", StepCounter.ComparisonStep, numberOfNumbers);
+            //bst.Contains(0);
+            //Console.WriteLine("Binary seach tree has {0} comparison steps for {1} items", StepCounter.ComparisonStep, numberOfNumbers);
             avlTree.Contains(0);
             Console.WriteLine("AVL tree has {0} comparison steps for {1} items", StepCounter.ComparisonStep, numberOfNumbers);
             redBlackTree.Contains(0);


Transmission boost for solar collector

Transmission boost for solar collector

--- Source/DMSolarCollector.cs
+++ Source/DMSolarCollector.cs
@@ -36,5 +36,19 @@
 			base.retractEvent();
 		}

+		protected override void onComplete(ScienceData data)
+		{
+			data.transmitValue = 0.7f;
+			data.labBoost = 2.5f;
+			base.onComplete(data);
+		}
+
+		protected override void onInitialComplete(ScienceData data)
+		{
+			data.transmitValue = 0.7f;
+			data.labBoost = 2.5f;
+			base.onInitialComplete(data);
+		}
+
 	}
 }


slojih i razdelitel

slojih i razdelitel


Cleanup: all loading using the same method.

--- ExcelMerge/FormMain.cs
+++ ExcelMerge/FormMain.cs
@@ -72,8 +72,8 @@
         {
             try
             {
-                var inputs1 = ProcessInputFile1(textBoxInput1.Text);
-                var inputs2 = ProcessInputFile2(textBoxInput2.Text);
+                var inputs1 = ProcessInputFile(textBoxInput1.Text);
+                var inputs2 = ProcessInputFile(textBoxInput2.Text);

                 _resultOutput = new List<OutputData>();
                 foreach (var input1 in inputs1)
@@ -102,47 +102,33 @@
             }
         }

-        #region Input file 2
-        private Dictionary<string, InputData> ProcessInputFile2(string filename)
-        {
-            var input = new Dictionary<string, InputData>();
-            using (var strm = new System.IO.FileStream(filename, System.IO.FileMode.Open))
-            {
-                IWorkbook workbook = new XSSFWorkbook(strm);
-                ISheet sheetSrc = workbook.GetSheet("Sheet1");
-                ValidateFirstRow(sheetSrc);
-
-                for (int rownum = 1; rownum < sheetSrc.PhysicalNumberOfRows; ++rownum)
-                {
-                    var row = (XSSFRow)sheetSrc.GetRow(rownum);
-                    InputData data = ProcessInputRow(row);
-                    if (data != null)
-                    {
-                        input.Add(data.Sifra, data);
-                    }
-                }
-            }
-            return input;
-        }
-        #endregion
-
-        #region Input file 1
-        private Dictionary<string, InputData> ProcessInputFile1(string filename)
+        #region Input file processing
+        private Dictionary<string, InputData> ProcessInputFile(string filename)
         {
             var input1 = new Dictionary<string, InputData>();
             using (var strm = new System.IO.FileStream(filename, System.IO.FileMode.Open))
             {
                 IWorkbook workbook = new XSSFWorkbook(strm);
-                ISheet sheetSrc = workbook.GetSheet("Sheet1");
-                ValidateFirstRow(sheetSrc);
-
-                for (int rownum = 1; rownum < sheetSrc.PhysicalNumberOfRows; ++rownum)
-                {
-                    var row = (XSSFRow)sheetSrc.GetRow(rownum);
-                    InputData data = ProcessInputRow(row);
-                    if (data != null)
+                ISheet sheetSrc = workbook.GetSheetAt(0);
+                if (sheetSrc == null)
+                {
+                    MessageBox.Show("Neuspješno dohvaćanje lista iz tablice", "Greška!", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                }
+                else
+                {
+                    ValidateFirstRow(sheetSrc);
+
+                    for (int rownum = 1; rownum < sheetSrc.PhysicalNumberOfRows; ++rownum)
                     {
-                        input1.Add(data.Sifra, data);
+                        var row = (XSSFRow)sheetSrc.GetRow(rownum);
+                        if (row != null)
+                        {
+                            InputData data = ProcessInputRow(row);
+                            if (data != null)
+                            {
+                                input1.Add(data.Sifra, data);
+                            }
+                        }
                     }
                 }
             }
@@ -186,6 +172,10 @@
         {
             IRow firstRow = sheetSrc.GetRow(0);

+            if (firstRow == null)
+            {
+                throw new Exception("Prvi list u tablici nema redaka.");
+            }
             if (firstRow.Cells[0].StringCellValue != "Sifra")
             {
                 throw new Exception(String.Format("Prvi stupac prve datoteke mora sadržavati šifre, a ne {0}", firstRow.Cells[0].StringCellValue));


(doc) Modify Wyam build/publish settings

To remove the virtual directory that is being used, in favour of running
directly out of the root of GitHub pages.

--- build/wyam.cake
+++ build/wyam.cake
@@ -17,11 +17,9 @@
         Preview = true,
         Watch = true,
         ConfigurationFile = MakeAbsolute((FilePath)"config.wyam"),
-        PreviewVirtualDirectory = "GitVersion",
         Settings = new Dictionary<string, object>
         {
             { "Host",  "gittools.github.io" },
-            { "LinkRoot",  "GitVersion" },
             { "BaseEditUrl", "https://github.com/gittools/GitVersion/tree/master/docs/input/" },
             { "SourceFiles", MakeAbsolute(parameters.Paths.Directories.Source) + "/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs" },
             { "Title", "GitVersion" },
@@ -42,11 +40,8 @@
         OutputPath = MakeAbsolute(Directory("artifacts/Documentation")),
         RootPath = MakeAbsolute(Directory("docs")),
         ConfigurationFile = MakeAbsolute((FilePath)"config.wyam"),
-        PreviewVirtualDirectory = "GitVersion",
         Settings = new Dictionary<string, object>
         {
-            { "Host",  "gittools.github.io" },
-            { "LinkRoot",  "GitVersion" },
             { "BaseEditUrl", "https://github.com/gittools/GitVersion/tree/master/docs/input/" },
             { "SourceFiles", MakeAbsolute(parameters.Paths.Directories.Source) + "/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs" },
             { "Title", "GitVersion" },
@@ -98,11 +93,8 @@
             OutputPath = MakeAbsolute(Directory("artifacts/Documentation")),
             RootPath = MakeAbsolute(Directory("docs")),
             ConfigurationFile = MakeAbsolute((FilePath)"config.wyam"),
-            PreviewVirtualDirectory = "GitVersion",
             Settings = new Dictionary<string, object>
             {
-                { "Host",  "gittools.github.io" },
-                { "LinkRoot",  "GitVersion" },
                 { "BaseEditUrl", "https://github.com/gittools/GitVersion/tree/master/docs/input/" },
                 { "SourceFiles", MakeAbsolute(parameters.Paths.Directories.Source) + "/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs" },
                 { "Title", "GitVersion" },


Fixed unloading crashes when Bohrium was not loaded

--- bridge/cil/NumCIL.Bohrium/Utility.cs
+++ bridge/cil/NumCIL.Bohrium/Utility.cs
@@ -57,7 +57,7 @@
         /// <summary>
         /// Static destructor helper
         /// </summary>
-        private static UnloaderHelper _unloaderHelper = new UnloaderHelper();
+        private static UnloaderHelper _unloaderHelper = null;

         /// <summary>
         /// Attempts to set up Bohrium by looking for the Bohrium checkout folder.
@@ -159,6 +159,7 @@
 			Activate<System.Numerics.Complex>();

             NumCIL.UFunc.ApplyManager.RegisterHandler(new NumCIL.Bohrium.ApplyImplementor());
+			_unloaderHelper = new UnloaderHelper();
             _unloaderHelper.SetTime();
         }

@@ -167,6 +168,7 @@
         /// </summary>
         public static void Deactivate()
         {
+			_unloaderHelper = null;
             Flush();
             Deactivate<float>();
             Deactivate<double>();
@@ -181,6 +183,9 @@
 			Deactivate<bool>();
 			Deactivate<NumCIL.Complex64.DataType>();
 			Deactivate<System.Numerics.Complex>();
+
+			GC.Collect();
+			GC.WaitForPendingFinalizers();
         }

         /// <summary>


Allowed signed VerticalShift values #5

Allowed signed VerticalShift values #5

--- FfntTool/Ffnt/Glyph.cs
+++ FfntTool/Ffnt/Glyph.cs
@@ -41,7 +41,7 @@
         public byte HorizontalShift { get; set; }

         [XmlAttribute]
-        public byte VerticalShift { get; set; }
+        public sbyte VerticalShift { get; set; }

         [XmlAttribute]
         public short Unknown1 { get; set; }
@@ -70,7 +70,7 @@
             Layer = reader.ReadByte();
             HorizontalSpace = reader.ReadByte();
             HorizontalShift = reader.ReadByte();
-            VerticalShift = reader.ReadByte();
+            VerticalShift = reader.ReadSByte();
             Unknown1 = reader.ReadInt16();
             Unknown2 = reader.ReadInt32();
             // TODO: Check which unknown properties are constant zero


Fixed a bug of virtual list layout when lineGap or columnGap is negative.

--- Source/Scripts/UI/GList.cs
+++ Source/Scripts/UI/GList.cs
@@ -1384,7 +1384,7 @@
 			if (numChildren > 0 && !forceUpdate)
 			{
 				float pos2 = this.GetChildAt(0).y;
-				if (pos2 > pos)
+				if (pos2 + (_lineGap > 0 ? 0 : -_lineGap) > pos)
 				{
 					for (int i = _firstIndex - _curLineItemCount; i >= 0; i -= _curLineItemCount)
 					{
@@ -1401,15 +1401,16 @@
 				}
 				else
 				{
+					float testGap = _lineGap > 0 ? _lineGap : 0;
 					for (int i = _firstIndex; i < _realNumItems; i += _curLineItemCount)
 					{
-						float pos3 = pos2 + _virtualItems[i].size.y + _lineGap;
-						if (pos3 > pos)
+						float pos3 = pos2 + _virtualItems[i].size.y;
+						if (pos3 + testGap > pos)
 						{
 							pos = pos2;
 							return i;
 						}
-						pos2 = pos3;
+						pos2 = pos3 + _lineGap;
 					}

 					pos = pos2;
@@ -1419,15 +1420,16 @@
 			else
 			{
 				float pos2 = 0;
+				float testGap = _lineGap > 0 ? _lineGap : 0;
 				for (int i = 0; i < _realNumItems; i += _curLineItemCount)
 				{
-					float pos3 = pos2 + _virtualItems[i].size.y + _lineGap;
-					if (pos3 > pos)
+					float pos3 = pos2 + _virtualItems[i].size.y;
+					if (pos3 + testGap > pos)
 					{
 						pos = pos2;
 						return i;
 					}
-					pos2 = pos3;
+					pos2 = pos3 + _lineGap;
 				}

 				pos = pos2;
@@ -1446,7 +1448,7 @@
 			if (numChildren > 0 && !forceUpdate)
 			{
 				float pos2 = this.GetChildAt(0).x;
-				if (pos2 > pos)
+				if (pos2 + (_columnGap > 0 ? 0 : -_columnGap) > pos)
 				{
 					for (int i = _firstIndex - _curLineItemCount; i >= 0; i -= _curLineItemCount)
 					{
@@ -1463,15 +1465,16 @@
 				}
 				else
 				{
+					float testGap = _columnGap > 0 ? _columnGap : 0;
 					for (int i = _firstIndex; i < _realNumItems; i += _curLineItemCount)
 					{
-						float pos3 = pos2 + _virtualItems[i].size.x + _columnGap;
-						if (pos3 > pos)
+						float pos3 = pos2 + _virtualItems[i].size.x;
+						if (pos3 + testGap > pos)
 						{
 							pos = pos2;
 							return i;
 						}
-						pos2 = pos3;
+						pos2 = pos3 + _columnGap;
 					}

 					pos = pos2;
@@ -1481,15 +1484,16 @@
 			else
 			{
 				float pos2 = 0;
+				float testGap = _columnGap > 0 ? _columnGap : 0;
 				for (int i = 0; i < _realNumItems; i += _curLineItemCount)
 				{
-					float pos3 = pos2 + _virtualItems[i].size.x + _columnGap;
-					if (pos3 > pos)
+					float pos3 = pos2 + _virtualItems[i].size.x;
+					if (pos3 + testGap > pos)
 					{
 						pos = pos2;
 						return i;
 					}
-					pos2 = pos3;
+					pos2 = pos3 + _columnGap;
 				}

 				pos = pos2;
@@ -1509,15 +1513,16 @@
 			int page = Mathf.FloorToInt(pos / viewWidth);
 			int startIndex = page * (_curLineItemCount * _curLineItemCount2);
 			float pos2 = page * viewWidth;
+			float testGap = _columnGap > 0 ? _columnGap : 0;
 			for (int i = 0; i < _curLineItemCount; i++)
 			{
-				float pos3 = pos2 + _virtualItems[startIndex + i].size.x + _columnGap;
-				if (pos3 > pos)
+				float pos3 = pos2 + _virtualItems[startIndex + i].size.x;
+				if (pos3 + testGap > pos)
 				{
 					pos = pos2;
 					return startIndex + i;
 				}
-				pos2 = pos3;
+				pos2 = pos3 + _columnGap;
 			}

 			pos = pos2;


Fixed Windows 7 can not be displayed correctly Apk file icon problem

--- apkshellext/ApkShellExt.cs
+++ apkshellext/ApkShellExt.cs
@@ -155,7 +155,6 @@
                 bool extract_aapt = !File.Exists(aapt);
                 bool extract_mgwz = !File.Exists(mgwz);

-
                 //extract aapt.exe and mgwz.dll
                 if (extract_aapt | extract_mgwz)
                 {
@@ -237,19 +236,17 @@
                 {
                     throw new Exception("Cannot find icon path!");
                 }
-                zip = new ZipFile(new FileStream(sFileName, FileMode.Open));
+                zip = new ZipFile(sFileName);
                 bmp = (Bitmap)Bitmap.FromStream(zip.GetInputStream(zip.FindEntry(icon_path, true)));
                 zip.Close();
-            }
-            catch(Exception e)
-            {
+            } catch {
                 if (zip != null) {
                     zip.Close();
                 }
                 //MessageBox.Show(e.Message);
                 bmp = new Bitmap(Properties.Resources.deficon);
             }
-            return Icon.FromHandle(bmp.GetHicon());
+            return Icon.FromHandle(bmp.GetHicon());
         }
         /// <summary>
         /// register this dll
@@ -297,19 +294,17 @@
                 rk = root.OpenSubKey(@"Wow6432Node\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved\");
                 rk.SetValue(GUID, "Android Package file, shell extention");
                 rk.Close();
-            }
-            catch { }
+            } catch { }
             root.Close();
         }
-
+
         /// <summary>
         /// unregister
         /// </summary>
         private static void UnregApk()
         {
             int key=0;
-            try
-            {
+            try{
                 RegistryKey root;
                 RegistryKey rk;
                 root = Registry.ClassesRoot;
@@ -326,11 +321,8 @@
                 rk.Close();

                 root.Close();
-            }
-            catch (Exception e)
-            {
-                //MessageBox.Show(e.Message);
-            }
+            } catch {}
         }
     }
 }
+// vim: expandtab tabstop=4 softtabstop=4 shiftwidth=4


fix duplicate name file

fix duplicate name file

--- FileProcess/frmMain.cs
+++ FileProcess/frmMain.cs
@@ -339,6 +339,10 @@
             hppWriter.Close();
             javaWriter.Close();
             csWriter.Close();
+
+            strHppIObjectInfo = "";
+            strJavaIObjectInfo = "";
+            strCSIObjectInfo = "";
         }

         void CreateStructThreadFunc()


fix typo

fix typo

--- jsnlog/Infrastructure/HostingHelpers.cs
+++ jsnlog/Infrastructure/HostingHelpers.cs
@@ -12,7 +12,7 @@
 #if NET452
             return System.Web.VirtualPathUtility.ToAbsolute(virtualPath);
 #else
-            //TODO: virtual path transalation for DNX.
+            //TODO: virtual path translation for DNX.
             // Probably get an instance of IApplicationEnvironment and then get the info from there.
             // If the application is in a virtual directory,
             // ~/myfile.jpg may have absolute url /myapp/myfile.jpg.


Enable reset after a crash (#1175)

Enable reset after a crash (#1175)

--- GUI/MainWindow.xaml.cs
+++ GUI/MainWindow.xaml.cs
@@ -616,6 +616,7 @@
                     System.Diagnostics.Process.Start(mailto);
                     Console.WriteLine(body);
                 }
+                ResetTasksButton.IsEnabled = true;
             }
         }


Add public property

Add public property

--- APAnimatorComponent/Editor/SceneTool.cs
+++ APAnimatorComponent/Editor/SceneTool.cs
@@ -4,14 +4,19 @@

     public static class SceneTool {

-        public static Tool LastTool = Tool.None;
+        private static Tool lastTool = Tool.None;
+
+        public static Tool LastTool {
+            get { return lastTool; }
+            set { lastTool = value; }
+        }

         public static void RememberCurrentTool() {
             // Remember active scene tool.
-            if (Tools.current != Tool.None) {
-                LastTool = Tools.current;
-                Tools.current = Tool.None;
-            }
+            if (Tools.current == Tool.None) return;
+
+            LastTool = Tools.current;
+            Tools.current = Tool.None;
         }

         public static void RestoreTool() {


TabContainer is not forcing 100% height if Height is empty (CodePlex item 27212)

--- AjaxControlToolkit/Tabs/TabContainer.cs
+++ AjaxControlToolkit/Tabs/TabContainer.cs
@@ -452,8 +452,6 @@

             if(!Height.IsEmpty)
                 writer.AddStyleAttribute(HtmlTextWriterStyle.Height, Height.ToString());
-            else
-                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");

             writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_body");
             writer.AddAttribute(HtmlTextWriterAttribute.Class, "ajax__tab_body" + GetSuffixTabStripPlacementCss());


Added Logging to test new builds on 8.0 infra

--- Sdl.Web.Templating/Templates/ResolveRichText.cs
+++ Sdl.Web.Templating/Templates/ResolveRichText.cs
@@ -44,11 +44,13 @@
             package.Remove(outputItem);
             if (output.StartsWith("<"))
             {
+                Logger.Debug("Content is XML");
                 //XML - only for backwards compatibility
                 package.PushItem(Package.OutputName, package.CreateXmlDocumentItem(ContentType.Xml, ResolveXmlContent(output)));
             }
             else
             {
+                Logger.Debug("Content is JSON");
                 //JSON
                 package.PushItem(Package.OutputName, package.CreateStringItem(ContentType.Text, ResolveJsonContent(output)));
             }