Esempio n. 1
0
        private async Task <IList <MySQLInstance> > FindMySQLInstances(string exeName = "mysqld.exe")
        {
            var lst = new List <MySQLInstance>();

            if (string.IsNullOrWhiteSpace(exeName))
            {
                exeName = DefaultMySQLExeName;
            }
            var pinfos = await ProcessUtil.GetProcesssInfoByName(exeName);

            foreach (var pinfo in pinfos)
            {
                var ppinfo = pinfos.FirstOrDefault(p => p.ProcessId == pinfo.ParentProcessId && p.CreationDate < pinfo.CreationDate);
                if (ppinfo != null && !string.IsNullOrWhiteSpace(pinfo.CommandLine))
                {
                    var args         = pinfo.CommandLine.Split(' ');
                    var instancepath = pinfo.CommandLine.Substring(0, pinfo.CommandLine.IndexOf(" --")).Trim().Trim('\"');
                    var inipath      = args.FirstOrDefault(str => str.StartsWith("--defaults-file="));
                    if (string.IsNullOrEmpty(inipath))
                    {
                        inipath = "my.ini";
                    }
                    else
                    {
                        inipath = inipath.Replace("--defaults-file=", "").Trim('\"');
                    }
                    var shellProcess = Process.GetProcessById((int)ppinfo.ProcessId);
                    var coreProcess  = Process.GetProcessById((int)pinfo.ProcessId);
                    var instance     = new MySQLInstance(instancepath, inipath, shellProcess, coreProcess);
                    lst.Add(instance);
                }
            }
            return(lst);
        }
Esempio n. 2
0
        public Quartermaster(MySQLInstance _sql, ServerQueryInstance _serverq, ServerInfo _serverinfo) : base(_sql, _serverq, _serverinfo)
        {
            registerEvents();
            slimtest = new SemaphoreSlim(1);

            SortChannels(12);
        }
Esempio n. 3
0
        private void RaiseOnNewInstanceFound(MySQLInstance instance)
        {
            var dataDir = AnalyzeMySQLDataDirFromIni(instance.InstanceIniPath);

            instance.DataDir = dataDir;
            LogApi.Log($"{instance} Found.");
            NewInstaceFound?.Invoke(this, instance);
        }
Esempio n. 4
0
 public Addon(MySQLInstance _sql, ServerQueryInstance _serverq, ServerInfo _serverinfo)
 {
     sql              = _sql;
     serverq          = _serverq;
     queryRunner      = serverq.queryRunner;
     atd              = serverq.atd;
     serverinfo       = _serverinfo;
     eventDumpStrings = new List <string>();
 }
Esempio n. 5
0
        public UserMonitor(MySQLInstance _sql, ServerQueryInstance _serverq, ServerInfo _serverinfo) : base(_sql, _serverq, _serverinfo)
        {
            registerEvents();

            MessageServerGroup(9);
        }
Esempio n. 6
0
 private void RaiseOnInstanceLost(MySQLInstance instance)
 {
     LogApi.Log($"{instance} Lost.");
     InstanceLost?.Invoke(this, instance);
 }