public void Should_return_actual_objects_HashCode()
		{
			const string testString = "Hello World!";
			var @class = new TestClass { TestValue = testString };
			var reader = new PropertyReader<TestClass>("TestValue");
			reader.GetItemHashCode(@class).ShouldEqual(testString.GetHashCode());
		}
示例#2
0
        private static IndexReadTimingResult GetIndexReadTimingResult(int numberOfItems)
        {
            var dummyCollectionOfData = (from x in Enumerable.Range(1, numberOfItems)
                                         select new TestClass { TestValue = Guid.NewGuid().ToString() })
                .ToList();

            Func<PropertyReadStrategy, int, long> timeFor = (readerStrategy, iterations) =>
                                                                {
                                                                    var stopwatch = Stopwatch.StartNew();
                                                                    var reader = new PropertyReader<TestClass>(readerStrategy, "TestValue");
                                                                    for (int i = 0; i < iterations; i++)
                                                                    {
                                                                        reader.ReadValue(dummyCollectionOfData[i]);
                                                                    }
                                                                    stopwatch.Stop();
                                                                    return stopwatch.ElapsedTicks;
                                                                };

            // Run each once to initialize any system level (possibly jitting???) or eronous code...
            timeFor(PropertyReadStrategy.Reflection, 1);
            timeFor(PropertyReadStrategy.DelegateMethod, 1);

            var reflectionTime = timeFor(PropertyReadStrategy.Reflection, numberOfItems);
            var delegateMethodTime = timeFor(PropertyReadStrategy.DelegateMethod, numberOfItems);

            return new IndexReadTimingResult
                    {
                        DelegateMethodTime = delegateMethodTime,
                        ReflectionTime = reflectionTime,
                        Iterations = numberOfItems,
                    };
        }
示例#3
0
        public static void HasApiRoute(HttpConfiguration config, string url, HttpMethod httpMethod, string body, object expectations)
        {
            var propertyReader = new PropertyReader();
            var expectedProps = propertyReader.Properties(expectations);

            HasApiRoute(config, url, httpMethod, body, expectedProps);
        }
        public void ShouldReadEmptyObject()
        {
            var reader = new PropertyReader();
            var properties = reader.Properties(new object());

            Assert.That(properties, Is.Not.Null);
            Assert.That(properties.Count, Is.EqualTo(0));
        }
示例#5
0
        public static new PlayerSprite LoadFromSaveFile(PropertyReader r, Game game)
        {
            PlayerSprite sprite = new PlayerSprite(r.GetString("sprite"), game);

            sprite.Load_FillInDetails(r, game);
            sprite.MovementAI = new PlayerMovementController(game);
            return sprite;
        }
        public void ShouldReadPropertiesOfAnonObject()
        {
            var reader = new PropertyReader();
            var properties = reader.Properties(new { Foo = 1, Bar = "Two" });

            Assert.That(properties, Is.Not.Null);
            Assert.That(properties.Count, Is.EqualTo(2));
            Assert.That(properties["Foo"], Is.EqualTo("1"));
            Assert.That(properties["Bar"], Is.EqualTo("Two"));
        }
        public void ShouldReadPropertyValueNull()
        {
            var reader = new PropertyReader();
            var properties = reader.Properties(new { Foo = 1, Bar = (string)null });

            Assert.That(properties, Is.Not.Null);
            Assert.That(properties.Count, Is.EqualTo(2));
            Assert.That(properties["Foo"], Is.EqualTo("1"));
            Assert.That(properties["Bar"], Is.Null);
        }
        public static void GeneratesActionUrl(RouteCollection routes,
            string expectedUrl, object fromProps,
            HttpMethod httpMethod = null, string appPath = "/", string requestBody = null)
        {
            if (httpMethod == null)
            {
                httpMethod = HttpMethod.Get;
            }

            var propertyReader = new PropertyReader();
            var expectedRouteValues = propertyReader.RouteValues(fromProps);

            WebRouteAssert.GeneratesActionUrl(routes, httpMethod, expectedUrl, expectedRouteValues, appPath, requestBody);
        }
示例#9
0
        public WwiseAudioVolume(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                case "bAutoPlay":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAutoPlay = true;
                    }
                    break;

                case "bLockLocation":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bLockLocation = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "UniqueTag":
                    UniqueTag = p.Value.IntValue;
                    break;

                case "Brush":
                    Brush = p.Value.IntValue;
                    break;

                case "BrushComponent":
                    BrushComponent = p.Value.IntValue;
                    if (pcc.isExport(BrushComponent - 1) && pcc.Exports[BrushComponent - 1].ClassName == "BrushComponent")
                    {
                        brush = new BrushComponent(pcc, BrushComponent - 1);
                    }
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "AudioComponent":
                    AudioComponent = p.Value.IntValue;
                    break;

                case "location":
                    location.X = BitConverter.ToSingle(p.raw, p.raw.Length - 12);
                    location.Y = BitConverter.ToSingle(p.raw, p.raw.Length - 8);
                    location.Z = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;
                }
            }
            MyMatrix = Matrix.Translation(location);
        }
示例#10
0
        protected void LoadData()
        {
            m_nmSFXFindActor = -1;


            List <PropertyReader.Property> props = PropertyReader.getPropList(pcc.Exports[index]);
            List <int> tracks = new List <int>();

            foreach (PropertyReader.Property p in props)
            {
                if (pcc.getNameEntry(p.Name) == "m_nmSFXFindActor")
                {
                    m_nmSFXFindActor = p.Value.IntValue;
                }
                else if (pcc.getNameEntry(p.Name) == "GroupName")
                {
                    GroupName = pcc.getNameEntry(p.Value.IntValue);
                }
                else if (pcc.getNameEntry(p.Name) == "GroupColor")
                {
                    GroupColor = BitConverter.ToInt32(p.raw, 32);
                }
                else if (pcc.getNameEntry(p.Name) == "BioForcedLodModel")
                {
                    BioForcedLodModel = p.Value.IntValue;
                }
                else if (pcc.getNameEntry(p.Name) == "bCollapsed")
                {
                    bCollapsed = p.Value.IntValue != 0;
                }
                else if (pcc.getNameEntry(p.Name) == "bIsParented")
                {
                    bIsParented = p.Value.IntValue != 0;
                }
                else if (pcc.getNameEntry(p.Name) == "m_eSFXFindActorMode")
                {
                    m_eSFXFindActorMode.set(p.raw);
                }
                else if (pcc.getNameEntry(p.Name) == "InterpTracks")
                {
                    for (int i = 0; i < p.Value.Array.Count; i += 4)
                    {
                        tracks.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1);
                    }
                }
                else if (pcc.getNameEntry(p.Name) == "GroupAnimSets")
                {
                    GroupAnimSets = new List <int>();
                    for (int i = 0; i < p.Value.Array.Count; i += 4)
                    {
                        GroupAnimSets.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1);
                    }
                }
            }
            foreach (int i in tracks)
            {
                switch (pcc.Exports[i].ClassName)
                {
                case "BioInterpTrackMove":
                    addTrack(new BioInterpTrackMove(i, pcc));
                    break;

                case "BioScalarParameterTrack":
                    addTrack(new BioScalarParameterTrack(i, pcc));
                    break;

                case "BioEvtSysTrackInterrupt":
                    addTrack(new BioEvtSysTrackInterrupt(i, pcc));
                    break;

                case "BioEvtSysTrackSubtitles":
                    addTrack(new BioEvtSysTrackSubtitles(i, pcc));
                    break;

                case "BioEvtSysTrackSwitchCamera":
                    addTrack(new BioEvtSysTrackSwitchCamera(i, pcc));
                    break;

                case "BioEvtSysTrackVOElements":
                    addTrack(new BioEvtSysTrackVOElements(i, pcc));
                    break;

                case "BioInterpTrackRotationMode":
                    addTrack(new BioInterpTrackRotationMode(i, pcc));
                    break;

                case "BioEvtSysTrackGesture":
                    addTrack(new BioEvtSysTrackGesture(i, pcc));
                    break;

                case "BioEvtSysTrackLighting":
                    addTrack(new BioEvtSysTrackLighting(i, pcc));
                    break;

                case "BioEvtSysTrackLookAt":
                    addTrack(new BioEvtSysTrackLookAt(i, pcc));
                    break;

                case "BioEvtSysTrackProp":
                    addTrack(new BioEvtSysTrackProp(i, pcc));
                    break;

                case "BioEvtSysTrackSetFacing":
                    addTrack(new BioEvtSysTrackSetFacing(i, pcc));
                    break;

                case "SFXGameInterpTrackProcFoley":
                    addTrack(new SFXGameInterpTrackProcFoley(i, pcc));
                    break;

                case "SFXInterpTrackPlayFaceOnlyVO":
                    addTrack(new SFXInterpTrackPlayFaceOnlyVO(i, pcc));
                    break;

                case "SFXInterpTrackAttachCrustEffect":
                    addTrack(new SFXInterpTrackAttachCrustEffect(i, pcc));
                    break;

                case "SFXInterpTrackAttachToActor":
                    addTrack(new SFXInterpTrackAttachToActor(i, pcc));
                    break;

                case "SFXInterpTrackAttachVFXToObject":
                    addTrack(new SFXInterpTrackAttachVFXToObject(i, pcc));
                    break;

                case "SFXInterpTrackBlackScreen":
                    addTrack(new SFXInterpTrackBlackScreen(i, pcc));
                    break;

                case "SFXInterpTrackDestroy":
                    addTrack(new SFXInterpTrackDestroy(i, pcc));
                    break;

                case "SFXInterpTrackForceLightEnvUpdate":
                    addTrack(new SFXInterpTrackForceLightEnvUpdate(i, pcc));
                    break;

                case "SFXInterpTrackLightEnvQuality":
                    addTrack(new SFXInterpTrackLightEnvQuality(i, pcc));
                    break;

                case "SFXInterpTrackMovieBink":
                    addTrack(new SFXInterpTrackMovieBink(i, pcc));
                    break;

                case "SFXInterpTrackMovieTexture":
                    addTrack(new SFXInterpTrackMovieTexture(i, pcc));
                    break;

                case "SFXInterpTrackSetPlayerNearClipPlane":
                    addTrack(new SFXInterpTrackSetPlayerNearClipPlane(i, pcc));
                    break;

                case "SFXInterpTrackSetWeaponInstant":
                    addTrack(new SFXInterpTrackSetWeaponInstant(i, pcc));
                    break;

                case "SFXInterpTrackToggleAffectedByHitEffects":
                    addTrack(new SFXInterpTrackToggleAffectedByHitEffects(i, pcc));
                    break;

                case "SFXInterpTrackToggleHidden":
                    addTrack(new SFXInterpTrackToggleHidden(i, pcc));
                    break;

                case "SFXInterpTrackToggleLightEnvironment":
                    addTrack(new SFXInterpTrackToggleLightEnvironment(i, pcc));
                    break;

                case "SFXGameInterpTrackWwiseMicLock":
                    addTrack(new SFXGameInterpTrackWwiseMicLock(i, pcc));
                    break;

                case "InterpTrackEvent":
                    addTrack(new InterpTrackEvent(i, pcc));
                    break;

                case "InterpTrackFaceFX":
                    addTrack(new InterpTrackFaceFX(i, pcc));
                    break;

                case "InterpTrackAnimControl":
                    addTrack(new InterpTrackAnimControl(i, pcc));
                    break;

                case "InterpTrackMove":
                    addTrack(new InterpTrackMove(i, pcc));
                    break;

                case "InterpTrackVisibility":
                    addTrack(new InterpTrackVisibility(i, pcc));
                    break;

                case "InterpTrackToggle":
                    addTrack(new InterpTrackToggle(i, pcc));
                    break;

                case "InterpTrackWwiseEvent":
                    addTrack(new InterpTrackWwiseEvent(i, pcc));
                    break;

                case "InterpTrackWwiseSoundEffect":
                    addTrack(new InterpTrackWwiseSoundEffect(i, pcc));
                    break;

                case "InterpTrackWwiseRTPC":
                    addTrack(new InterpTrackWwiseRTPC(i, pcc));
                    break;

                case "InterpTrackVectorProp":
                    addTrack(new InterpTrackVectorProp(i, pcc));
                    break;

                case "InterpTrackVectorMaterialParam":
                    addTrack(new InterpTrackVectorMaterialParam(i, pcc));
                    break;

                case "InterpTrackColorProp":
                    addTrack(new InterpTrackColorProp(i, pcc));
                    break;

                case "InterpTrackFloatProp":
                    addTrack(new InterpTrackFloatProp(i, pcc));
                    break;

                case "InterpTrackFloatMaterialParam":
                    addTrack(new InterpTrackFloatMaterialParam(i, pcc));
                    break;

                case "InterpTrackFloatParticleParam":
                    addTrack(new InterpTrackFloatParticleParam(i, pcc));
                    break;

                case "SFXInterpTrackClientEffect":
                    addTrack(new SFXInterpTrackClientEffect(i, pcc));
                    break;

                case "InterpTrackSound":
                    addTrack(new InterpTrackSound(i, pcc));
                    break;

                //Director only ?
                case "BioEvtSysTrackDOF":
                    addTrack(new BioEvtSysTrackDOF(i, pcc));
                    break;

                case "InterpTrackDirector":
                    addTrack(new InterpTrackDirector(i, pcc));
                    break;

                case "InterpTrackFade":
                    addTrack(new InterpTrackFade(i, pcc));
                    break;

                case "InterpTrackColorScale":
                    addTrack(new InterpTrackColorScale(i, pcc));
                    break;

                default:
                    MessageBox.Show($"{pcc.Exports[i].ClassName} is not recognized.\nPlease make a bug report here: {App.BugReportURL} \nwith this information: #{i} {pcc.FileName.Substring(pcc.FileName.LastIndexOf(@"\"))}");
                    break;
                }
            }
        }
