private void checkLocations()
        {
            listView3.Items.Clear();
            MadScience.Helpers.findInstalledGames();

            for (int i = 0; i < MadScience.Helpers.gamesInstalled.Items.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                MadScience.Helpers.GameInfo gameInfo = MadScience.Helpers.gamesInstalled.Items[i];
                item.Text = gameInfo.gameName;
                if (gameInfo.isInstalled)
                {
                    item.SubItems.Add("Yes");
                    if (MadScience.Helpers.gamesInstalled.globalFramework.hasFramework)
                    {
                        item.SubItems.Add("Common");
                    }
                    else
                    {
                        if (gameInfo.hasFramework)
                        {
                            item.SubItems.Add("Yes");
                        }
                        else
                        {
                            item.SubItems.Add("No");
                        }
                    }
                }
                else
                {
                    item.SubItems.Add("No");
                    item.SubItems.Add("");
                }

                if (gameInfo.version.Major > 0)
                {
                    item.SubItems.Add(gameInfo.version.ToString());
                }
                else
                {
                    item.SubItems.Add("");
                }
                item.SubItems.Add(gameInfo.path);

                listView3.Items.Add(item);
            }
        }
Exemplo n.º 2
0
        private void showCustomContent()
        {
            packageList.Clear();

            listView1.Items.Clear();
            listView1.Visible = false;

            conflictList.Clear();

            toolStripProgressBar1.Visible = true;
            button4.Visible = false;
            button5.Visible = false;
            button8.Visible = false;
            //label1.Visible = false;

            string lastScanDir = MadScience.Helpers.getRegistryValue("lastScanDir");

            if (!String.IsNullOrEmpty(lastScanDir) && String.IsNullOrEmpty(folderBrowserDialog1.SelectedPath))
            {
                folderBrowserDialog1.SelectedPath = lastScanDir;
            }
            if (String.IsNullOrEmpty(lastScanDir))
            {
                resetScanFolderToolStripMenuItem.Enabled = false;
            }
            else
            {
                resetScanFolderToolStripMenuItem.Enabled = true;
            }

            if (String.IsNullOrEmpty(folderBrowserDialog1.SelectedPath))
            {
                if (MadScience.Helpers.gamesInstalled.globalFramework.isInstalled)
                {
                    this.masterDir = Path.Combine(MadScience.Helpers.gamesInstalled.globalFramework.path, Path.Combine("Mods", "Packages"));
                    CountFiles(this.masterDir);
                }
                else
                {
                    for (int i = 0; i < MadScience.Helpers.gamesInstalled.Items.Count; i++)
                    {
                        MadScience.Helpers.GameInfo gameInfo = MadScience.Helpers.gamesInstalled.Items[i];
                        if (gameInfo.isInstalled)
                        {
                            if (gameInfo.hasFramework)
                            {
                                this.masterDir = Path.Combine(gameInfo.path, Path.Combine("Mods", "Packages"));
                                CountFiles(this.masterDir);
                            }
                            else
                            {
                                // Check for explicit Mods\Packages folder
                                if (Directory.Exists(Path.Combine(gameInfo.path, Path.Combine("Mods", "Packages"))))
                                {
                                    this.masterDir = Path.Combine(gameInfo.path, Path.Combine("Mods", "Packages"));
                                    CountFiles(this.masterDir);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                this.masterDir = folderBrowserDialog1.SelectedPath;
                CountFiles(folderBrowserDialog1.SelectedPath);
            }

            if (this.fileList.Count > 0)
            {
                ProcessFiles();
            }
            else
            {
                toolStripStatusLabel1.Text = "No packages found in any searched folder.";
            }

            //label1.Visible = true;
            toolStripProgressBar1.Visible = false;
            button4.Visible = true;
            button5.Visible = true;
            button8.Visible = true;

            button4.Enabled = false;

            listView1.Visible = true;

            //toolStripStatusLabel1.Text = "";
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Version vrs       = new Version(Application.ProductVersion);
            string  debugInfo = "Framework Info, generated by Sims 3 Dashboard v" + vrs.ToString(4) + System.Environment.NewLine;

            debugInfo += "---------------------------------------------------------------";
            debugInfo += System.Environment.NewLine;
            debugInfo += "OS: " + System.Environment.OSVersion.ToString() + System.Environment.NewLine;
            debugInfo += "CPUs: " + System.Environment.ProcessorCount.ToString() + System.Environment.NewLine;
            debugInfo += System.Environment.NewLine;

            //MadScience.Helpers.findInstalledGames();

            debugInfo += MadScience.Helpers.gamesInstalled.Items.Count.ToString() + " Sims 3 folders found:" + System.Environment.NewLine;
            debugInfo += System.Environment.NewLine;

            for (int i = 0; i < MadScience.Helpers.gamesInstalled.Items.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                MadScience.Helpers.GameInfo gameInfo = MadScience.Helpers.gamesInstalled.Items[i];

                debugInfo += "Game: " + gameInfo.gameName + System.Environment.NewLine;
                debugInfo += "Version: " + gameInfo.version + System.Environment.NewLine;
                debugInfo += "Path: " + gameInfo.path + System.Environment.NewLine;
                if (gameInfo.useGlobalFramework)
                {
                    debugInfo += "Framework: Yes (My Documents)" + System.Environment.NewLine;
                }
                else if (gameInfo.hasFramework)
                {
                    debugInfo += "Framework: Yes (Old-style Program Files)" + System.Environment.NewLine;
                }
                else
                {
                    debugInfo += "Framework: No" + System.Environment.NewLine;
                }

                debugInfo += "Framework debug: " + gameInfo.hasFramework.ToString() + " / " + gameInfo.useGlobalFramework.ToString() + System.Environment.NewLine;
                debugInfo += System.Environment.NewLine;
            }

            debugInfo += "Framework information: " + System.Environment.NewLine;
            debugInfo += "Global framework: " + MadScience.Helpers.gamesInstalled.globalFramework.isInstalled.ToString() + System.Environment.NewLine;
            debugInfo += "       Installed: " + MadScience.Helpers.gamesInstalled.globalFramework.hasFramework.ToString() + System.Environment.NewLine;
            debugInfo += "            Path: " + MadScience.Helpers.gamesInstalled.globalFramework.path + System.Environment.NewLine;

            if (MadScience.Helpers.gamesInstalled.globalFramework.hasFramework)
            {
                debugInfo += "Dumping contents of resource.cfg: " + System.Environment.NewLine;
                debugInfo += File.ReadAllText(Path.Combine(MadScience.Helpers.gamesInstalled.globalFramework.path, Path.Combine("Mods", "resource.cfg")));
                debugInfo += System.Environment.NewLine;
            }

            debugInfo += "There are " + packageList.Count + " packages in the scan location " + this.masterDir + System.Environment.NewLine;
            if (packageList.Count < 10)
            {
                for (int i = 0; i < packageList.Count; i++)
                {
                    debugInfo += "Package: [ " + packageList[i].Text + " ] Type: [ " + packageList[i].SubItems[2].Text + " ] Size: [ " + packageList[i].SubItems[3].Text + System.Environment.NewLine;
                }
            }

            debugInfo += "Checking for corrupt/broken/borked packages: " + System.Environment.NewLine;

            MadScience.Detective detective = new MadScience.Detective();

            for (int i = 0; i < packageList.Count; i++)
            {
                ListViewItem item = packageList[i];
                if (item.BackColor == detective.pType.ToColor(MadScience.Detective.PackageTypes.emptyPackage))
                {
                    debugInfo += item.SubItems[2].Text + ": [ " + item.Text + " ] Desc: [ " + item.SubItems[6].Text + " ] Size: [ " + item.SubItems[3].Text + " ]" + System.Environment.NewLine;
                }
                if (item.BackColor == detective.pType.ToColor(MadScience.Detective.PackageTypes.conflictPackage))
                {
                    debugInfo += "Conflicted: [ " + item.Text + " ] Type: [ " + item.SubItems[2].Text + " ] Desc: [ " + item.SubItems[6].Text + " ] Size: [ " + item.SubItems[3].Text + " ]" + System.Environment.NewLine;
                }
                if (item.BackColor == detective.pType.ToColor(MadScience.Detective.PackageTypes.sims2Package))
                {
                    debugInfo += item.SubItems[2].Text + ": [ " + item.Text + " ] Desc: [ " + item.SubItems[6].Text + " ] Size: [ " + item.SubItems[3].Text + " ]" + System.Environment.NewLine;
                }
                if (item.SubItems[2].Text.StartsWith("Corrupt"))
                {
                    debugInfo += item.SubItems[2].Text + ": [ " + item.Text + " ] Desc: [ " + item.SubItems[6].Text + " ] Size: [ " + item.SubItems[3].Text + " ]" + System.Environment.NewLine;
                }
            }


            string       tmpFile   = Path.GetTempFileName();
            StreamWriter tmpStream = new StreamWriter(tmpFile);

            tmpStream.Write(debugInfo);
            tmpStream.Close();

            Process notepad = new Process();

            notepad.StartInfo.FileName  = "notepad.exe";
            notepad.StartInfo.Arguments = tmpFile;
            notepad.Start();
        }