/// <summary> /// Constructor /// </summary> public Manager(IEnumerable <IMapping> Mappings) { Contract.Requires <ArgumentNullException>(Mappings != null, "Mappings"); this.Mappings = new ListMapping <Type, IMapping>(); this.Structures = new Dictionary <Type, Graph <IMapping> >(); Mappings.ForEach(x => this.Mappings.Add(x.ObjectType, x)); Mappings.GroupBy(x => x.DatabaseConfigType).ForEach(x => Structures.Add(x.Key, FindGraph(x))); }
public void AddStructure(Structure structure) { if (Structures.Any(x => x.Name == structure.Name)) { return; } Structures.Add(structure); }
internal void AddStructure(Structure structure) { if (Structures == null) { Structures = new List <Structure>(); } World.Structures.Add(structure.ID, structure); Structures.Add(structure); }
/// <summary> /// Loads the content from the directory and SE objects, creating object models. /// </summary> private void LoadSectorDetail() { Structures.Clear(); ConnectedTopBlockCache.Clear(); SpaceEngineersCore.ManageDeleteVoxelList.Clear(); ThePlayerCharacter = null; _customColors = null; if (ActiveWorld.SectorData != null && ActiveWorld.Checkpoint != null) { foreach (var entityBase in ActiveWorld.SectorData.SectorObjects) { var structure = StructureBaseModel.Create(entityBase, ActiveWorld.Savepath); if (structure is StructureCharacterModel) { var character = structure as StructureCharacterModel; if (ActiveWorld.Checkpoint != null && character.EntityId == ActiveWorld.Checkpoint.ControlledObject) { character.IsPlayer = true; ThePlayerCharacter = character; } } else if (structure is StructureCubeGridModel) { var cubeGrid = structure as StructureCubeGridModel; var list = cubeGrid.GetActiveCockpits(); foreach (var cockpit in list) { cubeGrid.Pilots++; // theoretically with the Hierarchy structure, there could be more than one character attached to a single cube. // thus, more than 1 pilot. var pilots = cockpit.GetHierarchyCharacters(); var character = (StructureCharacterModel)StructureBaseModel.Create(pilots.First(), null); character.IsPilot = true; if (ActiveWorld.Checkpoint != null && cockpit.EntityId == ActiveWorld.Checkpoint.ControlledObject) { ThePlayerCharacter = character; ThePlayerCharacter.IsPlayer = true; } Structures.Add(character); } } Structures.Add(structure); } CalcDistances(); } RaisePropertyChanged(() => Structures); }
private void StructureSetUpdated(StrucutureSetUpdatedEventArg strucutureSetUpdatedEventArg) { EmptyStructureList(); Trace.WriteLine("StructureSetUpdated called!"); var structures = strucutureSetUpdatedEventArg.StructureSet; foreach (Structure item in structures) { Structures.Add(item); } }
public TableMockBuilder AddRow(Action <Mock <IStructure> > structureBuilder) { var structure = new Mock <IStructure>(); structure.SetReturnsDefault(Prelude.Right <RfcErrorInfo, Unit>(Unit.Default)); structureBuilder(structure); Structures.Add(structure); return(this); }
/// <summary> /// Loads the content from the directory and SE objects, creating object models. /// </summary> private void LoadSectorDetail() { Structures.Clear(); SpaceEngineersCore.ManageDeleteVoxelList.Clear(); ThePlayerCharacter = null; _customColors = null; if (ActiveWorld.SectorData != null && ActiveWorld.Checkpoint != null) { foreach (var entityBase in ActiveWorld.SectorData.SectorObjects) { var structure = StructureBaseModel.Create(entityBase, ActiveWorld.Savepath); if (structure is StructureCharacterModel) { var character = structure as StructureCharacterModel; if (ActiveWorld.Checkpoint != null && character.EntityId == ActiveWorld.Checkpoint.ControlledObject) { character.IsPlayer = true; ThePlayerCharacter = character; } } else if (structure is StructureCubeGridModel) { var cubeGrid = structure as StructureCubeGridModel; var list = cubeGrid.GetActiveCockpits(); foreach (var cockpit in list) { cubeGrid.Pilots++; var character = (StructureCharacterModel)StructureBaseModel.Create(cockpit.Pilot, null); character.IsPilot = true; if (ActiveWorld.Checkpoint != null && cockpit.EntityId == ActiveWorld.Checkpoint.ControlledObject) { ThePlayerCharacter = character; ThePlayerCharacter.IsPlayer = true; } Structures.Add(character); } } Structures.Add(structure); } CalcDistances(); } RaisePropertyChanged(() => Structures); }
public IStructureBase AddEntity(MyObjectBuilder_EntityBase entity) { if (entity != null) { ActiveWorld.SectorData.SectorObjects.Add(entity); var structure = StructureBaseModel.Create(entity, ActiveWorld.Savepath); var position = ThePlayerCharacter != null ? (Vector3D)ThePlayerCharacter.PositionAndOrientation.Value.Position : Vector3D.Zero; structure.PlayerDistance = (position - structure.PositionAndOrientation.Value.Position).Length(); Structures.Add(structure); IsModified = true; return(structure); } return(null); }
private bool TryAddAsStructure(string symbolName, LanguageSymbol langSymbol) { var symbol = langSymbol as GMacStructure; if (symbol == null) { return(false); } Structures.Add(symbolName, symbol); Types.Add(symbolName, symbol); return(true); }
public void ShouldBeAbleToAddAStructure() { var clientId = new ClientId("ABC123"); var account1 = new Account(new AccountId(12341234), clientId); var account2 = new Account(new AccountId(12341235), clientId); var clientAccounts = new ClientAccounts(); clientAccounts.Add(account1); clientAccounts.Add(account2); var structure = new Structure(clientAccounts, getAllocation(), null, null); var structures = new Structures(); structures.Add(structure); Assert.True(structures.Contains(structure)); }
private void FillStructureCollection(MemberDeclarationSyntax member, string namespaceIdentifier) { var walker = new StructureWalker(SemanticModel); var structure = walker.GetStructure( member, namespaceIdentifier); structure.References = Usings; structure.Namespace = namespaceIdentifier; Structures.Add(structure); SearchInsideStructures <ClassDeclarationSyntax>( member, namespaceIdentifier); SearchInsideStructures <InterfaceDeclarationSyntax>( member, namespaceIdentifier); SearchInsideStructures <EnumDeclarationSyntax>( member, namespaceIdentifier); }
//will add an new building to it list dependeing on catefory void AddSpecToList(Ca cat) { if (cat == Ca.Way) { Way f = BuildingPot.Control.CurrentSpawnBuild as Way; f = (Way)CheckIfOnDict(_ways, f); Ways.Add(f.MyId, f); } else if (cat == Ca.Structure || cat == Ca.Shore) { Structure f = BuildingPot.Control.CurrentSpawnBuild as Structure; f = (Structure)CheckIfOnDict(Structures, f); Structures.Add(f.MyId, f); } else if (cat == Ca.DraggableSquare) { DragSquare f = BuildingPot.Control.CurrentSpawnBuild as DragSquare; f = (DragSquare)CheckIfOnDict(DragSquares, f); DragSquares.Add(f.MyId, f); } }
public void Build(AST.Parser AST) { FirstPass(AST); foreach (var element in AST.Elements) { VisitElement((dynamic)element); } // TODO: temporary hack to support old interface foreach (var element in elements.Values) { if (element is Structure) { Structures.Add((dynamic)element); } else { Enumerations.Add((dynamic)element); } } }
public void StartRecording(string name, string steamID = "") { if (Structures.ContainsKey(name)) { Structures.Remove(name); string path = Path.Combine(Util.GetStructuresFolder(), name + ".sps"); if (File.Exists(path)) { File.Delete(path); } } if (steamID == "") { DataStore.Add("StructureRecorderEveryone", "ON", name); } else { DataStore.Add("StructureRecorder", steamID, name); } Structure structure = CreateStructure(name); Structures.Add(name, structure); }
public void AddStructure(Vector2 position, string type) { if (type == "wall") { Structures.Add(new Structure(position, content.Load <Texture2D>("wall"), "wall")); CollisionPositions.Add(position); } if (type == "wall2") { Structures.Add(new Structure(position, content.Load <Texture2D>("wall2"), "wall2")); CollisionPositions.Add(position); } if (type == "wall3") { Structures.Add(new Structure(position, content.Load <Texture2D>("wall3"), "wall3")); CollisionPositions.Add(position); } if (type == "sandstonebasewall") { Structures.Add(new Structure(position, content.Load <Texture2D>("sandstonebasewall"), "sandstonebasewall")); CollisionPositions.Add(position); } if (type == "door") { Structures.Add(new Structure(position, content.Load <Texture2D>("sandstonedoorway"), "door")); } if (type == "flooring") { Structures.Add(new Structure(position, content.Load <Texture2D>("sandstonefloor"), "flooring")); FlooringPositions.Add(position); } }
/// <summary> /// コンパイルの実行 /// </summary> /// <param name="text">スクリプト</param> /// <param name="headerFilesList">ヘッダーファイル名のリスト</param> /// <param name="data">格納先データ</param> /// <returns>結果</returns> public override bool Compile(string text, Dictionary <string, string> headerFilesList, VirtualMachine.Data data) { // システムコールの追加の設定 AddSystemFunction((int)CustomSystemCall.RandomValue, Types.FLOAT, "float", "RandomValue"); AddSystemFunction((int)CustomSystemCall.RandomRangeFloat, Types.FLOAT, "float", "RandomRange", new char[2] { 'f', 'f' }); AddSystemFunction((int)CustomSystemCall.RandomRangeInt, Types.INTEGER, "int", "RandomRange", new char[2] { 'i', 'i' }); AddSystemFunction((int)CustomSystemCall.TextReplace, Types.STRING, "string", "TextReplace", new char[1] { 's' }); AddSystemFunction((int)CustomSystemCall.GetMessage, Types.STRING, "string", "GetMessage", new char[1] { 's' }); AddSystemFunction((int)CustomSystemCall.MusicPlay, Types.VOID, "void", "MusicPlay", new char[3] { 'i', 'f', 'f' }); AddSystemFunction((int)CustomSystemCall.SEPlay, Types.VOID, "void", "SEPlay", new char[4] { 'i', 'b', 'b', 'f' }); AddSystemFunction((int)CustomSystemCall.PopupShowFromId, Types.VOID, "void", "PopupShow", new char[3] { 'i', 's', 's' }); // 構造体テーブルセット Structures.Add(new StructureTable()); //ValueTable tempValueTable = new ValueTable(); //tempValueTable.Add(Types.FLOAT, "float", "x", 1); //tempValueTable.Add(Types.FLOAT, "float", "y", 1); //tempValueTable.Add(Types.FLOAT, "float", "z", 1); //tempValueTable.Add(Types.FLOAT, "float", "w", 1); //Structures.Last().Add("TipVector", tempValueTable); return(base.Compile(text, headerFilesList, data)); }
private void ParseRecursively(List <mValue> ValueList, int chunkOffset, int chunkNumber) { //Loop through values for (int i = 0; i < ValueList.Count; i++) { //Determine the value type switch (ValueList[i].Attributes) { case mValue.ObjectAttributes.Reflexive: { //If the offset is rediculous.. if (chunkOffset + ValueList[i].Offset > (int)Map.IO.In.BaseStream.Length) { break; } //Go to the reflexive offset Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset; //Get the reflexive mReflexive mreflexive = (mReflexive)ValueList[i]; //Initialize our instance of structure Structure structure = new Structure(); //Assign the name structure.Name = mreflexive.Name; //Add chunk modifier if (chunkNumber != -1) { structure.Name += " [" + chunkNumber + "]"; } //Assign the size structure.Size = mreflexive.Size; //Read the count structure.Count = Map.IO.In.ReadInt32(); //Read the pointer structure.Pointer = Map.IO.In.ReadInt32() - Map.MapHeader.mapMagic; //If the count or pointer are bad, break out and dont add it to the list if (structure.Count <= 0 | structure.Pointer <= 0 | structure.Count > 100000) { break; } //Assign the offset structure.Offset = chunkOffset + mreflexive.Offset; //Add it to the list Structures.Add(structure); //Loop through all the chunks for (int z = 0; z < structure.Count; z++) { //Parse recursively ParseRecursively(mreflexive.Values, structure.Pointer + (z * structure.Size), z); } break; } case mValue.ObjectAttributes.Ident: { //If the offset is rediculous.. if (chunkOffset + ValueList[i].Offset > (int)Map.IO.In.BaseStream.Length) { break; } //Go to the ident offset Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset; //Get the ident instance mIdent mident = (mIdent)ValueList[i]; //Initialize our instance of the ident Ident ident = new Ident(); //Assign the name ident.Name = mident.Name; if (chunkNumber != -1) { ident.Name += " [" + chunkNumber + "]"; } //Assign the offset ident.Offset = chunkOffset + mident.Offset - 12; //Assign the Ident ident.ID = Map.IO.In.ReadInt32(); //Get the tag index int index = Map.GetTagIndexByIdent(ident.ID); //Assign the class if (index != -1) { ident.TagClass = Map.IndexItems[index].Class; } else { ident.TagClass = "Null"; } //Assign the name if (index != -1) { ident.TagName = Map.IndexItems[index].Name; } else { ident.TagName = "Null"; } //Add to the ident to the list Idents.Add(ident); break; } case mValue.ObjectAttributes.StringID: { //If the offset is rediculous.. if (chunkOffset + ValueList[i].Offset > (int)Map.IO.In.BaseStream.Length) { break; } //Go to the ident offset Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset; //Get the ident instance mStringID mstringid = (mStringID)ValueList[i]; //Initialize our instance of the string id. StringIdentifier str = new StringIdentifier(); //Assign the name str.Name = mstringid.Name; if (chunkNumber != -1) { str.Name += " [" + chunkNumber + "]"; } //Assign the offset str.Offset = chunkOffset + mstringid.Offset; //Assign the Ident str.Identifier = Map.IO.In.ReadInt32(); //Get the string index int index = Map.StringTable.GetStringItemIndexByID(Map, str.Identifier); //Assign the string index str.StringIndex = index; //Try to.. try { //Assign the string name str.StringName = Map.StringTable.StringItems[index].Name; } catch { //Assign our invalid name str.StringName = "<<invalid sid>>"; } //Add to the string to the list Strings.Add(str); break; } } } }
void AddStructure(DrawableStructure structure) { GameWorld.AddChild(structure, 1); Structures.Add(structure); }
private void ParseRecursively(List <mValue> ValueList, int chunkOffset, int chunkNumber) { for (int i = 0; i < ValueList.Count; i++) { object name; switch (ValueList[i].Attributes) { case mValue.ObjectAttributes.TagBlock: { if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length)) { break; } continue; } case mValue.ObjectAttributes.TagData: { if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length)) { goto Label_0224; } continue; } case mValue.ObjectAttributes.TagReference: { if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length)) { goto Label_03B7; } continue; } case mValue.ObjectAttributes.StringID: { if ((chunkOffset + ValueList[i].Offset) <= ((int)Map.IO.In.BaseStream.Length)) { goto Label_05E5; } continue; } default: { continue; } } Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset; mTagBlock block = (mTagBlock)ValueList[i]; Structure item = new Structure { Name = block.Name }; if (chunkNumber != -1) { name = item.Name; item.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" }); } item.Size = block.Size; item.Count = Map.IO.In.ReadInt32(); item.Pointer = Map.IO.In.ReadInt32() - Map.Map_Header.mapMagic; if (!(((item.Count <= 0) | (item.Pointer <= 0)) | (item.Count > 0x186a0))) { item.Offset = chunkOffset + block.Offset; Structures.Add(item); for (int j = 0; j < item.Count; j++) { ParseRecursively(block.Values, item.Pointer + (j * item.Size), j); } } continue; Label_0224: Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset; mTagData data = (mTagData)ValueList[i]; TagData data2 = new TagData { Name = data.Name }; if (chunkNumber != -1) { name = data2.Name; data2.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" }); } data2.Size = Map.IO.In.ReadInt32(); Stream baseStream = Map.IO.In.BaseStream; baseStream.Position += 8L; data2.Pointer = Map.IO.In.ReadInt32() - Map.Map_Header.mapMagic; if (!((data2.Size <= 0) | (data2.Pointer <= 0))) { data2.Offset = chunkOffset + data.Offset; Tag_Data_Blocks.Add(data2); } continue; Label_03B7: Map.IO.In.BaseStream.Position = (chunkOffset + ValueList[i].Offset) + 12; mTagReference reference = (mTagReference)ValueList[i]; Ident ident = new Ident { Name = reference.Name }; if (chunkNumber != -1) { name = ident.Name; ident.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" }); } ident.Offset = chunkOffset + reference.Offset; ident.ID = Map.IO.In.ReadInt32(); int tagIndexByIdent = Map.GetTagIndexByIdent(ident.ID); if (tagIndexByIdent != -1) { ident.TagClass = Map.Index_Items[tagIndexByIdent].Class; } else { ident.TagClass = "Null"; } if (tagIndexByIdent != -1) { int key = Map.Index_Items[tagIndexByIdent].Ident; string str = Map.Index_Items[tagIndexByIdent].Name; if (Map.tagNameList.TagPaths.ContainsKey(key)) { try { str = Map.tagNameList.TagPaths[key]; } catch { } } ident.TagName = str + "." + Map.Index_Items[tagIndexByIdent].Class; } else { ident.TagName = "Null"; } Idents.Add(ident); continue; Label_05E5: Map.IO.In.BaseStream.Position = chunkOffset + ValueList[i].Offset; mStringID gid = (mStringID)ValueList[i]; StringIdentifier identifier = new StringIdentifier { Name = gid.Name }; if (chunkNumber != -1) { name = identifier.Name; identifier.Name = string.Concat(new object[] { name, " [", chunkNumber, "]" }); } identifier.Offset = chunkOffset + gid.Offset; identifier.Identifier = Map.IO.In.ReadInt32(); tagIndexByIdent = Map.String_Table.GetStringItemIndexByID(Map, identifier.Identifier); identifier.StringIndex = tagIndexByIdent; try { identifier.StringName = Map.String_Table.StringItems[tagIndexByIdent].Name; } catch { identifier.StringName = "<<invalid sid>>"; } Strings.Add(identifier); } }