Inheritance: System.Windows.Forms.Form
Exemple #1
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoadingDialog loader = new LoadingDialog(Microsoft.Win32.Registry.ClassesRoot);
            if (loader.ShowDialog() == DialogResult.OK)
            {
                m_appContext = new AppContextImpl(loader.LoadedReg);
                Application.Run(m_appContext);
            }
        }
Exemple #2
0
 private void menuFileOpenDatabase_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "OleViewDotNet DB File (*.ovdb)|*.ovdb|All Files (*.*)|*.*";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             using (LoadingDialog loader = new LoadingDialog(false, dlg.FileName))
             {
                 if ((loader.ShowDialog() != DialogResult.OK) && (loader.Error != null))
                 {
                     MessageBox.Show(loader.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
     }
 }
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (LoadingDialog loader = new LoadingDialog(Microsoft.Win32.Registry.ClassesRoot))
            {
                if (loader.ShowDialog() == DialogResult.OK)
                {
                    using (_mainForm = new MainForm())
                    {
                        Application.Run(_mainForm);
                    }
                }
            }
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            string database_file = null;
            string save_file     = null;
            bool   enum_clsid    = false;
            bool   show_help     = false;
            bool   user_only     = false;

            OptionSet opts = new OptionSet()
            {
                { "i|in=", "Open a database file.", v => database_file = v },
                { "o|out=", "Save database and exit.", v => save_file = v },
                { "e|enum", "Enumerate the provided CLSID (GUID).", v => enum_clsid = v != null },
                { "u|user", "Use only current user registrations.", v => user_only = v != null },
                { "h|help", "Show this message and exit.", v => show_help = v != null },
            };

            List <string> additional_args = opts.Parse(args);

            if (show_help || (enum_clsid && additional_args.Count < 4))
            {
                StringWriter writer = new StringWriter();
                writer.WriteLine("Usage: OleViewDotNet [options] [enum args]");
                writer.WriteLine();
                writer.WriteLine("Options:");
                opts.WriteOptionDescriptions(writer);
                MessageBox.Show(writer.ToString(), "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Environment.Exit(1);
            }

            if (enum_clsid)
            {
                try
                {
                    Environment.Exit(EnumInterfaces(additional_args));
                }
                catch
                {
                    Environment.Exit(42);
                }
            }
            else
            {
                Exception   error    = null;
                COMRegistry instance = null;
                AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                using (LoadingDialog loader = new LoadingDialog(user_only, database_file))
                {
                    if (loader.ShowDialog() == DialogResult.OK)
                    {
                        instance = loader.Instance;
                        if (save_file != null)
                        {
                            try
                            {
                                instance.Save(save_file);
                            }
                            catch (Exception ex)
                            {
                                error = ex;
                            }
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        error = loader.Error;
                    }
                }

                if (error == null)
                {
                    using (_mainForm = new MainForm(instance))
                    {
                        Application.Run(_mainForm);
                    }
                }
                else
                {
                    MessageBox.Show(error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #5
0
        public static void Main(string[] args)
        {
            string database_file = null;
            string save_file = null;
            bool enum_clsid = false;
            bool show_help = false;
            bool user_only = false;

            OptionSet opts = new OptionSet() {
                { "i|in=",  "Open a database file.", v => database_file = v },
                { "o|out=", "Save database and exit.", v => save_file = v },
                { "e|enum",  "Enumerate the provided CLSID (GUID).", v => enum_clsid = v != null },
                { "u|user",  "Use only current user registrations.", v => user_only = v != null },
                { "h|help",  "Show this message and exit.", v => show_help = v != null },
            };

            List<string> additional_args = opts.Parse(args);

            if (show_help || (enum_clsid && additional_args.Count < 4))
            {
                StringWriter writer = new StringWriter();
                writer.WriteLine("Usage: OleViewDotNet [options] [enum args]");
                writer.WriteLine();
                writer.WriteLine("Options:");
                opts.WriteOptionDescriptions(writer);
                MessageBox.Show(writer.ToString(), "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Environment.Exit(1);
            }

            if (enum_clsid)
            {
                try
                {
                    Environment.Exit(EnumInterfaces(additional_args));
                }
                catch
                {
                    Environment.Exit(42);
                }
            }
            else
            {
                Exception error = null;
                COMRegistry instance = null;
                AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                using (LoadingDialog loader = new LoadingDialog(user_only, database_file))
                {
                    if (loader.ShowDialog() == DialogResult.OK)
                    {
                        instance = loader.Instance;
                        if (save_file != null)
                        {
                            try
                            {
                                instance.Save(save_file);
                            }
                            catch (Exception ex)
                            {
                                error = ex;
                            }
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        error = loader.Error;
                    }
                }

                if (error == null)
                {
                    using (_mainForm = new MainForm(instance))
                    {
                        Application.Run(_mainForm);
                    }
                }
                else
                {
                    MessageBox.Show(error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #6
0
 private void menuFileOpenDatabase_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "OleViewDotNet DB File (*.ovdb)|*.ovdb|All Files (*.*)|*.*";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             using (LoadingDialog loader = new LoadingDialog(false, dlg.FileName))
             {
                 if ((loader.ShowDialog() != DialogResult.OK) && (loader.Error != null))
                 {
                     MessageBox.Show(loader.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }                    
         }
     }
 }