// ============================================ // 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); }
// ============================================ // PUBLIC Constructors // ============================================ public NetworkManager(MenuManager menu, UserPanel userPanel, NotebookViewer nv) { this.userPanel = userPanel; this.notebookViewer = nv; this.menuManager = menu; // Initialize P2PManager & CMD Manager this.p2pManager = P2PManager.GetInstance(); this.cmdManager = CmdManager.GetInstance(); // Network SetSensitiveNetworkMenu(P2PManager.IsListening()); // Add Event Handlers this.menuManager.Activated += new EventHandler(OnMenuActivated); notebookViewer.NetworkViewer.ItemRemoved += new PeerSelectedHandler(OnPeerRemove); }
private void OnDelProtocolEvent(P2PManager p2pManager) { // Network Viewer networkViewer.SendFile -= new SendFileHandler(OnSendFile); // Folder Viewers notebookViewer.SaveFile -= new SendFileHandler(OnSaveFile); notebookViewer.FileSend -= new FileSendEventHandler(OnSendFileMenu); notebookViewer.FolderRefresh -= new StringEventHandler(OnFolderRefresh); // Protocol Commands CmdManager.GetEvent -= new ProtocolHandler(OnGetEvent); CmdManager.AskEvent -= new ProtocolHandler(OnAskEvent); CmdManager.SndEvent -= new ProtocolHandler(OnSndEvent); CmdManager.SndStartEvent -= new ProtocolHandler(OnSndStartEvent); CmdManager.SndEndEvent -= new ProtocolHandler(OnSndEndEvent); CmdManager.SndAbortEvent -= new ProtocolHandler(OnSndAbortEvent); CmdManager.RecvAbortEvent -= new ProtocolHandler(OnRecvAbortEvent); }
protected void OnAddProtocolCmd(P2PManager p2p, CmdManager cmd) { // Initalize Talk Manager TalkManager.Initialize(this.nyFolder); // Add Protocol Event Handler CmdManager.UnknownEvent += new ProtocolHandler(OnUnknownEvent); // Sensitivize Talk Menu SetSensitiveTalkMenu(true); }
protected void OnDelProtocolCmd(P2PManager p2p, CmdManager cmd) { // Uninitalize Talk Manager TalkManager.Uninitialize(); // Del Protocol Event Handler CmdManager.UnknownEvent -= new ProtocolHandler(OnUnknownEvent); // Sensitivize Talk Menu SetSensitiveTalkMenu(false); }
// ============================================ // PUBLIC Constructors // ============================================ public NetworkManager(GUI.Window window) { // Initialize Events (None) UserAccept = null; // Initialize Components this.menuManager = window.Menu; this.userPanel = window.UserPanel; this.notebookViewer = window.NotebookViewer; this.networkViewer = this.notebookViewer.NetworkViewer; // Initialize P2PManager & CMD Manager this.p2pManager = P2PManager.GetInstance(); // Network SetSensitiveNetworkMenu(P2PManager.IsListening()); // Add Event Handlers menuManager.Activated += new EventHandler(OnMenuActivated); networkViewer.ItemRemoved += new PeerSelectedHandler(OnPeerRemove); CmdManager.AddProtocolEvent += new SetProtocolEventHandler(OnAddProtocolEvent); CmdManager.DelProtocolEvent += new SetProtocolEventHandler(OnDelProtocolEvent); }
// ============================================ // PRIVATE (Methods) Event Handler // ============================================ private void OnAddProtocolEvent(P2PManager p2p, CmdManager cmd) { // NetworkViewer NetworkViewer networkViewer = notebookViewer.NetworkViewer; networkViewer.SendFile += new SendFileHandler(OnSendFile); // Folder Viewers notebookViewer.SaveFile += new SendFileHandler(OnSaveFile); notebookViewer.FileSend += new FileSendEventHandler(OnSendFileMenu); notebookViewer.FolderRefresh += new StringEventHandler(OnFolderRefresh); // Protocol Commands CmdManager.GetEvent += new ProtocolHandler(OnGetEvent); CmdManager.AskEvent += new ProtocolHandler(OnAskEvent); CmdManager.AcceptEvent += new ProtocolHandler(OnAcceptEvent); CmdManager.SndEvent += new ProtocolHandler(OnSndEvent); CmdManager.SndStartEvent += new ProtocolHandler(OnSndStartEvent); CmdManager.SndEndEvent += new ProtocolHandler(OnSndEndEvent); CmdManager.SndAbortEvent += new ProtocolHandler(OnSndAbortEvent); CmdManager.RecvAbortEvent += new ProtocolHandler(OnRecvAbortEvent); }
protected void OnDelProtocolCmd(P2PManager p2p, CmdManager cmd) { CmdManager.LoginEvent -= new ProtocolLoginHandler(OnPeerLogin); CmdManager.GetEvent -= new ProtocolHandler(OnGetEvent); CmdManager.UnknownEvent -= new ProtocolHandler(OnUnknownEvent); }
private void OnDelProtocolEvent(P2PManager p2pManager) { // Stop Auto Add Buddy Timeout timeoutAddBuddyRet = false; }
private void OnAddProtocolEvent(P2PManager p2pManager) { // Auto Add Buddy Timeout (2min) timeoutAddBuddyRet = true; AutoAddBuddyTimeout(); GLib.Timeout.Add(120000, AutoAddBuddyTimeout); }
/// Initialize NyFolder P2PManager & Network Related private static void InitNetwork() { // Initialize P2PManager Debug.Log("Initializing P2P Manager..."); p2pManager = P2PManager.GetInstance(); // Initialize Command Manager Debug.Log("Initializing Protocol Manager..."); CmdManager.Initialize(); // Initialize Download Manager Debug.Log("Initializing Download Manager..."); DownloadManager.Initialize(); // Initialize Upload Manager Debug.Log("Initializing Upload Manager..."); UploadManager.Initialize(); }
private void OnDelProtocolCmds(P2PManager p2pManager) { if (nyFolder.MainWindow != null) { // Sensitivize Talk Menu SetSensitiveTalkMenu(false); } // Del Protocol Event Handler CmdManager.UnknownEvent -= new ProtocolHandler(OnUnknownEvent); // Uninitalize Talk Manager TalkManager.Uninitialize(); }