コード例 #1
0
        /*
         * public virtual Race Race1 {
         *  get
         *  {
         *      if (race1 == null)
         *          race1 = _dbSession.Get<Domain.Race>(IdRace1);
         *      return race1;
         *  }
         *  set {
         *      race1 = value;
         *      IdRace1 = race1.Id;
         *  }
         * }
         *
         * public virtual Race Race2
         * {
         *  get
         *  {
         *      if (race2 == null)
         *          race2 = _dbSession.Get<Domain.Race>(IdRace2);
         *      return race2;
         *  }
         *  set {
         *      race2 = value;
         *      IdRace2 = race2.Id;
         *  }
         * }
         *
         * public virtual Race Race3
         * {
         *  get
         *  {
         *      if (race3 == null && IdRace3 != null)
         *          race3 = _dbSession.Get<Domain.Race>(IdRace3);
         *      return race3;
         *  }
         *  set { race3 = value; }
         * }
         */

        public override string ToString()
        {
            return
                ("IdRace1 = " + FeatherStrings.TraceString(IdRace1) +
                 "IdRace2 = " + FeatherStrings.TraceString(IdRace2) +
                 "IdRace3 = " + FeatherStrings.TraceString(IdRace3));
        }
コード例 #2
0
 public override string ToString()
 {
     return
         ("IdRace1 = " + FeatherStrings.TraceString(IdRace1) +
          ", IdRace2 = " + FeatherStrings.TraceString(IdRace2) +
          ", IdRace3 = " + FeatherStrings.TraceString(IdRace3 == null ? "(null)" : IdRace3.ToString()));
 }
コード例 #3
0
ファイル: FusionDemon.cs プロジェクト: DenkouNova/Yatagarasu
 public override string ToString()
 {
     return
         ("Demon1 = " + FeatherStrings.TraceString(Demon1.ToString()) +
          ", Demon2 = " + FeatherStrings.TraceString(Demon2.ToString()) +
          ", Demon3 = " + FeatherStrings.TraceString(Demon3 == null ? "(null)" : Demon3.ToString()));
 }
コード例 #4
0
ファイル: Quote.cs プロジェクト: DenkouNova/Nightingale
 public override string ToString()
 {
     return("Id = " + FeatherStrings.TraceString(Id) +
            ", " + "Text = " + FeatherStrings.TraceString(Text) +
            ", " + "Character = " + FeatherStrings.TraceString(Character) +
            ", " + "Words.Count = " + FeatherStrings.TraceString(Words.Count) +
            ", " + "Source.Id = " + FeatherStrings.TraceString(Source.Id));
 }
コード例 #5
0
ファイル: Demon.cs プロジェクト: DenkouNova/Yatagarasu
 public override string ToString()
 {
     return("Id = " + FeatherStrings.TraceString(Id) +
            ", " + "Level = " + FeatherStrings.TraceString(Level) +
            ", " + "Name = " + FeatherStrings.TraceString(Name) +
            ", " + "Race = " + FeatherStrings.TraceString(Race.Name) +
            ", " + "InParty = " + FeatherStrings.TraceString(InParty));
 }
コード例 #6
0
        protected override void ParseAllLines(string[] allLines)
        {
            string location = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name;

            _logger.OpenSection(location);

            var lastLineType = LineTypeEnum.Nothing;

            foreach (var oneLine in allLines)
            {
                var result   = ParseLine(oneLine, lastLineType);
                var lineType = result.Item1;
                var contents = result.Item2;

                switch (lineType)
                {
                case LineTypeEnum.Nothing:
                case LineTypeEnum.Comment:
                    break;

                case LineTypeEnum.Kanji:
                case LineTypeEnum.Kana:
                case LineTypeEnum.Romaji:
                case LineTypeEnum.Translation:
                    var ex = new Exception("Line type '" + lineType + "' is not a valid line type for this parser.");
                    _logger.Error(ex);
                    throw ex;

                case LineTypeEnum.Source:
                    _logger.Info("Adding new source '" + contents + "'");
                    var source = new Domain.Source(contents);
                    AddNewSource(source);
                    break;

                case LineTypeEnum.Quote:
                    _logger.Info("Adding new quote '" + contents + "'");
                    var character = contents.Substring(0, contents.IndexOf("「"));
                    var quoteText = FeatherStrings.GetTextBetween(contents, "「", "」");

                    var quote = new Domain.Quote(character, quoteText);
                    AddNewQuote(quote);
                    break;

                case LineTypeEnum.JwpceWord:
                    var kanji       = contents.Substring(0, contents.IndexOf("【"));
                    var kana        = FeatherStrings.GetTextBetween(contents, "【", "】");
                    var translation = contents.Substring(contents.IndexOf("】") + 1);

                    var word = new Nightingale.Domain.Word(kanji, kana, translation);
                    AddNewWord(word);
                    break;
                }
                lastLineType = lineType;
            }

            _logger.CloseSection(location);
        }
