Run() публичный Метод

public Run ( ) : void
Результат void
Пример #1
0
        public static void Main(string [] args)
        {
            // Parse the command line options
            bool show_help       = false;
            OptionSet option_set = new OptionSet () {
                { "v|version", _("Print version information"), v => { PrintVersion (); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                option_set.Parse (args);

            } catch (OptionException e) {
                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
                ShowHelp (option_set);

            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController ();
            Controller.Initialize ();

            if (Controller != null) {
                UI = new SparkleUI ();
                UI.Run ();
            }
        }
Пример #2
0
        public static void Main(string [] args)
        {
            // Parse the command line options
            bool      show_help  = false;
            OptionSet option_set = new OptionSet()
            {
                { "v|version", _("Print version information"), v => { PrintVersion(); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                option_set.Parse(args);
            } catch (OptionException e) {
                Console.Write("SparkleShare: ");
                Console.WriteLine(e.Message);
                Console.WriteLine("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
            {
                ShowHelp(option_set);
            }


            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController();
            Controller.Initialize();

            if (Controller != null)
            {
                UI = new SparkleUI();
                UI.Run();
            }
        }
Пример #3
0
        public static void Main (string [] args)
        {
			Console.WriteLine("start");
            if (args.Length != 0 && !args [0].Equals ("start") &&
                SparkleBackend.Platform != PlatformID.MacOSX &&
                SparkleBackend.Platform != PlatformID.Win32NT) {

                string n = Environment.NewLine;

                Console.WriteLine (n +
                    "SparkleShare is a collaboration and sharing tool that is" + n +
                    "designed to keep things simple and to stay out of your way." + n +
                    n +
                    "Version: " + SparkleLib.SparkleBackend.Version + n +
                    "Copyright (C) 2010 Hylke Bons" + n +
                    "This program comes with ABSOLUTELY NO WARRANTY." + n +
                    n +
                    "This is free software, and you are welcome to redistribute it" + n +
                    "under certain conditions. Please read the GNU GPLv3 for details." + n +
                    n +
                    "Usage: sparkleshare [start|stop|restart]");
				Console.WriteLine ("SparkleShare is already running.");
                Environment.Exit (-1);
            }

			// Only allow one instance of SparkleShare (on Windows)
			if (!program_mutex.WaitOne (0, false)) {
				Console.WriteLine ("SparkleShare is already running.");
				Environment.Exit (-1);
			}

#if !DEBUG
            try {
#endif
                Controller = new SparkleController ();
                Controller.Initialize ();

                UI = new SparkleUI ();
                UI.Run ();
            
#if !DEBUG
            } catch (Exception e) {
				Console.WriteLine("Exception in Program.Main");
                SparkleLogger.WriteCrashReport (e);
                Environment.Exit (-1);
            }
#endif

            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers ();
            #endif
        }
Пример #4
0
        public static void Main(string [] args)
        {
            if (args.Length != 0 && !args [0].Equals("start") &&
                SparkleBackend.Platform != PlatformID.MacOSX &&
                SparkleBackend.Platform != PlatformID.Win32NT)
            {
                string n = Environment.NewLine;

                Console.WriteLine(n +
                                  "SparkleShare is a collaboration and sharing tool that is" + n +
                                  "designed to keep things simple and to stay out of your way." + n +
                                  n +
                                  "Version: " + SparkleLib.SparkleBackend.Version + n +
                                  "Copyright (C) 2010 Hylke Bons" + n +
                                  "This program comes with ABSOLUTELY NO WARRANTY." + n +
                                  n +
                                  "This is free software, and you are welcome to redistribute it" + n +
                                  "under certain conditions. Please read the GNU GPLv3 for details." + n +
                                  n +
                                  "Usage: sparkleshare [start|stop|restart]");

                Environment.Exit(-1);
            }

            // Only allow one instance of SparkleShare (on Windows)
            if (!program_mutex.WaitOne(0, false))
            {
                Console.WriteLine("SparkleShare is already running.");

                Controller = new SparkleController();
                Controller.Initialize();

                UI = new SparkleUI();
                UI.Run();
            }

            try {
                Controller = new SparkleController();
                Controller.Initialize();

                UI = new SparkleUI();
                UI.Run();
            } catch (Exception e) {
                SparkleLogger.WriteCrashReport(e);
                Environment.Exit(-1);
            }

            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();
            #endif
        }
Пример #5
0
        public static void Main(string [] args)
        {
            // Parse the command line options
            bool      show_help  = false;
            OptionSet option_set = new OptionSet()
            {
                { "v|version", _("Print version information"), v => { PrintVersion(); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                option_set.Parse(args);
            } catch (OptionException e) {
                Console.Write("SparkleShare: ");
                Console.WriteLine(e.Message);
                Console.WriteLine("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
            {
                ShowHelp(option_set);
            }


            // Only allow one instance of SparkleShare
            if (!ProgramMutex.WaitOne(0, false))
            {
                Console.WriteLine("SparkleShare is already running.");
                Environment.Exit(-1);
            }


            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController();
            Controller.Initialize();

            if (Controller != null)
            {
                UI = new SparkleUI();
                UI.Run();
            }

            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();
            #endif
        }
Пример #6
0
        public static void Main(string [] args)
        {
            Arguments = args;

            if (args.Length != 0 && !args [0].Equals("help") &&
                SparkleBackend.Platform != PlatformID.MacOSX &&
                SparkleBackend.Platform != PlatformID.Win32NT)
            {
                string n = Environment.NewLine;

                Console.WriteLine(n +
                                  "Share and collaborate by syncing with any Git repository instantly." + n +
                                  n +
                                  "Version: " + SparkleLib.SparkleBackend.Version + n +
                                  "Copyright (C) 2010 Hylke Bons and others" + n +
                                  "This program comes with ABSOLUTELY NO WARRANTY." + n +
                                  n +
                                  "This is free software, and you are welcome to redistribute it" + n +
                                  "under certain conditions. Please read the GNU GPLv3 for details." + n +
                                  n +
                                  "Usage: sparkleshare [start|open]");

                Environment.Exit(-1);
            }

            // Only allow one instance of SparkleShare (on Windows)
            if (!program_mutex.WaitOne(0, false))
            {
                Console.WriteLine("SparkleShare is already running.");
                Environment.Exit(-1);
            }

            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            Controller = new SparkleController();
            Controller.Initialize();

            UI = new SparkleUI();
            UI.Run();

            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();
            #endif
        }
Пример #7
0
        public static void Main (string [] args)
        {
            Arguments = args;

            if (args.Length != 0 && !args [0].Equals ("help") &&
                SparkleBackend.Platform != PlatformID.MacOSX &&
                SparkleBackend.Platform != PlatformID.Win32NT) {

                string n = Environment.NewLine;

                Console.WriteLine (n +
                    "Share and collaborate by syncing with any Git repository instantly." + n +
                    n +
                    "Version: " + SparkleLib.SparkleBackend.Version + n +
                    "Copyright (C) 2010 Hylke Bons and others" + n +
                    "This program comes with ABSOLUTELY NO WARRANTY." + n +
                    n +
                    "This is free software, and you are welcome to redistribute it" + n +
                    "under certain conditions. Please read the GNU GPLv3 for details." + n +
                    n +
                    "Usage: sparkleshare [start|open]");

                Environment.Exit (-1);
            }

            // Only allow one instance of SparkleShare (on Windows)
            if (!program_mutex.WaitOne (0, false)) {
                Console.WriteLine ("SparkleShare is already running.");
                Environment.Exit (-1);
            }

            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            Controller = new SparkleController ();
            Controller.Initialize ();

            UI = new SparkleUI ();
            UI.Run ();

            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers ();
            #endif
        }
Пример #8
0
        public static void Main(string [] args)
        {
            if (args.Length != 0 && !args [0].Equals("start"))
            {
                Console.WriteLine(" ");
                Console.WriteLine("SparkleShare is a collaboration and sharing tool that is ");
                Console.WriteLine("designed to keep things simple and to stay out of your way.");
                Console.WriteLine(" ");
                Console.WriteLine("Version: " + SparkleLib.Defines.VERSION);
                Console.WriteLine("Copyright (C) 2010 Hylke Bons");
                Console.WriteLine(" ");
                Console.WriteLine("This program comes with ABSOLUTELY NO WARRANTY.");
                Console.WriteLine(" ");
                Console.WriteLine("This is free software, and you are welcome to redistribute it ");
                Console.WriteLine("under certain conditions. Please read the GNU GPLv3 for details.");
                Console.WriteLine(" ");
                Console.WriteLine("Usage: sparkleshare [start|stop|restart]");

                Environment.Exit(-1);
            }

            // Only allow one instance of SparkleShare (on Windows)
            if (!program_mutex.WaitOne(0, false))
            {
                Console.WriteLine("SparkleShare is already running.");
                Environment.Exit(-1);
            }

            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController();
            Controller.Initialize();

            if (Controller != null)
            {
                UI = new SparkleUI();
                UI.Run();
            }

            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();
            #endif
        }
Пример #9
0
        public static void Main (string [] args)
        {
            if (args.Length != 0 && !args [0].Equals ("start")) {
                Console.WriteLine (" ");
                Console.WriteLine ("SparkleShare is a collaboration and sharing tool that is ");
                Console.WriteLine ("designed to keep things simple and to stay out of your way.");
                Console.WriteLine (" ");
                Console.WriteLine ("Version: " + SparkleLib.Defines.VERSION);
                Console.WriteLine ("Copyright (C) 2010 Hylke Bons");
                Console.WriteLine (" ");
                Console.WriteLine ("This program comes with ABSOLUTELY NO WARRANTY.");
                Console.WriteLine (" ");
                Console.WriteLine ("This is free software, and you are welcome to redistribute it ");
                Console.WriteLine ("under certain conditions. Please read the GNU GPLv3 for details.");
                Console.WriteLine (" ");
                Console.WriteLine ("Usage: sparkleshare [start|stop|restart]");

                Environment.Exit (-1);
            }
			
			// Only allow one instance of SparkleShare (on Windows)
			if (!program_mutex.WaitOne (0, false)) {
				Console.WriteLine ("SparkleShare is already running.");
				Environment.Exit (-1);
			}

            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController ();
            Controller.Initialize ();
        
            if (Controller != null) {
                UI = new SparkleUI ();
                UI.Run ();
            }
         
            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers ();
            #endif
        }
Пример #10
0
        public static void Main(string [] args)
        {
            // Use translations
            Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);

            // Don't allow running as root
            if (new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) {

                Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
                Console.WriteLine (_("Things would go utterly wrong."));

                Environment.Exit (0);

            }

            // Parse the command line options
            bool hide_ui   = false;
            bool show_help = false;

            var p = new OptionSet () {
                { "d|disable-gui", _("Don't show the notification icon"), v => hide_ui = v != null },
                { "v|version", _("Print version information"), v => { PrintVersion (); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {

                p.Parse (args);

            } catch (OptionException e) {

                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");

            }

            if (show_help)
                ShowHelp (p);

            // Load the right controller for the OS
            string controller_name;
            switch (SparkleShare.Platform) {

                case PlatformID.Unix:
                    SetProcessName ("sparkleshare");
                    controller_name = "Lin";
                break;

                case PlatformID.MacOSX:
                    controller_name = "Mac";
                break;

                case PlatformID.Win32NT:
                    controller_name = "Win";
                break;

                default:
                    controller_name = "Lin";
                break;

            }

            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = (SparkleController) Activator.CreateInstance (
                Type.GetType ("SparkleShare.Sparkle" + controller_name + "Controller"));

            if (Controller != null && !hide_ui) {

                UI = new SparkleUI ();
                UI.Run ();

            }
        }
Пример #11
0
        public static void Main(string [] args)
        {
            // Use translations
            Catalog.Init(Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);

            // Don't allow running as root
            if (new UnixUserInfo(UnixEnvironment.UserName).UserId == 0)
            {
                Console.WriteLine(_("Sorry, you can't run SparkleShare with these permissions."));
                Console.WriteLine(_("Things would go utterly wrong."));
                Environment.Exit(0);
            }

            // Parse the command line options
            bool hide_ui   = false;
            bool show_help = false;

            var p = new OptionSet()
            {
                { "d|disable-gui", _("Don't show the notification icon"), v => hide_ui = v != null },
                { "v|version", _("Print version information"), v => { PrintVersion(); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                p.Parse(args);
            } catch (OptionException e) {
                Console.Write("SparkleShare: ");
                Console.WriteLine(e.Message);
                Console.WriteLine("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
            {
                ShowHelp(p);
            }

            // Load the right controller for the OS
            string controller_name;

            switch (SparkleShare.Platform)
            {
            case PlatformID.Unix:
                SetProcessName("sparkleshare");
                controller_name = "Lin";
                break;

            case PlatformID.MacOSX:
                controller_name = "Mac";
                break;

            case PlatformID.Win32NT:
                controller_name = "Win";
                break;

            default:
                controller_name = "Lin";
                break;
            }

            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = (SparkleController)Activator.CreateInstance(
                Type.GetType("SparkleShare.Sparkle" + controller_name + "Controller"));

            if (Controller != null && !hide_ui)
            {
                UI = new SparkleUI();
                UI.Run();
            }
        }
Пример #12
0
        public static void Main(string [] args)
        {
            // Use translations
            Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);

            // Don't allow running as root
            if (new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) {

                Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
                Console.WriteLine (_("Things would go utterly wrong."));

                Environment.Exit (0);

            }

            bool hide_ui   = false;
            bool show_help = false;

            var p = new OptionSet () {
                { "d|disable-gui", _("Don't show the notification icon"), v => hide_ui = v != null },
                { "v|version", _("Show this help text"), v => { PrintVersion (); } },
                { "h|help", _("Print version information"), v => show_help = v != null }
            };

            try {

                p.Parse (args);

            } catch (OptionException e) {

                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");

            }

            if (show_help)
                ShowHelp (p);

            switch (SparkleShare.Platform) {

                case PlatformID.Unix:
                    SetProcessName ("sparkleshare");
                    Controller = new SparkleLinController ();
                break;

                case PlatformID.MacOSX:
                    //Controller = new SparkleMacController ();
                break;

                case PlatformID.Win32NT:
                    //Controller = new SparkleWinController ();
                break;

            }

            if (!hide_ui) {

                UI = new SparkleUI ();
                UI.Run ();

            }
        }
Пример #13
0
        public static void Main (string [] args)
        {
            // Parse the command line options
            bool show_help       = false;
            OptionSet option_set = new OptionSet () {
                { "v|version", _("Print version information"), v => { PrintVersion (); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                option_set.Parse (args);

            } catch (OptionException e) {
                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
                ShowHelp (option_set);

			
			// Only allow one instance of SparkleShare
			if (!ProgramMutex.WaitOne (0, false)) {
				Console.WriteLine ("SparkleShare is already running.");
				Environment.Exit (-1);
			}
				
			
            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController ();
            Controller.Initialize ();
        
            if (Controller != null) {
                UI = new SparkleUI ();
                UI.Run ();
            }
         
            #if !__MonoCS__
            // Suppress assertion messages in debug mode
            GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers ();
            #endif
        }
Пример #14
0
        public static void Main(string [] args)
        {
            // Parse the command line options
            bool show_help       = false;
            OptionSet option_set = new OptionSet () {
                { "v|version", _("Print version information"), v => { PrintVersion (); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                option_set.Parse (args);

            } catch (OptionException e) {
                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
                ShowHelp (option_set);

            // Load the right controller for the OS
            string controller_name = "Lin";
            switch (SparkleBackend.Platform) {
            case PlatformID.Unix:
                SetProcessName ("sparkleshare");
                break;
            case PlatformID.MacOSX:
                controller_name = "Mac";
                break;
            case PlatformID.Win32NT:
                controller_name = "Win";
                break;
            }

            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleMacController ();
            Controller.Initialize ();

            if (Controller != null) {
                UI = new SparkleUI ();
                UI.Run ();
            }
        }
Пример #15
0
        public static void Main(string [] args)
        {
            // Use translations
            Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);

            // Check whether git is installed
            Process process = new Process ();
            process.StartInfo.FileName = "git";
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.UseShellExecute = false;
            process.Start ();

            if (process.StandardOutput.ReadToEnd ().IndexOf ("version") == -1) {

                Console.WriteLine (_("Git wasn't found."));
                Console.WriteLine (_("You can get Git from http://git-scm.com/."));

                Environment.Exit (0);

            }

            UnixUserInfo user_info = new UnixUserInfo (UnixEnvironment.UserName);

            // Don't allow running as root
            if (user_info.UserId == 0) {

                Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions."));
                Console.WriteLine (_("Things would go utterly wrong."));

                Environment.Exit (0);

            }

            bool HideUI   = false;
            bool ShowHelp = false;

            var p = new OptionSet () {
                { "d|disable-gui", _("Don't show the notification icon"), v => HideUI = v != null },
                { "v|version", _("Show this help text"), v => { PrintVersion (); Environment.Exit (0); } },
                { "h|help", _("Print version information"), v=> ShowHelp = v != null }
            };

            try {

                p.Parse (args);

            } catch (OptionException e) {

                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");

            }

            if (ShowHelp)
                DisplayHelp(p);

            SparkleUI = new SparkleUI (HideUI);
            SparkleUI.Run();
        }
Пример #16
0
        public static void Main (string [] args)
        {
            SetUiCulture();

            // Parse the command line options
            bool show_help       = false;
            OptionSet option_set = new OptionSet () {
                { "v|version", _("Print version information"), v => { PrintVersion (); } },
                { "h|help", _("Show this help text"), v => show_help = v != null }
            };

            try {
                option_set.Parse (args);

            } catch (OptionException e) {
                Console.Write ("SparkleShare: ");
                Console.WriteLine (e.Message);
                Console.WriteLine ("Try `sparkleshare --help' for more information.");
            }

            if (show_help)
                ShowHelp (option_set);


            // Initialize the controller this way so that
            // there aren't any exceptions in the OS specific UI's
            Controller = new SparkleController ();
            Controller.Initialize ();
        
            if (Controller != null) {
                UI = new SparkleUI ();
                UI.Run ();
            }

#if !__MonoCS__
            // For now we must do GC.Collect to free some internal handles, otherwise
            // in debug mode you can got assertion message.
            GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers ();
            CefSharp.CEF.Shutdown ();    // Shutdown CEF.
#endif
        }