Exemple #1
0
 internal NeighborhoodPath(string name, string path, ExpansionItem ei, bool def)
 {
     this.name = name;
     this.path = path;
     this.ei   = ei;
     this.def  = def;
 }
Exemple #2
0
 protected string GetPath(ExpansionItem ei)
 {
     if (ei.InstallFolder == null)
     {
         return(ei.RealInstallFolder);
     }
     if (ei.InstallFolder.Trim() == "")
     {
         return(ei.RealInstallFolder);
     }
     return(ei.InstallFolder);
 }
Exemple #3
0
        public int CompareTo(object obj)
        {
            ExpansionItem a = obj as ExpansionItem;

            if (a == null)
            {
                return(0);
            }
            else
            {
                return(Version.CompareTo(a.Version));
            }
        }
Exemple #4
0
        public static bool Execute(FileTableItem fti)
        {
            FileTableItemForm f = new FileTableItemForm();

            f.tbName.Text = fti.Name;
            f.tbRoot.Text = fti.Type.ToString();
            if (fti.EpVersion + 1 < f.cbEpVer.Items.Count)
            {
                f.cbEpVer.SelectedIndex = fti.EpVersion + 1;
            }
            else
            {
                ExpansionItem ei = PathProvider.Global[fti.EpVersion];
                for (int i = 0; i < f.cbEpVer.Items.Count; i++)
                {
                    if (f.cbEpVer.Items[i].ToString() == ei.Name)
                    {
                        f.cbEpVer.SelectedIndex = i;
                        break;
                    }
                }
            }
            f.cbRec.Checked = fti.IsRecursive;
            f.ok            = false;
            f.file          = fti.IsFile;
            f.UpdateRec();

            f.ShowDialog();

            if (f.ok)
            {
                fti.Type        = FileTablePaths.Absolute;
                fti.Name        = f.tbName.Text.Trim();
                fti.IsRecursive = f.cbRec.Checked;
                string epname = f.cbEpVer.Text;
                foreach (ExpansionItem ei in PathProvider.Global.Expansions)
                {
                    if (ei.Name == epname)
                    {
                        fti.EpVersion = ei.Version;
                    }
                }

                fti.IsFile = f.file;

                return(true);
            }

            return(false);
        }
Exemple #5
0
        private void Activate_miOpenInEp(object sender, System.EventArgs e)
        {
            ToolStripMenuItem mi = sender as ToolStripMenuItem;

            if (mi != null)
            {
                ExpansionItem ei = mi.Tag as ExpansionItem;
                if (ei != null)
                {
                    ofd.InitialDirectory = Path.Combine(ei.InstallFolder, @"TSData\Res");
                    ofd.FileName         = "";
                    this.Activate_miOpen(sender, e);
                }
            }
        }
Exemple #6
0
        public int GetEPVersion()
        {
            if (val > 0x80000000)
            {
                return(-1);
            }
            ExpansionItem ei = PathProvider.Global[AsExpansions];

            if (ei.Flag.Class == ExpansionItem.Classes.Story)
            {
                return(-1);
            }
            return(ei.Version);

            //return -1;
        }
Exemple #7
0
        /// <summary>
        /// Returns the DisplayName for a given Expansion
        /// </summary>
        /// <param name="ei">Expansion you are looking for</param>
        /// <returns>DisplayName of the Expoansion</returns>
        internal static string GetDisplayedNameForExpansion(ExpansionItem ei)
        {
            try
            {
#if MAC
                return("The Sims 2");
#else
                Microsoft.Win32.RegistryKey rk = ei.Registry;
                return(GetDisplayedNameForExpansion(rk));
#endif
            }
            catch (Exception)
            {
                return("The Sims 2");
            }
        }
Exemple #8
0
        /// <summary>
        /// Returns the object describing the highest Expansion in the interval [minver, maxver[
        /// </summary>
        /// <param name="minver"></param>
        /// <param name="maxver"> not including this version</param>
        /// <returns>null will be returned, if the passed Expansion is not yet defined. If it is just not installed on
        /// the users Nil, a valid object will be returned, but the <see cref="ExoansionItem.Exists"/> property
        /// returns false.</returns>
        public ExpansionItem GetHighestAvailableExpansion(int minver, int maxver)
        {
            ExpansionItem exp = null;
            ExpansionItem t   = null;
            int           v   = minver;

            while (v < maxver)
            {
                t = GetExpansion(v++);
                if (t != null)
                {
                    if (t.Exists)
                    {
                        exp = t;
                    }
                }
            }
            return(exp);
        }
Exemple #9
0
 public bool ShareOneGroup(ExpansionItem ei)
 {
     return((ei.Group & Group) != 0);
 }
