public List <Employe> Loader() { if (IsDBExist) { return(Deserializator.Deserialize()); } else { return(new List <Employe>()); } }
public void Start() { var itemMenu = Deserializator.DeserialMenu(); Deserializator.DeserialColors(); MenuRender mr = new MenuRender(new Menu()); int numRow = 0; do { numRow = mr.SelectMenu(typeMenu.ICON); if (numRow == -1) { break; } try { var instance = Factory.CreateInstance(itemMenu[numRow].AssemblyName, itemMenu[numRow].TypeName); Type type = instance.GetType(); MethodInfo method = type.GetMethod(itemMenu[numRow].MethodToCall); method.Invoke(instance, null); } catch (Exception ex) { Console.WriteLine(ex.Message); } #region not_finished if (numRow != -1) { Console.WriteLine(itemMenu[numRow].MethodToCall); } if (numRow == 8) { Header.Show(); Settings settings = new Settings(); settings.Start(); } Thread.Sleep(200); Console.Read(); #endregion } while (numRow != -1); Serializator.SerializSettings(SaveColor()); }
public void PerformUpdate(EntityManager entityManager, AbsoluteSimulationFrame simulationFrame, IInBitStream bitStream) { var deserializeEntity = new Deserializator(); while (deserializeEntity.ReadEntity(bitStream, out var entityWithMeta)) { var entity = mapper.ToUnityEntity(entityWithMeta.EntityId); var wasSimulated = entity != default && entityManager.Exists(entity) && entityManager.HasComponent <Simulated>(entity); // Skip locally destroyed entities if (destroyedEntities.ContainsKey(entity)) { if (!entityWithMeta.IsDeleted) { DeserializeComponentSkip.SkipComponents(componentSkip, bitStream); } continue; } // Meta information concerns entity creation, destruction and ownership if (entityWithMeta.HasMeta) { entity = PerformEntityMetaUpdate(entityManager, entityWithMeta, entity); } // Deserialize and apply component updates if (entity != default) { var isSimulated = entityManager.HasComponent <Simulated>(entity); var wasTransferred = isSimulated && !wasSimulated; // Only update components for non-simulated entities - unless it was transferred with this packet if (!isSimulated || wasTransferred) { UpdateComponents(entityManager, entity, simulationFrame, bitStream); } else { DeserializeComponentSkip.SkipComponents(componentSkip, bitStream); Log.Warning($"Trying to update owned entity {entityWithMeta.EntityId}"); } } else if (!entityWithMeta.IsDeleted) { // An error has occurred if the entity is null unless it's because it was just deleted Log.Warning($"Entity is missing {entityWithMeta.EntityId}"); DeserializeComponentSkip.SkipComponents(componentSkip, bitStream); } } }
public void ReadComponentDataUpdateEx(EntityManager entityManager, Entity entity, uint componentType, AbsoluteSimulationFrame simulationFrame, IInBitStream bitStream, bool justCreated) { var componentOwnership = Deserializator.ReadComponentOwnership(bitStream); // Read bit from stream... componentOwnership = entityManager.HasComponent <Simulated>(entity); // Then overwrite it with entity ownership. var inProtocolStream = new Coherence.FieldStream.Deserialize.Streams.InBitStream(bitStream); switch (componentType) { case TypeIds.InternalWorldPosition: DeserializeWorldPosition(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; case TypeIds.InternalWorldOrientation: DeserializeWorldOrientation(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; case TypeIds.InternalLocalUser: DeserializeLocalUser(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; case TypeIds.InternalWorldPositionQuery: DeserializeWorldPositionQuery(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; case TypeIds.InternalArchetypeComponent: DeserializeArchetypeComponent(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; case TypeIds.InternalPersistence: DeserializePersistence(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; case TypeIds.InternalPlayer: DeserializePlayer(entityManager, entity, componentOwnership, simulationFrame, inProtocolStream, justCreated, bitStream); break; default: Log.Warning("couldn't find component", "componentType", componentType); break; } }
private void UpdateComponents(EntityManager entityManager, Entity entity, AbsoluteSimulationFrame simulationFrame, IInBitStream bitStream) { var componentCount = Deserializator.ReadComponentCount(bitStream); for (var i = 0; i < componentCount; i++) { var componentState = Deserializator.ReadComponentState(bitStream); var componentId = Deserializator.ReadComponentId(bitStream); switch (componentState) { case ComponentState.Construct: { var componentTypeId = Deserializator.ReadComponentTypeId(bitStream); componentDeserialize.CreateIfNeededAndReadComponentDataUpdate(entityManager, entity, componentTypeId, simulationFrame, bitStream); } break; case ComponentState.Update: { // TODO: lookup component ID from state. var updateComponentTypeId = componentId; componentDeserialize.ReadComponentDataUpdate(entityManager, entity, updateComponentTypeId, simulationFrame, bitStream); } break; case ComponentState.Destruct: { var destroyComponentTypeId = componentId; DestroyComponentData(entityManager, entity, destroyComponentTypeId); } break; } } }