// Token: 0x060003AB RID: 939 RVA: 0x000185B4 File Offset: 0x000167B4 public ITechnology GetTechnology(string technologyID) { if (string.IsNullOrEmpty(technologyID)) { throw new ArgumentNullException("technologyID"); } ITechnology result = null; if (!this.items.TryGetValue(technologyID, out result)) { throw new KeyNotFoundException(technologyID); } return(result); }
public ITechnology GetTechnology(string technologyID) { if (string.IsNullOrEmpty(technologyID)) { throw new ArgumentNullException(nameof(technologyID)); } ITechnology itechnology = (ITechnology)null; if (!this.items.TryGetValue(technologyID, out itechnology)) { throw new KeyNotFoundException(technologyID); } return(itechnology); }
public void ReportTechnologyPollingAssignmentIndication( ITechnologyPolling technologyPolling, int[] netObjectsInstanceIDs, bool enabledStateChangedTo) { if (technologyPolling == null) { throw new ArgumentNullException(nameof(technologyPolling)); } if (netObjectsInstanceIDs == null) { throw new ArgumentNullException(nameof(netObjectsInstanceIDs)); } if (netObjectsInstanceIDs.Length == 0) { return; } ITechnology technology = TechnologyManager.Instance.TechnologyFactory.GetTechnology(technologyPolling.get_TechnologyID()); string netObjectPrefix = NetObjectTypesDAL.GetNetObjectPrefix(this.swisFactory, technology.get_TargetEntity()); string entityName = NetObjectTypesDAL.GetEntityName(this.swisFactory, technology.get_TargetEntity()); Dictionary <int, string> netObjectsCaptions = NetObjectTypesDAL.GetNetObjectsCaptions(this.swisFactory, technology.get_TargetEntity(), netObjectsInstanceIDs); foreach (int objectsInstanceId in netObjectsInstanceIDs) { PropertyBag propertyBag1 = new PropertyBag(); ((Dictionary <string, object>)propertyBag1).Add("InstanceType", (object)"Orion.TechnologyPollingAssignments"); ((Dictionary <string, object>)propertyBag1).Add("InstanceID", (object)objectsInstanceId.ToString()); ((Dictionary <string, object>)propertyBag1).Add("TechnologyPollingID", (object)technologyPolling.get_TechnologyPollingID()); ((Dictionary <string, object>)propertyBag1).Add("Enabled", (object)enabledStateChangedTo); ((Dictionary <string, object>)propertyBag1).Add("TargetEntity", (object)technology.get_TargetEntity()); ((Dictionary <string, object>)propertyBag1).Add("TechPollingDispName", (object)technologyPolling.get_DisplayName()); ((Dictionary <string, object>)propertyBag1).Add("TechnologyDispName", (object)technology.get_DisplayName()); PropertyBag propertyBag2 = propertyBag1; string str; if (netObjectsCaptions.TryGetValue(objectsInstanceId, out str)) { ((Dictionary <string, object>)propertyBag2).Add("NetObjectCaption", (object)str); } if (netObjectPrefix != null) { ((Dictionary <string, object>)propertyBag2).Add("NetObjectPrefix", (object)netObjectPrefix); ((Dictionary <string, object>)propertyBag2).Add((string)KnownKeys.NetObject, (object)string.Format("{0}:{1}", (object)netObjectPrefix, (object)objectsInstanceId)); } if (entityName != null) { ((Dictionary <string, object>)propertyBag2).Add("NetObjectName", (object)entityName); } this.publishManager.Publish(PublishHelper.ConvertIndication((IIndication) new TechnologyPollingAssignmentIndication((IndicationType)2, propertyBag2))); } }
public TechnologyViewModel(int level, ITechnology res) { this.Level = level; this.Name = res.Name; this.Description = res.Description; this.MaxLevel = res.MaxLevel; this.Prerequisite = res.Prerequisite; this.RequiredResearchTime = this.Level < this.MaxLevel ? res.ResearchTime[this.Level + 1].TotalMinutes : 0; this.Modifiers = res.Modifier; var requiredResources = res.GetRequiredResources(this.Level + 1); this.RequiredEnergy = requiredResources[0]; this.RequiredCrystals = requiredResources[1]; this.RequiredMetal = requiredResources[2]; }
// Token: 0x06000427 RID: 1063 RVA: 0x0001C408 File Offset: 0x0001A608 public void ReportTechnologyPollingAssignmentIndication(ITechnologyPolling technologyPolling, int[] netObjectsInstanceIDs, bool enabledStateChangedTo) { if (technologyPolling == null) { throw new ArgumentNullException("technologyPolling"); } if (netObjectsInstanceIDs == null) { throw new ArgumentNullException("netObjectsInstanceIDs"); } if (netObjectsInstanceIDs.Length == 0) { return; } ITechnology technology = TechnologyManager.Instance.TechnologyFactory.GetTechnology(technologyPolling.TechnologyID); string netObjectPrefix = NetObjectTypesDAL.GetNetObjectPrefix(this.swisFactory, technology.TargetEntity); string entityName = NetObjectTypesDAL.GetEntityName(this.swisFactory, technology.TargetEntity); Dictionary <int, string> netObjectsCaptions = NetObjectTypesDAL.GetNetObjectsCaptions(this.swisFactory, technology.TargetEntity, netObjectsInstanceIDs); foreach (int num in netObjectsInstanceIDs) { PropertyBag propertyBag = new PropertyBag(); propertyBag.Add("InstanceType", "Orion.TechnologyPollingAssignments"); propertyBag.Add("InstanceID", num.ToString()); propertyBag.Add("TechnologyPollingID", technologyPolling.TechnologyPollingID); propertyBag.Add("Enabled", enabledStateChangedTo); propertyBag.Add("TargetEntity", technology.TargetEntity); propertyBag.Add("TechPollingDispName", technologyPolling.DisplayName); propertyBag.Add("TechnologyDispName", technology.DisplayName); PropertyBag propertyBag2 = propertyBag; string value; if (netObjectsCaptions.TryGetValue(num, out value)) { propertyBag2.Add("NetObjectCaption", value); } if (netObjectPrefix != null) { propertyBag2.Add("NetObjectPrefix", netObjectPrefix); propertyBag2.Add(KnownKeys.NetObject, string.Format("{0}:{1}", netObjectPrefix, num)); } if (entityName != null) { propertyBag2.Add("NetObjectName", entityName); } this.indicationReporter.ReportIndication(new TechnologyPollingAssignmentIndication(2, propertyBag2)); } }
/// <summary> /// Creates a new technology with a couple of emission factors for different years, then inserts that mix in the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonNewTechnology_Click(object sender, EventArgs e) { //Hardcoded crude oil resource ID, could be fetched from the IData class instead int CRUDE_RES_ID = 23; //Creating new instance of a technology ITechnology technology = _dataHelper.CreateNewTechnology("Example4 Technology"); //Sets the resource being combusted/used by that technology bool success = _dataHelper.TechnologySetResource(technology, CRUDE_RES_ID); //Adds a couple of yers for the emissions that will be created success &= _dataHelper.TechnologyAddYear(technology, 2010); success &= _dataHelper.TechnologyAddYear(technology, 2014); //Adds a couple of emission factors for different gases IGas gas = _controller.CurrentProject.Data.Gases.AllValues.First(); IGas gas2 = _controller.CurrentProject.Data.Gases.AllValues.Last(); success &= _dataHelper.TechnologyAddEmission(technology, gas); success &= _dataHelper.TechnologyAddEmission(technology, gas2); //Retrieves an emission factor to observe it's value IParameter ef = _dataHelper.TechnologyGetEF(technology, 2014, gas.Id); //Sets the emission factor for a specific year and pollutant success &= _dataHelper.TechnologySetEF(technology, 2014, gas.Id, ef.UnitGroupName, 1); //Adds the technology to the database success &= _dataHelper.DataInsertOrUpdateTechnology(technology); if (success) { MessageBox.Show("Technology named : '" + technology.Name + "' inserted in dataset"); } else { MessageBox.Show("Failure"); } }
public TechnologiesController(ITechnology technology) { _technology = technology; }
public TechnologyFinder(ITechnology technology, List<string> siteURLs) { this.mTechnology = technology; this.mSiteURLs = siteURLs; this.mSiteURLsWithTheTechnology = new List<string>(); }
private bool CanResearch(PlayerObject pO, int toLevel, ITechnology techLogic) { if (pO.Technologies.CurrentlyResearching != CurrentlyResearching.None) { return false; } if (toLevel > techLogic.MaxLevel) { return false; } if (pO.Buildings.ResearchCentreLevel < techLogic.Prerequisite) { return false; } var requiredResources = techLogic.GetRequiredResources(toLevel); return pO.Resources.Energy > requiredResources[0] && pO.Resources.Crystal > requiredResources[1] && pO.Resources.Metal > requiredResources[2]; }
private static void SetupShopifyTechnology(out ITechnology technology, out SitesLoader sitesLoader) { FileStream patternsFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\ShopifyStringPatterns.txt", FileMode.Open); technology = new Technology("Shopify", patternsFile); FileStream sitesFile = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\\ShopifySitesURLs.txt", FileMode.Open); sitesLoader = new SitesLoader(sitesFile); }
private void SubstractResources(PlayerObject pO, int[] resources, int amount, ITechnology techLogic) { if (resources.Length < 3) { throw new ArgumentException(); } var cheaperFleetModifier = techLogic.Modifier[pO.Technologies.CheaperFleetLevel]; var requiredEnergy = (resources[0] - (int)(cheaperFleetModifier * resources[0])) * amount; var requiredCrystals = (resources[1] - (int)(cheaperFleetModifier * resources[1])) * amount; var requiredMetal = (resources[2] - (int)(cheaperFleetModifier * resources[2])) * amount; pO.Resources.Energy -= requiredEnergy; pO.Resources.Crystal -= requiredCrystals; pO.Resources.Metal -= requiredMetal; }
private bool CanRecruit(PlayerObject pO, int amount, IShip shipLogic, ITechnology techLogic) { if (pO.Units.CurrentlyRecruiting != CurrentlyRecruiting.None) { return false; } if (amount <= 0) { return false; } if (pO.Buildings.BarracksLevel < shipLogic.Prerequisite) { return false; } var requiredResources = shipLogic.RequiredResourcesToBuild; var cheaperFleetModifier = techLogic.Modifier[pO.Technologies.CheaperFleetLevel]; var requiredEnergy = (requiredResources[0] - (int) (cheaperFleetModifier*requiredResources[0]))*amount; var requiredCrystals = (requiredResources[1] - (int)(cheaperFleetModifier * requiredResources[1])) * amount; var requiredMetal = (requiredResources[2] - (int)(cheaperFleetModifier * requiredResources[2])) * amount; return pO.Resources.Energy > requiredEnergy && pO.Resources.Crystal > requiredCrystals && pO.Resources.Metal > requiredMetal; }