コード例 #1
0
        public static void UpdateConfiguration(ServantAgentConfiguration configuration, string saveToDirectory = null)
        {
            var configFile = Path.Combine(saveToDirectory ?? ConfigFileDirectory, ConfigFileFileName);

            File.WriteAllText(configFile, Json.SerializeToString(configuration));
            TinyIoCContainer.Current.Register(configuration);
        }
コード例 #2
0
        public static ServantAgentConfiguration GetConfigurationFromDisk()
        {
            var configFile = Path.Combine(ConfigFileDirectory, ConfigFileFileName);
            ServantAgentConfiguration configuration;

            if (!File.Exists(configFile))
            {
                configuration = new ServantAgentConfiguration { ServantIoHost = "https://www.servant.io", InstallationGuid = Guid.NewGuid() };

                UpdateConfiguration(configuration);
            }
            else
            {
                configuration = Json.DeserializeFromString<ServantAgentConfiguration>(File.ReadAllText(configFile));
            }

            return configuration;
        }
コード例 #3
0
        public static ServantAgentConfiguration GetConfigurationFromDisk()
        {
            var configFile = Path.Combine(ConfigFileDirectory, ConfigFileFileName);
            ServantAgentConfiguration configuration;

            if (!File.Exists(configFile))
            {
                configuration = new ServantAgentConfiguration {
                    ServantIoHost = "https://www.servant.io", InstallationGuid = Guid.NewGuid()
                };

                UpdateConfiguration(configuration);
            }
            else
            {
                configuration = Json.DeserializeFromString <ServantAgentConfiguration>(File.ReadAllText(configFile));
            }

            return(configuration);
        }
コード例 #4
0
 private static void SendServerInfo(ServantAgentConfiguration configuration)
 {
     ReplyOverHttp(new CommandResponse(CommandResponse.ResponseType.ServerInfo) { Message = Json.SerializeToString(
         new ServerInfo()
         {
             ServantVersion = configuration.Version,
             ServerName = Environment.MachineName,
             OperatingSystem = OperatingSystemHelper.GetOsVersion(),
             TotalSites = SiteManager.TotalSites,
             TotalApplicationPools = SiteManager.TotalApplicationPools
         }
         ), Success = true });
 }
コード例 #5
0
 public static void UpdateConfiguration(ServantAgentConfiguration configuration, string saveToDirectory = null)
 {
     var configFile = Path.Combine(saveToDirectory ?? ConfigFileDirectory, ConfigFileFileName);
     File.WriteAllText(configFile, Json.SerializeToString(configuration));
     TinyIoCContainer.Current.Register(configuration);
 }