public void UpdateAppInfo()
        {
            InstalledApps = new List <InstalledAppInfo>();
            string Info = string.Empty;

            try
            {
                Info = HttpCommands.StartScript(Settings.Default.Server, "Apps/AppInit/appinit.cgi?info");
            }
            catch (Exception ex) { Logger.GetInstance().AddLogLine(LogLevel.Warning, "", ex); }
            //catch { } my edit

            string appinfo = string.Empty;

            try
            {
                appinfo = Info.Substring(Info.IndexOf('{'));
                appinfo = appinfo.Substring(0, appinfo.LastIndexOf('}') + 1);
            }
            catch (Exception ex) { Logger.GetInstance().AddLogLine(LogLevel.Warning, "", ex); }
            //catch { } my edit

            foreach (string app in appinfo.Split(new char[] { '}' }, StringSplitOptions.RemoveEmptyEntries))
            {
                try
                {
                    string path    = GetJSONValue(app, "path");                             // Regex.Match(app, "\\s*\"?path\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    string name    = GetJSONValue(app, "name");                             //Regex.Match(app, "\\s*\"?name\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    bool   started = GetJSONValue(app, "started") == "1";                   //Regex.Match(app, "\\s*\"?started\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value == "1";

                    int    appinfo_format = int.Parse(GetJSONValue(app, "appinfo_format")); //Regex.Match(app, "\\s*\"?appinfo_format\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value);
                    string version        = GetJSONValue(app, "version");                   //Regex.Match(app, "\\s*\"?version\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    bool   enabled        = GetJSONValue(app, "enabled") == "1";            //Regex.Match(app, "\\s*\"?enabled\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value == "1";
                    string daemon_script  = GetJSONValue(app, "daemon_script");             //Regex.Match(app, "\\s*\"?daemon_script\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    string crontab        = GetJSONValue(app, "crontab");                   //Regex.Match(app, "\\s*\"?crontab\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    string setup_script   = GetJSONValue(app, "setup_script");              //Regex.Match(app, "\\s*\"?setup_script\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    string gayaui_path    = GetJSONValue(app, "gayaui_path");               //Regex.Match(app, "\\s*\"?gayaui_path\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;
                    string webui_path     = GetJSONValue(app, "webui_path");                //Regex.Match(app, "\\s*\"?webui_path\"?\\s*[=:]{1}\\s*\"?([^\",]+)\"?\\s*").Groups[1].Value;

                    InstalledApps.Add(new InstalledAppInfo(started, path, appinfo_format, name, version, enabled, daemon_script, crontab, setup_script, gayaui_path, webui_path));
                }
                catch (Exception ex) { Logger.GetInstance().AddLogLine(LogLevel.Warning, "", ex); }
                //catch { } my edit
            }

            UpdateRepositoryStates();

            if (OnUpdateComplete != null)
            {
                OnUpdateComplete();
            }
        }
예제 #2
0
        private void ExecuteAppInitCommand(object command)
        {
            string result = HttpCommands.StartScript(Settings.Default.Server, command.ToString().Replace(" ", "%20"));

            UpdateAppInfo();
        }