コード例 #1
0
ファイル: Settings.cs プロジェクト: ChrisK91/CWSRestart
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "ServerService.dll.config");
            settings = new Utilities.Settings(file);

            IPService = new Uri(settings.GetAppSettingWithStandardValue("IPService", "http://bot.whatismyipaddress.com/"));
            Loopback = settings.GetAppSettingWithStandardValue("Loopback", IPAddress.Loopback);
            Port = settings.GetAppSettingWithStandardValue("Port", 12345);

            IPAddress tmp;

            if (settings.GetAppSettingValue("LAN") != null && IPAddress.TryParse(settings.GetAppSettingValue("LAN"), out tmp))
                LAN = tmp;

            if (settings.GetAppSettingValue("Internet") != null && IPAddress.TryParse(settings.GetAppSettingValue("Internet"), out tmp))
                Internet = tmp;

            ServerProcessName = settings.GetAppSettingWithStandardValue("ServerProcessName", "Server");
            Timeout = settings.GetAppSettingWithStandardValue("Timeout", 10000);
            ServerPath = settings.GetAppSettingWithStandardValue("ServerPath", "");

            CheckLoopback = settings.GetAppSettingWithStandardValue("CheckLoopback", false);
            CheckLAN = settings.GetAppSettingWithStandardValue("CheckLAN", true);
            CheckInternet = settings.GetAppSettingWithStandardValue("CheckInternet", true);

            DoNotRedirectOutput = settings.GetAppSettingWithStandardValue("DoNotRedirectOutput", false);
            StatisticsInterval = settings.GetAppSettingWithStandardValue("StatisticsInterval", 1000);
            SaveStatisticsEvery = settings.GetAppSettingWithStandardValue("SaveStatisticsEvery", 5);

            Microsoft.Win32.SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
            SessionActive = settings.GetAppSettingWithStandardValue("SessionActiveDefault", true);
            BypassSendQuit = settings.GetAppSettingWithStandardValue("BypassSendQuit", false);

            LogFolder = settings.GetAppSettingValue("LogFolder");
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: ChrisK91/CWSRestart
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "CWSWeb.exe.config");
            settings = new Utilities.Settings(file);

            LinesToRead = settings.GetAppSettingWithStandardValue("LinesToRead", 201);
        }
コード例 #3
0
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "CWSWeb.exe.config");

            settings = new Utilities.Settings(file);

            LinesToRead = settings.GetAppSettingWithStandardValue("LinesToRead", 201);
        }
コード例 #4
0
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "CWSRestart.exe.config");

            settings = new Utilities.Settings(file);

            string presetsDirectory  = Path.Combine(Directory.GetCurrentDirectory(), "presets");
            string importedDirectory = Path.Combine(Directory.GetCurrentDirectory(), "presets", "imported");

            AutostartCWSProtocol = settings.GetAppSettingWithStandardValue("AutostartCWSProtocol", false);
            AutostartStatistics  = settings.GetAppSettingWithStandardValue("AutostartStatistics", false);
            AutostartWatcher     = settings.GetAppSettingWithStandardValue("AutostartWatcher", false);
            WatcherTimeout       = settings.GetAppSettingWithStandardValue("WatcherTimeout", (uint)60);
            AutoPresetLoading    = settings.GetAppSettingWithStandardValue("AutoPresetLoading", false);

            if (!Directory.Exists(presetsDirectory))
            {
                Directory.CreateDirectory(presetsDirectory);
            }

            if (!Directory.Exists(importedDirectory))
            {
                Directory.CreateDirectory(importedDirectory);
            }

            else
            {
                foreach (string f in Directory.EnumerateFiles(presetsDirectory, "*.*", SearchOption.TopDirectoryOnly))
                {
                    if (Path.GetExtension(f).ToLowerInvariant() == ".xml")
                    {
                        LoadPreset(f);
                        movePreset(f);
                    }
                }
            }

            FileSystemWatcher fsw = new FileSystemWatcher(presetsDirectory, "*.xml");

            fsw.IncludeSubdirectories = false;
            fsw.Created            += fsw_Created;
            fsw.Changed            += fsw_Created;
            fsw.Renamed            += fsw_Renamed;
            fsw.EnableRaisingEvents = true;
        }
