示例#1
0
 public string CheckReservations(RegionProfileData theSim, XmlNode authkeynode)
 {
     foreach (IGridDataPlugin plugin in _plugins)
     {
         try
         {
             //Check reservations
             ReservationData reserveData =
                 plugin.GetReservationAtPoint(theSim.regionLocX, theSim.regionLocY);
             if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) ||
                 (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey))
             {
                 plugin.AddProfile(theSim);
                 m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")");
                 logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5,
                         "Region successfully updated and connected to grid.");
             }
             else
             {
                 m_log.Warn("[grid]: " +
                            "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
                 // Wanted: " + reserveData.gridRecvKey + ", Got: " + theSim.regionRecvKey + ".");
                 return("Unable to update region (RestSetSimMethod): Incorrect auth key.");
             }
         }
         catch (Exception e)
         {
             m_log.Warn("[GRID]: GetRegionPlugin Handle " + plugin.Name + " unable to add new sim: " +
                        e.ToString());
         }
     }
     return("OK");
 }
示例#2
0
        public DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim)
        {
            DataResponse insertResponse = DataResponse.RESPONSE_ERROR;

            foreach (IGridDataPlugin plugin in _plugins)
            {
                try
                {
                    if (existingSim == null)
                    {
                        insertResponse = plugin.AddProfile(sim);
                    }
                    else
                    {
                        insertResponse = plugin.UpdateProfile(sim);
                    }
                }
                catch (Exception e)
                {
                    m_log.Warn("[LOGIN END]: " +
                               "Unable to login region " + sim.ToString() + " via " + plugin.Name);
                    m_log.Warn("[LOGIN END]: " + e.ToString());
                }
            }
            return(insertResponse);
        }