示例#11
0
        public CoverLink(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "Physics":
                    Physics = p.Value.IntValue;
                    break;

                case "LocationDescription":
                    LocationDescription = p.Value.IntValue;
                    break;

                case "bHasCrossLevelPaths":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHasCrossLevelPaths = true;
                    }
                    break;

                case "bAutoAdjust":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAutoAdjust = true;
                    }
                    break;

                case "bDisabled":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bDisabled = true;
                    }
                    break;

                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "bPlayerOnly":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPlayerOnly = true;
                    }
                    break;

                case "bLooped":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bLooped = true;
                    }
                    break;

                case "bBlockActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBlockActors = true;
                    }
                    break;

                case "bCollideActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCollideActors = true;
                    }
                    break;

                case "bPathColliding":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathColliding = true;
                    }
                    break;

                case "bPathsChanged":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathsChanged = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "nextNavigationPoint":
                    nextNavigationPoint = p.Value.IntValue;
                    break;

                case "CylinderComponent":
                    CylinderComponent = p.Value.IntValue;
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "NextCoverLink":
                    NextCoverLink = p.Value.IntValue;
                    break;

                case "Base":
                    Base = p.Value.IntValue;
                    break;

                case "CircularRadius":
                    CircularRadius = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "MaxFireLinkDist":
                    MaxFireLinkDist = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "visitedWeight":
                    visitedWeight = p.Value.IntValue;
                    break;

                case "bestPathWeight":
                    bestPathWeight = p.Value.IntValue;
                    break;

                case "NetworkID":
                    NetworkID = p.Value.IntValue;
                    break;

                case "ApproximateLineOfFire":
                    ApproximateLineOfFire = p.Value.IntValue;
                    break;

                case "Cost":
                    Cost = p.Value.IntValue;
                    break;

                case "ExtraCost":
                    ExtraCost = p.Value.IntValue;
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                    #endregion
                }
            }
        }
示例#12
0
        public SplineActor(PCCObject Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc, pcc.Exports[Index]);
            BitConverter.IsLittleEndian = true;
            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                case "Physics":
                    Physics = p.Value.IntValue;
                    break;

                case "bEdShouldSnap":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bEdShouldSnap = true;
                    }
                    break;

                case "bDisableDestination":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bDisableDestination = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "UniqueTag":
                    UniqueTag = p.Value.IntValue;
                    break;

                case "Rotation":
                    Rotator = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    if (to == new Vector3())
                    {
                        to = location;
                    }
                    break;

                case "Connections":
                    Connections = p.raw;
                    break;
                }
            }
            ProcessConnections();
        }
示例#13
0
        public Emitter(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "Physics":
                    Physics = p.Value.IntValue;
                    break;

                case "TickGroup":
                    TickGroup = p.Value.IntValue;
                    break;

                case "bNoVFXSound":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bNoVFXSound = true;
                    }
                    break;

                case "bHidden":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHidden = true;
                    }
                    break;

                case "bShadowParented":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bShadowParented = true;
                    }
                    break;

                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "bPathColliding":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathColliding = true;
                    }
                    break;

                case "bHardAttach":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHardAttach = true;
                    }
                    break;

                case "bBioSnapToBase":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBioSnapToBase = true;
                    }
                    break;

                case "bCurrentlyActive":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCurrentlyActive = true;
                    }
                    break;

                case "bIgnoreBaseRotation":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bIgnoreBaseRotation = true;
                    }
                    break;

                case "bLockLocation":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bLockLocation = true;
                    }
                    break;

                case "bPostUpdateTickGroup":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPostUpdateTickGroup = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "BaseBoneName":
                    BaseBoneName = p.Value.IntValue;
                    break;

                case "UniqueTag":
                    UniqueTag = p.Value.IntValue;
                    break;

                case "ParticleSystemComponent":
                    ParticleSystemComponent = p.Value.IntValue;
                    break;

                case "LightEnvironment":
                    LightEnvironment = p.Value.IntValue;
                    break;

                case "Base":
                    Base = p.Value.IntValue;
                    break;

                case "BaseSkelComponent":
                    BaseSkelComponent = p.Value.IntValue;
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                    #endregion
                }
            }
            MyMatrix = Matrix.Translation(location);
            GenerateMesh();
        }
        public StaticMeshComponent(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "LightMapEncoding":
                    LightMapEncoding = p.Value.IntValue;
                    break;

                case "RBChannel":
                    RBChannel = p.Value.IntValue;
                    break;

                case "DepthPriorityGroup":
                    DepthPriorityGroup = p.Value.IntValue;
                    break;

                case "TickGroup":
                    TickGroup = p.Value.IntValue;
                    break;

                case "bIgnoreInstanceForTextureStreaming":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bIgnoreInstanceForTextureStreaming = true;
                    }
                    break;

                case "CastShadow":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        CastShadow = true;
                    }
                    break;

                case "CollideActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        CollideActors = true;
                    }
                    break;

                case "BlockRigidBody":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        BlockRigidBody = true;
                    }
                    break;

                case "bForceDirectLightMap":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bForceDirectLightMap = true;
                    }
                    break;

                case "bCastDynamicShadow":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCastDynamicShadow = true;
                    }
                    break;

                case "bAcceptsDynamicDominantLightShadows":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAcceptsDynamicDominantLightShadows = true;
                    }
                    break;

                case "bAcceptsLights":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAcceptsLights = true;
                    }
                    break;

                case "bAcceptsDynamicLights":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAcceptsDynamicLights = true;
                    }
                    break;

                case "bCullModulatedShadowOnBackfaces":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCullModulatedShadowOnBackfaces = true;
                    }
                    break;

                case "bCullModulatedShadowOnEmissive":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCullModulatedShadowOnEmissive = true;
                    }
                    break;

                case "bAllowAmbientOcclusion":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAllowAmbientOcclusion = true;
                    }
                    break;

                case "bUsePrecomputedShadows":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bUsePrecomputedShadows = true;
                    }
                    break;

                case "CanBlockCamera":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        CanBlockCamera = true;
                    }
                    break;

                case "bAllowShadowFade":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAllowShadowFade = true;
                    }
                    break;

                case "bBioIsReceivingDecals":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBioIsReceivingDecals = true;
                    }
                    break;

                case "BlockNonZeroExtent":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        BlockNonZeroExtent = true;
                    }
                    break;

                case "bAcceptsStaticDecals":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAcceptsStaticDecals = true;
                    }
                    break;

                case "bAcceptsDynamicDecals":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAcceptsDynamicDecals = true;
                    }
                    break;

                case "bAcceptsFoliage":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAcceptsFoliage = true;
                    }
                    break;

                case "HiddenGame":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        HiddenGame = true;
                    }
                    break;

                case "bBioForcePrecomputedShadows":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBioForcePrecomputedShadows = true;
                    }
                    break;

                case "bCastHiddenShadow":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCastHiddenShadow = true;
                    }
                    break;

                case "bUseAsOccluder":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bUseAsOccluder = true;
                    }
                    break;

                case "BlockZeroExtent":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        BlockZeroExtent = true;
                    }
                    break;

                case "bAllowCullDistanceVolume":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAllowCullDistanceVolume = true;
                    }
                    break;

                case "bAllowApproximateOcclusion":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bAllowApproximateOcclusion = true;
                    }
                    break;

                case "bSelfShadowOnly":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bSelfShadowOnly = true;
                    }
                    break;

                case "OverridePhysMat":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        OverridePhysMat = true;
                    }
                    break;

                case "bUseOnePassLightingOnTranslucency":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bUseOnePassLightingOnTranslucency = true;
                    }
                    break;

                case "bLockLightingCache":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bLockLightingCache = true;
                    }
                    break;

                case "bDisableAllRigidBody":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bDisableAllRigidBody = true;
                    }
                    break;

                case "BlockActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        BlockActors = true;
                    }
                    break;

                case "bNotifyRigidBodyCollision":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bNotifyRigidBodyCollision = true;
                    }
                    break;

                case "bIgnoreRadialImpulse":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bIgnoreRadialImpulse = true;
                    }
                    break;

                case "bIgnoreRadialForce":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bIgnoreRadialForce = true;
                    }
                    break;

                case "HiddenEditor":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        HiddenEditor = true;
                    }
                    break;

                case "StaticMesh":
                    StaticMesh_ = p.Value.IntValue;
                    break;

                case "ReplacementPrimitive":
                    ReplacementPrimitive = p.Value.IntValue;
                    break;

                case "LightEnvironment":
                    LightEnvironment = p.Value.IntValue;
                    break;

                case "ShadowParent":
                    ShadowParent = p.Value.IntValue;
                    break;

                case "PhysMaterialOverride":
                    PhysMaterialOverride = p.Value.IntValue;
                    break;

                case "MaxDrawDistance":
                    MaxDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "CachedMaxDrawDistance":
                    CachedMaxDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "MinDrawDistance":
                    MinDrawDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "AudioObstruction":
                    AudioObstruction = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "AudioOcclusion":
                    AudioOcclusion = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "OverriddenLODMaxRange":
                    OverriddenLODMaxRange = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "Scale":
                    Scale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "Scale3D":
                    Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                          BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                          BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                           BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                           BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "Translation":
                    Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "MassiveLODDistance":
                    MassiveLODDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "MotionBlurScale":
                    MotionBlurScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "TranslucencySortPriority":
                    TranslucencySortPriority = p.Value.IntValue;
                    break;

                case "LocalTranslucencySortPriority":
                    LocalTranslucencySortPriority = p.Value.IntValue;
                    break;

                case "ForcedLodModel":
                    ForcedLodModel = p.Value.IntValue;
                    break;
                    #endregion
                }
            }
            if (StaticMesh_ - 1 >= 0 && StaticMesh_ - 1 < pcc.Exports.Count)
            {
                if (pcc.Exports[StaticMesh_ - 1].ClassName == "StaticMesh")
                {
                    STM = new StaticMesh(pcc, StaticMesh_ - 1);
                    STM.Mesh.Bounds.t      = null;//save memory
                    STM.Mesh.Edges.t       = null;
                    STM.Mesh.Buffers.t     = null;
                    STM.Mesh.IdxBuf.t      = null;
                    STM.Mesh.kDOPTree.t    = null;
                    STM.Mesh.Mat.t         = null;
                    STM.Mesh.RawTris.t     = null;
                    STM.Mesh.UnknownPart.t = null;
                    STM.Mesh.Vertices.t    = null;
                }
            }
            MyMatrix  = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(Scale3D);
            MyMatrix *= Matrix.Scaling(Scale, Scale, Scale);
            Vector3 rot = RotatorToDX(Rotation);
            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(Translation);
        }
