Beispiel #1
0
        private void Go()
        {
            var config = new BoxartConfig
            {
                SdRoot                = txtSdRoot.Text,
                BoxartPath            = txtBoxart.Text,
                SettingsPath          = _config.GetCorrectSettingsIniPath(txtSdRoot.Text),
                BoxartWidth           = (int)numWidth.Value,
                BoxartHeight          = (int)numHeight.Value,
                KeepAspectRatio       = chkKeepAspectRatio.Checked,
                OverwriteExisting     = chkOverwriteExisting.Checked,
                BoxartBorderColor     = rbtBorderBlack.Checked ? 0xFF000000 : 0xFFFFFFFF, // Todo Check
                BoxartBorderThickness = chkBorderThick.Checked ? 2 : 1,
                BoxartBorderStyle     = chkBorder.Checked ? rbtBorder3DS.Checked ? BoxartBorderStyle.Nintendo3DS : rbtBorderDSi.Checked ? BoxartBorderStyle.NintendoDSi : BoxartBorderStyle.Line : BoxartBorderStyle.None
            };

            _crawler.DownloadArt(config).Wait();

            _isRunning = false;
            this.UIThread(SetUx);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            ConsoleEx.WriteGreenLine(BoxartConfig.Credits);
            Console.WriteLine();

            var config = new BoxartConfig();

            try
            {
                config.Load();
            }
            catch { Console.WriteLine("Could not load TwilightBoxart.ini - using defaults."); }

            if (!config.DisableUpdates)
            {
                try
                {
                    var update = GithubClient.GetNewRelease(BoxartConfig.Repository, BoxartConfig.Version);

                    if (update != null)
                    {
                        ConsoleEx.WriteGreenLine(update.UpdateText);

                        if (ConsoleEx.YesNoMenu())
                        {
                            OSHelper.OpenBrowser(BoxartConfig.RepositoryReleasesUrl);
                        }

                        Console.WriteLine();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Could not check for updates: {e.Message}");
                }
            }

            if (string.IsNullOrEmpty(config.SdRoot))
            {
                var allDrives = new List <DriveInfo>();
                try
                {
                    allDrives = DriveInfo.GetDrives().Where(c => c.DriveType == DriveType.Removable).ToList();
                }
                catch { }

                var choice = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                if (allDrives.Count > 0)
                {
                    var choices = allDrives.Select(c => c.Name).ToList();
                    choices.Add("Current Directory");
                    var i = ConsoleEx.MenuIndex("Select your SD location: ", true, choices.ToArray());
                    if (i != choices.Count - 1)
                    {
                        choice = allDrives[i].RootDirectory.FullName;
                    }
                }
                else
                {
                    Console.WriteLine("No settings or drives found. Using current directory.");
                }

                config.SdRoot = choice;
            }

            var boxArtPath = config.GetCorrectBoxartPath();

            ConsoleEx.WriteGreenLine("Loaded settings:");
            Console.WriteLine("SDRoot / Roms location: \t" + config.SdRoot);
            Console.WriteLine("BoxArt location: \t\t" + boxArtPath);
            Console.WriteLine();
            if (!ConsoleEx.YesNoMenu("Is this OK?"))
            {
                Console.WriteLine("Please edit TwilightBoxart.ini or insert your SD card and try again.");
                return;
            }
            Console.WriteLine();

            var progress = new Progress <string>(Console.WriteLine);
            var crawler  = new BoxartCrawler(progress);

            config.BoxartPath   = boxArtPath;
            config.SettingsPath = config.GetCorrectSettingsIniPath();
            crawler.DownloadArt(config).Wait();
        }