コード例 #7
0
ファイル: Word.cs プロジェクト: DenkouNova/Nightingale
 public override string ToString()
 {
     return("Id = " + FeatherStrings.TraceString(Id) +
            ", " + "Kanji = " + FeatherStrings.TraceString(Kanji) +
            ", " + "Kana = " + FeatherStrings.TraceString(Kana) +
            ", " + "Translation = " + FeatherStrings.TraceString(Translation) +
            ", " + "ReadingMastery = " + FeatherStrings.TraceString(ReadingMastery) +
            ", " + "TranslationMastery = " + FeatherStrings.TraceString(TranslationMastery) +
            ", " + "KanjiMastery = " + FeatherStrings.TraceString(KanjiMastery) +
            ", " + "Stars = " + FeatherStrings.TraceString(Stars) +
            ", " + "Text = " + FeatherStrings.TraceString(LastStudied) +
            ", " + "Disabled = " + FeatherStrings.TraceString(Disabled) + " (" + (Disabled > 0) + ")" +
            ", " + "Quote.Id = " + FeatherStrings.TraceString(Quote.Id));
 }
コード例 #8
0
 public override string ToString()
 {
     return("Id = " + FeatherStrings.TraceString(Id) +
            ", " + "Name = " + FeatherStrings.TraceString(Name));
 }
コード例 #9
0
        protected override void ParseAllLines(string[] allLines)
        {
            string location = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name;

            _logger.OpenSection(location);

            var lastLineType = LineTypeEnum.Nothing;

            Exception ex;

            foreach (var oneLine in allLines)
            {
                var result   = ParseLine(oneLine, lastLineType);
                var lineType = result.Item1;
                var contents = result.Item2;

                switch (lineType)
                {
                case LineTypeEnum.JwpceWord:
                    ex = new Exception("Line type '" + lineType + "' is not a valid line type for this parser.");
                    _logger.Error(ex);
                    throw ex;
                    break;

                case LineTypeEnum.Nothing:
                case LineTypeEnum.Comment:
                case LineTypeEnum.Romaji:
                    break;

                case LineTypeEnum.Source:
                    _logger.Info("Adding new source '" + contents + "'");
                    var source = new Domain.Source(contents);
                    AddNewSource(source);
                    break;

                case LineTypeEnum.Quote:
                    _logger.Info("Adding new quote '" + contents + "'");
                    var character = contents.Substring(0, contents.IndexOf("「"));
                    var quoteText = FeatherStrings.GetTextBetween(contents, "「", "」");

                    var quote = new Domain.Quote(character, quoteText);
                    AddNewQuote(quote);
                    break;

                ///////////////////////////////

                case LineTypeEnum.Kanji:
                    if (!String.IsNullOrEmpty(_kanji) ||
                        !String.IsNullOrEmpty(_kana) ||
                        !String.IsNullOrEmpty(_translation))
                    {
                        ex = new Exception("Kanji is not valid. A word is currently being created. " +
                                           "_kanji = '" + _kanji + "', _kana = '" + _kana + "', _translation = '" + _translation + "'");
                        _logger.Error(ex);
                        throw ex;
                    }
                    _kanji = contents;
                    break;

                case LineTypeEnum.Kana:
                    if (String.IsNullOrEmpty(_kanji) ||
                        !String.IsNullOrEmpty(_kana) ||
                        !String.IsNullOrEmpty(_translation))
                    {
                        ex = new Exception("Kana is not valid. A word is currently being created. " +
                                           "_kanji = '" + _kanji + "', _kana = '" + _kana + "', _translation = '" + _translation + "'");
                        _logger.Error(ex);
                        throw ex;
                    }
                    _kana = contents;
                    break;

                case LineTypeEnum.Translation:
                    if (!String.IsNullOrEmpty(_kanji) &&
                        String.IsNullOrEmpty(_kana) &&
                        String.IsNullOrEmpty(_translation))
                    {
                        // e.g. "うだうだ \r\n idle, long-winded and meaningless"
                        _logger.Info("Word is kana-only.");

                        _kana        = _kanji; // actually _kanji contains the kana here...
                        _translation = contents;

                        var wordKanaOnly = new Nightingale.Domain.Word(_kanji, _kana, _translation);
                        AddNewWord(wordKanaOnly);

                        // Revert to "not currently inserting a word" mode
                        _kanji = _kana = _translation = null;
                        break;
                    }

                    if (String.IsNullOrEmpty(_kanji) ||
                        String.IsNullOrEmpty(_kana) ||
                        !String.IsNullOrEmpty(_translation))
                    {
                        ex = new Exception("Translation is not valid. Must be constructing a new word. " +
                                           "_kanji = '" + _kanji + "', _kana = '" + _kana + "', _translation = '" + _translation + "'");
                        _logger.Error(ex);
                        throw ex;
                    }
                    _translation = contents;

                    var word = new Nightingale.Domain.Word(_kanji, _kana, _translation);
                    AddNewWord(word);

                    // Revert to "not currently inserting a word" mode
                    _kanji = _kana = _translation = null;
                    break;

                    ///////////////////////////////
                }
                lastLineType = lineType;
            }

            _logger.CloseSection(location);
        }
コード例 #10
0
 public override string ToString()
 {
     return("Id = " + FeatherStrings.TraceString(Id) +
            ", " + "Text = " + FeatherStrings.TraceString(Text) +
            ", " + "Quotes.Count = " + FeatherStrings.TraceString(Quotes.Count));
 }