Exemple #1
0
            public Message Build()
            {
                //if (!HasMessage)
                //	throw new Exception();
                var voices = Voices.ToList();

                voices.Sort(CompareVoiceIds);
                string  novelId = (IsNovel ? "novel   " : string.Empty);
                string  nameId  = string.Join("", Names.Select(n => n.Content));
                string  voiceId = string.Join(" ", voices.Select(ToVoiceId));
                string  groupId = $"{novelId}{nameId}  {voiceId}";
                Message m       = new Message {
                    GroupId  = groupId,
                    Script   = Script,
                    Names    = Names.ToImmutableArrayLW(),
                    Messages = Messages.ToImmutableArrayLW(),
                    Voices   = Voices.ToImmutableArrayLW(),
                };

                Names.Clear();
                Messages.Clear();
                Voices.Clear();
                string msg = m.CreateMessage().Message;

                if (msg.Length == 0 || msg == "\n")
                {
                    return(null);
                }
                if (msg == new string('.', msg.Length))
                {
                    return(null);
                }
                if (JpUtils.Check(msg))
                {
                    return(null);
                }
                return(m);
            }