示例#15
0
    void ExecutionWindowFunction(int windowID)
    {
        BehaviourTreeExecutionNode node = (BehaviourTreeExecutionNode)FindNodeByID(BehaviourTreeEditorWindow.behaviourTree, windowID);

        Event current = Event.current;

        if (current.mousePosition.x >= 0.0f && current.mousePosition.x <= nodeSize.x * zoomScale &&
            current.mousePosition.y >= 0.0f && current.mousePosition.y <= nodeSize.y * zoomScale &&
            DragAndDrop.objectReferences.Length == 1)
        {
            Object taskScriptAsset = DragAndDrop.objectReferences[0];

            if (!(taskScriptAsset is MonoScript))
            {
                DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
            }
            else
            {
                DragAndDrop.visualMode = DragAndDropVisualMode.Link;
            }
        }

        if (current.type == EventType.MouseDown && current.button == 1)
        {
            this.selectedNode = node;

            if (Selection.activeObject != BehaviourTreeEditorWindow.behaviourTree)
            {
                SelectNodeButDontChangeProjectView();
            }

            GenericMenu menu = new GenericMenu();

            AddInsertNewParentOptions(menu);
            AddMoveOption(menu);
            menu.AddItem(new GUIContent("Delete Node"), false, DeleteNodeCallback);
            menu.ShowAsContext();

            current.Use();
        }
        else if (current.type.Equals(EventType.DragExited))
        {
            Object taskScriptAsset = DragAndDrop.objectReferences[0];

            if (!(taskScriptAsset is MonoScript))
            {
                current.Use();
                return;
            }

            System.Type taskType = (taskScriptAsset as MonoScript).GetClass();

            ScriptableObject so = ScriptableObject.CreateInstance(taskType);

            if (!(so is BehaviourTreeTask))
            {
                current.Use();
                return;
            }

            BehaviourTreeTask oldTaskToRemove = node.task;

            node.task = so as BehaviourTreeTask;

            node.contextLink.Clear();

            PropertyReader.Variable[] variables = PropertyReader.GetFields(node.task.GetType());

            foreach (PropertyReader.Variable variable in variables)
            {
                if (variable.name.StartsWith("in_") || variable.name.StartsWith("out_"))
                {
                    node.contextLink.Add(variable.name, variable.name.Split('_')[1]);
                }
            }

            node.displayedName = taskType.ToString();

            AddTaskToAssets(node, oldTaskToRemove);

            BehaviourTreeEditorWindow.SaveBehaviourTree();

            this.selectedNode = node;

            Selection.activeObject = taskScriptAsset;

            SelectNodeButDontChangeProjectView();

            current.Use();
        }
        else if (current.type == EventType.MouseDown && current.button == 0 && current.clickCount == 2)
        {
            this.selectedNode = node;

            if (Selection.activeObject != BehaviourTreeEditorWindow.behaviourTree)
            {
                SelectNodeButDontChangeProjectView();
            }

            MonoScript monoscript = MonoScript.FromScriptableObject(node.task);
            string     scriptPath = AssetDatabase.GetAssetPath(monoscript);
            UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(scriptPath, 0);

            current.Use();
        }
        else if (current.type == EventType.MouseDown && current.button == 0)
        {
            this.selectedNode = node;

            if (Selection.activeObject != BehaviourTreeEditorWindow.behaviourTree)
            {
                SelectNodeButDontChangeProjectView();
            }

            current.Use();
        }
    }
示例#16
0
        public BioMorphFace(IMEPackage Pcc, int Index) : base(Pcc, Index)
        {
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
                IExportEntry export = pcc.Exports[MyIndex];
                Props = PropertyReader.getPropList(export);

                int startVerticesIndex = -1;
                foreach (PropertyReader.Property prop in Props)
                {
                    string propName = pcc.getNameEntry(prop.Name);
                    switch (propName)
                    {
                    case "m_aMorphFeatures":
                        ReadMorphFeatures(prop);
                        break;

                    case "m_aFinalSkeleton":
                        ReadFinalSkeleton(prop);
                        break;

                    case "m_oBaseHead":
                        int objIndex = prop.Value.IntValue;
                        if (pcc.isExport(objIndex - 1))
                        {
                            m_oBaseHead = new MESkeletalMesh(pcc, objIndex - 1);
                        }
                        else if (pcc.isImport(-objIndex - 1))
                        {
                            // look for a package actually containing the object
                            IMEPackage nPcc     = null;
                            int        expIndex = -1;
                            LookupObjectInImports(-objIndex - 1, out nPcc, out expIndex);
                            if (nPcc != null && expIndex > -1)
                            {
                                m_oBaseHead = new MESkeletalMesh(nPcc, expIndex);
                            }
                        }
                        break;

                    case "m_oHairMesh":
                        int objHairIndex = prop.Value.IntValue;
                        if (pcc.isExport(objHairIndex - 1))
                        {
                            m_oHairMesh = new MESkeletalMesh(pcc, objHairIndex - 1);
                        }
                        else if (pcc.isImport(-objHairIndex - 1))
                        {
                            IMEPackage nPcc     = null;
                            int        expIndex = -1;
                            LookupObjectInImports(-objHairIndex - 1, out nPcc, out expIndex);
                            if (nPcc != null && expIndex > -1)
                            {
                                m_oHairMesh = new MESkeletalMesh(nPcc, expIndex);
                            }
                        }
                        break;

                    case "m_nInternalMorphFaceContentVersion":
                        break;

                    case "m_oMaterialOverrides":
                        int objMatOIndex = prop.Value.IntValue;
                        if (pcc.isExport(objMatOIndex - 1))
                        {
                            m_oMaterialOverrides = new MaterialOverrides(pcc, objMatOIndex - 1);
                        }
                        else if (pcc.isImport(-objMatOIndex - 1))
                        {
                            IMEPackage nPcc     = null;
                            int        expIndex = -1;
                            LookupObjectInImports(-objMatOIndex - 1, out nPcc, out expIndex);
                            if (nPcc != null && expIndex > -1)
                            {
                                m_oMaterialOverrides = new MaterialOverrides(nPcc, expIndex);
                            }
                        }
                        break;

                    case "CurrentMorphFaceContentVersion":
                    case "bRequiresDynamicUpdates":
                        break;

                    case "None":
                        startVerticesIndex = prop.offsetval + prop.raw.Length;
                        break;

                    default:
                        Console.WriteLine("Unknow property for BioMorphFace: " + pcc.getNameEntry(prop.Name));
                        break;
                    }
                }
                ReadVertices(startVerticesIndex);
            }
        }
示例#17
0
        public PathNode(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "bHasCrossLevelPaths":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHasCrossLevelPaths = true;
                    }
                    break;

                case "bPathsChanged":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathsChanged = true;
                    }
                    break;

                case "bOneWayPath":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bOneWayPath = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "nextNavigationPoint":
                    nextNavigationPoint = p.Value.IntValue;
                    break;

                case "CylinderComponent":
                    CylinderComponent = p.Value.IntValue;
                    break;

                case "Base":
                    Base = p.Value.IntValue;
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "visitedWeight":
                    visitedWeight = p.Value.IntValue;
                    break;

                case "bestPathWeight":
                    bestPathWeight = p.Value.IntValue;
                    break;

                case "NetworkID":
                    NetworkID = p.Value.IntValue;
                    break;

                case "ApproximateLineOfFire":
                    ApproximateLineOfFire = p.Value.IntValue;
                    break;

                case "Cost":
                    Cost = p.Value.IntValue;
                    break;

                case "ExtraCost":
                    ExtraCost = p.Value.IntValue;
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                    #endregion
                }
            }
        }
示例#18
0
        public TreeNode MakeSubObj(TreeNode t, int index)
        {
            byte[] buff = pcc.GetObjectData(index);
            List <PropertyReader.Property> Pr = PropertyReader.getPropList(pcc, buff);
            int      count, pos, count2, pos2;
            TreeNode t2, t3, t4;
            List <PropertyReader.Property> Pr2, Pr3;

            foreach (PropertyReader.Property p in Pr)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                    #region InputLinks
                case "InputLinks":
                    t2    = new TreeNode("Input Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkAction":
                                t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "LinkedOp":
                                t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.getObjectName(pp.Value.IntValue));
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;

                    #endregion
                    #region Output Links
                case "OutputLinks":
                    t2    = new TreeNode("Output Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkAction":
                                t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "LinkedOp":
                                t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.getObjectName(pp.Value.IntValue));
                                break;

                            case "Links":
                                t4     = new TreeNode("Links");
                                count2 = BitConverter.ToInt32(pp.raw, 24);
                                pos2   = 28;
                                for (int i2 = 0; i2 < count2; i2++)
                                {
                                    Pr3 = PropertyReader.ReadProp(pcc, pp.raw, pos2);
                                    string res = "#" + i2 + " : ";
                                    foreach (PropertyReader.Property ppp in Pr3)
                                    {
                                        string s3 = pcc.GetName(ppp.Name);
                                        switch (s3)
                                        {
                                        case "LinkedOp":
                                            res += "Linked Operation (" + ppp.Value.IntValue + " " + pcc.GetObjectPath(ppp.Value.IntValue) + pcc.getObjectName(ppp.Value.IntValue) + ") ";
                                            break;

                                        case "InputLinkIdx":
                                            res += "Input Link Index(" + ppp.Value.IntValue + ")";
                                            break;
                                        }
                                    }
                                    t4.Nodes.Add(res);
                                    pos2 = Pr3[Pr3.Count - 1].offend;
                                }
                                t3.Nodes.Add(t4);
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;

                    #endregion
                    #region Variable Links
                case "VariableLinks":
                    t2    = new TreeNode("Variable Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkVar":
                                t3.Nodes.Add("Link Variable : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "PropertyName":
                                t3.Nodes.Add("Property Name : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "ExpectedType":
                                t3.Nodes.Add("Expected Type : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.getObjectName(pp.Value.IntValue));
                                break;

                            case "LinkedVariables":
                                t4     = new TreeNode("Linked Variables");
                                count2 = BitConverter.ToInt32(pp.raw, 24);
                                for (int i2 = 0; i2 < count2; i2++)
                                {
                                    int idx = BitConverter.ToInt32(pp.raw, 28 + i2 * 4);
                                    t4.Nodes.Add("#" + i2 + " : #" + idx + " " + pcc.GetObjectPath(idx) + pcc.getObjectName(idx));
                                }
                                t3.Nodes.Add(t4);
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;
                    #endregion
                }
            }
            return(t);
        }
示例#19
0
        public MantleMarker(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "bHasCrossLevelPaths":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHasCrossLevelPaths = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "nextNavigationPoint":
                    nextNavigationPoint = p.Value.IntValue;
                    break;

                case "CylinderComponent":
                    CylinderComponent = p.Value.IntValue;
                    break;

                case "Owner":
                    Owner = p.Value.IntValue;
                    break;

                case "Base":
                    Base = p.Value.IntValue;
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "visitedWeight":
                    visitedWeight = p.Value.IntValue;
                    break;

                case "bestPathWeight":
                    bestPathWeight = p.Value.IntValue;
                    break;

                case "NetworkID":
                    NetworkID = p.Value.IntValue;
                    break;

                case "ApproximateLineOfFire":
                    ApproximateLineOfFire = p.Value.IntValue;
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                    #endregion
                }
            }
            MyMatrix = Matrix.Translation(location);
            GenerateMesh();
        }