Exemple #10
0
        /// <summary>
        /// Creates a default Folder xml
        /// </summary>
        public static void BuildFolderXml()
        {
            try
            {
                XmlWriterSettings xws = new XmlWriterSettings();
                xws.CloseOutput = true;
                xws.Indent      = true;
                xws.Encoding    = System.Text.Encoding.UTF8;
                XmlWriter xw = XmlWriter.Create(Helper.DataFolder.FoldersXREGW, xws);

                try
                {
                    xw.WriteStartElement("folders");
                    xw.WriteStartElement("filetable");

                    xw.WriteStartElement("file");
                    xw.WriteAttributeString("root", "save");
                    xw.WriteValue("Downloads" + Helper.PATH_SEP + "_EnableColorOptionsGMND.package");
                    xw.WriteEndElement();

                    xw.WriteStartElement("file");
                    xw.WriteAttributeString("root", "game");
                    xw.WriteValue("TSData" + Helper.PATH_SEP + "Res" + Helper.PATH_SEP + "Sims3D" + Helper.PATH_SEP + "_EnableColorOptionsMMAT.package");
                    xw.WriteEndElement();

                    xw.WriteStartElement("path");
                    xw.WriteAttributeString("root", "save");
                    xw.WriteAttributeString("recursive", "1");
                    xw.WriteValue("zCEP-EXTRA");
                    xw.WriteEndElement();

                    xw.WriteStartElement("path");
                    xw.WriteAttributeString("root", "game");
                    xw.WriteAttributeString("recursive", "1");
                    xw.WriteValue("TSData" + Helper.PATH_SEP + "Res" + Helper.PATH_SEP + "Catalog" + Helper.PATH_SEP + "zCEP-EXTRA");
                    xw.WriteEndElement();

                    for (int i = PathProvider.Global.Expansions.Count - 1; i >= 0; i--)
                    {
                        ExpansionItem ei = PathProvider.Global.Expansions[i];
                        string        s  = ei.ShortId.ToLower();

                        //string ign = "";
                        foreach (string folder in ei.PreObjectFileTableFolders)
                        {
                            writenode(xw, (ei.Group & 1) != 1, s, null, folder);
                        }

                        if (ei.Flag.Class == ExpansionItem.Classes.Story || !ei.Flag.FullObjectsPackage)
                        {
                            writenode(xw, (ei.Group & 1) != 1, s, null, ei.ObjectsSubFolder);
                        }
                        else
                        {
                            writenode(xw, (ei.Group & 1) != 1, s, ei.Version.ToString(), ei.ObjectsSubFolder);
                        }

                        foreach (string folder in ei.FileTableFolders)
                        {
                            writenode(xw, (ei.Group & 1) != 1, s, null, folder);
                        }
                    }

                    xw.WriteEndElement();
                    xw.WriteEndElement();
                }
                finally
                {
                    xw.Close();
                    xw = null;
                }
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("Unable to create default Folder File!", ex);
            }
        }
Exemple #11
0
        void Load()
        {
            censorfiles.Add(System.IO.Path.Combine(SimSavegameFolder, @"Downloads\quaxi_nl_censor_v1.package"));
            censorfiles.Add(System.IO.Path.Combine(SimSavegameFolder, @"Downloads\quaxi_nl_censor.package"));
            string[] names = xrk.GetSubKeyNames();
            int      ver   = -1;

            avlgrp = 0;
            System.Diagnostics.Debug.WriteLine("\r\n----\r\nExpansionItems");
            foreach (string name in names)
            {
                ExpansionItem i = new ExpansionItem(xrk.OpenSubKey(name, false));
                exps.Add(i);
                map[i.Expansion] = i;

                if (i.Flag.Class == ExpansionItem.Classes.Story)
                {
                    continue;
                }

                if (i.CensorFile != "")
                {
                    string fl = System.IO.Path.Combine(SimSavegameFolder, @"Downloads\" + i.CensorFileName);
                    if (!censorfiles.Contains(fl))
                    {
                        censorfiles.Add(fl);
                    }
                    fl = System.IO.Path.Combine(SimSavegameFolder, @"Config\" + i.CensorFileName);
                    if (!censorfiles.Contains(fl))
                    {
                        censorfiles.Add(fl);
                    }
                }
                if (i.Version > ver)
                {
                    ver       = i.Version;
                    lastknown = i.Expansion;
                }

                avlgrp = avlgrp | (uint)i.Group;
            }
            System.Diagnostics.Debug.WriteLine("----\r\n");



            spver  = GetMaxVersion(ExpansionItem.Classes.StuffPack);
            epver  = GetMaxVersion(ExpansionItem.Classes.ExpansionPack);
            stver  = GetMaxVersion(ExpansionItem.Classes.Story);
            latest = this.GetLatestExpansion();

            exps.Sort();

            CreateSaveGameMap();

            paths = new List <string>();
            foreach (ExpansionItem ei in exps)
            {
                if (ei.Exists)
                {
                    if (System.IO.Directory.Exists(ei.InstallFolder))
                    {
                        paths.Add(ei.InstallFolder);
                    }
                }
            }
        }