コード例 #5
0
ファイル: Settings.cs プロジェクト: ChrisK91/CWSRestart
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "CWSRestart.exe.config");
            settings = new Utilities.Settings(file);

            string presetsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "presets");
            string importedDirectory = Path.Combine(Directory.GetCurrentDirectory(), "presets", "imported");

            AutostartCWSProtocol = settings.GetAppSettingWithStandardValue("AutostartCWSProtocol", false);
            AutostartStatistics = settings.GetAppSettingWithStandardValue("AutostartStatistics", false);
            AutostartWatcher = settings.GetAppSettingWithStandardValue("AutostartWatcher", false);
            WatcherTimeout = settings.GetAppSettingWithStandardValue("WatcherTimeout", (uint)60);
            AutoPresetLoading = settings.GetAppSettingWithStandardValue("AutoPresetLoading", false);

            if (!Directory.Exists(presetsDirectory))
                Directory.CreateDirectory(presetsDirectory);

            if (!Directory.Exists(importedDirectory))
                Directory.CreateDirectory(importedDirectory);

            else
            {
                foreach (string f in Directory.EnumerateFiles(presetsDirectory, "*.*", SearchOption.TopDirectoryOnly))
                {
                    if (Path.GetExtension(f).ToLowerInvariant() == ".xml")
                    {
                        LoadPreset(f);
                        movePreset(f);
                    }
                }
            }

            FileSystemWatcher fsw = new FileSystemWatcher(presetsDirectory, "*.xml");
            fsw.IncludeSubdirectories = false;
            fsw.Created += fsw_Created;
            fsw.Changed += fsw_Created;
            fsw.Renamed += fsw_Renamed;
            fsw.EnableRaisingEvents = true;
        }
コード例 #6
0
ファイル: Settings.cs プロジェクト: ChrisK91/CWSRestart
        private Settings()
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "CubeWorldMITM.exe.config");

            Logger = new Utilities.Logging.MultiLogger();
            settings = new Utilities.Settings(path);

            Utilities.Logging.ConsoleLogger clog = new Utilities.Logging.ConsoleLogger();
            Utilities.Logging.FileLogger flog = new Utilities.Logging.FileLogger(Path.Combine(Directory.GetCurrentDirectory(), "mitm.log"));

            MinLevel = settings.GetAppSettingWithStandardValue("MinLevel", -1);
            MaxLevel = settings.GetAppSettingWithStandardValue("MaxLevel", -1);
            MinHP = settings.GetAppSettingWithStandardValue("MinHP", -1f);
            MaxHP = settings.GetAppSettingWithStandardValue("MaxHP", -1f);
            PlayerLimit = settings.GetAppSettingWithStandardValue("PlayerLimit", -1);
            StartServer = settings.GetAppSettingWithStandardValue("StartServer", false);
            ServerLocation = settings.GetAppSettingWithStandardValue("ServerLocation", "");
            AutoIdentifyPlayers = settings.GetAppSettingWithStandardValue("AutoIdentifyPlayers", false);
            PrivateSlots = settings.GetAppSettingWithStandardValue("PrivateSlots", 0);
            clog.Level = settings.GetAppSettingWithStandardValue("ConsoleLoggingLevel", Utilities.Logging.Verbosity.Detailed);
            flog.Level = settings.GetAppSettingWithStandardValue("FileLoggingLevel", Utilities.Logging.Verbosity.Minimal);

            if (settings.GetAppSettingWithStandardValue("ConsoleLoggingEnabled", true))
                Logger.Add(clog);

            if (settings.GetAppSettingWithStandardValue("FileLoggingEnabled", true))
                Logger.Add(flog);
        }