示例#20
0
        public BioTriggerVolume(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "bCollideActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCollideActors = true;
                    }
                    break;

                case "bProcessAllActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bProcessAllActors = true;
                    }
                    break;

                case "bBlockActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBlockActors = true;
                    }
                    break;

                case "Enabled":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        Enabled = true;
                    }
                    break;

                case "bHiddenEdGroup":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHiddenEdGroup = true;
                    }
                    break;

                case "OneShot":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        OneShot = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "UniqueTag":
                    UniqueTag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "Brush":
                    Brush = p.Value.IntValue;
                    break;

                case "BrushComponent":
                    BrushComponent = p.Value.IntValue;
                    if (pcc.isExport(BrushComponent - 1) && pcc.Exports[BrushComponent - 1].ClassName == "BrushComponent")
                    {
                        brush = new BrushComponent(pcc, BrushComponent - 1);
                    }
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "LocationPriority":
                    LocationPriority = p.Value.IntValue;
                    break;

                case "location":
                    location.X = BitConverter.ToSingle(p.raw, p.raw.Length - 12);
                    location.Y = BitConverter.ToSingle(p.raw, p.raw.Length - 8);
                    location.Z = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;
                    #endregion
                }
            }
            MyMatrix = Matrix.Translation(location);
        }
示例#21
0
        private Map(string mapName, Game game, PropertyReader objectList)
        {
            this.mapName = mapName;
            PropertyReader baseReader = game.loader.GetPropertyReader();
            PropertyReader info = baseReader.Select("maps/" + mapName + "/info.xml");
            cols = info.GetInt("width");
            rows = info.GetInt("height");
            int numLayers = info.GetInt("layers");
            tileSize = game.TileSize;

            layers = new Layer[numLayers];
            for (int i = 0; i < numLayers; ++i) {
                layers[i] = new Layer(cols, rows, "maps/" + mapName + "/layers/{0}." + i.ToString(), game);
            }

            PropertyReader objects;
            if (objectList == null) {
                objects = baseReader.Select("maps/" + mapName + "/objects.xml");
                foreach (PropertyReader obj in objects.SelectAll("object")) {
                    string name = obj.GetString("sprite");
                    int x = obj.GetInt("x");
                    int y = obj.GetInt("y");
                    int l = obj.GetInt("layer");
                    string action = obj.GetString("action");
                    string movement = obj.GetString("movement");
                    string collide = obj.GetString("collide");
                    Sprite sp = new Sprite(name, game);
                    this.Place(sp, x, y, l);
                    if (action != "") {
                        Script script = game.vm.LoadResumableScript(game.loader.LoadText("scripts/" + action));
                        script.Owner = sp;
                        sp.Action = script;
                    }
                    if (movement != "") {
                        MovementAI ai = new ScriptedMovementAI(game.loader.LoadText("scripts/" + movement), game);
                        sp.MovementAI = ai;
                    }
                    if (collide != "") {
                        Script script = game.vm.LoadResumableScript(game.loader.LoadText("scripts/" + collide));
                        script.Owner = sp;
                        sp.Collide = script;
                    }
                }
            }
            else {
                objects = objectList;
                foreach (PropertyReader obj in objects.SelectAll("object")) {
                    if (obj.GetBool("player")) continue;
                    int x = obj.GetInt("x");
                    int y = obj.GetInt("y");
                    int l = obj.GetInt("layer");
                    Sprite sp = Sprite.LoadFromSaveFile(obj, game);
                    this.Place(sp, x, y, l);
                }
            }

            PropertyReader onstep = baseReader.Select("maps/" + mapName + "/onstep.xml");
            foreach (PropertyReader stepEvent in onstep.SelectAll("event")) {
                int x = stepEvent.GetInt("x");
                int y = stepEvent.GetInt("y");
                int l = stepEvent.GetInt("layer");
                string name = stepEvent.GetString("script");
                Script script = game.vm.LoadResumableScript(game.loader.LoadText("scripts/" + name));
                layers[l].onStep[x, y].Add(script);
            }

            PropertyReader ladders = baseReader.Select("maps/" + mapName + "/ladders.xml");
            foreach (PropertyReader ladder in ladders.SelectAll("ladder")) {
                int x = ladder.GetInt("x");
                int y = ladder.GetInt("y");
                int baseLayer = ladder.GetInt("base");
                int topLayer = ladder.GetInt("top");
                layers[baseLayer].ladderMove[x, y - 1] = layers[topLayer];
                layers[topLayer].ladderMove[x, y] = layers[baseLayer];
            }
        }
示例#22
0
        public static void HasApiRoute(HttpConfiguration config, string url, HttpMethod httpMethod, string body, BodyFormat bodyFormat, object expectations)
        {
            var propertyReader = new PropertyReader();
            var expectedProps = propertyReader.RouteValues(expectations);

            ApiRouteAssert.HasRoute(config, url, httpMethod, body, bodyFormat, expectedProps);
        }
示例#23
0
        private void pg1_PropertyValueChanged(object o, PropertyValueChangedEventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            n = CurrentObjects[n];
            string   name   = e.ChangedItem.Label;
            GridItem parent = e.ChangedItem.Parent;

            //if (parent != null) name = parent.Label;
            if (parent.Label == "data")
            {
                GridItem parent2 = parent.Parent;
                if (parent2 != null)
                {
                    name = parent2.Label;
                }
            }
            Type parentVal = null;

            if (parent.Value != null)
            {
                parentVal = parent.Value.GetType();
            }
            if (name == "nameindex" || parentVal == typeof(Unreal.ColorProp) || parentVal == typeof(Unreal.VectorProp) || parentVal == typeof(Unreal.RotatorProp))
            {
                name = parent.Label;
            }
            PCCObject.ExportEntry          ent = pcc.Exports[n];
            List <PropertyReader.Property> p   = PropertyReader.getPropList(pcc, ent);
            int m = -1;

            for (int i = 0; i < p.Count; i++)
            {
                if (pcc.Names[p[i].Name] == name)
                {
                    m = i;
                }
            }
            if (m == -1)
            {
                return;
            }
            byte[] buff2;
            switch (p[m].TypeVal)
            {
            case PropertyReader.Type.BoolProperty:
                byte res = 0;
                if ((bool)e.ChangedItem.Value == true)
                {
                    res = 1;
                }
                ent.Data[p[m].offsetval] = res;
                break;

            case PropertyReader.Type.FloatProperty:
                buff2 = BitConverter.GetBytes((float)e.ChangedItem.Value);
                for (int i = 0; i < 4; i++)
                {
                    ent.Data[p[m].offsetval + i] = buff2[i];
                }
                break;

            case PropertyReader.Type.IntProperty:
            case PropertyReader.Type.StringRefProperty:
                int newv = Convert.ToInt32(e.ChangedItem.Value);
                int oldv = Convert.ToInt32(e.OldValue);
                buff2 = BitConverter.GetBytes(newv);
                for (int i = 0; i < 4; i++)
                {
                    ent.Data[p[m].offsetval + i] = buff2[i];
                }
                break;

            case PropertyReader.Type.StrProperty:
                string      s          = Convert.ToString(e.ChangedItem.Value);
                int         oldLength  = -(int)BitConverter.ToInt64(ent.Data, p[m].offsetval);
                List <byte> stringBuff = new List <byte>(s.Length * 2);
                for (int i = 0; i < s.Length; i++)
                {
                    stringBuff.AddRange(BitConverter.GetBytes(s[i]));
                }
                stringBuff.Add(0);
                stringBuff.Add(0);
                buff2 = BitConverter.GetBytes((s.LongCount() + 1) * 2 + 4);
                for (int i = 0; i < 4; i++)
                {
                    ent.Data[p[m].offsetval - 8 + i] = buff2[i];
                }
                buff2 = BitConverter.GetBytes(-(s.LongCount() + 1));
                for (int i = 0; i < 8; i++)
                {
                    ent.Data[p[m].offsetval + i] = buff2[i];
                }
                buff2 = new byte[ent.Data.Length - (oldLength * 2) + stringBuff.Count];
                int startLength  = p[m].offsetval + 4;
                int startLength2 = startLength + (oldLength * 2);
                for (int i = 0; i < startLength; i++)
                {
                    buff2[i] = ent.Data[i];
                }
                for (int i = 0; i < stringBuff.Count; i++)
                {
                    buff2[i + startLength] = stringBuff[i];
                }
                startLength += stringBuff.Count;
                for (int i = 0; i < ent.Data.Length - startLength2; i++)
                {
                    buff2[i + startLength] = ent.Data[i + startLength2];
                }
                ent.Data = buff2;
                break;

            case PropertyReader.Type.StructProperty:
                if (e.ChangedItem.Label != "nameindex" && parentVal == typeof(Unreal.ColorProp))
                {
                    switch (e.ChangedItem.Label)
                    {
                    case "Alpha":
                        ent.Data[p[m].offsetval + 11] = Convert.ToByte(e.ChangedItem.Value);
                        break;

                    case "Red":
                        ent.Data[p[m].offsetval + 10] = Convert.ToByte(e.ChangedItem.Value);
                        break;

                    case "Green":
                        ent.Data[p[m].offsetval + 9] = Convert.ToByte(e.ChangedItem.Value);
                        break;

                    case "Blue":
                        ent.Data[p[m].offsetval + 8] = Convert.ToByte(e.ChangedItem.Value);
                        break;

                    default:
                        break;
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                else if (e.ChangedItem.Label != "nameindex" && parentVal == typeof(Unreal.VectorProp))
                {
                    int offset = 0;
                    switch (e.ChangedItem.Label)
                    {
                    case "X":
                        offset = 8;
                        break;

                    case "Y":
                        offset = 12;
                        break;

                    case "Z":
                        offset = 16;
                        break;

                    default:
                        break;
                    }
                    if (offset != 0)
                    {
                        buff2 = BitConverter.GetBytes(Convert.ToSingle(e.ChangedItem.Value));
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + offset + i] = buff2[i];
                        }
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                else if (e.ChangedItem.Label != "nameindex" && parentVal == typeof(Unreal.RotatorProp))
                {
                    int offset = 0;
                    switch (e.ChangedItem.Label)
                    {
                    case "Pitch":
                        offset = 8;
                        break;

                    case "Yaw":
                        offset = 12;
                        break;

                    case "Roll":
                        offset = 16;
                        break;

                    default:
                        break;
                    }
                    if (offset != 0)
                    {
                        int val = Convert.ToInt32(Convert.ToSingle(e.ChangedItem.Value) * 65536f / 360f);
                        buff2 = BitConverter.GetBytes(val);
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + offset + i] = buff2[i];
                        }
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                else if (e.ChangedItem.Label != "nameindex" && parentVal == typeof(Unreal.LinearColorProp))
                {
                    int offset = 0;
                    switch (e.ChangedItem.Label)
                    {
                    case "Red":
                        offset = 8;
                        break;

                    case "Green":
                        offset = 12;
                        break;

                    case "Blue":
                        offset = 16;
                        break;

                    case "Alpha":
                        offset = 20;
                        break;

                    default:
                        break;
                    }
                    if (offset != 0)
                    {
                        buff2 = BitConverter.GetBytes(Convert.ToSingle(e.ChangedItem.Value));
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + offset + i] = buff2[i];
                        }
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                else if (e.ChangedItem.Value.GetType() == typeof(int))
                {
                    int val = Convert.ToInt32(e.ChangedItem.Value);
                    if (e.ChangedItem.Label == "nameindex")
                    {
                        int val1 = Convert.ToInt32(e.ChangedItem.Value);
                        buff2 = BitConverter.GetBytes(val1);
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + i] = buff2[i];
                        }
                        int t = listBox1.SelectedIndex;
                        listBox1.SelectedIndex = -1;
                        listBox1.SelectedIndex = t;
                    }
                    else
                    {
                        string sidx = e.ChangedItem.Label.Replace("[", "");
                        sidx = sidx.Replace("]", "");
                        int index = Convert.ToInt32(sidx);
                        buff2 = BitConverter.GetBytes(val);
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + i + index * 4 + 8] = buff2[i];
                        }
                        int t = listBox1.SelectedIndex;
                        listBox1.SelectedIndex = -1;
                        listBox1.SelectedIndex = t;
                    }
                }
                break;

            case PropertyReader.Type.ByteProperty:
            case PropertyReader.Type.NameProperty:
                if (e.ChangedItem.Value.GetType() == typeof(int))
                {
                    int val = Convert.ToInt32(e.ChangedItem.Value);
                    buff2 = BitConverter.GetBytes(val);
                    for (int i = 0; i < 4; i++)
                    {
                        ent.Data[p[m].offsetval + i] = buff2[i];
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                break;

            case PropertyReader.Type.ObjectProperty:
                if (e.ChangedItem.Value.GetType() == typeof(int))
                {
                    int val = Convert.ToInt32(e.ChangedItem.Value);
                    buff2 = BitConverter.GetBytes(val);
                    for (int i = 0; i < 4; i++)
                    {
                        ent.Data[p[m].offsetval + i] = buff2[i];
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                break;

            default:
                return;
            }
            pcc.Exports[n] = ent;
            pg1.ExpandAllGridItems();
        }
示例#24
0
 public static Sprite LoadFromSaveFile(PropertyReader r, Game game)
 {
     Sprite sp = new Sprite(r.GetString("sprite"), game);
     sp.Load_FillInDetails(r, game);
     return sp;
 }
示例#25
0
        private void makeDialogDumpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ME3Directory.cookedPath))
            {
                MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                return;
            }
            string path = ME3Directory.cookedPath;

            string[] files = Directory.GetFiles(path);
            pb1.Minimum = 0;
            rtb1.Text   = "";
            int    count  = 0;
            int    count2 = 0;
            string t      = "";

            pauseToolStripMenuItem.Visible = true;
            pb2.Value   = 0;
            pb2.Maximum = files.Length;
            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].ToLower().EndsWith(".pcc"))
                {
                    while (pause)
                    {
                        Application.DoEvents();
                    }
                    pcc         = new PCCObject(files[i]);
                    pb1.Maximum = pcc.Exports.Count;
                    pb2.Value   = i;
                    string s = "String references for file " + files[i] + "\n";
                    for (int j = 0; j < pcc.Exports.Count; j++)
                    {
                        PCCObject.ExportEntry          ent = pcc.Exports[j];
                        List <PropertyReader.Property> p   = PropertyReader.getPropList(pcc, ent.Data);

                        for (int k = 0; k < p.Count; k++)
                        {
                            PropertyReader.Property prop = p[k];
                            if (prop.TypeVal == PropertyReader.Type.StringRefProperty)
                            {
                                s += "Object #" + j + " : " + PropertyReader.PropertyToText(prop, pcc) + "\n";
                            }
                            if (prop.TypeVal == PropertyReader.Type.ArrayProperty)
                            {
                                string tt = DumpArray(pcc, ent.Data, prop.offsetval + 4, s, 1);
                                if (tt.Length != 0)
                                {
                                    s += "Object #" + j + " in : " + PropertyReader.PropertyToText(prop, pcc) + "\n";
                                    s += tt;
                                }
                            }
                            if (prop.TypeVal == PropertyReader.Type.StructProperty)
                            {
                                string tt = DumpArray(pcc, ent.Data, prop.offsetval + 8, s, 1);
                                if (tt.Length != 0)
                                {
                                    s += "Object #" + j + " in : " + PropertyReader.PropertyToText(prop, pcc) + "\n";
                                    s += tt;
                                }
                            }
                        }
                        if (count++ > 500)
                        {
                            count       = 0;
                            pb1.Value   = j;
                            Status.Text = "State : " + j + " / " + pcc.Exports.Count;
                            if (count2++ > 10)
                            {
                                count2              = 0;
                                rtb1.Text           = t;
                                rtb1.SelectionStart = rtb1.TextLength;
                                rtb1.ScrollToCaret();
                                rtb1.Visible = true;
                            }
                            Application.DoEvents();
                        }
                    }
                    t += s + "\n";
                }
            }
            Status.Text         = "State : Done";
            rtb1.Text           = t;
            rtb1.SelectionStart = rtb1.TextLength;
            rtb1.ScrollToCaret();
            pb1.Value = 0;
            pauseToolStripMenuItem.Visible = false;
        }
