Example #1
0
 private SimPe.CheckItemState chkFileTable_ClickedFix(object sender, SimPe.CheckItemState isok)
 {
     isok = CheckItemState.Unknown;
     try
     {
         string msg = "your file table folder settings will be reset";
         if (Helper.Profile.Length > 0)
         {
             msg += " and you will need to re-save profile " + Helper.Profile;
         }
         if (System.Windows.Forms.MessageBox.Show("The File table settings file was not correct and you have asked to fix it.\n" +
                                                  Helper.DataFolder.FoldersXREG + "\n" +
                                                  "SimPE can generate a new one (" + msg + ").\n\n" +
                                                  "Should SimPe delete the File table settings File?"
                                                  , "Fix",
                                                  System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
         {
             System.IO.File.Delete(Helper.DataFolder.FoldersXREG);
             FileTable.Reload();
             if (FixedFileTable != null)
             {
                 FixedFileTable(this, new EventArgs());
             }
         }
     }
     catch
     {
         isok = CheckItemState.Fail;
     }
     return(isok);
 }
Example #2
0
 private SimPe.CheckItemState chkSimFolder_ClickedFix(object sender, SimPe.CheckItemState isok)
 {
     isok = CheckItemState.Unknown;
     PathProvider.Global.SetDefaultPaths();
     if (Helper.Profile.Length > 0)
     {
         System.Windows.Forms.MessageBox.Show("You will need to re-save profile " + Helper.Profile, "Fix",
                                              System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
     }
     return(isok);
 }
Example #3
0
        private SimPe.CheckItemState chkCache_CalledCheck(object sender, SimPe.CheckItemState isok)
        {
            isok = CheckItemState.Ok;
            CheckItem ci = sender as CheckItem;

            try
            {
                SimPe.Cache.CacheFile cf = new SimPe.Cache.CacheFile();
                string path = Helper.SimPeCache;
                try
                {
                    cf.Load(path);
                }
                catch (Exception ex)
                {
                    ci.Details += SimPe.Localization.GetString("Check: Unable to load cache") + Helper.lbr;
                    ci.Details += "    " + SimPe.Localization.GetString("Check: Error while load").Replace("{name}", path) + Helper.lbr;
                    ci.Details += "    " + ex.Message + Helper.lbr + Helper.lbr;
                }

                path = Helper.SimPeLanguageCache;
                try
                {
                    cf.Load(path);
                }
                catch (Exception ex)
                {
                    ci.Details += SimPe.Localization.GetString("Check: Unable to load cache") + Helper.lbr;
                    ci.Details += "    " + SimPe.Localization.GetString("Check: Error while load").Replace("{name}", path) + Helper.lbr;
                    ci.Details += "    " + ex.Message + Helper.lbr + Helper.lbr;
                }
            }
            catch (Exception ex)
            {
                isok       = CheckItemState.Fail;
                ci.Details = ex.Message;
            }

            return(isok);
        }
Example #4
0
        private SimPe.CheckItemState chkFileTable_CalledCheck(object sender, SimPe.CheckItemState isok)
        {
            isok = CheckItemState.Ok;
            FileTable.FileIndex.Load();
            CheckItem ci = sender as CheckItem;

            try
            {
                SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFile(Data.MetaData.OBJD_FILE, true);
                if (items.Length < 3000)
                {
                    ci.Details += SimPe.Localization.GetString("Check: No Objects") + Helper.lbr;
                    isok        = CheckItemState.Fail;
                }
                else
                {
                    items = FileTable.FileIndex.FindFile(Data.MetaData.OBJD_FILE, 0x7F94AFE8, 0x000041AB, null);
                    if (items.Length == 0)
                    {
                        ci.Details += SimPe.Localization.GetString("Check: No Objects") + Helper.lbr;
                        isok        = CheckItemState.Fail;
                    }
                }

                items = FileTable.FileIndex.FindFile(Data.MetaData.TXMT, true);
                if (items.Length < 100)
                {
                    ci.Details += SimPe.Localization.GetString("Check: No Textures") + Helper.lbr;
                    isok        = CheckItemState.Fail;
                }
            }
            catch (Exception ex)
            {
                isok       = CheckItemState.Fail;
                ci.Details = ex.Message;
            }

            return(isok);
        }
Example #5
0
 private SimPe.CheckItemState chkCache_ClickedFix(object sender, SimPe.CheckItemState isok)
 {
     isok = CheckItemState.Unknown;
     ClearCache();
     return(isok);
 }
Example #6
0
        private SimPe.CheckItemState chkSimFolder_CalledCheck(object sender, SimPe.CheckItemState isok)
        {
            isok = CheckItemState.Ok;
            CheckItem ci = sender as CheckItem;

            try
            {
                string test, path;
                foreach (ExpansionItem ei in PathProvider.Global.Expansions)
                {
                    if (!ei.Exists)
                    {
                        continue;
                    }
                    path = ei.InstallFolder;                    //Helper.WindowsRegistry.GetExecutableFolder(ep);
                    string name = ei.ExeName;

                    test = System.IO.Path.Combine(path, "TSBin" + Helper.PATH_SEP + name);
                    if (!System.IO.File.Exists(test))
                    {
                        isok        = CheckItemState.Fail;
                        ci.Details += SimPe.Localization.GetString("Check: Folder not found").Replace("{name}", ei.Name) + Helper.lbr;
                        ci.Details += "    " + SimPe.Localization.GetString("Check: Unable to locate").Replace("{name}", test) + Helper.lbr + Helper.lbr;
                        continue;
                    }

                    test = System.IO.Path.Combine(path, "TSData" + Helper.PATH_SEP + "Res" + Helper.PATH_SEP + "Objects" + Helper.PATH_SEP + "objects.package");
                    if (!System.IO.File.Exists(test))
                    {
                        isok        = CheckItemState.Fail;
                        ci.Details += SimPe.Localization.GetString("Check: Folder not found").Replace("{name}", ei.Name) + Helper.lbr;
                        ci.Details += "    " + SimPe.Localization.GetString("Check: Unable to locate").Replace("{name}", test) + Helper.lbr + Helper.lbr;
                        continue;
                    }
                }

                path = PathProvider.SimSavegameFolder;
                test = System.IO.Path.Combine(path, "Neighborhoods");
                if (!System.IO.Directory.Exists(test))
                {
                    isok        = CheckItemState.Fail;
                    ci.Details += SimPe.Localization.GetString("Check: Folder not found").Replace("{name}", SimPe.Localization.GetString("Savegames")) + Helper.lbr;
                    ci.Details += "    " + SimPe.Localization.GetString("Check: Unable to locate").Replace("{name}", test) + Helper.lbr + Helper.lbr;
                }

                if (isok == CheckItemState.Ok)
                {
                    test = Data.MetaData.GMND_PACKAGE;
                    if (!System.IO.File.Exists(test))
                    {
                        isok        = CheckItemState.Warning;
                        ci.Details += SimPe.Localization.GetString("Check: CEP not found") + Helper.lbr;
                        ci.Details += "    " + SimPe.Localization.GetString("Check: Unable to locate").Replace("{name}", test) + Helper.lbr + Helper.lbr;
                    }

                    test = Data.MetaData.MMAT_PACKAGE;
                    if (!System.IO.File.Exists(test))
                    {
                        isok        = CheckItemState.Warning;
                        ci.Details += SimPe.Localization.GetString("Check: CEP not found") + Helper.lbr;
                        ci.Details += "    " + SimPe.Localization.GetString("Check: Unable to locate").Replace("{name}", test) + Helper.lbr + Helper.lbr;
                    }
                }
            }
            catch (Exception ex)
            {
                isok       = CheckItemState.Fail;
                ci.Details = ex.Message;
            }

            return(isok);
        }