示例#1
0
        public Main()
        {
            InitializeComponent();

            PortableSettingsProvider.SettingsFileName      = Common.USER_SETTINGS;
            PortableSettingsProviderBase.SettingsDirectory = Process.path_prefix;
            PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.History.Default);

            Common.Settings.Default.Upgrade();
            Common.History.Default.Upgrade();

            debugLogToolStripMenuItem.Checked = Common.Settings.Default.DebugLog;

            aboutToolStripMenuItem.Text = String.Format("&About {0}", Application.ProductName);

            bool init = Process.initialize(out List <string> messages);

            foreach (var message in messages)
            {
                MessageBox.Show(message, Application.ProductName);
            }

            if (!init)
            {
                Environment.Exit(-1);
            }

            titles = Process.processHistory();

            reloadData();

            toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
        }
示例#2
0
        private void Main_Load(object sender, EventArgs e)
        {
            Location = Common.Settings.Default.WindowLocation;
            Size = Common.Settings.Default.WindowSize;

            if (Common.Settings.Default.Columns.Any())
            {
                foreach (var column in objectListView.AllColumns)
                {
                    if (!Common.Settings.Default.Columns.Union(new List<string> { "titleID", "titleName", "error" }).ToList().Contains(column.AspectName))
                    {
                        column.IsVisible = false;
                    }
                }
                objectListView.RebuildColumns();
            }

            foreach (var column in objectListView.Columns.Cast<ColumnHeader>().Zip(Common.Settings.Default.ColumnWidth, Tuple.Create))
            {
                column.Item1.Width = column.Item2;
            }

            titles = Process.processHistory();

            reloadData();

            toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
        }
        public override void WindowDidLoad()
        {
            base.WindowDidLoad();

            tableViewDataSource = new TableViewDataSource();
            tableViewDelegate   = new TableViewDelegate(tableViewDataSource);

            tableView.DataSource = tableViewDataSource;
            tableView.Delegate   = tableViewDelegate;

            PortableSettingsProvider.SettingsFileName      = Common.USER_SETTINGS;
            PortableSettingsProviderBase.SettingsDirectory = Process.path_prefix;
            PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.History.Default);

            Common.Settings.Default.Upgrade();
            Common.History.Default.Upgrade();

            NSMenuItem debugLog = Window.Menu?.ItemWithTitle("File")?.Submenu.ItemWithTitle("Debug Log");

            if (debugLog != null)
            {
                debugLog.State = Common.Settings.Default.DebugLog ? NSCellStateValue.On : NSCellStateValue.Off;
            }

            bool init = Process.initialize(out List <string> messages);

            foreach (var message in messages)
            {
                var alert = new NSAlert()
                {
                    InformativeText = message,
                    MessageText     = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleExecutable").ToString(),
                };
                alert.RunModal();
            }

            if (!init)
            {
                Environment.Exit(-1);
            }

            backgroundWorker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            backgroundWorker.DoWork             += BackgroundWorker_DoWork;
            backgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            titles = Process.processHistory();

            tableViewDataSource.Titles.AddRange(titles);

            tableView.ReloadData();
        }
示例#4
0
        private void historyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process.latestVersions.Clear();

            int index = 0;

            foreach (ToolStripMenuItem item in historyToolStripMenuItem.DropDownItems)
            {
                item.Checked = item == sender;

                if (item == sender)
                {
                    titles = Process.processHistory(index);

                    reloadData();

                    toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
                }

                index++;
            }
        }