示例#26
0
 protected void Load_FillInDetails(PropertyReader r, Game game)
 {
     this.x = r.GetInt("x");
     this.y = r.GetInt("y");
     this.layer = r.GetInt("layer");
     this.corrX = r.GetInt("corrX");
     this.corrY = r.GetInt("corrY");
     string scriptText = r.GetString("action");
     if (scriptText != "") {
         this.action = game.vm.LoadResumableScript(scriptText);
         this.action.Owner = this;
     }
     scriptText = r.GetString("movement");
     if (scriptText != "") {
         this.movementAI = new ScriptedMovementAI(scriptText, game);
     }
     scriptText = r.GetString("collide");
     if (scriptText != "") {
         this.Collide = game.vm.LoadResumableScript(scriptText);
         this.Collide.Owner = this;
     }
     Turn((Dir)Enum.Parse(typeof(Dir), r.GetString("facing")));
     this.moving = (Dir)Enum.Parse(typeof(Dir), r.GetString("moving"));
 }
示例#27
0
        public void LetsDump2(string classname)
        {
            if (String.IsNullOrEmpty(ME3Directory.cookedPath))
            {
                MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                return;
            }
            string path = ME3Directory.cookedPath;

            string[] files = Directory.GetFiles(path, "*.pcc");
            pb1.Minimum = 0;
            rtb1.Text   = "";
            pauseToolStripMenuItem.Visible = true;
            pb2.Value   = 0;
            pb2.Maximum = files.Length;
            List <string> Names = new List <string>();
            List <string> Types = new List <string>();
            List <string> First = new List <string>();

            DebugOutput.Clear();
            for (int i = 0; i < files.Length; i++)
            {
                while (pause)
                {
                    Application.DoEvents();
                }
                pcc = new PCCObject(files[i]);
                DebugOutput.PrintLn(i + "/" + files.Length + " Scanning file : " + Path.GetFileName(files[i]));
                pb1.Maximum = pcc.Exports.Count;
                pb2.Value   = i;
                for (int j = 0; j < pcc.Exports.Count; j++)
                {
                    PCCObject.ExportEntry ent = pcc.Exports[j];
                    if (ent.ClassName == classname)
                    {
                        List <PropertyReader.Property> p = PropertyReader.getPropList(pcc, ent.Data);
                        for (int k = 0; k < p.Count; k++)
                        {
                            PropertyReader.Property prop = p[k];
                            int found = -1;
                            for (int l = 0; l < Names.Count(); l++)
                            {
                                if (pcc.getNameEntry(prop.Name) == Names[l])
                                {
                                    found = l;
                                }
                            }
                            if (found == -1)
                            {
                                Names.Add(pcc.getNameEntry(prop.Name));
                                Types.Add(PropertyReader.TypeToString((int)prop.TypeVal));
                                First.Add(Path.GetFileName(files[i]) + " #" + j);
                            }
                        }
                    }
                    if (j % 500 == 0)
                    {
                        pb1.Value   = j;
                        Status.Text = "State : " + j + " / " + pcc.Exports.Count;
                        string s = "Possible properties found so far for class \"" + classname + "\":\n";
                        for (int k = 0; k < Names.Count(); k++)
                        {
                            s += Types[k] + " : \"" + Names[k] + "\" first found: " + First[k] + "\n";
                        }
                        Action action = () => rtb1.Text = s;
                        rtb1.Invoke(action);
                        action = () => rtb1.SelectionStart = s.Length;
                        rtb1.Invoke(action);
                        action = () => rtb1.ScrollToCaret();
                        rtb1.Invoke(action);
                        Application.DoEvents();
                    }
                }
            }
            Status.Text = "State : Done";
            string t = "Possible properties found for class \"" + classname + "\":\n";

            for (int k = 0; k < Names.Count(); k++)
            {
                t += Types[k] + " : \"" + Names[k] + "\" first found: " + First[k] + "\n";
            }
            rtb1.Text           = t;
            rtb1.SelectionStart = rtb1.TextLength;
            rtb1.ScrollToCaret();
            pb1.Value = 0;
            pauseToolStripMenuItem.Visible = false;
        }
示例#28
0
        public void ProcessConnections()
        {
            List <CustomVertex.PositionColored> list = new List <CustomVertex.PositionColored>();

            if (Connections.Length == 0)
            {
                return;
            }
            byte[] buff = GetArrayContent(Connections);
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, 0);
            int f = -1;

            toIdx = -1;
            foreach (PropertyReader.Property p in pp)
            {
                if (pcc.getNameEntry(p.Name) == "ConnectTo")
                {
                    f = p.Value.IntValue - 1;
                }
            }
            if (pcc.isExport(f) && pcc.Exports[f].ClassName == "SplineActor")
            {
                to    = SplineActor.GetLocation(pcc, f);
                toIdx = f;
            }
            from    = new List <Vector3>();
            fromIdx = new List <int>();
            buff    = new byte[0];
            foreach (PropertyReader.Property p in Props)
            {
                if (pcc.getNameEntry(p.Name) == "LinksFrom")
                {
                    buff = GetArrayContent(p.raw);
                }
            }
            BitConverter.IsLittleEndian = true;
            for (int i = 0; i < buff.Length / 4; i++)
            {
                int Idx = BitConverter.ToInt32(buff, i * 4) - 1;
                fromIdx.Add(Idx);
                from.Add(SplineActor.GetLocation(pcc, Idx));
            }
            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(to, Color.GreenYellow.ToArgb()));
            foreach (Vector3 v in from)
            {
                list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
                list.Add(new CustomVertex.PositionColored(v, Color.GreenYellow.ToArgb()));
            }

            float w = 20;

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));
            points     = list.ToArray();
            points_sel = list.ToArray();
            for (int i = 0; i < points_sel.Length; i++)
            {
                points_sel[i].Color = Color.Red.ToArgb();
            }
        }
示例#29
0
        private static IList <RouteValue> ProcessCompoundActionParam(HttpParameterDescriptor param, IHttpRouteData routeDataValues, PropertyReader propertyReader)
        {
            var routeValues = new List <RouteValue>();

            var fieldNames = propertyReader.SimplePropertyNames(param.ParameterType);

            foreach (var fieldName in fieldNames)
            {
                var value = ReadParamWithRouteValue(fieldName.ToLowerInvariant(), routeDataValues.Values);
                if (value != null)
                {
                    routeValues.Add(value);
                }
            }

            return(routeValues);
        }
示例#30
0
        public StaticMeshActor(PCCObject Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            foreach (PropertyReader.Property p in Props)
            {
                string s = pcc.getNameEntry(p.Name);
                switch (s)
                {
                    #region
                case "bCollideActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCollideActors = true;
                    }
                    break;

                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "bPathColliding":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathColliding = true;
                    }
                    break;

                case "bLockLocation":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bLockLocation = true;
                    }
                    break;

                case "OverridePhysMat":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        OverridePhysMat = true;
                    }
                    break;

                case "bHidden":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHidden = true;
                    }
                    break;

                case "bShadowParented":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bShadowParented = true;
                    }
                    break;

                case "bCollideComplex":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCollideComplex = true;
                    }
                    break;

                case "bHiddenEd":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHiddenEd = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "UniqueTag":
                    UniqueTag = p.Value.IntValue;
                    break;

                case "StaticMeshComponent":
                    StaticMeshComponent = p.Value.IntValue;
                    if (pcc.isExport(StaticMeshComponent - 1) && pcc.Exports[StaticMeshComponent - 1].ClassName == "StaticMeshComponent")
                    {
                        STMC = new StaticMeshComponent(pcc, StaticMeshComponent - 1);
                    }
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "AudioOcclusion":
                    AudioOcclusion = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                    #endregion
                case "DrawScale3D":
                    DrawScale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotator = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                }
            }
            MyMatrix  = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(DrawScale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
            Vector3 rot = RotatorToDX(Rotator);
            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(location);
        }
