/// <summary> /// Create Factories mapped to satisfy the demanded types(and all the intermediate dependencies). /// Any failures to locate a needed factory will cause an exception. /// </summary> /// <param name="factoriesPath">Path to the Factories List file</param> /// <param name="demandedTypes">A list of types needed for stress test execution</param> public FactoryPool(string factoriesPath, List <Type> demandedTypes, ConstraintsTable constraintsTable) { List <Type> factoryTypes = TypeListReader.ParseTypeList(factoriesPath, typeof(DiscoverableFactory)); List <DiscoverableFactory> factories = InstantiateFactories(factoryTypes); RegisterFactories(factories, demandedTypes); constraintsTable.VerifyConstraints(factoryTypes); }
public void GenerateFromConfig() { LoadModel(); name = name + "(" + Path.GetFileName(m_scriptPath) + ")"; List <ParticleInfo> particleInfo = m_config.GenerateFromConfig(); GameObject rootParticle = GameObject.Find("Particles"); if (rootParticle == null) { rootParticle = new GameObject(); rootParticle.name = "Particles"; rootParticle.transform.position = Vector3.zero; rootParticle.transform.SetParent(transform); } foreach (ParticleInfo info in particleInfo) { GameObject gameObject = new GameObject(); DynamicParticleComponent particle = gameObject.AddComponent <DynamicParticleComponent>(); gameObject.name = "Particle VertID : " + info.VertInfo.VertID.ToString(); particle.ClothSimEntity = this; particle.ParticleInfo = info; m_particleEntities.Add(info.VertInfo.VertID, gameObject); gameObject.transform.SetParent(rootParticle.transform); } foreach (GameObject gameObject in m_particleEntities.Values) { DynamicParticleComponent particle = gameObject.GetComponent <DynamicParticleComponent>(); ConstraintsTable constraintsTable = particle.ParticleInfo.VertInfo.ConstraintsTable; particle.ConstraintParticles = new List <DynamicParticleComponent.ConstraintInfo>(); foreach (ConstraintDef def in constraintsTable.ConstraintsDefs) { GameObject constraintGameObject; if (m_particleEntities.TryGetValue(def.TargetVert, out constraintGameObject)) { DynamicParticleComponent.ConstraintInfo constraintInfo = new DynamicParticleComponent.ConstraintInfo(); constraintInfo.ConstraintParticle = constraintGameObject.GetComponent <DynamicParticleComponent>(); constraintInfo.DynamicProperties = m_config.GetDynamicPropertiesDef(def.ConstraintType); particle.ConstraintParticles.Add(constraintInfo); } } } GenerateCollisionFromConfig(); }
/// <summary> /// Initializes the state object against the state Payload. /// </summary> /// <param name="stateData"></param> public void Initialize(IStatePayload stateData) { ConvenienceStressStatePayload payload = (ConvenienceStressStatePayload)stateData; string windowXamlPaths = payload.WindowXamlPaths; if (!String.IsNullOrEmpty(windowXamlPaths)) { windowXamls = windowXamlPaths.Split(new char[] { ',' }); } contentXaml = payload.ContentXamlPath; constraintsTable = new ConstraintsTable(payload.ConstraintsTablePath); actionTypes = TypeListReader.ParseTypeList(payload.ActionsPath, typeof(DiscoverableAction)); factoryPool = new FactoryPool(payload.FactoriesPath, DiscoverableInputHelper.GetFactoryInputTypes(actionTypes), constraintsTable); constraintsTable.VerifyConstraints(actionTypes); memoryLimit = payload.MemoryLimit; }
public string DiarySurvey() { int surveyId = 2; var config = new MapperConfiguration(cfg => { cfg.CreateMap <Survey, SurveyDTO>(); cfg.CreateMap <Question, QuestionDTO>(); cfg.CreateMap <PossibleAnswers, PossibleAnswerDTO>(); cfg.CreateMap <SubQuestions, SubQuestionDTO>(); cfg.CreateMap <ConstraintsTable, ConstraintsDTO[]>(); }); Survey survey = repository.GetSurvey(surveyId); OtherQuestions[] OtherQuestions = data.OtherQuestions.Where(p => p.SurveyId == surveyId).ToArray(); var mapper = config.CreateMapper(); ConstraintsTable ConstraintsForTransfer = new ConstraintsTable(); ConstraintsForTransfer.ConstraintsCollection = data.Constraints.Where(p => p.SurveyId == surveyId).ToArray(); var constraintz = JsonConvert.SerializeObject(ConstraintsForTransfer); ExcludedResultsTable ExcludedResultsForTransfer = new ExcludedResultsTable(); ExcludedResultsForTransfer.ExcludedResults = data.ExcludedResults.Where(p => p.SurveyId == surveyId).ToArray(); var surveyz = mapper.Map <Survey, SurveyDTO>(survey); var constraint1z = mapper.Map <ConstraintsTable, ConstraintsDTO[]>(ConstraintsForTransfer); var surveyzToTransfer = JsonConvert.SerializeObject(surveyz); Pagination[] Pagination = data.Paginations.Where(p => p.SurveyId == surveyId).ToArray(); Object[] objectForDataTransfer = new Object[5]; objectForDataTransfer[0] = ConstraintsForTransfer; objectForDataTransfer[1] = surveyz; objectForDataTransfer[2] = ExcludedResultsForTransfer.ExcludedResults; objectForDataTransfer[3] = OtherQuestions; objectForDataTransfer[4] = Pagination; return(JsonConvert.SerializeObject(objectForDataTransfer)); }