Exemplo n.º 1
0
        public static void Begin()
        {
            if (m_Command != null && m_Command.HasCompleted)
            {
                m_Command = null;
            }

            if (m_Timer != null || m_Command != null)
            {
                return;
            }

            m_Timer = new My16Below();
            m_Timer.Start();
        }
Exemplo n.º 2
0
        public static void UpdateMy16Below_OnCommand(CommandEventArgs e)
        {
            if (m_Command != null && m_Command.HasCompleted)
            {
                m_Command = null;
            }

            if (m_Timer == null && m_Command == null)
            {
                Begin();
                e.Mobile.SendMessage("My16Below update process has been started.");
            }
            else
            {
                e.Mobile.SendMessage("My16Below database is already being updated.");
            }
        }
Exemplo n.º 3
0
        public static void Begin()
        {
            if (m_Command != null && !m_Command.HasCompleted)
            {
                return;
            }

            DateTime start = DateTime.UtcNow;

            Console.WriteLine("My16Below: Updating status database");

            try
            {
                m_Command = new DatabaseCommandQueue("My16Below: Status database updated in {0:F1} seconds", "My16Below Status Database Thread");

                m_Command.Enqueue("DELETE FROM my16Below_status");

                List <NetState> online = NetState.Instances;

                for (int i = 0; i < online.Count; ++i)
                {
                    NetState ns  = online[i];
                    Mobile   mob = ns.Mobile;

                    if (mob != null)
                    {
                        m_Command.Enqueue(String.Format("INSERT INTO my16Below_status (char_id) VALUES ({0})", mob.Serial.Value.ToString()));
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("My16Below: Error updating status database");
                Console.WriteLine(e);
            }

            if (m_Command != null)
            {
                m_Command.Enqueue(null);
            }
        }
Exemplo n.º 4
0
        public void CheckConnection()
        {
            if (m_Command == null)
            {
                m_Command = new DatabaseCommandQueue("My16Below: Characeter database updated in {0:F1} seconds", "My16Below Character Database Thread");

                if (Config.LoadDataInFile)
                {
                    this.m_OpSkills  = this.GetUniqueWriter("skills", out this.m_SkillsPath);
                    this.m_OpLayers  = this.GetUniqueWriter("layers", out this.m_LayersPath);
                    this.m_OpMobiles = this.GetUniqueWriter("mobiles", out this.m_MobilesPath);

                    m_Command.Enqueue("TRUNCATE TABLE my16Below_characters");
                    m_Command.Enqueue("TRUNCATE TABLE my16Below_characters_layers");
                    m_Command.Enqueue("TRUNCATE TABLE my16Below_characters_skills");
                }

                m_Command.Enqueue("TRUNCATE TABLE my16Below_guilds");
                m_Command.Enqueue("TRUNCATE TABLE my16Below_guilds_wars");
            }
        }