示例#31
0
        private void ReadEntryList()
        {
            EntryList = new List <EntryListStuct>();
            int f = FindPropByName("m_EntryList");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, buff, pos);
                EntryListStuct e = new EntryListStuct();
                foreach (PropertyReader.Property pp in p)
                {
                    string name = pcc.getNameEntry(pp.Name);
                    switch (name)
                    {
                    case "ReplyListNew":
                        byte[] buff2  = pp.raw;
                        int    count2 = BitConverter.ToInt32(buff2, 0x18);
                        int    pos2   = 0x1C;
                        e.ReplyList = new List <EntryListReplyListStruct>();
                        for (int j = 0; j < count2; j++)
                        {
                            List <PropertyReader.Property> p2 = PropertyReader.ReadProp(pcc, buff2, pos2);
                            EntryListReplyListStruct       r  = new EntryListReplyListStruct();
                            foreach (PropertyReader.Property ppp in p2)
                            {
                                switch (pcc.getNameEntry(ppp.Name))
                                {
                                case "sParaphrase":
                                    r.Paraphrase = ppp.Value.StringValue;
                                    break;

                                case "nIndex":
                                    r.Index = ppp.Value.IntValue;
                                    break;

                                case "srParaphrase":
                                    r.refParaphrase = ppp.Value.IntValue;
                                    break;

                                case "Category":
                                    r.CategoryValue = BitConverter.ToInt32(ppp.raw, 24);
                                    break;

                                case "None":
                                    break;

                                default:
                                    MessageBox.Show(pcc.getNameEntry(ppp.Name));
                                    break;
                                }
                            }
                            e.ReplyList.Add(r);
                            pos2 = p2[p2.Count - 1].offend;
                        }
                        break;

                    case "aSpeakerList":
                        buff2         = pp.raw;
                        count2        = BitConverter.ToInt32(buff2, 0x18);
                        e.SpeakerList = new List <int>();
                        for (int j = 0; j < count2; j++)
                        {
                            e.SpeakerList.Add(BitConverter.ToInt32(buff2, 0x1C + 4 * j));
                        }
                        break;

                    case "nSpeakerIndex":
                        e.SpeakerIndex = pp.Value.IntValue;
                        break;

                    case "nListenerIndex":
                        e.ListenerIndex = pp.Value.IntValue;
                        break;

                    case "bSkippable":
                        e.Skippable = (pp.Value.IntValue == 1);
                        break;

                    case "sText":
                        e.Text = pp.Value.StringValue;
                        break;

                    case "srText":
                        e.refText = pp.Value.IntValue;
                        break;

                    case "nConditionalFunc":
                        e.ConditionalFunc = pp.Value.IntValue;
                        break;

                    case "nConditionalParam":
                        e.ConditionalParam = pp.Value.IntValue;
                        break;

                    case "nStateTransition":
                        e.StateTransition = pp.Value.IntValue;
                        break;

                    case "nStateTransitionParam":
                        e.StateTransitionParam = pp.Value.IntValue;
                        break;

                    case "nExportID":
                        e.ExportID = pp.Value.IntValue;
                        break;

                    case "nScriptIndex":
                        e.ScriptIndex = pp.Value.IntValue;
                        break;

                    case "nCameraIntimacy":
                        e.CameraIntimacy = pp.Value.IntValue;
                        break;

                    case "bFireConditional":
                        e.FireConditional = (pp.Value.IntValue == 1);
                        break;

                    case "bAmbient":
                        e.Ambient = (pp.Value.IntValue == 1);
                        break;

                    case "bNonTextLine":
                        e.NonTextline = (pp.Value.IntValue == 1);
                        break;

                    case "bIgnoreBodyGestures":
                        e.IgnoreBodyGestures = (pp.Value.IntValue == 1);
                        break;

                    case "eGUIStyle":
                        e.GUIStyleValue = BitConverter.ToInt32(pp.raw, 24);
                        break;

                    case "None":
                        break;

                    default:
                        MessageBox.Show(pcc.getNameEntry(pp.Name));
                        break;
                    }
                }
                EntryList.Add(e);
                pos = p[p.Count - 1].offend;
            }
        }
示例#32
0
        public void LoadInterpData(int idx, ME3Package pccobject)
        {
            TimeScale.RemoveAllChildren();
            TimeScale.Width = 3600;
            TimelineView.RemoveAllChildren();
            TimelineView.Width = 3600;
            scrollbarH.Maximum = 3600;
            PPath line;
            SText text;

            for (int i = 0; i < TimeScale.Width; i += 60)
            {
                line          = PPath.CreateLine(i, 1, i, Timeline.InfoHeight);
                line.Pickable = false;
                line.Pen      = new Pen(Color.FromArgb(110, 110, 110));
                TimeScale.AddChild(line);
                text          = new SText(i / 60 - 1 + ".00", Color.FromArgb(175, 175, 175), false);
                text.Pickable = false;
                text.TranslateBy(i + 2, Timeline.InfoHeight - text.Height);
                TimeScale.AddChild(text);
            }

            pcc   = pccobject;
            index = idx;
            foreach (InterpGroup g in InterpGroups)
            {
                RemoveChild(g.listEntry);
            }
            InterpGroups.Clear();


            List <PropertyReader.Property> props = PropertyReader.getPropList(pcc.Exports[index]);
            List <int> groups = new List <int>();

            foreach (PropertyReader.Property p in props)
            {
                if (pcc.getNameEntry(p.Name) == "InterpLength")
                {
                    InterpLength = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "EdSectionStart")
                {
                    EdSectionStart = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "EdSectionEnd")
                {
                    EdSectionEnd = BitConverter.ToSingle(p.raw, 24);
                }
                if (pcc.getNameEntry(p.Name) == "m_nBioCutSceneVersion")
                {
                    m_nBioCutSceneVersion = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "m_pSFXSceneData")
                {
                    m_pSFXSceneData = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "ObjInstanceVersion")
                {
                    ObjInstanceVersion = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "ParentSequence")
                {
                    ParentSequence = p.Value.IntValue;
                }
                if (pcc.getNameEntry(p.Name) == "InterpGroups")
                {
                    for (int i = 0; i < p.Value.Array.Count; i += 4)
                    {
                        groups.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1);
                    }
                }
            }
            foreach (int i in groups)
            {
                if (pcc.Exports[i].ClassName.StartsWith("InterpGroup"))
                {
                    addGroup(new InterpGroup(i, pcc));
                }
                else
                {
                    addGroup(new SFXSceneGroup(i, pcc));
                }
            }
            TimeScale.MoveToFront();
            PPath startmark = PPath.CreatePolygon(53, 1, 61, 1, 61, 9);

            startmark.Pen      = null;
            startmark.Brush    = new SolidBrush(Color.FromArgb(255, 80, 80));
            startmark.Pickable = false;
            TimeScale.AddChild(startmark);
            endmark       = PPath.CreatePolygon(InterpLength * 60 + 61, 1, InterpLength * 60 + 69, 1, InterpLength * 60 + 61, 9);
            endmark.Pen   = null;
            endmark.Brush = startmark.Brush;
            TimeScale.AddChild(endmark);
            foreach (InterpGroup g in InterpGroups)
            {
                foreach (InterpTrack t in g.InterpTracks)
                {
                    t.GetKeyFrames();
                    t.DrawKeyFrames();
                    TimelineView.AddChild(t.timelineEntry);
                }
            }
        }
