Esempio n. 1
0
        /// <summary>
        /// Returns a Language String (if available in the passed Language)
        /// </summary>
        /// <param name="l">the Language</param>
        /// <returns>List of Strings</returns>
        public StrToken FallbackedLanguageItem(Data.MetaData.Languages l, int index)
        {
            StrItemList list = this.LanguageItems(l);
            StrToken    name;

            if (list.Length > index)
            {
                name = list[index];
            }
            else
            {
                name = new StrToken(0, 0, "", "");
            }

            if (name.Title.Trim() == "")
            {
                list = this.LanguageItems(1);
                if (list.Length > index)
                {
                    name = list[index];
                }
            }


            return(name);
        }
Esempio n. 2
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        protected override void Unserialize(System.IO.BinaryReader reader)
        {
            lines = new Hashtable();
            if (reader.BaseStream.Length <= 0x40)
            {
                return;
            }

            byte[] fi = reader.ReadBytes(0x40);

            SimPe.Data.MetaData.FormatCode fo = (SimPe.Data.MetaData.FormatCode)reader.ReadUInt16();
            if (fo != Data.MetaData.FormatCode.normal)
            {
                return;
            }

            ushort count = reader.ReadUInt16();

            filename = fi;
            format   = fo;
            lines    = new Hashtable();

            if ((limit != 0) && (count > limit))
            {
                count = (ushort)limit;                                                  // limit number of StrItem entries loaded
            }
            for (int i = 0; i < count; i++)
            {
                StrToken.Unserialize(reader, lines);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Removes this Item From the List
        /// </summary>
        /// <param name="item">The Item you want to remove</param>
        public void Remove(StrToken item)
        {
            StrItemList lng = (StrItemList)lines[item.Language.Id];

            if (lng != null)
            {
                lng.Remove(item);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Adds a new String Item
        /// </summary>
        /// <param name="item">The Item you want to add</param>
        public void Add(StrToken item)
        {
            StrItemList lng = (StrItemList)lines[item.Language.Id];

            if (lng == null)
            {
                lng = new StrItemList();
                lines[item.Language.Id] = lng;
            }

            lng.Add(item);
        }
Esempio n. 5
0
        void LoadWantTable(SDescVersions version)
        {
            wnl = null;
            if (version == SDescVersions.BaseGame)
            {
                string flname = System.IO.Path.Combine(PathProvider.Global.GetExpansion(Expansions.BaseGame).InstallFolder, @"TSData\Res\Objects\objects.package");
                if (System.IO.File.Exists(flname))
                {
                    SimPe.Packages.File fl = SimPe.Packages.File.LoadFromFile(flname);
                    Interfaces.Files.IPackedFileDescriptor pfd = fl.FindFile(0x53545223, 0, 0x7FE59FD0, 0xc8);

                    if (pfd != null)
                    {
                        SimPe.PackedFiles.Wrapper.Str str = new Str();
                        str.ProcessData(pfd, fl);

                        SimPe.PackedFiles.Wrapper.StrItemList list = str.LanguageItems(1);
                        string xml = "<wantSimulator>" + Helper.lbr;
                        xml += "  <persondata>" + Helper.lbr;
                        for (int sid = 0; sid < list.Length; sid++)
                        {
                            SimPe.PackedFiles.Wrapper.StrToken si = list[sid];
                            xml += "    <persondata id=\"" + (sid + 1).ToString() + "\" name=\"" + si.Title + "\" /> " + Helper.lbr;
                        }
                        xml += "  </persondata>" + Helper.lbr;
                        xml += "</wantSimulator>" + Helper.lbr;

                        wnl = new SimPe.Plugin.WantNameLoader(xml);
                    }
                }
            }

            if (wnl == null)
            {
                FileTable.FileIndex.Load();
                wnl = new SimPe.Plugin.WantNameLoader(version);
            }
        }
Esempio n. 6
0
 public bool Contains(StrToken stritem)
 {
     return(base.Contains(stritem));
 }
Esempio n. 7
0
 public void Remove(StrToken stritem)
 {
     base.Remove(stritem);
 }
Esempio n. 8
0
 public void Insert(int index, StrToken stritem)
 {
     base.Insert(index, stritem);
 }
Esempio n. 9
0
 public int Add(StrToken stritem)
 {
     return(base.Add(stritem));
 }