public string GetCarrierCode(CarrierType carrierType) { switch (carrierType) { case CarrierType.UPSRed: return("UPS2"); break; //case CarrierType.UPSNextDayAir_Early_AM: // return "14"; // break; //case CarrierType.UPSNextDayAirSaver: // return "13"; // break; case CarrierType.UPSBlue: return("UPS3"); break; //case CarrierType.UPS2ndDayAir_AM: // return "59"; // break; //case CarrierType.UPS3DaySelect: // return "12"; // break; case CarrierType.UPSGround: return("UPSG"); break; } return("05"); }
/// <summary> /// liest pro User und Carrier alle zugewiesenen Events und baut die eigentliche Messages auf. /// Speichert die ab und löscht die Relation zwischen Event / Registration /// </summary> /// <returns>Anzahl der aufbereiteten Messages</returns> public int GetPending() { int intCount = 0; string strLastUserID = string.Empty; CarrierType enuLastCarrierType = CarrierType.None; NotificationMessage objMessage = null; SqlConnection Conn = new SqlConnection(Helper.GetSiemeConnectionString()); try { SqlCommand GetData = new SqlCommand(); GetData.Connection = Conn; GetData.CommandType = CommandType.StoredProcedure; GetData.CommandText = "hisp_Notification_RegisteredEvent_GetPending"; Conn.Open(); SqlDataReader sqlReader = GetData.ExecuteReader(CommandBehavior.CloseConnection); while (sqlReader.Read()) { CarrierType enuCarrierType = (CarrierType)Convert.ToInt32(sqlReader["NRE_Carrier"]); string strUserID = sqlReader["NUS_USR_ID"].ToString(); string strEventID = sqlReader["NEV_ID"].ToString(); string strRegisterID = sqlReader["NRE_ID"].ToString(); if (strLastUserID != strUserID || enuLastCarrierType != enuCarrierType) { strLastUserID = strUserID; enuLastCarrierType = enuCarrierType; objMessage = InsertPending(objMessage); // TODO: Return value always null objMessage = new NotificationMessage(enuCarrierType, strWebRoot, strRootFolder); } objMessage.AddEvent(sqlReader); SetGroupID(strEventID, strRegisterID, objMessage.GroupID); intCount++; } sqlReader.Close(); objMessage = InsertPending(objMessage); } catch { if (objMessage != null) { SetGroupID(string.Empty, string.Empty, objMessage.GroupID); } throw; } finally { if (Conn != null && Conn.State != ConnectionState.Closed) { Conn.Close(); } } return(intCount); }
public void SetChecked(CarrierType type, bool value) { if (listCarrier.ContainsKey(type)) { listCarrier[type].Checked = value; } }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 50, Configuration.FieldSeparator), Id, ExternalAccessionIdentifier?.ToDelimitedString(), AccessionIdentifier?.ToDelimitedString(), ContainerIdentifier?.ToDelimitedString(), PrimaryParentContainerIdentifier?.ToDelimitedString(), EquipmentContainerIdentifier?.ToDelimitedString(), SpecimenSource, RegistrationDateTime.HasValue ? RegistrationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ContainerStatus?.ToDelimitedString(), CarrierType?.ToDelimitedString(), CarrierIdentifier?.ToDelimitedString(), PositionInCarrier?.ToDelimitedString(), TrayTypeSac?.ToDelimitedString(), TrayIdentifier?.ToDelimitedString(), PositionInTray?.ToDelimitedString(), Location != null ? string.Join(Configuration.FieldRepeatSeparator, Location.Select(x => x.ToDelimitedString())) : null, ContainerHeight.HasValue ? ContainerHeight.Value.ToString(Consts.NumericFormat, culture) : null, ContainerDiameter.HasValue ? ContainerDiameter.Value.ToString(Consts.NumericFormat, culture) : null, BarrierDelta.HasValue ? BarrierDelta.Value.ToString(Consts.NumericFormat, culture) : null, BottomDelta.HasValue ? BottomDelta.Value.ToString(Consts.NumericFormat, culture) : null, ContainerHeightDiameterDeltaUnits?.ToDelimitedString(), ContainerVolume.HasValue ? ContainerVolume.Value.ToString(Consts.NumericFormat, culture) : null, AvailableSpecimenVolume.HasValue ? AvailableSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null, InitialSpecimenVolume.HasValue ? InitialSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null, VolumeUnits?.ToDelimitedString(), SeparatorType?.ToDelimitedString(), CapType?.ToDelimitedString(), Additive != null ? string.Join(Configuration.FieldRepeatSeparator, Additive.Select(x => x.ToDelimitedString())) : null, SpecimenComponent?.ToDelimitedString(), DilutionFactor?.ToDelimitedString(), Treatment?.ToDelimitedString(), Temperature?.ToDelimitedString(), HemolysisIndex.HasValue ? HemolysisIndex.Value.ToString(Consts.NumericFormat, culture) : null, HemolysisIndexUnits?.ToDelimitedString(), LipemiaIndex.HasValue ? LipemiaIndex.Value.ToString(Consts.NumericFormat, culture) : null, LipemiaIndexUnits?.ToDelimitedString(), IcterusIndex.HasValue ? IcterusIndex.Value.ToString(Consts.NumericFormat, culture) : null, IcterusIndexUnits?.ToDelimitedString(), FibrinIndex.HasValue ? FibrinIndex.Value.ToString(Consts.NumericFormat, culture) : null, FibrinIndexUnits?.ToDelimitedString(), SystemInducedContaminants != null ? string.Join(Configuration.FieldRepeatSeparator, SystemInducedContaminants.Select(x => x.ToDelimitedString())) : null, DrugInterference != null ? string.Join(Configuration.FieldRepeatSeparator, DrugInterference.Select(x => x.ToDelimitedString())) : null, ArtificialBlood?.ToDelimitedString(), SpecialHandlingCode != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialHandlingCode.Select(x => x.ToDelimitedString())) : null, OtherEnvironmentalFactors != null ? string.Join(Configuration.FieldRepeatSeparator, OtherEnvironmentalFactors.Select(x => x.ToDelimitedString())) : null, ContainerLength?.ToDelimitedString(), ContainerWidth?.ToDelimitedString(), ContainerForm?.ToDelimitedString(), ContainerMaterial?.ToDelimitedString(), ContainerCommonName?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public NotificationMessage(CarrierType carrierType, string webRoot, string rootFolder) { enuCarrierType = carrierType; strWebRoot = webRoot; strRootFolder = rootFolder; strGroupID = Guid.NewGuid().ToString(); LoadEventBase(); }
public bool CanShipTo(string address, CarrierType carrier) { if (carrier == CarrierType.Pickup) { return(true); } return(!string.IsNullOrWhiteSpace(address)); }
public static CarrierType GetCarrierType(List <LogicalBank> banks) { int[] numArray = new int[8]; for (int index = 0; index < 8; ++index) { numArray[index] = 0; } foreach (LogicalBank bank in banks) { switch (bank.TurretClass) { case WeaponEnums.TurretClasses.Biomissile: ++numArray[3]; continue; case WeaponEnums.TurretClasses.Drone: ++numArray[1]; continue; case WeaponEnums.TurretClasses.AssaultShuttle: ++numArray[2]; continue; case WeaponEnums.TurretClasses.DestroyerRider: ++numArray[5]; continue; case WeaponEnums.TurretClasses.CruiserRider: ++numArray[6]; continue; case WeaponEnums.TurretClasses.DreadnoughtRider: ++numArray[7]; continue; case WeaponEnums.TurretClasses.BoardingPod: ++numArray[4]; continue; default: continue; } } CarrierType carrierType = CarrierType.None; int num = 0; for (int index = 0; index < 8; ++index) { if (numArray[index] > num) { num = numArray[index]; carrierType = (CarrierType)index; } } return(carrierType); }
internal void SetChecked(CarrierType type) { foreach (CarrierType key in listCarrier.Keys) { if (key != type) { listCarrier[key].Checked = false; } } }
internal static CarrierType GetCarrierTypeEnum(string value, CarrierType defaultValue) { foreach (CarrierType item in Enum.GetValues(typeof(CarrierType))) { if (item.ToString() == value) { return(item); } } return(defaultValue); }
public Carrier Item(CarrierType type) { if (listCarrier.ContainsKey(type)) { return(listCarrier[type]); } else { return(null); } }
//Validation for the carrier method private static void ValidCarrierTypeCheck(CarrierType carrierType) { if (!((int)carrierType > 4 || carrierType < 0)) { Console.WriteLine($"The payment method {carrierType} was chosen."); Console.WriteLine(); } else { Console.WriteLine("The default value is applied"); Console.WriteLine(); } }
public Leg(string uniqueIdentifier,ShippingAgent carrier, CarrierType carrierType,Destination origin,Destination destination ,DateTime departureTime, DateTime arrivalTime, double cost, double totalCapacity) { this.uniqueIdentifier = uniqueIdentifier; this.carrier = carrier; this.carrierType = carrierType; this.origin = origin; this.destination = destination; this.departureTime = departureTime; this.arrivalTime = arrivalTime; this.cost = cost; this.totalCapacity = totalCapacity; this.UsedCapacity = 0; }
public Label(string id, string url, LabelFormat format, string trackingNumber, CarrierType carrier, NFX.Financial.Amount rate) : this() { ID = id; CreateDate = App.TimeSource.UTCNow; URL = url; Format = format; TrackingNumber = trackingNumber; Carrier = carrier; Rate = rate; }
public MessageSend(SqlDataReader sqlReader, bool testMode, string conn) { blnTestMode = testMode; strConn = conn; strID = sqlReader["NNS_ID"].ToString(); enuCarrierType = (CarrierType)Convert.ToInt32(sqlReader["NNS_Carrier"]); string[] strAddress = sqlReader["NNS_Address"].ToString().Split('|'); foreach (string strItem in strAddress) { listAddress.Add(strItem); } strSubject = sqlReader["NNS_Subject"].ToString(); strBody = sqlReader["NNS_Body"].ToString(); }
//Messages to user private static void ConfirmingAddress(EShopBasket basket, int paymentType, CarrierType carrierType, string address) { var simpleEshop = new SimpleEshop(); var success = simpleEshop.PayAndSendOrder(basket, paymentType, address, carrierType); Console.Write("Checking the address..."); Console.Write("Checking with the system... "); Console.WriteLine("Loading... "); Thread.Sleep(2000); Console.WriteLine("Is the address correct? "); Console.WriteLine(success); Console.WriteLine("Your order is complete!"); Console.WriteLine(); Console.WriteLine("Note that our future features you will be able to receive a comfirmation email with your order! \nThank you for shopping with us!"); Console.WriteLine(); }
private void FillObject(Business.RegistrationDefaultList list, XmlElement xmlDefault) { EventIdentifier enuEventIdentifier = (EventIdentifier)Convert.ToInt32(xmlDefault.GetAttribute("Identifier")); Business.RegistrationDefault item = list.Item(enuEventIdentifier); if (item != null) { item.Identifier = enuEventIdentifier; CarrierType enuCarrierType = (CarrierType)Convert.ToInt32(xmlDefault.GetAttribute("Carrier")); Business.Carrier objCarrier = item.Carriers.Item(enuCarrierType); if (objCarrier != null) { objCarrier.Checked = true; objCarrier.Collect = (CarrierCollect)Convert.ToInt32(xmlDefault.GetAttribute("Collect")); objCarrier.CollectValue = 1; } } }
public void TestAll() { List <CarrierType> types = CarrierType.All(); Assert.AreNotEqual(0, types.Count); }
public bool PayAndSendOrder(EShopBasket basket, int paymentMethod, string address, CarrierType carrierType) { var payments = new Payments(); bool success = payments.PayBasket(basket, paymentMethod); if (success) { if (carrierType != CarrierType.Pickup) { var shipment = new Shipment(); if (shipment.CanShipTo(address, carrierType)) { shipment.DeliverOrder(address, basket); } else { success = false; } } } return(success); }
internal void ImportRow(Entities edc, RoutesCatalogRoute route, string routePrefix, bool testData, Action <ProgressChangedEventArgs> progress) { ServiceType _service = GetService(route); Partner _Partner = GetOrAddJTIPartner(edc, _service, route.Vendor.Trim(), testData); FreightPayer _freightPayer = GetOrAdd <FreightPayer>(edc.FreightPayer, m_FreightPayer, route.Freight_Payer__I_C__MainLeg.ToString(), testData, x => NewItemCreateNotification(x, progress)); CityType _CityType = GetOrAddCity(edc, route.Dest_City.Trim(), route.Dest_Country.Trim(), "Unknown", progress); Currency _Currency = GetOrAdd <Currency>(edc.Currency, m_Currency, route.Currency, false, x => NewItemCreateNotification(x, progress)); ShipmentType _ShipmentType = GetOrAdd <ShipmentType>(edc.ShipmentType, m_ShipmentType, route.ShipmentType, false, x => NewItemCreateNotification(x, progress)); CarrierType _CarrierCarrierType = GetOrAdd <CarrierType>(edc.Carrier, m_CarrierCarrierType, route.Carrier, false, x => NewItemCreateNotification(x, progress)); TranspotUnit _TransportUnit = GetOrAdd <TranspotUnit>(edc.TransportUnitType, m_TransportUnit, route.Equipment_Type__UoM, false, x => NewItemCreateNotification(x, progress)); SAPDestinationPlant _SAPDestinationPlant = GetOrAdd <SAPDestinationPlant>(edc.SAPDestinationPlant, m_SAPDestinationPlant, route.SAP_Dest_Plant, false, x => NewItemCreateNotification(x, progress)); BusienssDescription _businessDescription = GetOrAdd <BusienssDescription>(edc.BusinessDescription, m_BusinessDescription, route.Business_description, false, x => NewItemCreateNotification(x, progress)); Commodity _commodity = GetOrAdd <Commodity>(edc.Commodity, m_CommodityCommodity, route.Commodity, false, x => NewItemCreateNotification(x, progress)); string _sku = route.Material_Master__Reference; string _title = String.Format("{3} To: {0}, by: {1}, of: {2}", _CityType.Title, _Partner.Title, route.Commodity, routePrefix); switch (_service) { case ServiceType.Forwarder: Route _rt = new Route() { Route2BusinessDescriptionTitle = _businessDescription, CarrierTitle = _CarrierCarrierType, Route2CityTitle = _CityType, DepartureCity = route.Dept_City, CurrencyTitle = _Currency, FreightPayerTitle = _freightPayer, GoodsHandlingPO = route.PO_NUMBER, MaterialMaster = _sku, DeparturePort = route.Port_of_Dept, RemarkMM = route.Remarks, SAPDestinationPlantTitle = _SAPDestinationPlant, ShipmentTypeTitle = _ShipmentType, Title = _title, TransportCosts = testData ? 4567.8 : route.Total_Cost_per_UoM.String2Double(), TransportUnitTypeTitle = _TransportUnit, PartnerTitle = _Partner, Route2Commodity = _commodity, Incoterm = route.Selling_Incoterm }; edc.Route.InsertOnSubmit(_rt); break; case ServiceType.SecurityEscortProvider: SecurityEscortCatalog _sec = new SecurityEscortCatalog() { SecurityEscortCatalog2BusinessDescriptionTitle = _businessDescription, CurrencyTitle = _Currency, EscortDestination = route.Dest_City, FreightPayerTitle = _freightPayer, MaterialMaster = _sku, RemarkMM = route.Remarks, SecurityCost = testData ? 345.6 : route.Total_Cost_per_UoM.String2Double(), SecurityEscrotPO = route.PO_NUMBER, Title = _title, PartnerTitle = _Partner }; edc.SecurityEscortRoute.InsertOnSubmit(_sec); break; case ServiceType.VendorAndForwarder: case ServiceType.None: case ServiceType.Invalid: case ServiceType.Vendor: default: break; } //TODO edc.SubmitChanges(); }
private string GetCarrierText(CarrierType cType) { string key = "TextAlerts" + cType.ToString(); return(language.GetString(key)); }
public bool IsCarrierAvailably(CarrierType type) { return(listCarrierType.Contains(type)); }
internal void AddRoute(PreliminaryDataRouteRoute _route, bool _testData) { try { ServiceType _service = GetService(_route); Partner _prtnr = GetOrAddJTIPartner(_service, _route.Vendor.Trim(), _testData); FreightPayer _freightPayer = GetOrAdd <FreightPayer>(m_EDC.FreightPayer, m_FreightPayer, _route.Freight_Payer__I_C__MainLeg, _testData); CityType _CityType = GetOrAddCity(_route.Dest_City, _route.Dest_Country, null); Currency _Currency = GetOrAdd <Currency>(m_EDC.Currency, m_Currency, _route.Currency, false); ShipmentType _ShipmentType = GetOrAdd <ShipmentType>(m_EDC.ShipmentType, m_ShipmentType, _route.ShipmentType, false); CarrierType _CarrierCarrierType = GetOrAdd <CarrierType>(m_EDC.Carrier, m_CarrierCarrierType, _route.Carrier, false); TranspotUnit _TranspotUnit = GetOrAdd <TranspotUnit>(m_EDC.TransportUnitType, m_TranspotUnit, _route.Equipment_Type__UoM, false); SAPDestinationPlant _SAPDestinationPlant = GetOrAdd <SAPDestinationPlant>(m_EDC.SAPDestinationPlant, m_SAPDestinationPlant, _route.SAP_Dest_Plant, false); BusienssDescription _busnessDscrptn = GetOrAdd <BusienssDescription>(m_EDC.BusinessDescription, m_BusinessDescription, _route.Business_description, false); Commodity _cmdty = GetOrAdd <Commodity>(m_EDC.Commodity, m_CommodityCommodity, _route.Commodity, false); string _sku = _route.Material_Master__Reference; string _title = String.Format("To: {0}, by: {1}, of: {2}", _CityType.Title, _prtnr.Title, _route.Commodity); switch (_service) { case ServiceType.Forwarder: Route _rt = new Route() { Route2BusinessDescriptionTitle = _busnessDscrptn, CarrierTitle = _CarrierCarrierType, Route2CityTitle = _CityType, DepartureCity = _route.Dept_City, CurrencyTitle = _Currency, FreightPayerTitle = _freightPayer, GoodsHandlingPO = _route.PO_NUMBER, MaterialMaster = _sku, DeparturePort = _route.Port_of_Dept, RemarkMM = _route.Remarks, SAPDestinationPlantTitle = _SAPDestinationPlant, ShipmentTypeTitle = _ShipmentType, Title = _title, TransportCosts = _testData ? 4567.8 : _route.Total_Cost_per_UoM.String2Double(), TransportUnitTypeTitle = _TranspotUnit, PartnerTitle = _prtnr, Route2Commodity = _cmdty, Incoterm = _route.Selling_Incoterm }; m_EDC.Route.InsertOnSubmit(_rt); break; case ServiceType.SecurityEscortProvider: SecurityEscortCatalog _sec = new SecurityEscortCatalog() { SecurityEscortCatalog2BusinessDescriptionTitle = _busnessDscrptn, CurrencyTitle = _Currency, EscortDestination = _route.Dest_City, FreightPayerTitle = _freightPayer, MaterialMaster = _sku, RemarkMM = _route.Remarks, SecurityCost = _testData ? 345.6 : _route.Total_Cost_per_UoM.String2Double(), SecurityEscrotPO = _route.PO_NUMBER, Title = _title, PartnerTitle = _prtnr }; m_EDC.SecurityEscortRoute.InsertOnSubmit(_sec); break; case ServiceType.VendorAndForwarder: case ServiceType.None: case ServiceType.Invalid: case ServiceType.Vendor: default: break; } m_EDC.SubmitChanges(); } catch (Exception ex) { string _format = "Cannot add route data SKU={0} Description={1} because of import Error= {2}"; throw new ApplicationException(String.Format(_format, _route.Material_Master_Short_Text, _route.Business_description, ex.Message)); } }
// Sends orders to a shipping service endpoint dependent on the specified carrier private static async Task <IEnumerable <ItemTrackingDetail> > PostToCarrierAsync(CarrierType carrierType, Order[] orders) { var shipDetails = CreateShipDetails(orders); Console.WriteLine("Sending {0} orders to {1}.", orders.Length, carrierType); var client = new System.Net.Http.HttpClient(); var response = await client.PostAsync("http://localhost:9099/api/" + carrierType.ToString(), shipDetails, new JsonMediaTypeFormatter()); if (!response.IsSuccessStatusCode) { throw new ApplicationException("Exception in shipping processor (" + carrierType + "): " + response.ReasonPhrase); } var results = await response.Content.ReadAsAsync <List <ItemTrackingDetail> >(); return(results); }
public void LoadFromXml( AssetDatabase assetdb, string filename, string faction, ShipSectionType sectionType, ShipClass sectionClass) { ShipSection ss = new ShipSection(); ShipXmlUtility.LoadShipSectionFromXml(filename, ref ss); this.Type = sectionType; this.Class = sectionClass; this.Faction = faction; this.SectionName = Path.GetFileNameWithoutExtension(filename); string str1 = ""; switch (this.Class) { case ShipClass.Cruiser: str1 = "CR"; break; case ShipClass.Dreadnought: str1 = "DN"; break; case ShipClass.Leviathan: str1 = "LV"; break; case ShipClass.BattleRider: str1 = "BR"; break; case ShipClass.Station: str1 = "SN"; break; } this.ModelName = FileSystemHelpers.StripMountName(ss.ModelPath); string str2 = Path.Combine(Path.GetDirectoryName(this.ModelName), "Damage_" + str1 + "_" + this.Type.ToString() + "_Default.scene"); this.DestroyedModelName = string.IsNullOrEmpty(ss.DestroyedModelPath) ? str2 : ss.DestroyedModelPath; this.DamagedModelName = ss.DamageModelPath; this.AmbientSound = ss.AmbientSound; this.EngineSound = ss.EngineSound; string str3 = string.Format("COMBAT_023-01_{0}_GeneralShipsBeingAttacked", (object)faction); string str4 = ""; switch (this.Class) { case ShipClass.Cruiser: str4 = string.Format("COMBAT_029-01_{0}_CruiserDestroyed", (object)faction); break; case ShipClass.Dreadnought: str4 = string.Format("COMBAT_030-01_{0}_DreadnoughtDestroyed", (object)faction); break; case ShipClass.Leviathan: str4 = string.Format("COMBAT_031-01_{0}_LeviathanDestroyed", (object)faction); break; case ShipClass.BattleRider: str4 = string.Format("COMBAT_020-01_{0}_BattleRiderDestroyed", (object)faction); break; case ShipClass.Station: switch (this.StationType) { case StationType.NAVAL: str3 = string.Format("COMBAT_067-01_{0}_NavalStationUnderAttack", (object)faction); str4 = string.Format("COMBAT_066-01_{0}_NavalStationDestroyed", (object)faction); break; case StationType.SCIENCE: str3 = string.Format("COMBAT_069-01_{0}_ScienceStationUnderAttack", (object)faction); str4 = string.Format("COMBAT_068-01_{0}_ScienceStationDestroyed", (object)faction); break; case StationType.CIVILIAN: str3 = string.Format("COMBAT_071-01_{0}_CivilianStationUnderAttack", (object)faction); str4 = string.Format("COMBAT_072-01_{0}_CivilianStationDestroyed", (object)faction); break; case StationType.DIPLOMATIC: str3 = string.Format("COMBAT_070a-01_{0}_DiplomaticStationUnderAttack", (object)faction); str4 = string.Format("COMBAT_070-01_{0}_DiplomaticStationDestroyed", (object)faction); break; } break; } this.UnderAttackSound = string.IsNullOrEmpty(ss.UnderAttackSound) ? str3 : ss.UnderAttackSound; this.DestroyedSound = string.IsNullOrEmpty(ss.DestroyedSound) ? str4 : ss.DestroyedSound; this.Title = ss.Title; this.Description = ss.Description; if (string.IsNullOrWhiteSpace(this.Title)) { this.Title = Path.GetFileNameWithoutExtension(filename); } string withoutExtension = Path.GetFileNameWithoutExtension(filename); this.CombatAIType = !string.IsNullOrEmpty(ss.CombatAiType) ? (SectionEnumerations.CombatAiType)Enum.Parse(typeof(SectionEnumerations.CombatAiType), ss.CombatAiType) : SectionEnumerations.CombatAiType.Normal; switch (this.CombatAIType) { case SectionEnumerations.CombatAiType.Drone: this.SetBattleRiderType(BattleRiderTypes.drone); break; case SectionEnumerations.CombatAiType.AssaultShuttle: this.SetBattleRiderType(BattleRiderTypes.assaultshuttle); break; case SectionEnumerations.CombatAiType.NodeFighter: this.SetBattleRiderType(BattleRiderTypes.nodefighter); break; case SectionEnumerations.CombatAiType.Swarmer: case SectionEnumerations.CombatAiType.SwarmerGuardian: case SectionEnumerations.CombatAiType.VonNeumannPyramid: case SectionEnumerations.CombatAiType.LocustFighter: case SectionEnumerations.CombatAiType.MorrigiCrow: this.SetBattleRiderType(BattleRiderTypes.battlerider); break; case SectionEnumerations.CombatAiType.VonNeumannSeekerProbe: this.SetBattleRiderType(BattleRiderTypes.assaultshuttle); break; default: this.SetBattleRiderType(ObtainShipClassTypes.GetBattleRiderTypeByName(this.Class, withoutExtension)); break; } if (withoutExtension.Contains("protectorate")) { this.ShipFleetAbilityType = ShipFleetAbilityType.Protectorate; } else if (withoutExtension.Contains("suulka_the_hidden")) { this.ShipFleetAbilityType = ShipFleetAbilityType.Hidden; } else if (withoutExtension.Contains("suulka_the_deaf")) { this.ShipFleetAbilityType = ShipFleetAbilityType.Deaf; } this.IsSuperTransport = this.SectionName.StartsWith("lv_supertransport", StringComparison.InvariantCultureIgnoreCase); this.IsBoreShip = this.SectionName.EndsWith("bore", StringComparison.InvariantCultureIgnoreCase); this.IsSupplyShip = this.SectionName.Contains("_supply"); this.IsGateShip = this.SectionName.StartsWith("cr_mis_gate", StringComparison.InvariantCultureIgnoreCase); this.IsTrapShip = this.SectionName.StartsWith("cr_mis_colonytrickster", StringComparison.InvariantCultureIgnoreCase); this.IsGravBoat = this.SectionName.StartsWith("cr_mis_gravboat", StringComparison.InvariantCultureIgnoreCase); this.IsAbsorberSection = this.SectionName.Contains("_absorber") || this.SectionName.Contains("_absorbtion"); this.IsListener = this.SectionName.Contains("_listener"); this.IsFireControl = this.Title.Contains("CR_CMD_FIRECONTROL") || this.Title.Contains("CR_CMD_FIRE_CONTROL"); this.IsAIControl = this.Title.Contains("CR_CMD_AI") || this.Title.Contains("DN_CMD_AI"); this.SuulkaType = this.GetSuulkaType(this.SectionName); this.IsFreighter = ss.isFreighter; this.FreighterSpace = ss.FreighterSpace; this.isPolice = ss.isPolice; this.SlaveCapacity = ss.SlaveCapacity; this.isPropaganda = this.SectionName.StartsWith("cr_mis_propaganda", StringComparison.InvariantCultureIgnoreCase); this.IsAccelerator = this.SectionName.StartsWith("cr_mis_ngp", StringComparison.InvariantCultureIgnoreCase); this.IsLoaCube = this.SectionName.StartsWith("cr_mis_cube", StringComparison.InvariantCultureIgnoreCase); this.IsScavenger = this.FileName.Contains("mis_scavenger") || this.FileName.Contains("dn_mis_subjugator"); this.IsWraithAbductor = this.FileName.Contains("wraith_abductor"); this.Armor[1] = new Kerberos.Sots.Framework.Size() { X = ss.TopArmor.X, Y = ss.TopArmor.Y }; this.Armor[3] = new Kerberos.Sots.Framework.Size() { X = ss.BottomArmor.X, Y = ss.BottomArmor.Y }; this.Armor[2] = this.Armor[0] = new Kerberos.Sots.Framework.Size() { X = ss.SideArmor.X, Y = ss.SideArmor.Y }; this.Structure = ss.Struct; this.LowStruct = ss.StructDamageAmount; this.Mass = (float)ss.Mass; this.SavingsCost = ss.SavingsCost; this.ProductionCost = ss.ProductionCost; this.ColonizationSpace = ss.ColonizerSpace; this.TerraformingSpace = ss.TerraformingPoints; this.ConstructionPoints = ss.ConstructionPoints; this.ReserveSize = ss.BattleRiderReserveSize; this.RepairPoints = ss.RepairPoints; this.FtlSpeed = ss.FtlSpeed; this.NodeSpeed = ss.NodeSpeed; this.MissionTime = ss.MissionTime; this.LaunchDelay = ss.LaunchDelay; this.DockingDelay = ss.DockingDelay; this.Crew = ss.Crew; this.CrewRequired = ss.CrewRequired; this.Power = ss.Power; this.Supply = ss.Supply; this.ECM = ss.ECM; this.ECCM = ss.ECCM; this.CommandPoints = ss.CommandPoints; this.Signature = ss.Signature; this.TacticalSensorRange = ss.TacticalSensorRange; this.ShipExplosiveDamage = ss.DeathDamage; this.ShipExplosiveRange = ss.ExplosionRadius; this.PsionicPowerLevel = ss.PsionicPowerLevel; if ((double)this.TacticalSensorRange <= 0.0) { this.TacticalSensorRange = 20000f; } this.DamageEffect = new LogicalEffect() { Name = !string.IsNullOrEmpty(ss.DamageEffectPath) ? ss.DamageEffectPath : ShipSectionAsset.GetShipDefaultDeathEffect(this.Class, this.BattleRiderType) }; this.DeathEffect = new LogicalEffect() { Name = !string.IsNullOrEmpty(ss.DestroyedEffectPath) ? ss.DestroyedEffectPath : ShipSectionAsset.GetShipDefaultDeathEffect(this.Class, this.BattleRiderType) }; this.ReactorFailureDeathEffect = new LogicalEffect() { Name = ShipSectionAsset.GetReactorShieldFailureDeathEffect(this.Class, this.Type) }; this.ReactorCriticalDeathEffect = new LogicalEffect() { Name = ShipSectionAsset.GetReactorCriticalDeathEffect(this.Class, this.Type, withoutExtension) }; this.AbsorbedDeathEffect = new LogicalEffect() { Name = ShipSectionAsset.GetAbsorbedDeathEffect(this.Class, this.Type) }; this.StrategicSensorRange = ss.StrategicSensorRange; this.FleetSpeedModifier = ss.FleetSpeedModifier; if ((double)this.StrategicSensorRange <= 0.0) { this.StrategicSensorRange = assetdb.DefaultStratSensorRange; } this.StationType = ss.StationType != null ? SectionEnumerations.StationTypesWithInvalid[ss.StationType] : StationType.INVALID_TYPE; this.StationLevel = ss.StationLevel; this.isConstructor = ss.isConstructor; this.Maneuvering.LinearAccel = ss.Acceleration; this.Maneuvering.RotAccel.X = ss.RotationalAccelerationYaw; this.Maneuvering.RotAccel.Y = ss.RotationalAccelerationPitch; this.Maneuvering.RotAccel.Z = ss.RotationalAccelerationRoll; this.Maneuvering.Deacceleration = ss.Decceleration; this.Maneuvering.LinearSpeed = ss.LinearSpeed; this.Maneuvering.RotationSpeed = ss.RotationSpeed; HashSet <string> source1 = new HashSet <string>(); foreach (Kerberos.Sots.Data.ShipFramework.Tech tech in ss.Techs) { source1.Add(tech.Name); this.isDeepScan = this.isDeepScan || tech.Name == "CCC_Advanced_Sensors"; this.hasJammer = this.hasJammer || tech.Name == "CCC_Sensor_Jammer"; if (this.cloakingType == CloakingType.None) { switch (tech.Name) { case "SLD_Cloaking": this.cloakingType = CloakingType.Cloaking; continue; case "SLD_Improved_Cloaking": this.cloakingType = CloakingType.ImprovedCloaking; continue; default: continue; } } } List <HashSet <string> > stringSetList = new List <HashSet <string> >(); foreach (ShipOptionGroup shipOptionGroup in ss.ShipOptionGroups) { HashSet <string> stringSet = new HashSet <string>(); foreach (ShipOption shipOption in shipOptionGroup.ShipOptions) { stringSet.Add(shipOption.Name); } stringSetList.Add(stringSet); } switch (sectionClass) { case ShipClass.Cruiser: source1.Add("ENG_Cruiser_Construction"); break; case ShipClass.Dreadnought: source1.Add("ENG_Dreadnought_Construction"); break; case ShipClass.Leviathan: source1.Add("ENG_Leviathian_Construction"); break; } List <LogicalModuleMount> logicalModuleMountList = new List <LogicalModuleMount>(); foreach (ModuleMount module in ss.Modules) { LogicalModuleMount logicalModuleMount = new LogicalModuleMount() { Section = this }; logicalModuleMount.AssignedModuleName = module.AssignedModuleName; logicalModuleMount.ModuleType = module.Type; logicalModuleMount.NodeName = module.NodeName; logicalModuleMount.FrameX = module.FrameX; logicalModuleMount.FrameY = module.FrameY; logicalModuleMountList.Add(logicalModuleMount); } List <LogicalBank> banks = new List <LogicalBank>(); List <LogicalMount> logicalMountList = new List <LogicalMount>(); foreach (Bank bank in ss.Banks) { LogicalBank logicalBank = new LogicalBank() { TurretSize = (WeaponEnums.WeaponSizes)Enum.Parse(typeof(WeaponEnums.WeaponSizes), bank.Size), Section = this, Module = (LogicalModule)null, GUID = Guid.Parse(bank.Id), DefaultWeaponName = bank.DefaultWeapon }; logicalBank.TurretClass = (WeaponEnums.TurretClasses)Enum.Parse(typeof(WeaponEnums.TurretClasses), bank.Class); logicalBank.FrameX = bank.FrameX; logicalBank.FrameY = bank.FrameY; this.IsCarrier = this.IsCarrier || WeaponEnums.IsBattleRider(logicalBank.TurretClass); this.isMineLayer = this.isMineLayer || logicalBank.TurretClass == WeaponEnums.TurretClasses.Minelayer; banks.Add(logicalBank); foreach (Mount mount in bank.Mounts) { LogicalMount logicalMount = new LogicalMount() { Bank = logicalBank, NodeName = mount.NodeName, TurretOverload = mount.TurretOverload, BarrelOverload = mount.BarrelOverload, BaseOverload = mount.BaseOverload, FireAnimName = mount.SectionFireAnimation != null ? mount.SectionFireAnimation : "", ReloadAnimName = mount.SectionReloadAnimation != null ? mount.SectionReloadAnimation : "", Yaw = { Min = mount.YawMin, Max = mount.YawMax }, Pitch = { Min = mount.PitchMin, Max = mount.PitchMax } }; logicalMount.Pitch.Min = Math.Max(-90f, logicalMount.Pitch.Min); logicalMount.Pitch.Max = Math.Min(90f, logicalMount.Pitch.Max); logicalMountList.Add(logicalMount); } } if (this.IsCarrier) { this.CarrierType = ShipSectionAsset.GetCarrierType(banks); } List <string> stringList = new List <string>(); List <ShipSectionType> shipSectionTypeList = new List <ShipSectionType>(); foreach (ExcludedSection excludedSection in ss.ExcludedSections) { stringList.Add(excludedSection.Name); } foreach (ExcludedType excludedType in ss.ExcludedTypes) { ShipSectionType shipSectionType = ShipSectionType.Command; if (excludedType.Name == "Engine") { shipSectionType = ShipSectionType.Engine; } else if (excludedType.Name == "Mission") { shipSectionType = ShipSectionType.Mission; } shipSectionTypeList.Add(shipSectionType); } List <SectionEnumerations.PsionicAbility> psionicAbilityList = new List <SectionEnumerations.PsionicAbility>(); foreach (AvailablePsionicAbility psionicAbility in ss.PsionicAbilities) { psionicAbilityList.Add((SectionEnumerations.PsionicAbility)Enum.Parse(typeof(SectionEnumerations.PsionicAbility), psionicAbility.Name)); } foreach (IEnumerable <string> source2 in stringSetList) { this.ShipOptions.Add(source2.ToArray <string>()); } this.RequiredTechs = source1.ToArray <string>(); this.Banks = banks.ToArray(); this.Mounts = logicalMountList.ToArray(); this.Modules = logicalModuleMountList.ToArray(); this.ExcludeSections = stringList.ToArray(); this.ExcludeSectionTypes = shipSectionTypeList.ToArray(); this.PsionicAbilities = psionicAbilityList.ToArray(); if (!ss.RealShipClass.HasValue) { if (this.RealClass != RealShipClasses.BattleCruiser && this.RealClass != RealShipClasses.BattleShip) { this.RealClass = ObtainShipClassTypes.GetRealShipClass(this.Class, this.BattleRiderType, filename); } } else { this.RealClass = ss.RealShipClass.Value; } if (this.CombatAIType != SectionEnumerations.CombatAiType.VonNeumannDisc) { return; } this.cloakingType = CloakingType.ImprovedCloaking; }
private Carrier(string name, CarrierType type) { Name = name; Type = type; }
public static Carrier Of(string name, CarrierType type) => new Carrier(name, type);