Exemple #1
0
        public static void c_IPConfig(string cmd)
        {
            string[] args = cmd.Split(' ');

            if (args.Length == 1)
            {
                Console.WriteLine("IP Config");
                return;
            }

            if (args[1] == "/release")
            {
                Network.DHCP.Core.SendReleasePacket();
            }
            else if (args[1] == "/interfaces")
            {
                Utilities.Settings settings = new Utilities.Settings(@"0:\netinterface.conf");
                int i = 0;
                foreach (String s in NetworkInterfaces.CustomName)
                {
                    Console.WriteLine(s + " " + settings.Get(s) + " " + NetworkInterfaces.PCIName[i]);
                    i++;
                }
            }
            else if (args[1] == "/interface")
            {
                Console.WriteLine(NetworkInterfaces.Interface(args[2]));
            }
            else if (args[1] == "/set")
            {
                if (args.Length <= 3)
                {
                    Console.WriteLine("Usage : " + args[0] + " /set {interface} {IPv4} {Subnet} -g {Gateway} -d {PrimaryDNS}");
                    //ipconfig /set PCNETII 192.168.1.32 255.255.255.0 -g 192.168.1.254 -d 8.8.8.8
                }
                else
                {
                    if (NetworkInterfaces.Interface(args[2]) != "null")
                    {
                        Utilities.Settings settings = new Utilities.Settings(@"0:\" + NetworkInterfaces.Interface(args[2]) + ".conf");
                        NetworkStack.RemoveAllConfigIP();
                        ApplyIP(args, settings);
                        settings.Push();
                        NetworkInit.Enable();
                    }
                    else
                    {
                        Console.WriteLine("This interface doesn't exists.");
                    }
                }
            }
            else if (args[1] == "/renew")
            {
                Network.DHCP.Core.SendDiscoverPacket();
            }
            else
            {
                Console.WriteLine("IP Config");
            }
        }
Exemple #2
0
        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);
        }
        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);
            }
        }
Exemple #4
0
        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");
        }
Exemple #5
0
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "CWSWeb.exe.config");
            settings = new Utilities.Settings(file);

            LinesToRead = settings.GetAppSettingWithStandardValue("LinesToRead", 201);
        }
Exemple #6
0
        private Settings()
        {
            string file = Path.Combine(Directory.GetCurrentDirectory(), "CWSWeb.exe.config");

            settings = new Utilities.Settings(file);

            LinesToRead = settings.GetAppSettingWithStandardValue("LinesToRead", 201);
        }
 public Settings(Utilities.Settings config)
 {
     this.config = config;
     if (config.ContainsKey("gimbal-offsets"))
     {
         var s = config["gimbal-offsets"];
         if (s.Contains(":"))
         {
             var t = s.Split(':');
             this.PitchOffset = Convert.ToDecimal(t[0]);
             this.RollOffset  = Convert.ToDecimal(t[1]);
         }
     }
 }
Exemple #8
0
 public Settings()
 {
     InitializeComponent();
     setting = new Utilities.Settings();
     try
     {
         DrillDuration = setting.GetValueOrDefault(Utilities.Settings.DrillDurationSettingKeyName, setting.DrillDurationSettingDefault);
         WarningDuration = setting.GetValueOrDefault(Utilities.Settings.WarningSettingKeyName, setting.WarningSettingDefault);
         ResetDuration = setting.GetValueOrDefault(Utilities.Settings.ResetSettingKeyName, setting.ResetSettingDefault);
     }
     catch (Exception e)
     {
         MessageBox.Show("Whoops, sorry something went wrong while loading your settings.");
     }
 }
Exemple #9
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;
        }