コード例 #7
0
ファイル: Settings.cs プロジェクト: gatekeeper1122/CWSRestart
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "ServerService.dll.config");

            settings = new Utilities.Settings(file);

            IPService = new Uri(settings.GetAppSettingWithStandardValue("IPService", "http://bot.whatismyipaddress.com/"));
            Loopback  = settings.GetAppSettingWithStandardValue("Loopback", IPAddress.Loopback);
            Port      = settings.GetAppSettingWithStandardValue("Port", 12345);

            IPAddress tmp;

            if (settings.GetAppSettingValue("LAN") != null && IPAddress.TryParse(settings.GetAppSettingValue("LAN"), out tmp))
            {
                LAN = tmp;
            }

            if (settings.GetAppSettingValue("Internet") != null && IPAddress.TryParse(settings.GetAppSettingValue("Internet"), out tmp))
            {
                Internet = tmp;
            }

            ServerProcessName = settings.GetAppSettingWithStandardValue("ServerProcessName", "Server");
            Timeout           = settings.GetAppSettingWithStandardValue("Timeout", 10000);
            ServerPath        = settings.GetAppSettingWithStandardValue("ServerPath", "");

            CheckLoopback = settings.GetAppSettingWithStandardValue("CheckLoopback", false);
            CheckLAN      = settings.GetAppSettingWithStandardValue("CheckLAN", true);
            CheckInternet = settings.GetAppSettingWithStandardValue("CheckInternet", true);

            DoNotRedirectOutput = settings.GetAppSettingWithStandardValue("DoNotRedirectOutput", false);
            StatisticsInterval  = settings.GetAppSettingWithStandardValue("StatisticsInterval", 1000);
            SaveStatisticsEvery = settings.GetAppSettingWithStandardValue("SaveStatisticsEvery", 5);

            Microsoft.Win32.SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
            SessionActive  = settings.GetAppSettingWithStandardValue("SessionActiveDefault", true);
            BypassSendQuit = settings.GetAppSettingWithStandardValue("BypassSendQuit", false);

            LogFolder = settings.GetAppSettingValue("LogFolder");
        }
コード例 #8
0
ファイル: Settings.cs プロジェクト: gatekeeper1122/CWSRestart
        private Settings()
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "CubeWorldMITM.exe.config");

            Logger   = new Utilities.Logging.MultiLogger();
            settings = new Utilities.Settings(path);

            Utilities.Logging.ConsoleLogger clog = new Utilities.Logging.ConsoleLogger();
            Utilities.Logging.FileLogger    flog = new Utilities.Logging.FileLogger(Path.Combine(Directory.GetCurrentDirectory(), "mitm.log"));

            MinLevel            = settings.GetAppSettingWithStandardValue("MinLevel", -1);
            MaxLevel            = settings.GetAppSettingWithStandardValue("MaxLevel", -1);
            MinHP               = settings.GetAppSettingWithStandardValue("MinHP", -1f);
            MaxHP               = settings.GetAppSettingWithStandardValue("MaxHP", -1f);
            PlayerLimit         = settings.GetAppSettingWithStandardValue("PlayerLimit", -1);
            StartServer         = settings.GetAppSettingWithStandardValue("StartServer", false);
            ServerLocation      = settings.GetAppSettingWithStandardValue("ServerLocation", "");
            AutoIdentifyPlayers = settings.GetAppSettingWithStandardValue("AutoIdentifyPlayers", false);
            PrivateSlots        = settings.GetAppSettingWithStandardValue("PrivateSlots", 0);
            clog.Level          = settings.GetAppSettingWithStandardValue("ConsoleLoggingLevel", Utilities.Logging.Verbosity.Detailed);
            flog.Level          = settings.GetAppSettingWithStandardValue("FileLoggingLevel", Utilities.Logging.Verbosity.Minimal);

            if (settings.GetAppSettingWithStandardValue("ConsoleLoggingEnabled", true))
            {
                Logger.Add(clog);
            }

            if (settings.GetAppSettingWithStandardValue("FileLoggingEnabled", true))
            {
                Logger.Add(flog);
            }
        }