// ============================================
        //             APPLICATION MAIN
        // ============================================
        public static int Main(string[] args)
        {
            // Starting Application
            Debug.Log("{0} {1} Started...", Info.Name, Info.Version);

            do {
                p2pManager = null;
                nyFolder = null;

                // Initialize Gtk Support
                if (Gtk.Application.InitCheck("NyFolder.exe", ref args) == false) {
                    PrintErrorMessage("You Don't Have Gtk Support Here...");
                    return(1);
                }

                // Initialize Components
                InitBase();
                InitNetwork();
                InitApplication();

                try {
                    // Set 'No Restart' Application
                    NyFolderApp.Restart = false;

                    // Run NyFolder Application
                    nyFolder.Run();

                    // Run Gtk Main
                    Gtk.Application.Run();
                } catch (NyFolderExit) {
                    // This is Logout Event :D
                    NyFolderApp.Restart = true;
                } catch (Exception e) {
                    PrintErrorMessage(e);
                    return(1);
                } finally {
                    // Uninitialize Plugins
                    PluginManager.StopPlugins();

                    // Clear Download/Upload Manager
                    UploadManager.Clear();
                    DownloadManager.Clear();

                    // Destroy All P2P Connections
                    if (p2pManager != null) p2pManager.Kill();

                    // NyFolder Quit Application
                    if (NyFolderApp.Restart == false && nyFolder != null)
                        nyFolder.Quit();
                }
                Thread.Sleep(1000);
            } while (NyFolderApp.Restart == true);

            // Application Correct Termination
            Debug.Log("{0} {1} Ended...", Info.Name, Info.Version);
            return(0);
        }
        /// Initialize NyFolder Application + Plugins
        private static void InitApplication()
        {
            // Initialize NyFolder Application
            Debug.Log("Initializing NyFolder...");
            nyFolder = new NyFolderApp();
            nyFolder.Initialize();

            // Initialize Plugins
            Debug.Log("Initializing NyFolder Plugins...");
            PluginManager.Initialize(nyFolder);

            // Start Plugins
            Debug.Log("Starting NyFolder Plugins...");
            PluginManager.RunPlugins();
        }
Exemple #3
0
        // ============================================
        //               APPLICATION MAIN
        // ============================================
        public static int Main(string[] args)
        {
            do
            {
                NyFolderApp.RestartApplication = false;
                P2PManager  p2pManager = null;
                NyFolderApp nyFolder   = null;

                try {
                    // Initialize P2PManager
                    p2pManager = P2PManager.GetInstance();

                    // Initialize Gtk Support
                    Gtk.Application.Init();

                    // Initialize NyFolder Application
                    nyFolder = new NyFolderApp();
                    nyFolder.Initialize();

                    // Initialize Plugins
                    new PluginManager(nyFolder);

                    // Run NyFolder Application
                    nyFolder.Run();

                    // Run GtkMain
                    Gtk.Application.Run();
                } catch (Exception e) {
                    Console.WriteLine("{0} {1} Error", Info.Name, Info.Version);
                    Console.WriteLine("Source:  {0}", e.Source);
                    Console.WriteLine("Message: {0}", e.Message);
                    Console.WriteLine("Stack Trace:\n{0}", e.StackTrace);
                    Console.WriteLine();
                    Console.WriteLine("Please, Report Bug(s) To Matteo Bertozzi <*****@*****.**>");
                    return(1);
                } finally {
                    if (nyFolder != null)
                    {
                        nyFolder.Quit();
                    }
                    if (p2pManager != null)
                    {
                        p2pManager.Kill();
                    }
                }
            } while (NyFolderApp.RestartApplication == true);
            return(0);
        }
        // ============================================
        //               APPLICATION MAIN
        // ============================================
        public static int Main(string[] args)
        {
            do {
                NyFolderApp.RestartApplication = false;
                P2PManager p2pManager = null;
                NyFolderApp nyFolder = null;

                try {
                    // Initialize P2PManager
                    p2pManager = P2PManager.GetInstance();

                    // Initialize Gtk Support
                    Gtk.Application.Init();

                    // Initialize NyFolder Application
                    nyFolder = new NyFolderApp();
                    nyFolder.Initialize();

                    // Initialize Plugins
                    new PluginManager(nyFolder);

                    // Run NyFolder Application
                    nyFolder.Run();

                    // Run GtkMain
                    Gtk.Application.Run();
                } catch (Exception e) {
                    Console.WriteLine("{0} {1} Error", Info.Name, Info.Version);
                    Console.WriteLine("Source:  {0}", e.Source);
                    Console.WriteLine("Message: {0}", e.Message);
                    Console.WriteLine("Stack Trace:\n{0}", e.StackTrace);
                    Console.WriteLine();
                    Console.WriteLine("Please, Report Bug(s) To Matteo Bertozzi <*****@*****.**>");
                    return(1);
                } finally {
                    if (nyFolder != null) nyFolder.Quit();
                    if (p2pManager != null) p2pManager.Kill();
                }
            } while (NyFolderApp.RestartApplication == true);
            return(0);
        }
        // ============================================
        //             APPLICATION MAIN
        // ============================================
        public static int Main(string[] args)
        {
            // Starting Application
            Debug.Log("{0} {1} Started...", Info.Name, Info.Version);

            do
            {
                p2pManager = null;
                nyFolder   = null;

                // Initialize Gtk Support
                if (Gtk.Application.InitCheck("NyFolder.exe", ref args) == false)
                {
                    PrintErrorMessage("You Don't Have Gtk Support Here...");
                    return(1);
                }

                // Initialize Components
                InitBase();
                InitNetwork();
                InitApplication();

                try {
                    // Set 'No Restart' Application
                    NyFolderApp.Restart = false;

                    // Run NyFolder Application
                    nyFolder.Run();

                    // Run Gtk Main
                    Gtk.Application.Run();
                } catch (NyFolderExit) {
                    // This is Logout Event :D
                    NyFolderApp.Restart = true;
                } catch (Exception e) {
                    PrintErrorMessage(e);
                    return(1);
                } finally {
                    // Uninitialize Plugins
                    PluginManager.StopPlugins();

                    // Clear Download/Upload Manager
                    UploadManager.Clear();
                    DownloadManager.Clear();

                    // Destroy All P2P Connections
                    if (p2pManager != null)
                    {
                        p2pManager.Kill();
                    }

                    // NyFolder Quit Application
                    if (NyFolderApp.Restart == false && nyFolder != null)
                    {
                        nyFolder.Quit();
                    }
                }
                Thread.Sleep(1000);
            } while (NyFolderApp.Restart == true);

            // Application Correct Termination
            Debug.Log("{0} {1} Ended...", Info.Name, Info.Version);
            return(0);
        }
        /// Initialize NyFolder Application + Plugins
        private static void InitApplication()
        {
            // Initialize NyFolder Application
            Debug.Log("Initializing NyFolder...");
            nyFolder = new NyFolderApp();
            nyFolder.Initialize();

            // Initialize Plugins
            Debug.Log("Initializing NyFolder Plugins...");
            PluginManager.Initialize(nyFolder);

            // Start Plugins
            Debug.Log("Starting NyFolder Plugins...");
            PluginManager.RunPlugins();
        }