private void frmMain_Load(object sender, System.EventArgs e) { try { Global.m_DataDirectory = Environment.GetEnvironmentVariable("appdata") + @"\nomp\"; if (Global.m_DataDirectory == @"\nomp\") throw new ArgumentNullException(); } catch { Global.m_DataDirectory = Global.m_CurrentDirectory; } Global.m_CacheDirectory = Global.m_DataDirectory + @"\Cache\"; try { RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"); string str = (string)rk.GetValue("Personal"); if (str == null ) throw new ArgumentNullException(); Global.m_DownloadDirectory = str + @"\download\"; } catch { Global.m_DownloadDirectory = Global.m_CurrentDirectory + @"\download\"; } Global.ConnectionLog = new CEventLogEngine( Global.m_DataDirectory + "connection.log"); Global.ConnectionLog.Enabled = false; // Set to true to have all NNTP trafic logged to connection.log if( !System.IO.Directory.Exists( Global.m_CacheDirectory)) System.IO.Directory.CreateDirectory( Global.m_CacheDirectory); if( !System.IO.Directory.Exists( Global.m_DownloadDirectory)) System.IO.Directory.CreateDirectory( Global.m_DownloadDirectory); Decoder.DecodeQueue = new ArrayQueue(); Decoder.DecoderThread = new System.Threading.Thread( new System.Threading.ThreadStart( Decoder.Decode)); Decoder.DecoderThread.Priority = System.Threading.ThreadPriority.Lowest; Decoder.DecoderThread.Name = "Decoder"; Decoder.DecoderThread.Start(); Global.m_Options = new OptionValues(false, true, 15, false, true, 5, true, 6, false, false, "", "", false, false, Global.m_CurrentDirectory, false); if(!LoadOptions(Global.m_DataDirectory + "options.xml")) { if(!LoadOptions(Global.m_CurrentDirectory + "options.xml")) frmMain.LogWriteError(Global.m_CurrentDirectory + "options.xml failed to load"); } m_ServerManager = new ServerManager(); if(!m_ServerManager.LoadServers(Global.m_DataDirectory + "servers.xml")) { if(!m_ServerManager.LoadServers(Global.m_CurrentDirectory + "servers.xml")) frmMain.LogWriteError(Global.m_CurrentDirectory + "servers.xml failed to load"); } if(System.IO.File.Exists(Global.m_DataDirectory + "nzb-o-matic.xml")) ImportNZB(Global.m_DataDirectory + "nzb-o-matic.xml"); if( Global.m_Options.ConnectOnStart) { frmMain.LogWriteInfo("Connect on startup enabled."); Connect(); } foreach(string str in Global.Args) { frmMain.LogWriteInfo("Startup parameter: " + str); if(str == "/start") { frmMain.LogWriteInfo("Connect on startup switch detected."); Connect(); } if(str == "/exit") { frmMain.LogWriteInfo("Exit on completion switch detected."); Global.m_ExitComplete = true; Menu_Main_Options_Exit.Checked = true; } if(str.EndsWith(".nzb")) { ImportNZB(str); } } copydata = new CopyData(); copydata.AssignHandle(this.Handle); copydata.Channels.Add("NZBImport"); copydata.DataReceived += new DataReceivedEventHandler(copydata_DataReceived); UpdateServers(); frmMain.LogWriteInfo(Global.Name + " succesfully started."); frmMain.LogWriteInfo("Version: " + Global.Version); }
private void frmMain_Load(object sender, System.EventArgs e) { Global.ConnectionLog = new CEventLogEngine( Global.m_CurrentDirectory + "connection.log"); Global.ConnectionLog.Enabled = false; // Set to true to have all NNTP trafic logged to connection.log if( !System.IO.Directory.Exists( Global.m_CurrentDirectory + "Cache")) System.IO.Directory.CreateDirectory( Global.m_CurrentDirectory + "Cache"); if( !System.IO.Directory.Exists( Global.m_CurrentDirectory + "Download")) System.IO.Directory.CreateDirectory( Global.m_CurrentDirectory + "Download"); Decoder.DecodeQueue = new ArrayQueue(); Decoder.DecoderThread = new System.Threading.Thread( new System.Threading.ThreadStart( Decoder.Decode)); Decoder.DecoderThread.Priority = System.Threading.ThreadPriority.Lowest; Decoder.DecoderThread.Name = "Decoder"; Decoder.DecoderThread.Start(); Global.m_Options = new OptionValues(false, true, 15, false, true, 5, true, 6, false, false, "", "", false, false, Global.m_CurrentDirectory); if(!LoadOptions(Global.m_CurrentDirectory + "options.xml")) frmMain.LogWriteError(Global.m_CurrentDirectory + "options.xml failed to load"); m_ServerManager = new ServerManager(); if(!m_ServerManager.LoadServers(Global.m_CurrentDirectory + "servers.xml")) frmMain.LogWriteError(Global.m_CurrentDirectory + "servers.xml failed to load"); if(System.IO.File.Exists(Global.m_CurrentDirectory + "nzb-o-matic.xml")) ImportNZB(Global.m_CurrentDirectory + "nzb-o-matic.xml"); if( Global.m_Options.ConnectOnStart) { frmMain.LogWriteInfo("Connect on startup enabled."); Connect(); } foreach(string str in Global.Args) { frmMain.LogWriteInfo("Startup parameter: " + str); if(str == "/start") { frmMain.LogWriteInfo("Connect on startup switch detected."); Connect(); } if(str == "/exit") { frmMain.LogWriteInfo("Exit on completion switch detected."); Global.m_ExitComplete = true; Menu_Main_Options_Exit.Checked = true; } if(str.EndsWith(".nzb")) { ImportNZB(str); } } copydata = new CopyData(); copydata.AssignHandle(this.Handle); copydata.Channels.Add("NZBImport"); copydata.DataReceived += new DataReceivedEventHandler(copydata_DataReceived); UpdateServers(); frmMain.LogWriteInfo(Global.Name + " succesfully started."); frmMain.LogWriteInfo("Version: " + Global.Version); }