示例#33
0
        private void addObjectsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CurrentObjects == null)
            {
                return;
            }
            string result = Microsoft.VisualBasic.Interaction.InputBox("Please enter object index", "ME1Explorer");

            if (result == "")
            {
                return;
            }
            int i;

            if (int.TryParse(result, out i))
            {
                if (i < pcc.Exports.Count)
                {
                    if (!CurrentObjects.Contains(i))
                    {
                        byte[]      buff     = pcc.Exports[SequenceIndex].Data;
                        List <byte> ListBuff = new List <byte>(buff);
                        BitConverter.IsLittleEndian = true;
                        List <PropertyReader.Property> p = PropertyReader.getPropList(pcc, buff);
                        for (int j = 0; j < p.Count(); j++)
                        {
                            if (pcc.getNameEntry(p[j].Name) == "SequenceObjects")
                            {
                                int    count     = BitConverter.ToInt32(p[j].raw, 24);
                                byte[] sizebuff  = BitConverter.GetBytes(BitConverter.ToInt32(p[j].raw, 16) + 4);
                                byte[] countbuff = BitConverter.GetBytes(count + 1);
                                for (int k = 0; k < 4; k++)
                                {
                                    ListBuff[p[j].offsetval - 8 + k] = sizebuff[k];
                                    ListBuff[p[j].offsetval + k]     = countbuff[k];
                                }
                                ListBuff.InsertRange(p[j].offsetval + 4 + count * 4, BitConverter.GetBytes(i + 1));
                                pcc.Exports[SequenceIndex].Data = ListBuff.ToArray();
                                SaveData s = new SaveData();
                                s.index = i;
                                s.X     = graphEditor.Camera.Bounds.X + graphEditor.Camera.Bounds.Width / 2;
                                s.Y     = graphEditor.Camera.Bounds.Y + graphEditor.Camera.Bounds.Height / 2;
                                List <SaveData> list = new List <SaveData>();
                                list.Add(s);
                                saveView(false, list);
                                LoadSequence(SequenceIndex, false);
                                break;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(i + " is already in the sequence.");
                    }
                }
                else
                {
                    MessageBox.Show(i + " is not in the export list.");
                }
            }
            else
            {
                MessageBox.Show(result + " is not an integer.");
            }
        }
示例#34
0
        public InterpCurve(IMEPackage _pcc, PropertyReader.Property p)
        {
            pcc = _pcc;

            Curves    = new ObservableCollection <Curve>();
            Name      = pcc.getNameEntry(p.Name);
            curveType = (CurveType)Enum.Parse(typeof(CurveType), pcc.getNameEntry(p.Value.IntValue));

            float     InVal      = 0f;
            CurveMode InterpMode = CurveMode.CIM_Linear;
            var       points     = PropertyReader.ReadStructArrayProp(pcc, PropertyReader.getPropOrNull(pcc, p.raw, 32, "Points"));

            switch (curveType)
            {
            case CurveType.InterpCurveQuat:
                throw new NotImplementedException($"InterpCurveQuat has not been implemented yet.");

            case CurveType.InterpCurveFloat:
                float OutVal                 = 0f;
                float ArriveTangent          = 0f;
                float LeaveTangent           = 0f;
                LinkedList <CurvePoint> vals = new LinkedList <CurvePoint>();
                foreach (var point in points)
                {
                    foreach (var prop in point)
                    {
                        switch (pcc.getNameEntry(prop.Name))
                        {
                        case "InVal":
                            InVal = BitConverter.ToSingle(prop.raw, 24);
                            break;

                        case "OutVal":
                            OutVal = BitConverter.ToSingle(prop.raw, 24);
                            break;

                        case "ArriveTangent":
                            ArriveTangent = BitConverter.ToSingle(prop.raw, 24);
                            break;

                        case "LeaveTangent":
                            LeaveTangent = BitConverter.ToSingle(prop.raw, 24);
                            break;

                        case "InterpMode":
                            InterpMode = (CurveMode)Enum.Parse(typeof(CurveMode), pcc.getNameEntry(prop.Value.IntValue));
                            break;

                        default:
                            break;
                        }
                    }
                    vals.AddLast(new CurvePoint(InVal, OutVal, ArriveTangent, LeaveTangent, InterpMode));
                }
                Curves.Add(new Curve("X", vals));
                break;

            case CurveType.InterpCurveVector:
                Vector OutValVec          = new Vector(0, 0, 0);
                Vector ArriveTangentVec   = new Vector(0, 0, 0);
                Vector LeaveTangentVec    = new Vector(0, 0, 0);
                LinkedList <CurvePoint> x = new LinkedList <CurvePoint>();
                LinkedList <CurvePoint> y = new LinkedList <CurvePoint>();
                LinkedList <CurvePoint> z = new LinkedList <CurvePoint>();
                foreach (var point in points)
                {
                    foreach (var prop in point)
                    {
                        switch (pcc.getNameEntry(prop.Name))
                        {
                        case "InVal":
                            InVal = BitConverter.ToSingle(prop.raw, 24);
                            break;

                        case "OutVal":
                            OutValVec = GetVector(prop);
                            break;

                        case "ArriveTangent":
                            ArriveTangentVec = GetVector(prop);
                            break;

                        case "LeaveTangent":
                            LeaveTangentVec = GetVector(prop);
                            break;

                        case "InterpMode":
                            InterpMode = (CurveMode)Enum.Parse(typeof(CurveMode), pcc.getNameEntry(prop.Value.IntValue));
                            break;

                        default:
                            break;
                        }
                    }
                    x.AddLast(new CurvePoint(InVal, OutValVec.X, ArriveTangentVec.X, LeaveTangentVec.X, InterpMode));
                    y.AddLast(new CurvePoint(InVal, OutValVec.Y, ArriveTangentVec.Y, LeaveTangentVec.Y, InterpMode));
                    z.AddLast(new CurvePoint(InVal, OutValVec.Z, ArriveTangentVec.Z, LeaveTangentVec.Z, InterpMode));
                }
                if (Name == "EulerTrack")
                {
                    Curves.Add(new Curve("Roll", x));
                    Curves.Add(new Curve("Pitch", y));
                    Curves.Add(new Curve("Yaw", z));
                }
                else
                {
                    Curves.Add(new Curve("X", x));
                    Curves.Add(new Curve("Y", y));
                    Curves.Add(new Curve("Z", z));
                }
                break;

            case CurveType.InterpCurveVector2D:
                throw new NotImplementedException($"InterpCurveVector2D has not been implemented yet.");

            case CurveType.InterpCurveTwoVectors:
                throw new NotImplementedException($"InterpCurveTwoVectors has not been implemented yet.");

            case CurveType.InterpCurveLinearColor:
                throw new NotImplementedException($"InterpCurveLinearColor has not been implemented yet.");

            default:
                break;
            }
            foreach (var curve in Curves)
            {
                curve.SharedValueChanged += Curve_SharedValueChanged;
                curve.ListModified       += Curve_ListModified;
            }
        }
示例#35
0
        private void pg1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            n = CurrentObjects[n];
            string   name   = e.ChangedItem.Label;
            GridItem parent = e.ChangedItem.Parent;

            //if (parent != null) name = parent.Label;
            if (parent.Label == "data")
            {
                GridItem parent2 = parent.Parent;
                if (parent2 != null)
                {
                    name = parent2.Label;
                }
            }
            if (name == "nameindex")
            {
                name = parent.Label;
            }
            byte[] buff = pcc.Exports[n].Data;
            List <PropertyReader.Property> p = PropertyReader.getPropList(pcc, buff);
            int m = -1;

            for (int i = 0; i < p.Count; i++)
            {
                if (pcc.Names[p[i].Name] == name)
                {
                    m = i;
                }
            }
            if (m == -1)
            {
                return;
            }
            PCCObject.ExportEntry ent = pcc.Exports[n];
            byte[] buff2;
            switch (p[m].TypeVal)
            {
            case PropertyReader.Type.BoolProperty:
                byte res = 0;
                if ((bool)e.ChangedItem.Value == true)
                {
                    res = 1;
                }
                ent.Data[p[m].offsetval] = res;
                break;

            case PropertyReader.Type.FloatProperty:
                buff2 = BitConverter.GetBytes((float)e.ChangedItem.Value);
                for (int i = 0; i < 4; i++)
                {
                    ent.Data[p[m].offsetval + i] = buff2[i];
                }
                break;

            case PropertyReader.Type.IntProperty:
            case PropertyReader.Type.StringRefProperty:
                int newv = Convert.ToInt32(e.ChangedItem.Value);
                int oldv = Convert.ToInt32(e.OldValue);
                buff2 = BitConverter.GetBytes(newv);
                for (int i = 0; i < 4; i++)
                {
                    ent.Data[p[m].offsetval + i] = buff2[i];
                }
                break;

            case PropertyReader.Type.StructProperty:
                if (e.ChangedItem.Value.GetType() == typeof(int))
                {
                    int val = Convert.ToInt32(e.ChangedItem.Value);
                    if (e.ChangedItem.Label == "nameindex")
                    {
                        int val1 = Convert.ToInt32(e.ChangedItem.Value);
                        buff2 = BitConverter.GetBytes(val1);
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + i] = buff2[i];
                        }
                        int t = listBox1.SelectedIndex;
                        listBox1.SelectedIndex = -1;
                        listBox1.SelectedIndex = t;
                    }
                    else
                    {
                        string sidx = e.ChangedItem.Label.Replace("[", "");
                        sidx = sidx.Replace("]", "");
                        int index = Convert.ToInt32(sidx);
                        buff2 = BitConverter.GetBytes(val);
                        for (int i = 0; i < 4; i++)
                        {
                            ent.Data[p[m].offsetval + i + index * 4 + 8] = buff2[i];
                        }
                        int t = listBox1.SelectedIndex;
                        listBox1.SelectedIndex = -1;
                        listBox1.SelectedIndex = t;
                    }
                }
                break;

            case PropertyReader.Type.ByteProperty:
            case PropertyReader.Type.NameProperty:
                if (e.ChangedItem.Value.GetType() == typeof(int))
                {
                    int val = Convert.ToInt32(e.ChangedItem.Value);
                    buff2 = BitConverter.GetBytes(val);
                    for (int i = 0; i < 4; i++)
                    {
                        ent.Data[p[m].offsetval + i] = buff2[i];
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                break;

            case PropertyReader.Type.ObjectProperty:
                if (e.ChangedItem.Value.GetType() == typeof(int))
                {
                    int val = Convert.ToInt32(e.ChangedItem.Value);
                    buff2 = BitConverter.GetBytes(val);
                    for (int i = 0; i < 4; i++)
                    {
                        ent.Data[p[m].offsetval + i] = buff2[i];
                    }
                    int t = listBox1.SelectedIndex;
                    listBox1.SelectedIndex = -1;
                    listBox1.SelectedIndex = t;
                }
                break;

            default:
                return;
            }
            pcc.Exports[n] = ent;
            pg1.ExpandAllGridItems();
        }
示例#36
0
 public static Map LoadFromSaveFile(PropertyReader p, Game game)
 {
     return new Map(p.GetString("mapname"), game, p);
 }
示例#37
0
        public InterpActor(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "Physics":
                    Physics = p.Value.IntValue;
                    break;

                case "RemoteRole":
                    RemoteRole = p.Value.IntValue;
                    break;

                case "bShadowParented":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bShadowParented = true;
                    }
                    break;

                case "bCollideActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCollideActors = true;
                    }
                    break;

                case "bHidden":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHidden = true;
                    }
                    break;

                case "bPathColliding":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathColliding = true;
                    }
                    break;

                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "bHardAttach":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHardAttach = true;
                    }
                    break;

                case "bStopOnEncroach":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bStopOnEncroach = true;
                    }
                    break;

                case "bHiddenEdGroup":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHiddenEdGroup = true;
                    }
                    break;

                case "bNoEncroachCheck":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bNoEncroachCheck = true;
                    }
                    break;

                case "bPawnCanBaseOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPawnCanBaseOn = true;
                    }
                    break;

                case "bLockLocation":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bLockLocation = true;
                    }
                    break;

                case "bCollideComplex":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCollideComplex = true;
                    }
                    break;

                case "bBlockActors":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBlockActors = true;
                    }
                    break;

                case "bHiddenEd":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHiddenEd = true;
                    }
                    break;

                case "bBioSnapToBase":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBioSnapToBase = true;
                    }
                    break;

                case "bIgnoreBaseRotation":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bIgnoreBaseRotation = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "BaseBoneName":
                    BaseBoneName = p.Value.IntValue;
                    break;

                case "UniqueTag":
                    UniqueTag = p.Value.IntValue;
                    break;

                case "StaticMeshComponent":
                    StaticMeshComponent = p.Value.IntValue;
                    if (pcc.isExport(StaticMeshComponent - 1) && pcc.Exports[StaticMeshComponent - 1].ClassName == "StaticMeshComponent")
                    {
                        STMC = new StaticMeshComponent(pcc, StaticMeshComponent - 1);
                    }
                    break;

                case "LightEnvironment":
                    LightEnvironment = p.Value.IntValue;
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "Base":
                    Base = p.Value.IntValue;
                    break;

                case "BaseSkelComponent":
                    BaseSkelComponent = p.Value.IntValue;
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "CreationTime":
                    CreationTime = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "TickFrequencyAtEndDistance":
                    TickFrequencyAtEndDistance = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "NetUpdateFrequency":
                    NetUpdateFrequency = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "DrawScale3D":
                    DrawScale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotator = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                    #endregion
                }
            }
            MyMatrix  = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(DrawScale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
            Vector3 rot = RotatorToDX(Rotator);
            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(location);
        }
示例#38
0
    /// <summary>
    /// 根据键获得值数组
    /// </summary>
    /// <param name="strKey">键</param>
    /// <returns>值数组</returns>
    //public string[] GetPropertiesArray(string strKey)
    //{
    //    string strResult = string.Empty;
    //    string str = string.Empty;
    //    sr.BaseStream.Seek(0, SeekOrigin.End);
    //    sr.BaseStream.Seek(0, SeekOrigin.Begin);
    //    while ((str = sr.ReadLine()) != null)
    //    {
    //        if (str.Substring(0, str.IndexOf('=')).Equals(strKey))
    //        {
    //            strResult = str.Substring(str.IndexOf('=')+1);
    //            break;
    //        }
    //    }
    //    return strResult.Split(',');
    //}

    public static String readProperty(String baseName, String propertyName)
    {
        String propertyValue = null;
        String filePath = AppDomain.CurrentDomain.BaseDirectory + "properties\\" + baseName + ".properties";
        PropertyReader pr = new PropertyReader(filePath);
        
        propertyValue = pr.GetPropertiesText(propertyName);
        pr.Close();

        return propertyValue;

    }
示例#39
0
        /// <summary>
        /// Asserts that the API route exists, has the specified Http method and meets the expectations
        /// </summary>
        public static void HasApiRoute(HttpConfiguration config, string url, HttpMethod httpMethod, Dictionary<string, string> headers,  object expectations)
        {
            var propertyReader = new PropertyReader();
            var expectedProps = propertyReader.RouteValues(expectations);

            ApiRouteAssert.HasRoute(config, url, httpMethod, headers, string.Empty, BodyFormat.None, expectedProps);
        }
示例#40
0
 public static void HasRoute(RouteCollection routes, string url, string body, BodyFormat bodyFormat, object expectations)
 {
     var propertyReader = new PropertyReader();
     var expectedRouteValues = propertyReader.RouteValues(expectations);
     WebRouteAssert.HasRoute(routes, HttpMethod.Get, url, body, bodyFormat, expectedRouteValues);
 }
示例#41
0
 public PropertyCacheAccessor(PropertyReader baseReader, Dictionary<string, string> propertyCache, string basePath)
 {
     this.baseReader = baseReader;
     this.propertyCache = propertyCache;
     this.basePath = basePath;
 }
        public void ShouldNotReadNullObject()
        {
            var reader = new PropertyReader();

            Assert.Throws<ArgumentNullException>(() => reader.Properties(null));
        }
示例#43
0
		public void Should_return_zero_when_trying_to_get_a_null_objects_HashCode()
		{
			var @class = new TestClass();
			var reader = new PropertyReader<TestClass>("TestValue");
			reader.GetItemHashCode(@class).ShouldEqual(0);
		}
示例#44
0
        public BioPathPoint(PCCObject Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc, data);
            BitConverter.IsLittleEndian = true;
            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                    #region
                case "Physics":
                    Physics = p.Value.IntValue;
                    break;

                case "bHasCrossLevelPaths":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHasCrossLevelPaths = true;
                    }
                    break;

                case "bEnabled":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bEnabled = true;
                    }
                    break;

                case "bBlocked":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bBlocked = true;
                    }
                    break;

                case "bPathsChanged":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bPathsChanged = true;
                    }
                    break;

                case "bHiddenEdGroup":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bHiddenEdGroup = true;
                    }
                    break;

                case "bMakeSourceOnly":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bMakeSourceOnly = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "CylinderComponent":
                    CylinderComponent = p.Value.IntValue;
                    break;

                case "Base":
                    Base = p.Value.IntValue;
                    break;

                case "CollisionComponent":
                    CollisionComponent = p.Value.IntValue;
                    break;

                case "nextNavigationPoint":
                    nextNavigationPoint = p.Value.IntValue;
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "visitedWeight":
                    visitedWeight = p.Value.IntValue;
                    break;

                case "bestPathWeight":
                    bestPathWeight = p.Value.IntValue;
                    break;

                case "NetworkID":
                    NetworkID = p.Value.IntValue;
                    break;

                case "ApproximateLineOfFire":
                    ApproximateLineOfFire = p.Value.IntValue;
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                    #endregion
                }
            }
            MyMatrix = Matrix.Translation(location);
            GenerateMesh();
        }