Exemple #10
0
        public NewDrill()
        {
            InitializeComponent();
            initialfeedbackBanter = new Random().Next(0, banter.Length);
            descTxtBox.Text = banter[initialfeedbackBanter];

            Utilities.Settings set = new Utilities.Settings();

            //init drill duration
            DrillDuration = set.GetValueOrDefault(Utilities.Settings.DrillDurationSettingKeyName, set.DrillDurationSettingDefault);
            DrillMaxDuration = TimeSpan.FromMinutes(5);
            DrillStepDuration = TimeSpan.FromSeconds(5);
            //init warning duration
            WarningDuration = set.GetValueOrDefault(Utilities.Settings.WarningSettingKeyName, set.WarningSettingDefault);
            WarningMaxDuration = TimeSpan.FromSeconds(30);
            WarningStepDuration = TimeSpan.FromSeconds(5);
            //init reset duration
            ResetDuration = set.GetValueOrDefault(Utilities.Settings.ResetSettingKeyName, set.ResetSettingDefault);
            ResetMaxDuration = TimeSpan.FromSeconds(55);
            ResetStepDuration = TimeSpan.FromSeconds(5);
        }
Exemple #11
0
        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");
        }
Exemple #12
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;
        }
Exemple #13
0
        private static void ApplyIP(string[] args, Utilities.Settings settings)
        {
            int args_count = args.Length;

            switch (args_count)
            {
            default:
                Console.WriteLine("Usage : " + args[0] + " /set {interface} {IPv4} {Subnet} -g {Gateway} -d {PrimaryDNS}");
                break;

            case 5:
                if (Utilities.Misc.IsIpv4Address(args[3]) && Utilities.Misc.IsIpv4Address(args[4]))
                {
                    settings.Edit("ipaddress", args[3]);
                    settings.Edit("subnet", args[4]);
                    settings.Edit("gateway", "0.0.0.0");
                    settings.Edit("dns01", "0.0.0.0");
                }
                else
                {
                    //notcorrectaddress
                }
                break;

            case 7:
                if (Utilities.Misc.IsIpv4Address(args[3]) && Utilities.Misc.IsIpv4Address(args[4]) && Utilities.Misc.IsIpv4Address(args[6]))
                {
                    settings.Edit("ipaddress", args[3]);
                    settings.Edit("subnet", args[4]);
                    if (args[5] == "-g")
                    {
                        settings.Edit("gateway", args[6]);
                        settings.Edit("dns01", "0.0.0.0");
                    }
                    else if (args[5] == "-d")
                    {
                        settings.Edit("dns01", args[6]);
                        settings.Edit("gateway", "0.0.0.0");
                    }
                    else
                    {
                        Console.WriteLine("Usage : " + args[0] + " /set {interface} {IPv4} {Subnet} -g {Gateway} -d {PrimaryDNS}");
                        settings.Edit("gateway", "0.0.0.0");
                        settings.Edit("dns01", "0.0.0.0");
                    }
                }
                else
                {
                    //notcorrectaddress
                }
                break;

            case 9:
                if (Utilities.Misc.IsIpv4Address(args[3]) && Utilities.Misc.IsIpv4Address(args[4]) && Utilities.Misc.IsIpv4Address(args[6]) && Utilities.Misc.IsIpv4Address(args[8]))
                {
                    settings.Edit("ipaddress", args[3]);
                    settings.Edit("subnet", args[4]);
                    if (args[5] == "-g")
                    {
                        settings.Edit("gateway", args[6]);
                    }
                    else if (args[5] == "-d")
                    {
                        settings.Edit("dns01", args[6]);
                    }
                    else
                    {
                        Console.WriteLine("Usage : " + args[0] + " /set {interface} {IPv4} {Subnet} -g {Gateway} -d {PrimaryDNS}");
                        settings.Edit("gateway", "0.0.0.0");
                        settings.Edit("dns01", "0.0.0.0");
                    }

                    if (args[7] == "-g")
                    {
                        settings.Edit("gateway", args[8]);
                    }
                    else if (args[7] == "-d")
                    {
                        settings.Edit("dns01", args[8]);
                    }
                    else
                    {
                        Console.WriteLine("Usage : " + args[0] + " /set {interface} {IPv4} {Subnet} -g {Gateway} -d {PrimaryDNS}");
                        settings.Edit("gateway", "0.0.0.0");
                        settings.Edit("dns01", "0.0.0.0");
                    }
                }
                break;
            }
        }