Exemplo n.º 1
0
        private void OpenStorage()
        {
            using (OpenStorageForm osf = new OpenStorageForm())
            {
                if (osf.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                viewHelper.OpenStorage(false, osf.StoragePath, osf.Product);

                openRecentStorageToolStripMenuItem.Enabled = true;

                if (RecentStorage.Storages.Find(s => s.Path.Equals(osf.StoragePath, StringComparison.OrdinalIgnoreCase) && s.Product == osf.Product) == null)
                {
                    RecentStorage storage = new RecentStorage()
                    {
                        Path = osf.StoragePath, Product = osf.Product
                    };
                    RecentStorage.Storages.Add(storage);
                    Settings.Default.RecentStorages = RecentStorage.Save();
                    openRecentStorageToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem($"{storage.Path} ({storage.Product})")
                    {
                        Tag = storage
                    });
                }
            }
        }
Exemplo n.º 2
0
        private void openRecentStorageToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            RecentStorage storage = e.ClickedItem.Tag as RecentStorage;

            viewHelper.OpenStorage(false, storage.Path, storage.Product);
        }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

            viewHelper.OnCleanup        += ViewHelper_OnCleanup;
            viewHelper.OnStorageChanged += ViewHelper_OnStorageChanged;

            Settings.Default.PropertyChanged += Settings_PropertyChanged;

            iconsList.Images.Add(Resources.folder);
            iconsList.Images.Add(Resources.openFolder);
            iconsList.Images.Add(SystemIcons.WinLogo);

            folderTree.SelectedImageIndex = 1;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var locales = Enum.GetNames(typeof(LocaleFlags));

            foreach (var locale in locales)
            {
                if (locale == "None")
                {
                    continue;
                }

                var item = new ToolStripMenuItem(locale)
                {
                    Checked = Settings.Default.LocaleFlags.ToString() == locale
                };
                localeFlagsToolStripMenuItem.DropDownItems.Add(item);
            }

            NameValueCollection onlineStorageList = (NameValueCollection)ConfigurationManager.GetSection("OnlineStorageList");

            if (onlineStorageList != null)
            {
                openOnlineStorageToolStripMenuItem.Enabled = onlineStorageList.Count > 0;

                foreach (string game in onlineStorageList)
                {
                    var item = new ToolStripMenuItem(onlineStorageList[game])
                    {
                        Tag = game
                    };
                    openOnlineStorageToolStripMenuItem.DropDownItems.Add(item);
                }
            }

            if (!RecentStorage.Load(Settings.Default.RecentStorages))
            {
                Settings.Default.RecentStorages = string.Empty;
            }

            openRecentStorageToolStripMenuItem.Enabled = RecentStorage.Storages.Count > 0;

            foreach (var recentStorage in RecentStorage.Storages)
            {
                openRecentStorageToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem($"{recentStorage.Path} ({recentStorage.Product})")
                {
                    Tag = recentStorage
                });
            }

            useLVToolStripMenuItem.Checked = Settings.Default.OverrideArchive;
            tsmShowPreview.Checked         = Settings.Default.PreviewVisible;
        }