Exemplo n.º 1
0
        public static bool LoadConfig(string[] args)
        {
            try
            {
                var parser = new SimpleCommandLineParser();
                parser.Parse(args);

                bool exists = File.Exists(GGMCFile);

                if (!exists)
                {
                    GenerateConfig();
                }
                else
                {
                    GGMC = DeSerializeString <GGMConfig>(File.ReadAllText(GGMCFile));
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log(LogType.FatalError, "Error while loading config.", ex);
                return(false);
            }
        }
Exemplo n.º 2
0
        private static void GenerateConfig()
        {
            GGMC = new GGMConfig()
            {
                GPUs = new List <GPU>()
            };

            Application.Init();

            var top = Application.Top;

            // Creates the top-level window to show
            var win = new Window(new Rect(0, 1, top.Frame.Width, top.Frame.Height - 1), "GGM Config");

            top.Add(win);

            const int gpuOffset = 17;

            // Add some controls
            win.Add(

                new Label(3, 1, "Stratum Server: "),
                new TextField(20, 1, 40, ""),
                new Label(65, 1, "Port: "),
                new TextField(75, 1, 10, "13416"),
                // 4
                new Label(3, 3, "Stratum Login: "******""),
                new Label(65, 3, "Password: "******""),
                // 8
                new Label(3 + gpuOffset, 6, "GPU 1: "),
                new CheckBox(12 + gpuOffset, 6, "Enabled"),
                new RadioGroup(26 + gpuOffset, 6, new[] { "NVIDIA", "AMD" }),
                new Label(40 + gpuOffset, 6, "Device ID: "),
                new TextField(52 + gpuOffset, 6, 10, ""),

                new Label(3 + gpuOffset, 9, "GPU 2: "),
                new CheckBox(12 + gpuOffset, 9, "Enabled"),
                new RadioGroup(26 + gpuOffset, 9, new[] { "NVIDIA", "AMD" }),
                new Label(40 + gpuOffset, 9, "Device ID: "),
                new TextField(52 + gpuOffset, 9, 10, ""),

                new Label(3 + gpuOffset, 12, "GPU 3: "),
                new CheckBox(12 + gpuOffset, 12, "Enabled"),
                new RadioGroup(26 + gpuOffset, 12, new[] { "NVIDIA", "AMD" }),
                new Label(40 + gpuOffset, 12, "Device ID: "),
                new TextField(52 + gpuOffset, 12, 10, ""),

                new Label(3 + gpuOffset, 15, "GPU 4: "),
                new CheckBox(12 + gpuOffset, 15, "Enabled"),
                new RadioGroup(26 + gpuOffset, 15, new[] { "NVIDIA", "AMD" }),
                new Label(40 + gpuOffset, 15, "Device ID: "),
                new TextField(52 + gpuOffset, 15, 10, ""),

                new Label(3 + gpuOffset, 18, "GPU 5: "),
                new CheckBox(12 + gpuOffset, 18, "Enabled"),
                new RadioGroup(26 + gpuOffset, 18, new[] { "NVIDIA", "AMD" }),
                new Label(40 + gpuOffset, 18, "Device ID: "),
                new TextField(52 + gpuOffset, 18, 10, ""),

                new Label(3 + gpuOffset, 21, "GPU 6: "),
                new CheckBox(12 + gpuOffset, 21, "Enabled"),
                new RadioGroup(26 + gpuOffset, 21, new[] { "NVIDIA", "AMD" }),
                new Label(40 + gpuOffset, 21, "Device ID: "),
                new TextField(52 + gpuOffset, 21, 10, ""),

                new Button(3, 24, "Save", false)
            {
                Clicked = () => { Save(); }
            }
                );

            Application.Top.Add(win);
            Application.Run();
        }
Exemplo n.º 3
0
 public GrinConeeect(GGMConfig gGMC)
 {
     this.gGMC   = gGMC;
     IsConnected = true; // fake
 }