示例#45
0
        public void FreshTree(int n)
        {
            splitContainer1.BringToFront();
            treeView1.Nodes.Clear();
            PCCPackage.ExportEntry         e     = pcc.Exports[n];
            List <PropertyReader.Property> props = PropertyReader.ReadProp(pcc, e.Data, PropertyReader.detectStart(pcc, e.Data, (uint)e.ObjectFlags));
            TreeNode t = new TreeNode(n + " : " + pcc.GetObject(n + 1));
            int      idx;

            foreach (PropertyReader.Property p in props)
            {
                switch (pcc.GetName(p.Name))
                {
                case "InterpGroups":
                    int      count  = BitConverter.ToInt32(p.raw, 24);
                    TreeNode groups = new TreeNode("Interp Groups (" + count + ")");
                    for (int i = 0; i < count; i++)
                    {
                        idx = BitConverter.ToInt32(p.raw, 28 + i * 4);
                        if (idx > 0)
                        {
                            groups.Nodes.Add(MakeInterpGroupNode(idx - 1));
                        }
                        else
                        {
                            groups.Nodes.Add(idx + "");
                        }
                    }
                    if (groups.Nodes.Count != 0)
                    {
                        t.Nodes.Add(groups);
                    }
                    break;

                case "InterpLength":
                    byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                    float  f    = BitConverter.ToSingle(buff, 0);
                    t.Nodes.Add("Interp Length : " + f);
                    break;

                case "ParentSequence":
                    idx = p.Value.IntValue;
                    if (idx > 0)
                    {
                        t.Nodes.Add("Parent Sequence : " + idx + " (" + pcc.GetObject(idx) + ")");
                    }
                    break;
                }
            }
            treeView1.Nodes.Add(t);
            treeView1.Nodes[0].Expand();
        }
示例#46
0
 public static void HasRoute(RouteCollection routes, string url, string body, object expectations)
 {
     var propertyReader = new PropertyReader();
     var expectedProps = propertyReader.Properties(expectations);
     HasRoute(routes, url, body, expectedProps);
 }
示例#47
0
        public DecalActor(ME3Package Pcc, int Index)
        {
            pcc     = Pcc;
            MyIndex = Index;
            if (pcc.isExport(Index))
            {
                data = pcc.Exports[Index].Data;
            }
            Props = PropertyReader.getPropList(pcc.Exports[Index]);

            foreach (PropertyReader.Property p in Props)
            {
                switch (pcc.getNameEntry(p.Name))
                {
                case "bCanStepUpOn":
                    if (p.raw[p.raw.Length - 1] == 1)
                    {
                        bCanStepUpOn = true;
                    }
                    break;

                case "Tag":
                    Tag = p.Value.IntValue;
                    break;

                case "Group":
                    Group = p.Value.IntValue;
                    break;

                case "Decal":
                    Decal = p.Value.IntValue;
                    break;

                case "DrawScale":
                    DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "DrawScale3D":
                    DrawScale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotator = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                          BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "location":
                    location = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                           BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;
                }
            }
            if (pcc.isExport(Decal - 1) && pcc.Exports[Decal - 1].ClassName == "DecalComponent")
            {
                DC = new DecalComponent(pcc, Decal - 1);
            }
        }
示例#48
0
 public PropertyCacheAccessor(PropertyReader baseReader, Dictionary<string, string> propertyCache)
     : this(baseReader, propertyCache, "")
 {
 }
        private void ReadReplyList()
        {
            ReplyList = new List <ReplyListStruct>();
            int f = FindPropByName("m_ReplyList");

            if (f == -1)
            {
                return;
            }
            byte[] buff  = Props[f].raw;
            int    count = BitConverter.ToInt32(buff, 0x18);
            int    pos   = 0x1C;

            for (int i = 0; i < count; i++)
            {
                List <PropertyReader.Property> p = PropertyReader.ReadProp(pcc, buff, pos);
                ReplyListStruct e = new ReplyListStruct();
                foreach (PropertyReader.Property pp in p)
                {
                    switch (pcc.getNameEntry(pp.Name))
                    {
                    case "EntryList":
                        byte[] buff2  = pp.raw;
                        int    count2 = BitConverter.ToInt32(buff2, 0x18);
                        int    pos2   = 0x1C;
                        e.EntryList = new List <int>();
                        for (int j = 0; j < count2; j++)
                        {
                            e.EntryList.Add(BitConverter.ToInt32(buff2, pos2));
                            pos2 += 4;
                        }
                        break;

                    case "nListenerIndex":
                        e.ListenerIndex = pp.Value.IntValue;
                        break;

                    case "bUnskippable":
                        e.Unskippable = (pp.Value.IntValue == 1);
                        break;

                    case "ReplyType":
                        e.ReplyTypeValue = BitConverter.ToInt32(pp.raw, 24);
                        break;

                    case "sText":
                        e.Text = pp.Value.StringValue;
                        break;

                    case "srText":
                        e.refText = pp.Value.IntValue;
                        break;

                    case "nConditionalFunc":
                        e.ConditionalFunc = pp.Value.IntValue;
                        break;

                    case "nConditionalParam":
                        e.ConditionalParam = pp.Value.IntValue;
                        break;

                    case "nStateTransition":
                        e.StateTransition = pp.Value.IntValue;
                        break;

                    case "nStateTransitionParam":
                        e.StateTransitionParam = pp.Value.IntValue;
                        break;

                    case "nExportID":
                        e.ExportID = pp.Value.IntValue;
                        break;

                    case "nScriptIndex":
                        e.ScriptIndex = pp.Value.IntValue;
                        break;

                    case "nCameraIntimacy":
                        e.CameraIntimacy = pp.Value.IntValue;
                        break;

                    case "bFireConditional":
                        e.FireConditional = (pp.Value.IntValue == 1);
                        break;

                    case "bAmbient":
                        e.Ambient = (pp.Value.IntValue == 1);
                        break;

                    case "bNonTextLine":
                        e.NonTextLine = (pp.Value.IntValue == 1);
                        break;

                    case "bIgnoreBodyGestures":
                        e.IgnoreBodyGestures = (pp.Value.IntValue == 1);
                        break;

                    case "eGUIStyle":
                        e.GUIStyleValue = BitConverter.ToInt32(pp.raw, 24);
                        break;

                    case "None":
                        break;
                    }
                }
                ReplyList.Add(e);
                pos = p[p.Count - 1].offend;
            }
        }
示例#50
0
		public void Should_be_able_to_read_the_value_of_a_type_using_the_Reflection_strategy()
		{
			var t = new TestClass { TestValue = "Hi" };
			var p = new PropertyReader<TestClass>(PropertyReadStrategy.Reflection, "TestValue");
			p.ReadValue(t).ShouldEqual("Hi");
		}
示例#51
0
        public ME3Texture2D(ME3PCCObject pccObj, int texIdx)
        {
            pccRef = pccObj;
            // check if texIdx is an Export index and a Texture2D class
            if (pccObj.isExport(texIdx) && (pccObj.Exports[texIdx].ClassName == className))
            {
                ME3ExportEntry expEntry = pccObj.Exports[texIdx];
                properties = new Dictionary <string, PropertyReader.Property>();
                byte[] rawData          = (byte[])expEntry.Data.Clone();
                int    propertiesOffset = PropertyReader.detectStart(pccObj, rawData);
                headerData = new byte[propertiesOffset];
                Buffer.BlockCopy(rawData, 0, headerData, 0, propertiesOffset);
                pccOffset = (uint)expEntry.DataOffset;
                List <PropertyReader.Property> tempProperties = PropertyReader.getPropList(pccObj, rawData);
                texName = expEntry.ObjectName;
                for (int i = 0; i < tempProperties.Count; i++)
                {
                    PropertyReader.Property property = tempProperties[i];
                    if (!properties.ContainsKey(pccObj.Names[property.Name]))
                    {
                        properties.Add(pccObj.Names[property.Name], property);
                    }

                    switch (pccObj.Names[property.Name])
                    {
                    case "Format": texFormat = pccObj.Names[property.Value.IntValue].Substring(3); break;

                    case "TextureFileCacheName": arcName = pccObj.Names[property.Value.IntValue]; break;

                    case "LODGroup": LODGroup = pccObj.Names[property.Value.IntValue]; break;

                    case "None": dataOffset = (uint)(property.offsetval + property.Size); break;
                    }
                }

                // if "None" property isn't found throws an exception
                if (dataOffset == 0)
                {
                    throw new Exception("\"None\" property not found");
                }
                else
                {
                    imageData = new byte[rawData.Length - dataOffset];
                    Buffer.BlockCopy(rawData, (int)dataOffset, imageData, 0, (int)(rawData.Length - dataOffset));
                }
            }
            else
            {
                throw new Exception("Texture2D " + texIdx + " not found");
            }

            pccExpIdx = texIdx;
            MemoryStream dataStream = new MemoryStream(imageData);

            numMipMaps = dataStream.ReadValueU32();
            uint count = numMipMaps;

            privateImageList = new List <ImageInfo>();
            while (dataStream.Position < dataStream.Length && count > 0)
            {
                ImageInfo imgInfo = new ImageInfo();
                imgInfo.storageType = (storage)dataStream.ReadValueS32();
                imgInfo.uncSize     = dataStream.ReadValueS32();
                imgInfo.cprSize     = dataStream.ReadValueS32();
                imgInfo.offset      = dataStream.ReadValueS32();
                if (imgInfo.storageType == storage.pccSto)
                {
                    //imgInfo.offset = (int)(pccOffset + dataOffset); // saving pcc offset as relative to exportdata offset, not absolute
                    imgInfo.offset = (int)dataStream.Position; // saving pcc offset as relative to exportdata offset, not absolute
                    //MessageBox.Show("Pcc class offset: " + pccOffset + "\nimages data offset: " + imgInfo.offset.ToString());
                    dataStream.Seek(imgInfo.uncSize, SeekOrigin.Current);
                }
                imgInfo.imgSize = new ImageSize(dataStream.ReadValueU32(), dataStream.ReadValueU32());
                imgList.Add(imgInfo);
                count--;
            }

            // save what remains

            /*int remainingBytes = (int)(dataStream.Length - dataStream.Position);
             * footerData = new byte[remainingBytes];
             * dataStream.Read(footerData, 0, footerData.Length);*/
        }
示例#52
0
        public static List <DinosaurEntry> ExtractDinos(UAssetCacheBlock cache, List <ArkAsset> assets, DeltaExportPatch patch, PropertyReader primalDataReader, Dictionary <string, PropertyReader> dinoEntries)
        {
            //Loop through assets and import them
            List <DinosaurEntry> dinos = new List <DinosaurEntry>();

            foreach (var a in assets)
            {
                //Open file
                UAssetFileBlueprint f;
                try
                {
                    f = UAssetFileBlueprint.OpenFile(a.filename, false, a.name, a.installation.contentFolder);
                } catch (Exception ex)
                {
                    continue;
                }

                //Convert file
                try
                {
                    //Create a dino entry
                    DinosaurEntry entry = ArkDinoEntryConverter.Convert(f, cache, patch, primalDataReader, dinoEntries);
                    dinos.Add(entry);
                } catch (Exception ex)
                {
                    continue;
                }
            }
            return(dinos);
        }
示例#53
0
 public void Should_be_able_to_read_the_value_of_a_type_using_the_DelegateMethod_strategy()
 {
     var t = new TestClassA { TestValue = "Hi" };
     var p = new PropertyReader<TestClassA>(PropertyReadStrategy.DelegateMethod, "TestValue");
     p.ReadValue(t).ShouldEqual("Hi");
 }