public string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward, PlainVec3D orientationUp) { Definitions.CheckDefinitionIdExists(blockDefinitionId.ToMyDefinitionId()); return(m_blockPlacer.PlaceSingleBlock(m_session.CurrentCharacterId, blockDefinitionId, position.ToVector3(), orientationForward.ToVector3(), orientationUp.ToVector3()).BlockId().ToString()); }
public MySlimBlock PlaceBlock(DefinitionId blockDefinitionId, Vector3 position, Vector3 orientationForward, Vector3 orientationUp) { var grid = PlaceBlock(CubeBlockBuilderByBlockType(blockDefinitionId), position, orientationForward, orientationUp); return(grid.CubeBlocks.First()); }
public HeroNodeDef(OmegaStream stream) { base.Type = HeroDefinition.Types.Node; stream.CheckResourceHeader(0x544f5250, 2, 2); base.Id = stream.ReadULong(); base.Name = stream.ReadString(); base.Description = stream.ReadString(); stream.ReadUInt(); stream.ReadUInt(); this.baseClass = new DefinitionId(stream.ReadULong()); if (stream.TransportVersion < 5) { stream.ReadUInt(); } this.glomClasses = new List <DefinitionId>(); int num = stream.ReadInt(); for (int i = 0; i < num; i++) { this.glomClasses.Add(new DefinitionId(stream.ReadULong())); } stream.ReadByte(); if (stream.ReadUShort() >= 3) { this.streamStyle = stream.ReadByte(); } uint length = stream.ReadUInt(); this.serializedData = stream.ReadBytes(length); this.isProto = true; }
public HeroNodeDef(OmegaStream stream) { this.Type = HeroDefinition.Types.Node; stream.CheckResourceHeader(1414484560U, (ushort)2, (ushort)2); this.Id = stream.ReadULong(); this.Name = stream.ReadString(); this.Description = stream.ReadString(); int num1 = (int)stream.ReadUInt(); int num2 = (int)stream.ReadUInt(); this.baseClass = new DefinitionId(stream.ReadULong()); if ((int)stream.TransportVersion < 5) { int num3 = (int)stream.ReadUInt(); } this.glomClasses = new List <DefinitionId>(); int num4 = stream.ReadInt(); for (int index = 0; index < num4; ++index) { this.glomClasses.Add(new DefinitionId(stream.ReadULong())); } int num5 = (int)stream.ReadByte(); if ((int)stream.ReadUShort() >= 3) { this.streamStyle = stream.ReadByte(); } uint length = stream.ReadUInt(); this.serializedData = stream.ReadBytes(length); this.isProto = true; }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (DefinitionId.Length != 0) { hash ^= DefinitionId.GetHashCode(); } if (AddMoney != 0) { hash ^= AddMoney.GetHashCode(); } if (ToolsTip != 0) { hash ^= ToolsTip.GetHashCode(); } if (ToolsPuzzle != 0) { hash ^= ToolsPuzzle.GetHashCode(); } if (Cast != 0F) { hash ^= Cast.GetHashCode(); } return(hash); }
public void TrackingConfig_ctor_should_fill_in_fields_correctly() { using (TestHostContext tc = Setup(out Mock <IExecutionContext> mockExecutionContext)) { // Arrange. var repository = new RepositoryResource() { Type = RepositoryTypes.Git, Url = new Uri(RepositoryUrl) }; // Act. var config = new TrackingConfig(mockExecutionContext.Object, new[] { repository }, DefinitionId); // Assert. Assert.Equal(Path.Combine("322", "a"), config.ArtifactsDirectory); Assert.Equal("322", config.BuildDirectory); Assert.Equal(CollectionId, config.CollectionId); Assert.Equal(CollectionUrl, config.CollectionUrl); Assert.Equal(DefinitionId.ToString(), config.DefinitionId); Assert.Equal(DefinitionName, config.DefinitionName); Assert.Equal(3, config.FileFormatVersion); Assert.Equal(null, config.FileLocation); Assert.Equal("ea7c71421cca06c927f73627b66d6b4f4c3a5f4a", config.HashKey); Assert.Equal(RepositoryTypes.Git, config.RepositoryType); Assert.Equal(RepositoryUrl, config.RepositoryUrl); Assert.Equal(Path.Combine("322", "s"), config.SourcesDirectory); Assert.Equal("build", config.System); Assert.Equal(Path.Combine("322", "TestResults"), config.TestResultsDirectory); Assert.NotNull(config.RepositoryTrackingInfo); Assert.Equal(true, config.ShouldSerializeRepositoryTrackingInfo()); Assert.Equal(1, config.RepositoryTrackingInfo.Count); Assert.Equal(RepositoryUrl, config.RepositoryTrackingInfo[0].RepositoryUrl); } }
public static MyCubeBlockDefinition ToMyCubeBlockDefinition(this DefinitionId definitionId) { var id = definitionId.ToString(); return(MyDefinitionManager.Static .GetDefinitionsOfType <MyCubeBlockDefinition>() .First( cbd => cbd.Id.TypeId.ToString() == definitionId.Id && cbd.Id.SubtypeId.String == definitionId.Type )); }
public HeroNodeDef(OmegaStream stream) { Type = Types.Node; stream.CheckResourceHeader(1414484560U, 2, 2); Id = stream.ReadULong(); Name = stream.ReadString(); Description = stream.ReadString(); /*var num1 = (Int32)*/ stream.ReadUInt(); /*var num2 = (Int32)*/ stream.ReadUInt(); baseClass = new DefinitionId(stream.ReadULong()); if (stream.TransportVersion < 5) { /*var num3 = (Int32)*/ stream.ReadUInt(); } glomClasses = new List <DefinitionId>(); int num4 = stream.ReadInt(); for (int index = 0; index < num4; ++index) { glomClasses.Add(new DefinitionId(stream.ReadULong())); } /*var num5 = (Int32)*/ stream.ReadByte(); /*var streamFormat = */ stream.ReadUShort(); if (stream.TransportVersion >= 3) { streamStyle = stream.ReadByte(); } if (stream.TransportVersion < 4) { var co = stream.ReadUInt(); for (var i = 0U; i < co; ++i) { stream.ReadULong(); stream.ReadUInt(); } var len = stream.ReadUInt(); stream.ReadBytes(len); //throw new NotImplementedException(); } else { var length = stream.ReadUInt(); serializedData = stream.ReadBytes(length); isProto = true; } }
public string PlaceInGrid(DefinitionId blockDefinitionId, string gridId, PlainVec3I minPosition, PlainVec3I orientationForward, PlainVec3I orientationUp) { Definitions.CheckDefinitionIdExists(blockDefinitionId.ToMyDefinitionId()); //var playerId = m_session.Character.GetPlayerId(); var grid = m_observer.GetGridById(gridId); return(m_blockPlacer.PlaceInGrid( blockDefinitionId.ToMyCubeBlockDefinition().Id, grid, minPosition.ToVector3I(), orientationForward.ToVector3I(), orientationUp.ToVector3I(), MySession.Static.LocalPlayerId ).UniqueId.ToString()); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hash = DefinitionVariableId.GetHashCode(); // Suitable nullity checks etc, of course :) hash = hash * 17 + DefinitionId.GetHashCode(); hash = (VariableName != null) ? hash * 17 + VariableName.GetHashCode() : hash; hash = hash * 17 + StoreType.GetHashCode(); return(hash); } }
public void SetToolbarItem(DefinitionId definitionId, ToolbarLocation toolbarLocation) { var myDefinitionId = definitionId.ToMyDefinitionId(); Definitions.CheckDefinitionIdExists(myDefinitionId); if (IsWeapon(definitionId.Type)) { SetToolbarItem <MyObjectBuilder_ToolbarItemWeapon>(myDefinitionId, toolbarLocation); } else { SetToolbarItem <MyObjectBuilder_ToolbarItemCubeBlock>(myDefinitionId, toolbarLocation); } }
private MyObjectBuilder_CubeBlock CubeBlockBuilderByBlockType(long ownerId, DefinitionId blockDefinitionId) { var definitionBase = MyDefinitionManager.Static .GetAllDefinitions() .First(definition => definition.ToDefinitionId().Type == blockDefinitionId.Type); var obj = (MyObjectBuilder_CubeBlock)MyObjectBuilderSerializer.CreateNewObject(definitionBase.Id); obj.Min = new SerializableVector3I(0, 0, 0); obj.SubtypeName = blockDefinitionId.Type; obj.BlockOrientation = new SerializableBlockOrientation(Base6Directions.Direction.Forward, Base6Directions.Direction.Up); obj.Owner = ownerId; obj.BuiltBy = ownerId; return(obj); }
public override void Deserialize(PackedStream_2 stream) { base.hasValue = true; this.Variables = new VariableList(); DeserializeClass class2 = new DeserializeClass(stream, 1); for (uint i = 0; i < class2.Count; i++) { ulong num2; int num5; HeroFieldDef definition; HeroAnyValue value2; uint num3 = 0; int variableId = 0; class2.ReadFieldData(out num2, ref num3, ref variableId, out num5); if (num5 == 2) { continue; } HeroType type = new HeroType((HeroTypes)num3); DefinitionId field = new DefinitionId(num2); if (field.Definition != null) { definition = field.Definition as HeroFieldDef; HeroTypes types = definition.FieldType.Type; if (types != HeroTypes.Enum) { if (types == HeroTypes.LookupList) { goto Label_0096; } if (types != HeroTypes.ScriptRef) { goto Label_009F; } } type.Id = definition.FieldType.Id; } goto Label_009F; Label_0096: type = definition.FieldType; Label_009F: value2 = HeroAnyValue.Create(type); value2.Deserialize(stream); this.Variables.Add(new Variable(field, variableId, value2)); } }
private TestHostContext Setup(out Mock <IExecutionContext> mockExecutionContext) { var tc = new TestHostContext(this); // Setup the execution context. mockExecutionContext = new Mock <IExecutionContext>(); List <string> warnings; var variables = new Variables(tc, new Dictionary <string, VariableValue>(), out warnings); variables.Set(Constants.Variables.System.CollectionId, CollectionId); variables.Set(WellKnownDistributedTaskVariables.TFCollectionUrl, CollectionUrl); variables.Set(Constants.Variables.System.DefinitionId, DefinitionId.ToString()); variables.Set(Constants.Variables.Build.DefinitionName, DefinitionName); mockExecutionContext.Setup(x => x.Variables).Returns(variables); return(tc); }
public bool Equals(DefinitionVariable other) { // Check for null if (ReferenceEquals(other, null)) { return(false); } // Check for same reference if (ReferenceEquals(this, other)) { return(true); } // Check for same value return(DefinitionId.Equals(other.DefinitionId) && ((VariableName == null && other.VariableName == null) || (VariableName != null && other.VariableName != null && VariableName.Equals(other.VariableName))) && StoreType.Equals(other.StoreType)); }
public HeroNodeDef(byte[] data, int version) : base(data, version) { ushort num1 = 0; ushort num2 = 0; ushort num3; ushort num4; if (version == 1) { _14 = BitConverter.ToUInt16(Data, 20); _16 = BitConverter.ToUInt16(Data, 22); baseClass = new DefinitionId(BitConverter.ToUInt64(Data, 24)); num3 = BitConverter.ToUInt16(Data, 32); num4 = BitConverter.ToUInt16(Data, 34); } else { if (version != 2) { throw new InvalidDataException("Invalid version"); } baseClass = new DefinitionId(BitConverter.ToUInt64(Data, 24)); _14 = BitConverter.ToUInt16(Data, 32); _16 = BitConverter.ToUInt16(Data, 34); num3 = BitConverter.ToUInt16(Data, 36); num4 = BitConverter.ToUInt16(Data, 38); num1 = BitConverter.ToUInt16(Data, 42); num2 = BitConverter.ToUInt16(Data, 44); } glomClasses = new List <DefinitionId>(); for (ushort index = 0; (int)index < (int)num3; ++index) { glomClasses.Add(new DefinitionId(BitConverter.ToUInt64(Data, num4 + 8 * index))); } glomClasses2 = new List <DefinitionId>(); for (ushort index = 0; (int)index < (int)num1; ++index) { glomClasses2.Add(new DefinitionId(BitConverter.ToUInt64(Data, num2 + 8 * index))); } isProto = false; }
public HeroNodeDef(byte[] data, int version) : base(data, version) { ushort num; ushort num2; ushort num3 = 0; ushort num4 = 0; if (version == 1) { this._14 = BitConverter.ToUInt16(base.Data, 20); this._16 = BitConverter.ToUInt16(base.Data, 0x16); this.baseClass = new DefinitionId(BitConverter.ToUInt64(base.Data, 0x18)); num = BitConverter.ToUInt16(base.Data, 0x20); num2 = BitConverter.ToUInt16(base.Data, 0x22); } else { if (version != 2) { throw new InvalidDataException("Invalid version"); } this.baseClass = new DefinitionId(BitConverter.ToUInt64(base.Data, 0x18)); this._14 = BitConverter.ToUInt16(base.Data, 0x20); this._16 = BitConverter.ToUInt16(base.Data, 0x22); num = BitConverter.ToUInt16(base.Data, 0x24); num2 = BitConverter.ToUInt16(base.Data, 0x26); num3 = BitConverter.ToUInt16(base.Data, 0x2a); num4 = BitConverter.ToUInt16(base.Data, 0x2c); } this.glomClasses = new List <DefinitionId>(); for (ushort i = 0; i < num; i = (ushort)(i + 1)) { this.glomClasses.Add(new DefinitionId(BitConverter.ToUInt64(base.Data, num2 + (8 * i)))); } this.glomClasses2 = new List <DefinitionId>(); for (ushort j = 0; j < num3; j = (ushort)(j + 1)) { this.glomClasses2.Add(new DefinitionId(BitConverter.ToUInt64(base.Data, num4 + (8 * j)))); } this.isProto = false; }
public HeroClassDef(byte[] data, int version) : base(data, version) { this.ParentClasses = new List <DefinitionId>(); this.Fields = new List <DefinitionId>(); short num1; short num2; short num3; short num4; if (version == 1) { num1 = BitConverter.ToInt16(data, 22); num2 = BitConverter.ToInt16(data, 24); num3 = BitConverter.ToInt16(data, 26); num4 = BitConverter.ToInt16(data, 28); } else { if (version != 2) { throw new InvalidDataException("Invalid version"); } this.vers2_18 = new DefinitionId(BitConverter.ToUInt64(data, 24)); this.vers2_20 = new DefinitionId(BitConverter.ToUInt64(data, 32)); num1 = BitConverter.ToInt16(data, 42); num2 = BitConverter.ToInt16(data, 44); num3 = BitConverter.ToInt16(data, 46); num4 = BitConverter.ToInt16(data, 48); } for (int index = 0; index < (int)num1; ++index) { this.ParentClasses.Add(new DefinitionId(BitConverter.ToUInt64(data, (int)num2 + 8 * index))); } for (int index = 0; index < (int)num3; ++index) { this.Fields.Add(new DefinitionId(BitConverter.ToUInt64(data, (int)num4 + 8 * index))); } }
public HeroClassDef(byte[] data, int version) : base(data, version) { short num; short num2; short num3; short num4; this.ParentClasses = new List <DefinitionId>(); this.Fields = new List <DefinitionId>(); if (version == 1) { num = BitConverter.ToInt16(data, 0x16); num2 = BitConverter.ToInt16(data, 0x18); num3 = BitConverter.ToInt16(data, 0x1a); num4 = BitConverter.ToInt16(data, 0x1c); } else { if (version != 2) { throw new InvalidDataException("Invalid version"); } this.vers2_18 = new DefinitionId(BitConverter.ToUInt64(data, 0x18)); this.vers2_20 = new DefinitionId(BitConverter.ToUInt64(data, 0x20)); num = BitConverter.ToInt16(data, 0x2a); num2 = BitConverter.ToInt16(data, 0x2c); num3 = BitConverter.ToInt16(data, 0x2e); num4 = BitConverter.ToInt16(data, 0x30); } for (int i = 0; i < num; i++) { this.ParentClasses.Add(new DefinitionId(BitConverter.ToUInt64(data, num2 + (8 * i)))); } for (int j = 0; j < num3; j++) { this.Fields.Add(new DefinitionId(BitConverter.ToUInt64(data, num4 + (8 * j)))); } }
public override void Deserialize(PackedStream_2 stream) { this.hasValue = true; this.Variables = new VariableList(); DeserializeClass deserializeClass = new DeserializeClass(stream, 1); for (uint index = 0U; index < deserializeClass.Count; ++index) { uint type1 = 0U; int variableId = 0; ulong fieldId; int d; deserializeClass.ReadFieldData(out fieldId, ref type1, ref variableId, out d); if (d != 2) { HeroType type2 = new HeroType((HeroTypes)type1); DefinitionId field = new DefinitionId(fieldId); if (field.Definition != null) { HeroFieldDef heroFieldDef = field.Definition as HeroFieldDef; switch (heroFieldDef.FieldType.Type) { case HeroTypes.Enum: case HeroTypes.ScriptRef: type2.Id = heroFieldDef.FieldType.Id; break; case HeroTypes.LookupList: type2 = heroFieldDef.FieldType; break; } } HeroAnyValue heroAnyValue = HeroAnyValue.Create(type2); heroAnyValue.Deserialize(stream); this.Variables.Add(new Variable(field, variableId, heroAnyValue)); } } }
public void TrackingConfig_copy_legacy_ctor_should_fill_in_fields_correctly() { using (TestHostContext tc = Setup(out Mock <IExecutionContext> mockExecutionContext)) { // Arrange. var legacyConfig = new LegacyTrackingConfig { BuildDirectory = Path.Combine("path", "_work", "123"), CollectionId = CollectionId, DefinitionId = DefinitionId.ToString(), HashKey = "some_hash_key", RepositoryUrl = RepositoryUrl, System = "Build", }; // Act. var config = new TrackingConfig(mockExecutionContext.Object, legacyConfig, "s", "git", true); // Assert. Assert.Equal(Path.Combine("123", "a"), config.ArtifactsDirectory); Assert.Equal("123", config.BuildDirectory); Assert.Equal(CollectionId, config.CollectionId); Assert.Equal(CollectionUrl, config.CollectionUrl); Assert.Equal(DefinitionId.ToString(), config.DefinitionId); Assert.Equal(null, config.DefinitionName); Assert.Equal(3, config.FileFormatVersion); Assert.Equal(null, config.FileLocation); Assert.Equal("some_hash_key", config.HashKey); Assert.Equal("git", config.RepositoryType); Assert.Equal(RepositoryUrl, config.RepositoryUrl); Assert.Equal(Path.Combine("123", "s"), config.SourcesDirectory); Assert.Equal("Build", config.System); Assert.Equal(Path.Combine("123", "TestResults"), config.TestResultsDirectory); Assert.NotNull(config.RepositoryTrackingInfo); Assert.Equal(false, config.ShouldSerializeRepositoryTrackingInfo()); } }
protected override void ProcessRecord() { BaseParameters = new Dictionary <string, string> { { "SourceId", SourceId }, { "ArtifactTypeId", ArtifactTypeId }, { "ArtifactVersionId", ArtifactVersionId }, { "MaxCreatedTime", MaxCreatedTime?.ToString() }, { "MinCreatedTime", MinCreatedTime?.ToString() }, { "DefinitionId", DefinitionId?.ToString() }, { "QueryOrder", QueryOrder }, { "$Expand", ExpandProperties != null?string.Join(",", ExpandProperties) : null } }; var parameters = new ParallelRequestParams( "ArtifactVersionId", ArtifactVersionIds, BaseParameters ); var requestTasks = ParallelRequestAsync(VssAuthenticator.AzureDevOpsHost, "DefaultCollection/One/_apis/release/releases", parameters); WriteObject(requestTasks.Result); }
public static MyDefinitionId ToMyDefinitionId(this DefinitionId definitionId) { return(MyDefinitionId.Parse(definitionId.ToString())); }
public override int GetHashCode() { return(DefinitionId != null ? DefinitionId.GetHashCode() : 0); }
public void Serialize() { variables = new VariableList(); if (!isProto) { Decompress(); int startIndex = version != 1 ? 40 : 36; uint num1 = BitConverter.ToUInt32(Data, startIndex); ushort num2 = BitConverter.ToUInt16(Data, startIndex + 4); serializedData = new byte[num1]; Array.Copy(Data, num2, serializedData, 0L, num1); _2A = BitConverter.ToUInt16(Data, startIndex + 6); streamStyle = Data[startIndex + 8]; _2D = (byte)(Data[startIndex + 9] & 3U); } if (serializedData.Length == 0) { return; } byte[] bytes = Encoding.ASCII.GetBytes("azalie"); byte num = 0; for (int index = 0; index < serializedData.Length; ++index) { if (bytes[num] == serializedData[index] || bytes[num] == serializedData[index] + 97 - 65) { ++num; if (num == bytes.Length) { Console.WriteLine(Name); break; } } else { num = 0; } } var stream = new PackedStream2(streamStyle, serializedData); var deserializeClass = new DeserializeClass(stream, 1); for (uint index = 0U; index < deserializeClass.Count; ++index) { uint type1 = 0U; int variableId = 0; ulong fieldId; int d; deserializeClass.ReadFieldData(out fieldId, ref type1, ref variableId, out d); if (d != 2) { var type2 = new HeroType((HeroTypes)type1); var field = new DefinitionId(fieldId); if (field.Definition != null) { type2 = (field.Definition as HeroFieldDef).FieldType; } HeroAnyValue heroAnyValue = HeroAnyValue.Create(type2); heroAnyValue.Deserialize(stream); Variables.Add(new Variable(field, variableId, heroAnyValue)); } } }
string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward, PlainVec3D orientationUp) { return(m_se.Admin.Blocks.PlaceAt(blockDefinitionId, position, orientationForward, orientationUp)); }
public string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward, PlainVec3D orientationUp) { return(Enqueue(() => m_blocks.PlaceAt(blockDefinitionId, position, orientationForward, orientationUp))); }
public void Serialize() { this.variables = new VariableList(); if (!this.isProto) { int num; base.Decompress(); if (base.version == 1) { num = 0x24; } else { num = 40; } uint num2 = BitConverter.ToUInt32(base.Data, num); ushort num3 = BitConverter.ToUInt16(base.Data, num + 4); this.serializedData = new byte[num2]; Array.Copy(base.Data, (long)num3, this.serializedData, 0L, (long)num2); this._2A = BitConverter.ToUInt16(base.Data, num + 6); this.streamStyle = base.Data[num + 8]; this._2D = (byte)(base.Data[num + 9] & 3); } if (this.serializedData.Length != 0) { byte[] bytes = Encoding.ASCII.GetBytes("azalie"); byte index = 0; for (int i = 0; i < this.serializedData.Length; i++) { if ((bytes[index] == this.serializedData[i]) || (bytes[index] == ((this.serializedData[i] + 0x61) - 0x41))) { index = (byte)(index + 1); if (index != bytes.Length) { continue; } Console.WriteLine(base.Name); break; } index = 0; } PackedStream_2 stream = new PackedStream_2(this.streamStyle, this.serializedData); DeserializeClass class2 = new DeserializeClass(stream, 1); for (uint j = 0; j < class2.Count; j++) { ulong num7; int num10; uint num8 = 0; int variableId = 0; class2.ReadFieldData(out num7, ref num8, ref variableId, out num10); if (num10 != 2) { HeroType fieldType = new HeroType((HeroTypes)num8); DefinitionId field = new DefinitionId(num7); if (field.Definition != null) { HeroFieldDef definition = field.Definition as HeroFieldDef; fieldType = definition.FieldType; } HeroAnyValue value2 = HeroAnyValue.Create(fieldType); value2.Deserialize(stream); this.Variables.Add(new Variable(field, variableId, value2)); } } } }
public string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward, PlainVec3D orientationUp) { return(m_blockPlacer.PlaceBlock(blockDefinitionId, position.ToVector3(), orientationForward.ToVector3(), orientationUp.ToVector3()).BlockId().ToString()); }