Example #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);
        }
        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();
        }
Example #3
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);

            int index = 0;

            foreach (string property in Title.Properties)
            {
                ToolStripMenuItem menuItem = new ToolStripMenuItem
                {
                    Name = String.Format("property{0}ToolStripMenuItem", index++),
                    Text = property,
                };
                menuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
                copyToolStripMenuItem.DropDownItems.Add(menuItem);
            }

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

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

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

            Process.migrateSettings();
        }
Example #4
0
        public Main()
        {
            InitializeComponent();

            debugLogToolStripMenuItem.Checked = Properties.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);
            }
        }
        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();
        }
Example #6
0
        static void Main(string[] args)
        {
            FileVersionInfo info = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);

            if (info != null)
            {
                Console.WriteLine("{0} {1}", info.ProductName, info.ProductVersion);
                Console.WriteLine("{0} {1}", info.LegalCopyright, info.CompanyName);
            }
            else
            {
                Console.WriteLine("{0} {1}", Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version);
            }

            Console.WriteLine();

            bool   sdcard = false;
            string sort   = "";

            OptionSet options = null;

            options = new OptionSet()
            {
                { "c|sdcard", "open path as sdcard", v => sdcard = v != null },
                { "s|sort=", "sort by titleid, titlename or filename [default: filename]", (string s) => sort = s },
                { "h|help", "show this help message and exit", v => printHelp(options) },
                { "z|nsz", "enable nsz extension", v => Common.Settings.Default.NszExtension = v != null, true },
                { "d|debug", "enable debug log", v => Common.Settings.Default.DebugLog = v != null },
            };

            List <string> paths;

            try
            {
                paths = options.Parse(args);
            }
            catch (OptionException)
            {
                printHelp(options);
                return;
            }

            if (!paths.Any())
            {
                printHelp(options);
                return;
            }

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

            Console.ForegroundColor = ConsoleColor.DarkRed;
            foreach (var message in messages)
            {
                Console.WriteLine(message);
            }
            Console.ResetColor();

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

            processPaths(paths, sort, sdcard);
        }