コード例 #1
0
        void DoStartup()
        {
            if (Properties.Settings.Default.checkForUpdates)
            {
                #region Update Shit

                Party_Buffalo.Update u = new Update();
            #if TRACE
                Party_Buffalo.Update.UpdateInfo ud = u.CheckForUpdates(new Uri("http://clkxu5.com/drivexplore/coolapplicationstuff.xml"));
            #endif
            #if DEBUG
                Party_Buffalo.Update.UpdateInfo ud = new Update.UpdateInfo();
                if (UpdateDebug)
                {
                    if (!UpdateDebugForce)
                    {
                        ud = u.CheckForUpdates(new Uri("http://clkxu5.com/drivexplore/dev/coolapplicationstuff.xml"));
                    }
                    else
                    {
                        ud.Update = true;
                        ud.UpdateText = "This`Is`A`Test";
                        ud.UpdateVersion = "9000";
                    }
                }
            #endif
                if (ud.Update)
                {
                    if (!Aero)
                    {
                        Forms.UpdateForm uf = new Party_Buffalo.Forms.UpdateForm(ud);
                        uf.ShowDialog();
                    }
                    else
                    {
                        TaskDialog td = new TaskDialog();
                        td.Caption = "Update Available";
                        td.InstructionText = "Version " + ud.UpdateVersion + " is Available";
                        td.Text = "An update is available for Party Buffalo";
                        td.DetailsCollapsedLabel = "Change Log";
                        td.DetailsExpandedLabel = "Change Log";
                        td.ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandFooter;
                        string[] Split = ud.UpdateText.Split('`');
                        string UpdateText = "";
                        for (int i = 0; i < Split.Length; i++)
                        {
                            if (i != 0)
                            {
                                UpdateText += "\r\n";
                            }
                            if (Split[i] == "")
                            {
                                continue;
                            }
                            UpdateText += "-" + Split[i];
                        }
                        td.DetailsExpandedText = UpdateText;
                        TaskDialogCommandLink Download = new TaskDialogCommandLink("Download", "Download Party Buffalo version " + ud.UpdateVersion, "");
                        Download.Click += (o, f) =>
                        {
                            Forms.UpdateDownloadForm udf = new Party_Buffalo.Forms.UpdateDownloadForm(ud);
                            udf.ShowDialog();
                        };

                        TaskDialogCommandLink DontDownload = new TaskDialogCommandLink("DontDownload", "Let me go about my business and I'll download this stuff later...", "");
                        DontDownload.Click += (o, f) =>
                        {
                            td.Close();
                        };
                        td.Controls.Add(Download);
                        td.Controls.Add(DontDownload);
                        td.Show();
                    }
                }
                if (ud.QuickMessage != null && ud.QuickMessage != "")
                {
                    quickMessage.Text = ud.QuickMessage;
                }
                else
                {
                    quickMessage.Text = "Could not load quick message";
                }

                #endregion
            }
            else
            {
                m_DisableUpdates.Checked = true;
            }

            if (!Properties.Settings.Default.Upgraded)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.Upgraded = true;
                Properties.Settings.Default.Save();
            }
            if (Properties.Settings.Default.width > 50 && Properties.Settings.Default.height > 50)
            {
                this.Height = Properties.Settings.Default.height;
                this.Width = Properties.Settings.Default.width;
            }
            quickAddMode.Checked = Properties.Settings.Default.quickAddMode;
            SaveIcons.Checked = Properties.Settings.Default.SaveIcons;
            m_loadEntireDrive.Checked = Properties.Settings.Default.loadEntireDrive;
            m_LoadSTFS.Checked = Properties.Settings.Default.loadSTFS;
            m_retrieveGameNames.Checked = Properties.Settings.Default.loadTIDNames;
            cacheContentIcons.Checked = Properties.Settings.Default.cacheContentIcons;
            if (Properties.Settings.Default.hideToolBar)
            {
                m_hideToolBar.PerformClick();
            }
            if (Properties.Settings.Default.hideAddressBar)
            {
                m_hideAddressBar.PerformClick();
            }
            if (Properties.Settings.Default.hideStatusBar)
            {
                m_hideStatusBar.PerformClick();
            }
            switch (Properties.Settings.Default.view)
            {
                case View.Details:
                    c_Details.Checked = true;
                    listView1.View = View.Details;
                    break;
                case View.LargeIcon:
                    c_largeIcon.Checked = true;
                    listView1.View = View.LargeIcon;
                    break;
                case View.List:
                    c_List.Checked = true;
                    listView1.View = View.List;
                    break;
                case View.SmallIcon:
                    c_SmallIcon.Checked = true;
                    listView1.View = View.SmallIcon;
                    break;
                case View.Tile:
                    c_Tile.Checked = true;
                    listView1.View = View.Tile;
                    break;

            }

            if (Properties.Settings.Default.recentFiles != null)
            {
                List<string> Remove = new List<string>();
                foreach (string s in Properties.Settings.Default.recentFiles)
                {
                    if (System.IO.File.Exists(s))
                    {
                        MenuItem i = new MenuItem(s);
                        i.Click += new EventHandler(RecentFileHandler);
                        m_Open.MenuItems.Add(i);
                    }
                    else
                    {
                        Remove.Add(s);
                    }
                }

                for (int i = 0; i < Remove.Count; )
                {
                    Properties.Settings.Default.recentFiles.Remove(Remove[i]);
                    Remove.RemoveAt(i);
                }
            }

            List<MenuItem> mil = new List<MenuItem>();
            List<MenuItem> mit = new List<MenuItem>();

            // Add the "new known folder" (cached) items
            for (int i = 0; i < CLKsFATXLib.VariousFunctions.Known.Length; i++)
            {
                string ss = CLKsFATXLib.VariousFunctions.Known[i];
                string s = CLKsFATXLib.VariousFunctions.KnownEquivilent[i];
                // Create our listview menu item...
                MenuItem mu = new MenuItem(s + " (" + ss + ")");
                // Set its tag
                mu.Tag = ss;
                // Set its event handler
                mu.Click += new EventHandler(mu_Click);

                // Create our treeview menu item...
                MenuItem mut = new MenuItem(s + " (" + ss + ")");
                // Set its tag
                mut.Tag = ss;
                // Create its event handler
                mut.Click += new EventHandler(mut_Click);

                // Add it to the cached menu items
                mil.Add(mu);
                mit.Add(mut);
                //lCached.MenuItems.Add(mu);
                //tCached.MenuItems.Add(mut);
            }

            // Cast those as arrays
            MenuItem[] ArrayL = mil.ToArray();
            Array.Sort(ArrayL, new Extensions.MenuItemComparer());

            MenuItem[] ArrayT = mit.ToArray();
            Array.Sort(ArrayT, new Extensions.MenuItemComparer());

            // Add ranges
            lStatic.MenuItems.AddRange(ArrayL);
            tStatic.MenuItems.AddRange(ArrayT);

            // For treeview icon size
            switch (Properties.Settings.Default.treeViewIconWidthHeight)
            {
                case 16:
                    size16.Checked = true;
                    break;
                case 24:
                    size24.Checked = true;
                    break;
                case 32:
                    size32.Checked = true;
                    break;
                case 64:
                    size64.Checked = true;
                    break;
            }
            treeView1.ImageList.ImageSize = new Size(Properties.Settings.Default.treeViewIconWidthHeight, Properties.Settings.Default.treeViewIconWidthHeight);
        }
