Exemplo n.º 1
0
        private void InjectPrediction(ExtractedResourcePredictionD pred)
        {
            //was the tag for this prediction injected?
            var tag = InjectedTags.FirstOrDefault(t => t.OriginalIndex == pred.OriginalTagIndex);

            if (tag == null)
            {
                return;
            }

            ResourcePredictionD newpred = new ResourcePredictionD();

            var newtag = _tagIndices[tag];

            newpred.Tag = _cacheFile.Tags[newtag.Index];

            newpred.Index    = -1;
            newpred.Unknown1 = pred.Unknown1;
            newpred.Unknown2 = pred.Unknown2;

            foreach (ExtractedResourcePredictionC expc in pred.CEntries)
            {
                ResourcePredictionC pc = new ResourcePredictionC();
                pc.OverallIndex = -1;
                pc.Index        = -1;
                pc.BEntry       = new ResourcePredictionB();

                pc.BEntry.Index        = -1;
                pc.BEntry.OverallIndex = -1;

                foreach (ExtractedResourcePredictionA expa in expc.BEntry.AEntries)
                {
                    ResourcePredictionA pa = GeneratePredictionA(expa);
                    if (pa != null)
                    {
                        pc.BEntry.AEntries.Add(pa);
                    }
                }

                if (!pc.BEntry.IsEmpty)
                {
                    newpred.CEntries.Add(pc);
                }
            }

            foreach (ExtractedResourcePredictionA expa in pred.AEntries)
            {
                ResourcePredictionA pa = GeneratePredictionA(expa);
                if (pa != null)
                {
                    newpred.AEntries.Add(pa);
                }
            }

            if (!newpred.IsEmpty)
            {
                _resources.Predictions.Add(newpred);
            }
            return;
        }
Exemplo n.º 2
0
        private static ExtractedResourcePredictionD ReadPrediction(IReader reader, byte version)
        {
            if (version > 0)
            {
                throw new InvalidOperationException("Unrecognized \"pdct\" block version");
            }

            var prediction = new ExtractedResourcePredictionD();

            prediction.OriginalIndex    = reader.ReadInt32();
            prediction.OriginalTagIndex = new DatumIndex(reader.ReadUInt32());

            prediction.Unknown1 = reader.ReadInt32();
            prediction.Unknown2 = reader.ReadInt32();

            int cCount = reader.ReadInt32();

            for (int c = 0; c < cCount; c++)
            {
                var expc = new ExtractedResourcePredictionC();

                expc.BEntry = new ExtractedResourcePredictionB();

                int baCount = reader.ReadInt32();
                for (int a = 0; a < baCount; a++)
                {
                    ExtractedResourcePredictionA expa = new ExtractedResourcePredictionA();
                    expa.OriginalResourceSubIndex = reader.ReadInt32();
                    expa.OriginalResourceIndex    = new DatumIndex(reader.ReadUInt32());
                    expa.OriginalResourceGroup    = reader.ReadInt32();
                    expa.OriginalResourceName     = reader.ReadAscii();
                    expc.BEntry.AEntries.Add(expa);
                }
                prediction.CEntries.Add(expc);
            }

            int aCount = reader.ReadInt32();

            for (int a = 0; a < aCount; a++)
            {
                ExtractedResourcePredictionA expa = new ExtractedResourcePredictionA();
                expa.OriginalResourceSubIndex = reader.ReadInt32();
                expa.OriginalResourceIndex    = new DatumIndex(reader.ReadUInt32());
                expa.OriginalResourceGroup    = reader.ReadInt32();
                expa.OriginalResourceName     = reader.ReadAscii();
                prediction.AEntries.Add(expa);
            }

            return(prediction);
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Adds information about a resource prediction to the container.
 /// </summary>
 /// <param name="prediction">The prediction to add.</param>
 public void AddPrediction(ExtractedResourcePredictionD prediction)
 {
     _extractedPredictions.Add(prediction);
 }