Ejemplo n.º 1
0
        /// <summary>
        /// Saves all currently loaded objects that are dirty to the database
        /// </summary>
        public void RunSaveCycle(string serverID)
        {
            if (m_StopSaving || 1 == Interlocked.Exchange(ref m_UpdatingSaveQueue, 1))
            {
                // Failed to get the lock.  Process is already/still running.
                return;
            }
            Interlocked.Exchange(ref m_SaveCycleScheduled, 0);

            DateTime start = DateTime.UtcNow;
            ICollection <IGameObject> items = AllObjects;
            string msg       = "";
            int    processed = DB.Instance.Item_BatchUpdate((List <IGameObject>)items, out msg, this);

            DateTime fin = DateTime.UtcNow;
            TimeSpan len = fin - start;

            Log1.Logger("Server").Info("Game object save cycle wrote  [" + processed.ToString() + " objects in " + len.ToString() + "]");
            Log1.Logger("Server").Info("Server is now tracking [" + ObjectCount.ToString() + " game objects].");

            StartSaveCycle(serverID, len.TotalMilliseconds > ConfigHelper.GetIntConfig("ItemSaveCycleTimerMs", 30000));

            // Release the lock
            Interlocked.Exchange(ref m_UpdatingSaveQueue, 0);
        }
        public string[] ToList()
        {
            string[] properties = new string[4];

            properties[0] = $"Name: {Name}";
            properties[1] = $"Layer Count: {LayerCount.ToString()}";
            properties[2] = $"Object Count: {ObjectCount.ToString()}";
            properties[3] = $"Blockdefinition Count: {BlockDefinitionCount.ToString()}";

            return(properties);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts the value of the current <see cref="ReferenceManager" /> to its equivalent string representation.
 /// </summary>
 /// <returns>
 /// A string representation of the current <see cref="ReferenceManager" />.
 /// </returns>
 public override String ToString() => $"Object count: {ObjectCount.ToString()}";