示例#1
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "DATA":
                    if (Data == null)
                    {
                        Data = new DialogResponseData();
                    }

                    Data.ReadBinary(reader);
                    break;

                case "QSTI":
                    if (Quest == null)
                    {
                        Quest = new RecordReference();
                    }

                    Quest.ReadBinary(reader);
                    break;

                case "TPIC":
                    if (Topic == null)
                    {
                        Topic = new RecordReference();
                    }

                    Topic.ReadBinary(reader);
                    break;

                case "PNAM":
                    if (PreviousDialogResponse == null)
                    {
                        PreviousDialogResponse = new RecordReference();
                    }

                    PreviousDialogResponse.ReadBinary(reader);
                    break;

                case "NAME":
                    if (LearnedTopics == null)
                    {
                        LearnedTopics = new List <RecordReference>();
                    }

                    RecordReference tempNAME = new RecordReference();
                    tempNAME.ReadBinary(reader);
                    LearnedTopics.Add(tempNAME);
                    break;

                case "TRDT":
                    if (Responses == null)
                    {
                        Responses = new List <Response>();
                    }

                    Response tempTRDT = new Response();
                    tempTRDT.ReadBinary(reader);
                    Responses.Add(tempTRDT);
                    break;

                case "CTDA":
                    if (Conditions == null)
                    {
                        Conditions = new List <Condition>();
                    }

                    Condition tempCTDA = new Condition();
                    tempCTDA.ReadBinary(reader);
                    Conditions.Add(tempCTDA);
                    break;

                case "TCLT":
                    if (Choices == null)
                    {
                        Choices = new List <RecordReference>();
                    }

                    RecordReference tempTCLT = new RecordReference();
                    tempTCLT.ReadBinary(reader);
                    Choices.Add(tempTCLT);
                    break;

                case "TCLF":
                    if (LinkedFromList == null)
                    {
                        LinkedFromList = new List <RecordReference>();
                    }

                    RecordReference tempTCLF = new RecordReference();
                    tempTCLF.ReadBinary(reader);
                    LinkedFromList.Add(tempTCLF);
                    break;

                case "TCFU":
                    if (UnknownList == null)
                    {
                        UnknownList = new List <RecordReference>();
                    }

                    RecordReference tempTCFU = new RecordReference();
                    tempTCFU.ReadBinary(reader);
                    UnknownList.Add(tempTCFU);
                    break;

                case "SCHR":
                    if (BeginScript == null)
                    {
                        BeginScript = new EmbeddedScript();
                    }

                    BeginScript.ReadBinary(reader);
                    break;

                case "NEXT":
                    if (EndScript == null)
                    {
                        EndScript = new DialogEndScript();
                    }

                    EndScript.ReadBinary(reader);
                    break;

                case "SNDD":
                    if (UnusedSound == null)
                    {
                        UnusedSound = new RecordReference();
                    }

                    UnusedSound.ReadBinary(reader);
                    break;

                case "RNAM":
                    if (Prompt == null)
                    {
                        Prompt = new SimpleSubrecord <String>();
                    }

                    Prompt.ReadBinary(reader);
                    break;

                case "ANAM":
                    if (Speaker == null)
                    {
                        Speaker = new RecordReference();
                    }

                    Speaker.ReadBinary(reader);
                    break;

                case "KNAM":
                    if (RelatedSkillOrPerk == null)
                    {
                        RelatedSkillOrPerk = new RecordReference();
                    }

                    RelatedSkillOrPerk.ReadBinary(reader);
                    break;

                case "DNAM":
                    if (SpeechChallenge == null)
                    {
                        SpeechChallenge = new SimpleSubrecord <SpeechChallengeType>();
                    }

                    SpeechChallenge.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
示例#2
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Data", false, out subEle))
            {
                if (Data == null)
                {
                    Data = new DialogResponseData();
                }

                Data.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Quest", false, out subEle))
            {
                if (Quest == null)
                {
                    Quest = new RecordReference();
                }

                Quest.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Topic", false, out subEle))
            {
                if (Topic == null)
                {
                    Topic = new RecordReference();
                }

                Topic.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("PreviousDialogResponse", false, out subEle))
            {
                if (PreviousDialogResponse == null)
                {
                    PreviousDialogResponse = new RecordReference();
                }

                PreviousDialogResponse.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LearnedTopics", false, out subEle))
            {
                if (LearnedTopics == null)
                {
                    LearnedTopics = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempNAME = new RecordReference();
                    tempNAME.ReadXML(e, master);
                    LearnedTopics.Add(tempNAME);
                }
            }
            if (ele.TryPathTo("Responses", false, out subEle))
            {
                if (Responses == null)
                {
                    Responses = new List <Response>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    Response tempTRDT = new Response();
                    tempTRDT.ReadXML(e, master);
                    Responses.Add(tempTRDT);
                }
            }
            if (ele.TryPathTo("Conditions", false, out subEle))
            {
                if (Conditions == null)
                {
                    Conditions = new List <Condition>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    Condition tempCTDA = new Condition();
                    tempCTDA.ReadXML(e, master);
                    Conditions.Add(tempCTDA);
                }
            }
            if (ele.TryPathTo("Choices", false, out subEle))
            {
                if (Choices == null)
                {
                    Choices = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempTCLT = new RecordReference();
                    tempTCLT.ReadXML(e, master);
                    Choices.Add(tempTCLT);
                }
            }
            if (ele.TryPathTo("LinkedFromList", false, out subEle))
            {
                if (LinkedFromList == null)
                {
                    LinkedFromList = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempTCLF = new RecordReference();
                    tempTCLF.ReadXML(e, master);
                    LinkedFromList.Add(tempTCLF);
                }
            }
            if (ele.TryPathTo("UnknownList", false, out subEle))
            {
                if (UnknownList == null)
                {
                    UnknownList = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempTCFU = new RecordReference();
                    tempTCFU.ReadXML(e, master);
                    UnknownList.Add(tempTCFU);
                }
            }
            if (ele.TryPathTo("BeginScript", false, out subEle))
            {
                if (BeginScript == null)
                {
                    BeginScript = new EmbeddedScript();
                }

                BeginScript.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("EndScript", false, out subEle))
            {
                if (EndScript == null)
                {
                    EndScript = new DialogEndScript();
                }

                EndScript.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("UnusedSound", false, out subEle))
            {
                if (UnusedSound == null)
                {
                    UnusedSound = new RecordReference();
                }

                UnusedSound.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Prompt", false, out subEle))
            {
                if (Prompt == null)
                {
                    Prompt = new SimpleSubrecord <String>();
                }

                Prompt.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Speaker", false, out subEle))
            {
                if (Speaker == null)
                {
                    Speaker = new RecordReference();
                }

                Speaker.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("RelatedSkillOrPerk", false, out subEle))
            {
                if (RelatedSkillOrPerk == null)
                {
                    RelatedSkillOrPerk = new RecordReference();
                }

                RelatedSkillOrPerk.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SpeechChallenge", false, out subEle))
            {
                if (SpeechChallenge == null)
                {
                    SpeechChallenge = new SimpleSubrecord <SpeechChallengeType>();
                }

                SpeechChallenge.ReadXML(subEle, master);
            }
        }