Пример #1
0
 /// <summary>
 /// 言語エントリーを追加する。
 /// </summary>
 /// <param name="fssLanguageEntry">言語エントリー</param>
 public void AddEntry(FssLanguageEntry fssLanguageEntry)
 {
     if (this.Items.ContainsKey(fssLanguageEntry.EntryID))
     {
         var msg = $"Duplicate EntryID({fssLanguageEntry.EntryID}).";
         throw new Exception(msg);
     }
     else
     {
         this.Items.Add(fssLanguageEntry.EntryID, fssLanguageEntry);
     }
 }
Пример #2
0
        /// <summary>
        /// Streamからデータを読み込み、言語ファイルを返す。
        /// </summary>
        /// <param name="reader">Stream</param>
        /// <returns>言語ファイル</returns>
        public static FssLanguageFile Read(BinaryReader reader)
        {
            var fssLanguageFile = new FssLanguageFile();

            int entryCount = reader.ReadInt32();

            for (int i = 0; i < entryCount; i++)
            {
                var fssLanguageEntry = FssLanguageEntry.Read(reader);
                fssLanguageFile.AddEntry(fssLanguageEntry);
            }

            return(fssLanguageFile);
        }
Пример #3
0
        /// <summary>
        /// Streamからデータを読み込み、言語エントリーを返す。
        /// </summary>
        /// <param name="reader">Stream</param>
        /// <returns>言語エントリー</returns>
        public static FssLanguageEntry Read(BinaryReader reader)
        {
            var fssLanguageEntry = new FssLanguageEntry();

            fssLanguageEntry.EntryID     = FsbBinUtils.ReadString(reader);
            fssLanguageEntry.TermType    = reader.ReadInt32();
            fssLanguageEntry.Description = FsbBinUtils.ReadString(reader);
            if (fssLanguageEntry.Description == "\"")
            {
                ////fssLanguageEntry.Description = string.Empty;
            }

            var langCount = reader.ReadInt32();

            fssLanguageEntry.Texts = new List <string>();
            for (var i = 0; i < langCount; i++)
            {
                var text = FsbBinUtils.ReadString(reader);
                fssLanguageEntry.Texts.Add(text);
            }

            int languagesTouchCount = reader.ReadInt32();

            fssLanguageEntry.LanguagesTouch = new List <string>();
            for (int i = 0; i < languagesTouchCount; i++)
            {
                var touch = FsbBinUtils.ReadString(reader);
                fssLanguageEntry.LanguagesTouch.Add(touch);
            }

            int flagsCount = reader.ReadInt32();

            fssLanguageEntry.Flags = new List <int>();
            for (int i = 0; i < flagsCount; i++)
            {
                var flags = reader.ReadInt32();
                fssLanguageEntry.Flags.Add(flags);
            }

            return(fssLanguageEntry);
        }
Пример #4
0
        /// <summary>
        /// 自分自身のクローンを返す。
        /// </summary>
        /// <returns>自分自身のクローン</returns>
        public FssLanguageEntry Clone()
        {
            var entry = new FssLanguageEntry();

            entry.Description = this.Description;
            entry.EntryID     = this.EntryID;
            entry.Flags       = new List <int>();
            foreach (var flag in this.Flags)
            {
                entry.Flags.Add(flag);
            }

            entry.LanguagesTouch = this.LanguagesTouch;
            entry.TermType       = this.TermType;

            entry.Texts = new List <string>();
            foreach (var text in this.Texts)
            {
                entry.Texts.Add(text);
            }

            return(entry);
        }