コード例 #1
0
ファイル: LuaProcessor.cs プロジェクト: RunOnceEx/HtcSharp
 public Task Load(PluginServerContext pluginServerContext, ILogger logger)
 {
     Logger = logger;
     UserData.RegisterType <LuaLowLevelAccess>();
     UserData.RegisterType <LuaLowLevelClass>();
     return(Task.CompletedTask);
 }
コード例 #2
0
        public Task Load(PluginServerContext pluginServerContext, ILogger logger)
        {
            Logger = logger;
            string path = Path.Combine(pluginServerContext.PluginsPath, "ELPanel.conf");

            if (!File.Exists(path))
            {
                using var fileStream   = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
                using var streamWriter = new StreamWriter(fileStream);
                streamWriter.Write(JsonConvert.SerializeObject(new {
                    MySqlString = "Server=127.0.0.1;Port=3306;Database=elpanel;Uid=root;Pwd=root;"
                }, Formatting.Indented));
            }
            var config = JsonUtils.GetJsonFile(path);

            MySqlString    = config.GetValue("MySqlString", StringComparison.CurrentCultureIgnoreCase).Value <string>();
            MySqlManager   = new MySqlManager(MySqlString);
            ServerManager  = new ServerManager();
            SessionManager = new SessionManager();
            SessionManager.AddSession("86b13566-91ff-4ae3-b92e-aa1887b87574");
            return(Task.CompletedTask);
        }
コード例 #3
0
        public Task Load(PluginServerContext pluginServerContext, ILogger logger)
        {
            Logger = logger;
            string path = Path.Combine(pluginServerContext.PluginsPath, @"PhpConfig.json");

            if (!File.Exists(path))
            {
                using var fileStream   = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
                using var streamWriter = new StreamWriter(fileStream);
                streamWriter.Write(JsonConvert.SerializeObject(new {
                    PhpCgiExec = "%WorkingPath%\\plugins\\php\\php-cgi.exe",
                    PhpPath    = "%WorkingPath%\\plugins\\php",
                    Timeout    = 10000
                }, Formatting.Indented));
            }
            var config = JsonUtils.GetJsonFile(path);

            PhpCgiExec = HtcIOUtils.ReplacePathTags(config.GetValue("PhpCgiExec", StringComparison.CurrentCultureIgnoreCase).ToObject <string>());
            PhpPath    = HtcIOUtils.ReplacePathTags(config.GetValue("PhpPath", StringComparison.CurrentCultureIgnoreCase).ToObject <string>());
            Timeout    = config.GetValue("Timeout", StringComparison.CurrentCultureIgnoreCase).ToObject <int>();
            return(Task.CompletedTask);
        }
コード例 #4
0
ファイル: LuaMySQL.cs プロジェクト: RunOnceEx/HtcSharp
 public Task Load(PluginServerContext pluginServerContext, ILogger logger)
 {
     PluginServerContext = pluginServerContext;
     Logger = logger;
     return(Task.CompletedTask);
 }