Ejemplo n.º 1
0
        private static void NewServerSqlData(int ServerId, string ServerName)
        {
            var db = DManager.QueryFirstRow("SELECT 1 FROM channels WHERE ServerId = '{0}'", ServerId);

            if (db.IsNull())
            {
                DManager.Insert("`channels`(ServerId, ServerName, Channel, Password, Language)", ServerId, ServerName, IRCConfig.List[ServerName].MasterChannel, IRCConfig.List[ServerName].MasterChannelPassword, sLManager.Locale);
            }

            db = DManager.QueryFirstRow("SELECT 1 FROM schumix WHERE ServerId = '{0}'", ServerId);
            if (db.IsNull())
            {
                foreach (var function in Enum.GetNames(typeof(IFunctions)))
                {
                    if (function == IFunctions.Mantisbt.ToString() || function == IFunctions.Wordpress.ToString() ||
                        function == IFunctions.Svn.ToString() || function == IFunctions.Git.ToString() ||
                        function == IFunctions.Hg.ToString())
                    {
                        DManager.Insert("`schumix`(ServerId, ServerName, FunctionName, FunctionStatus)", ServerId, ServerName, function.ToLower(), Off);
                    }
                    else
                    {
                        DManager.Insert("`schumix`(ServerId, ServerName, FunctionName, FunctionStatus)", ServerId, ServerName, function.ToLower(), On);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private static void IsAllChannelFunction(int ServerId)
        {
            var db = DManager.Query("SELECT Functions, Channel FROM channels WHERE ServerId = '{0}'", ServerId);

            if (!db.IsNull())
            {
                foreach (DataRow row in db.Rows)
                {
                    string   functions = string.Empty;
                    var      dic       = new Dictionary <string, string>();
                    string   Channel   = row["Channel"].ToString();
                    string[] f         = row["Functions"].ToString().Split(SchumixBase.Comma);

                    foreach (var ff in f)
                    {
                        if (ff.IsNullOrEmpty())
                        {
                            continue;
                        }

                        if (!ff.Contains(SchumixBase.Colon.ToString()))
                        {
                            continue;
                        }

                        string name   = ff.Substring(0, ff.IndexOf(SchumixBase.Colon));
                        string status = ff.Substring(ff.IndexOf(SchumixBase.Colon) + 1);
                        dic.Add(name, status);
                    }

                    foreach (var function in Enum.GetNames(typeof(IChannelFunctions)))
                    {
                        if (dic.ContainsKey(function.ToString().ToLower()))
                        {
                            functions += SchumixBase.Comma + function.ToString().ToLower() + SchumixBase.Colon + dic[function.ToString().ToLower()];
                        }
                        else
                        {
                            if (function == IChannelFunctions.Log.ToString() || function == IChannelFunctions.Rejoin.ToString() ||
                                function == IChannelFunctions.Commands.ToString())
                            {
                                functions += SchumixBase.Comma + function.ToString().ToLower() + SchumixBase.Colon + SchumixBase.On;
                            }
                            else
                            {
                                functions += SchumixBase.Comma + function.ToString().ToLower() + SchumixBase.Colon + SchumixBase.Off;
                            }
                        }
                    }

                    dic.Clear();
                    SchumixBase.DManager.Update("channels", string.Format("Functions = '{0}'", functions), string.Format("Channel = '{0}' And ServerId = '{1}'", Channel, ServerId));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary> Extracts information out of the SWF/SWD in order to populate
        /// function line number tables in SourceFile variabels.
        /// </summary>
        public virtual void  parseSwfSwd(DManager manager)
        {
            m_manager = manager;

            // suck in the swf/swd into action lists and then walk the lists
            // looking for LineRecords
            m_container = new LineFunctionContainer(m_swf, m_swd);
            m_container.combForLineRecords(this);

            // we are done, sucess or no
            setPopulated();

            // log event that we have complete done
            manager.addEvent(new FunctionMetaDataAvailableEvent());
            m_manager = null;
        }
Ejemplo n.º 4
0
 private static void IsAllSchumixFunction(int ServerId, string ServerName)
 {
     foreach (var function in Enum.GetNames(typeof(IFunctions)))
     {
         var db = DManager.QueryFirstRow("SELECT 1 FROM schumix WHERE ServerId = '{0}' And FunctionName = '{1}'", ServerId, function.ToLower());
         if (db.IsNull())
         {
             if (function == IFunctions.Mantisbt.ToString() || function == IFunctions.Wordpress.ToString() ||
                 function == IFunctions.Svn.ToString() || function == IFunctions.Git.ToString() ||
                 function == IFunctions.Hg.ToString())
             {
                 DManager.Insert("`schumix`(ServerId, ServerName, FunctionName, FunctionStatus)", ServerId, ServerName, function.ToLower(), Off);
             }
             else
             {
                 DManager.Insert("`schumix`(ServerId, ServerName, FunctionName, FunctionStatus)", ServerId, ServerName, function.ToLower(), On);
             }
         }
     }
 }
        public void DicEntities()
        {
            ObjectIdCollection ids = DManager.IdsByXRecord(M.Constant.XRecordColindancia);

            if (ids.Count > 0)
            {
                foreach (ObjectId id in ids)
                {
                    Entity ent = id.OpenEntity() as Entity;

                    ObjectId idXrecord = DManager.GetXRecord(ent.ExtensionDictionary, M.Constant.XRecordColindancia);

                    string[] data = DManager.GetData(idXrecord);

                    string.Format("{0} tiene colindancia al {1} con {2}\n",
                                  ent.GetType().Name, data[0], data[1]).ToEditor();
                }
            }
            else
            {
                string.Format("No hay ids con record: {0}", M.Constant.XRecordColindancia)
                .ToEditor();
            }
        }
Ejemplo n.º 6
0
        public static void SqlInfoReConfig()
        {
            foreach (var sn in IRCConfig.List)
            {
                DManager.Update("channels", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("schumix", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("hlmessage", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("admins", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("ignore_addons", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("ignore_channels", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("ignore_commands", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("ignore_irc_commands", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));
                DManager.Update("ignore_nicks", string.Format("ServerName = '{0}'", sn.Key), string.Format("ServerId = '{0}'", sn.Value.ServerId));

                var db1 = DManager.Query("SELECT Id, ServerName FROM channels WHERE ServerId = '{0}'", sn.Value.ServerId);
                if (!db1.IsNull())
                {
                    foreach (DataRow row in db1.Rows)
                    {
                        bool ignore = false;
                        int  id     = row["Id"].ToInt32();
                        var  db3    = DManager.Query("SELECT Id, Channel FROM channels WHERE ServerName = '{0}' And Channel = '{1}' ORDER BY Id ASC", row["ServerName"].ToString(), IRCConfig.List[row["ServerName"].ToString()].MasterChannel);
                        if (!db3.IsNull())
                        {
                            int id2 = 0;
                            var db4 = DManager.QueryFirstRow("SELECT Id FROM channels WHERE ServerName = '{0}' ORDER BY Id ASC", row["ServerName"].ToString());

                            if (!db4.IsNull())
                            {
                                id2 = db4["Id"].ToInt32();
                            }

                            foreach (DataRow row2 in db3.Rows)
                            {
                                if (id2 != row2["Id"].ToInt32() && row2["Channel"].ToString() == IRCConfig.List[row["ServerName"].ToString()].MasterChannel)
                                {
                                    ignore = true;
                                    break;
                                }
                            }
                        }

                        var db2 = DManager.QueryFirstRow("SELECT Id, ServerName, Channel FROM channels WHERE ServerName = '{0}' ORDER BY Id ASC", row["ServerName"].ToString());

                        if (!db2.IsNull())
                        {
                            if (id == db2["Id"].ToInt32() && !ignore)
                            {
                                string channel    = db2["Channel"].ToString();
                                string servername = db2["ServerName"].ToString();
                                DManager.Update("channels", string.Format("Channel = '{0}'", IRCConfig.List[servername].MasterChannel), string.Format("Channel = '{0}' And ServerName = '{1}'", channel, servername));
                                DManager.Update("channels", string.Format("Password = '******'", IRCConfig.List[servername].MasterChannelPassword.Length > 0 ? IRCConfig.List[servername].MasterChannelPassword : string.Empty), string.Format("Channel = '{0}' And ServerName = '{1}'", channel, servername));
                                Log.Notice("SchumixBase", sLConsole.GetString("{0} master channel is updated to: {1}"), servername, IRCConfig.List[servername].MasterChannel);
                            }
                            else if (id == db2["Id"].ToInt32() && ignore)
                            {
                                Log.Warning("SchumixBase", sLConsole.GetString("The master channel already exist on the database, named by default!"));
                            }
                        }
                    }
                }

                NewServerSqlData(sn.Value.ServerId, sn.Key);
                IsAllSchumixFunction(sn.Value.ServerId, sn.Key);
                IsAllChannelFunction(sn.Value.ServerId);

                var db = DManager.Query("SELECT FunctionName, FunctionStatus FROM schumix WHERE ServerName = '{0}'", sn.Key);
                if (!db.IsNull())
                {
                    var list = new Dictionary <string, string>();

                    foreach (DataRow row in db.Rows)
                    {
                        string name   = row["FunctionName"].ToString();
                        string status = row["FunctionStatus"].ToString();
                        list.Add(name.ToLower(), status.ToLower());
                    }

                    IFunctionsClass.ServerList.Add(sn.Key, new IFunctionsClassBase(list));
                }
                else
                {
                    Log.Error("SchumixBase", sLConsole.GetString("FunctionReload: Failre request!"));
                }
            }
        }