Exemplo n.º 1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            General.loadSettings();                                                 // load settings on startup
            if (!General.minimizeToTray)                                            // if trayicon deactivated
            {
                nfTray.Visible = false;                                             // hide it
            }
            scnTimer.Enabled  = false;                                              // disable timer
            scnTimer.Interval = General.timer;                                      // set interval
            scnTimer.Tick    += new EventHandler(this.scan);                        // when Timer ticks call scan()
            if (General.saveOnClose)                                                // if enabled load URLs from file
            {
                string[] URLs;

                string boards = General.loadURLs(true);
                if (boards != "")
                {
                    URLs = boards.Split('\n');
                    for (int i = 0; i < URLs.Length - 1; i++)
                    {
                        Imageboard newImageboard = General.createNewIMB(URLs[i], true); // and add them
                        lbBoards.Items.Add(URLs[i]);
                        clBoards.Add(newImageboard);
                    }
                    scnTimer.Enabled = true;                                       // activate the timer
                    scan(null, null);                                              // and start scanning
                }


                string threads = General.loadURLs(false);                         // load threads
                if (threads != "")
                {
                    URLs = threads.Split('\n');
                    for (int i = 0; i < URLs.Length - 1; i++)
                    {
                        Imageboard newImageboard = General.createNewIMB(URLs[i], false);
                        if (newImageboard == null)
                        {
                            MessageBox.Show(URLs[i]);
                        }
                        else
                        {
                            lbThreads.Items.Add(URLs[i]);
                            clThreads.Add(newImageboard);
                            Thread nIMB = new Thread(delegate() {
                                newImageboard.download();
                            });
                            thrThreads.Add(nIMB);
                            thrThreads.Last().Start();
                        }
                    }
                }
            }

            if (General.firstStart)
            {
                FirstStart tFirstStart = new FirstStart();                        // if first start, show first start message
                tFirstStart.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            General.loadSettings();                                                     // load settings on startup
            if (!General.minimizeToTray)                                                // if trayicon deactivated
            {
                nfTray.Visible = false;                                                 // hide it
            }
            scnTimer.Enabled  = false;                                                  // disable timer
            scnTimer.Interval = General.timer;                                          // set interval
            scnTimer.Tick    += new EventHandler(this.scan);                            // when Timer ticks call scan()
            ThreadPool.SetMaxThreads(Environment.ProcessorCount, Environment.ProcessorCount);

            if (General.firstStart)
            {
                FirstStart tFirstStart = new FirstStart();                              // if first start, show first start message
                tFirstStart.ShowDialog();
            }

            if (General.saveOnClose)                                                    // if enabled load URLs from file
            {
                string boards  = General.loadURLs(true);
                string threads = General.loadURLs(false);                               // load threads

                if (!String.IsNullOrWhiteSpace(boards))
                {
                    lock (boardLock)
                    {
                        string[] URLs = boards.Split('\n');
                        for (int i = 0; i < URLs.Length - 1; i++)
                        {
                            Imageboard newImageboard = General.createNewIMB(URLs[i], true); // and add them
                            ListBoards.Add(newImageboard);
                        }
                    }
                }

                if (!String.IsNullOrWhiteSpace(threads))
                {
                    lock (threadLock)
                    {
                        string[] URLs = threads.Split('\n');
                        for (int i = 0; i < URLs.Length - 1; i++)
                        {
                            Imageboard newImageboard = General.createNewIMB(URLs[i], false);
                            ListThreads.Add(newImageboard);
                        }
                    }
                }

                lbBoards.DataSource  = ListBoards;
                lbThreads.DataSource = ListThreads;

                scnTimer.Enabled = true;                                       // activate the timer
                scan(null, null);                                              // and start scanning
            }
        }
Exemplo n.º 3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            General.loadSettings();                                                 // load settings on startup
            if (!General.minimizeToTray)                                            // if trayicon deactivated
            {
                nfTray.Visible = false;                                             // hide it
            }
            scnTimer.Enabled  = false;                                              // disable timer
            scnTimer.Interval = General.timer;                                      // set interval
            scnTimer.Tick    += new EventHandler(this.scan);                        // when Timer ticks call scan()
            if (General.saveOnClose)                                                // if enabled load URLs from file

            {
                DialogResult dr = MessageBox.Show("Load threads from last session?", "confirm that", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    string[] URLs;

                    string boards = General.loadURLs(true);
                    if (boards != "")
                    {
                        URLs = boards.Split('\n');
                        for (int i = 0; i < URLs.Length - 1; i++)
                        {
                            //Saving Boards is STUPID

                            /*
                             * Imageboard newImageboard = General.createNewIMB(URLs[i], true); // and add them
                             * lbBoards.Items.Add(URLs[i]);
                             * clBoards.Add(newImageboard);
                             */
                        }
                        scnTimer.Enabled = true;                                       // activate the timer
                        scan(null, null);                                              // and start scanning
                    }


                    string threads = General.loadURLs(false);                         // load threads
                    if (threads != "")
                    {
                        URLs = threads.Split('\n');
                        for (int i = 0; i < URLs.Length - 1; i++)
                        {
                            /*
                             * Imageboard newImageboard = General.createNewIMB(URLs[i], false);
                             * if(newImageboard == null) {
                             *  MessageBox.Show(URLs[i]);
                             * } else {
                             *  lbThreads.Items.Add(new IBDownloadItem(URLs[i]));
                             *  clThreads.Add(newImageboard);
                             *  Thread nIMB = new Thread(delegate() {
                             *      newImageboard.download();
                             *  });
                             *  thrThreads.Add(nIMB);
                             *  thrThreads.Last().Start();
                             * }
                             */

                            btnAdd_Click(null, null, URLs[i]);
                        }
                    }
                }
            }

            if (General.firstStart)
            {
                FirstStart tFirstStart = new FirstStart();                        // if first start, show first start message
                tFirstStart.ShowDialog();
            }
        }