Пример #1
0
        private FileValidity LoadFileSections()
        {
            m_sections.Clear();

            if (m_fileData.Length < MinimumFileSize)
            {
                return(FileValidity.NotDiablo2File);
            }

            int offset = 0;

            m_headerSection = new HeaderSection(m_fileData);
            m_sections.Add(m_headerSection);
            offset += m_headerSection.Size;

            var validity = ValidateData();

            if (validity == FileValidity.Valid)
            {
                m_questSection = new QuestSection(m_fileData, offset);
                m_sections.Add(m_questSection);
                offset += m_questSection.Size;

                m_waypointSection = new WaypointSection(m_fileData, offset);
                m_sections.Add(m_waypointSection);
                offset += m_waypointSection.Size;

                m_npcSection = new NpcSection(m_fileData, offset);
                m_sections.Add(m_npcSection);
                offset += m_npcSection.Size;

                m_statsSection = new StatsSection(m_fileData, offset);
                m_sections.Add(m_statsSection);
                offset += m_statsSection.Size;

                m_skillSection = new SkillSection(m_fileData, offset, m_headerSection.SkillSectionLength);
                m_sections.Add(m_skillSection);
                offset += m_skillSection.Size;

                m_itemSection = new ItemListSection(m_fileData, offset);
                m_sections.Add(m_itemSection);
                offset += m_itemSection.Size;

                m_corpseSection = new ItemListSection(m_fileData, offset);
                m_sections.Add(m_corpseSection);
                offset += m_corpseSection.Size;

                m_mercenarySection = new MercenaryItemSection(m_fileData, offset);
                m_sections.Add(m_mercenarySection);
                offset += m_mercenarySection.Size;

                //if (offset != m_fileData.Length)
                //    validity = FileValidity.UnknownError;
            }

            return(validity);
        }
Пример #2
0
        private ReadOnlySpan <byte> ReadStatsSection(ReadOnlySpan <byte> fileData)
        {
            m_statsSection = new StatsSection(fileData);
            m_statsSection.Validate();

            m_sections.Add(m_statsSection);

            return(fileData.Slice(m_statsSection.Size));
        }
Пример #3
0
        private void EditClassResourceDoneClick(object sender, RoutedEventArgs e)
        {
            var btn       = sender as Button;
            var textBlock = btn.Parent as FrameworkElement;

            if (textBlock != null)
            {
                textBlock.Visibility = Visibility.Collapsed;
            }

            var textBox = StatsSection.FindChildByName("ClassResourceTextBlock");

            textBox.Visibility = Visibility.Visible;
        }
Пример #4
0
        private void Read(BinaryReader reader)
        {
            // determine where all the sections are
            HeaderSection      = new(reader);
            ProtocolSection    = new(reader);
            AdcSection         = new(reader);
            DacSection         = new(reader);
            StringsSection     = new(reader);
            TagSection         = new(reader);
            DataSection        = new(reader);
            SynchArraySection  = new(reader);
            EpochSection       = new(reader);
            EpochPerDacSection = new(reader);
            AdcPerDacSection   = new(reader);
            UserListSection    = new(reader);
            StatsRegionSection = new(reader);
            MathSection        = new(reader);
            ScopeSection       = new(reader);
            DeltaSection       = new(reader);
            VoiceTagSection    = new(reader);
            AnnotationSection  = new(reader);
            StatsSection       = new(reader);

            // populate header values from each section
            ReadGroup1();
            ReadGroup2();
            ReadGroup3();
            ReadGroup5();
            ReadGroup6();
            ReadGroup7();
            ReadGroup9();
            ReadGroup10();
            ReadGroup12();

            // use header values to put additional information in the header object
            float tagTimeMult = (fSynchTimeUnit == 0)
                ? SamplePeriod / ChannelCount
                : fSynchTimeUnit / 1e6f;

            Tags = TagSection.GetTags(tagTimeMult);
        }