示例#5
0
        private void Main_Load(object sender, EventArgs e)
        {
            Location = Common.Settings.Default.WindowLocation;
            Size     = Common.Settings.Default.WindowSize;

            if (Common.Settings.Default.Columns.Any())
            {
                foreach (var column in objectListView.AllColumns)
                {
                    if (!Common.Settings.Default.Columns.Union(new List <string> {
                        "titleID", "titleName", "error"
                    }).ToList().Contains(column.AspectName))
                    {
                        column.IsVisible = false;
                    }
                }
                objectListView.RebuildColumns();
            }

            foreach (var column in objectListView.Columns.Cast <ColumnHeader>().Zip(Common.Settings.Default.ColumnWidth, Tuple.Create))
            {
                column.Item1.Width = column.Item2;
            }

            objectListView.CustomSorter = delegate(OLVColumn column, SortOrder order)
            {
                switch (column.AspectName)
                {
                case "versionString":
                case "latestVersionString":
                case "applicationVersionString":
                case "filesizeString":
                    objectListView.ListViewItemSorter = new CustomSorter(column, order);
                    break;

                case "displayVersion":
                    objectListView.ListViewItemSorter = new CustomSorter(column, order);
                    break;

                case "titleID":
                case "baseTitleID":
                case "titleName":
                case "systemUpdateString":
                case "systemVersionString":
                case "masterkeyString":
                case "titleKey":
                case "publisher":
                case "languagesString":
                case "filename":
                case "typeString":
                case "distribution":
                case "structureString":
                case "signatureString":
                case "permissionString":
                case "error":
                default:
                    objectListView.ListViewItemSorter = new ColumnComparer(column, order);
                    break;
                }
            };

            int index = 0;

            foreach (ArrayOfTitle history in Common.History.Default.Titles)
            {
                ToolStripMenuItem menuItem = new ToolStripMenuItem
                {
                    Name         = String.Format("history{0}ToolStripMenuItem", index++),
                    Text         = String.Format("{0} ({1} files)", history.description, history.title.Count),
                    CheckOnClick = true,
                };
                menuItem.Click += new System.EventHandler(this.historyToolStripMenuItem_Click);
                historyToolStripMenuItem.DropDownItems.Add(menuItem);
            }

            if (index > 0)
            {
                (historyToolStripMenuItem.DropDownItems[index - 1] as ToolStripMenuItem).Checked = true;
            }

            titles = Process.processHistory();

            reloadData();

            toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
        }
        public override void WindowDidLoad()
        {
            base.WindowDidLoad();

            tableViewDataSource = new TableViewDataSource();
            tableViewDelegate   = new TableViewDelegate(tableViewDataSource);

            tableView.DataSource = tableViewDataSource;
            tableView.Delegate   = tableViewDelegate;

            PortableSettingsProvider.SettingsFileName      = Common.USER_SETTINGS;
            PortableSettingsProviderBase.SettingsDirectory = Process.path_prefix;
            PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.History.Default);

            Common.Settings.Default.Upgrade();
            Common.History.Default.Upgrade();

            NSMenuItem debugLog = Window.Menu?.ItemWithTitle("File")?.Submenu.ItemWithTitle("Debug Log");

            if (debugLog != null)
            {
                debugLog.State = Common.Settings.Default.DebugLog ? NSCellStateValue.On : NSCellStateValue.Off;
            }

            historyMenu = Window.Menu?.ItemWithTitle("History")?.Submenu;

            InitContextMenu(contextMenu.ItemWithTitle("Copy")?.Submenu);

            bool init = Process.initialize(out List <string> messages);

            foreach (var message in messages)
            {
                var alert = new NSAlert()
                {
                    InformativeText = message,
                    MessageText     = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleExecutable").ToString(),
                };
                alert.RunModal();
            }

            if (!init)
            {
                Environment.Exit(-1);
            }

            Process.migrateSettings();

            backgroundWorker = new BackgroundWorker
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            backgroundWorker.DoWork             += BackgroundWorker_DoWork;
            backgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            int index = 0;

            foreach (ArrayOfTitle history in Common.History.Default.Titles)
            {
                NSMenuItem menuItem = new NSMenuItem(String.Format("{0} ({1} files)", history.description, history.title.Count), new System.EventHandler(History));
                historyMenu.AddItem(menuItem);

                index++;
            }

            if (index > 0)
            {
                historyMenu.Items[index - 1].State = NSCellStateValue.On;
            }

            titles = Process.processHistory();

            tableViewDataSource.Titles.AddRange(titles);

            tableView.ReloadData();
        }