コード例 #2
0
        private void m_CheckForUpdates_Click(object sender, EventArgs e)
        {
            #region Update Shit

            Party_Buffalo.Update u = new Update();
            #if TRACE
            Party_Buffalo.Update.UpdateInfo ud = u.CheckForUpdates(new Uri("http://clkxu5.com/drivexplore/coolapplicationstuff.xml"));
            #endif
            #if DEBUG
            Party_Buffalo.Update.UpdateInfo ud = new Update.UpdateInfo();
            if (UpdateDebug)
            {
                if (!UpdateDebugForce)
                {
                    ud = u.CheckForUpdates(new Uri("http://clkxu5.com/drivexplore/dev/coolapplicationstuff.xml"));
                }
                else
                {
                    ud.Update = true;
                    ud.UpdateText = "This`Is`A`Test";
                    ud.UpdateVersion = "9000";
                }
            }
            #endif
            if (ud.Update)
            {
                if (!Aero)
                {
                    Forms.UpdateForm uf = new Party_Buffalo.Forms.UpdateForm(ud);
                    uf.ShowDialog();
                }
                else
                {
                    TaskDialog td = new TaskDialog();
                    td.Caption = "Update Available";
                    td.InstructionText = "Version " + ud.UpdateVersion + " is Available";
                    td.Text = "An update is available for Party Buffalo";
                    td.DetailsCollapsedLabel = "Change Log";
                    td.DetailsExpandedLabel = "Change Log";
                    td.ExpansionMode = TaskDialogExpandedDetailsLocation.ExpandFooter;
                    string[] Split = ud.UpdateText.Split('`');
                    string UpdateText = "";
                    for (int i = 0; i < Split.Length; i++)
                    {
                        if (i != 0)
                        {
                            UpdateText += "\r\n";
                        }
                        if (Split[i] == "")
                        {
                            continue;
                        }
                        UpdateText += "-" + Split[i];
                    }
                    td.DetailsExpandedText = UpdateText;
                    TaskDialogCommandLink Download = new TaskDialogCommandLink("Download", "Download Party Buffalo version " + ud.UpdateVersion, "");
                    Download.Click += (o, f) =>
                    {
                        Forms.UpdateDownloadForm udf = new Party_Buffalo.Forms.UpdateDownloadForm(ud);
                        udf.ShowDialog();
                    };

                    TaskDialogCommandLink DontDownload = new TaskDialogCommandLink("DontDownload", "Let me go about my business and I'll download this stuff later...", "");
                    DontDownload.Click += (o, f) =>
                    {
                        td.Close();
                    };
                    td.Controls.Add(Download);
                    td.Controls.Add(DontDownload);
                    td.Show();
                }
            }
            else
            {
                MessageBox.Show("Party Buffalo is up to date!");
            }
            if (ud.QuickMessage != null && ud.QuickMessage != "")
            {
                quickMessage.Text = ud.QuickMessage;
            }
            else
            {
                quickMessage.Text = "Could not load quick message";
            }

            #endregion
        }