/// <summary>
		/// Virtual plugin called by coverage verification to validate the external policy. Used by UK motor policies to check there is an existing Xuber policy for the
		/// Genius policy and that the policy is verified
		/// </summary>
		/// <param name="component">Claim Header</param>
		/// <param name="point">Points Create,ComponentChange</param>
		/// <param name="pluginId">PlugIN ID</param>
		/// <param name="processParameters">The parameters for the virtual process. This should contain a UwHeaderData for the external policy</param>
		/// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns>
	    public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters)
		{
			PluginHelper<IBusinessComponent> pluginHelper = new PluginHelper<IBusinessComponent>(point, (ClaimHeader)component, new ProcessResultsCollection());

			if (pluginHelper.InvocationPoint == ProcessInvocationPoint.Virtual)
			{
				UWHeaderData policyHeaderData = processParameters.Parameters != null && processParameters.Parameters.Any() ? processParameters.Parameters[0] as UWHeaderData : null;

				if (policyHeaderData == null || string.IsNullOrEmpty(policyHeaderData.HeaderReference))
				{
					ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.ATTACHMENT_NOT_ALLOWED, ProcessInvocationPoint.Virtual, pluginHelper.Component);
				}
				else
				{
					// Get the verified policy header status from the application configuration
					var verifiedHeaderStatus = ClaimsBusinessLogicHelper.ResolveMandatoryConfig<string>(ConfigSetting_PolicyVerifiedHeaderStatus);

					// check the header status matches the verified status
					if (policyHeaderData.HeaderStatusCode != verifiedHeaderStatus)
					{
						ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.POLICYNOTVERIFIED_COVERAGEVERIFICATION_NOTALLOWED, ProcessInvocationPoint.Virtual, pluginHelper.Component, policyHeaderData.HeaderReference);
					}
				}
			}

			return pluginHelper.ProcessResults;
		}
Пример #2
0
        /// <summary>
        /// Set the Task Initial User and Due Date on the event as appliccable.
        /// </summary>
        /// <param name="component">Claim Event</param>
        /// <param name="point">Process Invocation Point</param>
        /// <param name="pluginId">unique plugin id</param>
        /// <param name="processParameters">Process parameters</param>
        /// <returns>collection of process results</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters)
        {
            PluginHelper<IBusinessComponent> pluginHelper = new PluginHelper<IBusinessComponent>(point, (ClaimEvent)component, new ProcessResultsCollection());

            switch (pluginHelper.InvocationPoint)
            {
                case ProcessInvocationPoint.Created:
                case ProcessInvocationPoint.Virtual:
                    {
                        this.UpdateTaskInitialUser(pluginHelper);
                        break;
                    }

                case ProcessInvocationPoint.PreValidationDefaulting:
                    {
                        // if a new event is added.
                        ClaimEvent clmEvent = (ClaimEvent)pluginHelper.Component;
                        if (clmEvent.IsNew)
                        {
                            this.SetTaskInitialUserForEvents(pluginHelper, clmEvent);
                        }

                        break;
                    }
            }

            return pluginHelper.ProcessResults;
        }
Пример #3
0
        /// <summary>
        /// Call on ClaimDetail Component
        /// </summary>
        /// <param name="component">Claim Detail</param>
        /// <param name="point">Points Create,Virtual,ComponentChange,PreCreateValidation</param>
        /// <param name="pluginId">PlugIn ID</param>
        /// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimDetail> pluginHelper = new PluginHelper<ClaimDetail>(point, component as ClaimDetail, new ProcessResultsCollection());

            switch (point)
            {
                // Set the claim title and check whether we default the isFunded? and Excess values from the Claim Header
                case ProcessInvocationPoint.Created:
                    this.SetClaimDetailTitle(pluginHelper.Component as ClaimDetail, point);
					this.InitializeExcess(pluginHelper.Component);
                    break;

                // Raise a claim inactivity event on the deatail if it's been closed; if this CD is attached at coverage level
                // attach all other unattached coverages to the same Policy Coverage
                case ProcessInvocationPoint.ComponentChange:
                    this.ClaimDetailStatusChangeEvent(pluginHelper);
                    this.AttacheAllClaimDetailsToCoverage(pluginHelper);
                    break;

                // Add estimate reviewed event, if applicable.
                case ProcessInvocationPoint.Virtual:
                    ClaimDetail cd = pluginHelper.Component as ClaimDetail;
                    this.CreateReviewEvent(cd);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Check External component exist or not
        /// </summary>
        /// <param name="pluginHelper">Plugin Helper</param>
        /// <param name="externalReference">External Reference</param>
        /// <param name="linkLevel">Policy Link Level</param>
        public void IsExternalPolicyChildComponentExists(PluginHelper<ClaimHeader> pluginHelper, string externalReference, StaticValues.PolicyLinkLevel linkLevel)
        {
            if (string.IsNullOrWhiteSpace(externalReference))
            {
                throw new ArgumentException("External Reference should not be null or empty.");
            }

            bool externalComponentExists = false;

            IUnderwritingService uwService = ObjectFactory.Resolve<IUnderwritingService>();

            switch (linkLevel)
            {
                case StaticValues.PolicyLinkLevel.Coverage:
                    externalComponentExists = uwService.GetCoverageIDByExternalReference(externalReference) > 0;
                    break;

                case StaticValues.PolicyLinkLevel.Section:
                    externalComponentExists = uwService.GetSectionIDByExternalReference(externalReference) > 0;
                    break;

                case StaticValues.PolicyLinkLevel.SectionDetail:
                    externalComponentExists = uwService.GetSectionDetailIDByExternalReference(externalReference) > 0;
                    break;
            }

            if (!externalComponentExists)
            {
                pluginHelper.AddError(ClaimConstants.POLICY_ATTACHMENT_NOT_ALLOWED);
            }
        }
        /// <summary>
        /// Validate AXAPolicy
        /// </summary>
        /// <param name="pluginHelper">Validate AXA Policy</param>
        /// <returns>return true if it is successfully validate</returns>
        private bool ValidateAXAPolicy(PluginHelper<ClaimDetail> pluginHelper)
        {
            // This validation ideally needs to run after the core PreCreateValidation which creates an XIAP policy if required
            ClaimDetail claimDetail = pluginHelper.Component;
            ClaimHeader claimHeader = claimDetail.ClaimHeader;
            // If Claim Detail is attached to a policy component, check policy is verified
            if ((claimDetail.UWSection != null || claimDetail.UWSectionDetail != null || claimDetail.UWCoverage != null)
                && !string.IsNullOrEmpty(claimHeader.PolicyExternalDataSource))
            {
                ProductClaimDefinition productClaimDef = claimHeader.GetProduct().ProductClaimDefinition;
                if (productClaimDef.ClaimHeaderAutomaticDeductibleProcessingMethod == (short)StaticValues.ClaimHeaderAutomaticDeductibleProcessingMethod.StandardClaimHeaderDeductible)
                {
                    if (!ClaimsBusinessLogicHelper.IsPolicyVerified(claimHeader))
                    {
                        ClaimsBusinessLogicHelper.AddFatalError(pluginHelper.ProcessResults, ClaimConstants.POLICYNOTVERIFIED_COVERAGEVERIFICATION_NOTALLOWED, ProcessInvocationPoint.PreCreateValidation, claimDetail, claimHeader.UWHeader.HeaderReference);
                    }
                    else
                    {
                        return true;
                    }
                }
            }

            return false;
        }
        /// <summary>
        /// This will validate correct combination of TypeOfLoss and CoverageType through decision table.
        /// </summary>
        /// <param name="component">Claim Header Component</param>
        /// <param name="point">Process Invocation Point Virtual</param>
        /// <param name="pluginId">plugin Id</param>
        /// <param name="processParameters">List of processParameters</param>
        /// <returns>Process Results Collection</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters)
        {
            StaticValues.PolicyLinkLevel policyLinkLevel;
            PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, component as ClaimHeader, new ProcessResultsCollection());
            switch (point)
            {
                case ProcessInvocationPoint.Virtual:
                    this.ValidateTypeOfLossAndCoverageTypeCombination(pluginHelper, (string)processParameters.Parameters[2]);
                    if (Enum.TryParse(processParameters.Parameters[1].ToString(), out policyLinkLevel))
                    {
                        this.IsExternalPolicyChildComponentExists(pluginHelper, (string)processParameters.Parameters[0], policyLinkLevel);
                    }
                    else
                    {
                        string messageTitle = string.Empty;
                        string messageBody = string.Empty;
                        MessageServiceFactory.GetMessageService().GetMessage(MessageConstants.InvalidValue, out messageTitle, out messageBody, ClaimConstants.POLICY_LINK_LEVEL);
                        throw new ArgumentException(messageBody);
                    }

                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Search the policy deductibles and excess records to see if there are any deductible reason codes 
        /// and attach them to the Transaction context in the form of the new DeductibleReasonCode data class.
        /// </summary>
        /// <param name="pluginHelper">Plugin Helper</param>
        private void LoadReasonCodes(PluginHelper<ClaimHeader> pluginHelper)
        {
            ClaimHeader claimHeader = pluginHelper.Component;
            // Only process if our Policy Product links to an external system (e.g. Genius) 
            // AND a Deductible Reason Code (ClaimHeaderAnalysisCode08) isn't already set
            if (!string.IsNullOrEmpty(claimHeader.PolicyExternalDataSource) && string.IsNullOrEmpty(claimHeader.ClaimHeaderAnalysisCode08))
            {
                ProductClaimDefinition productClaimDef = claimHeader.GetProduct().ProductClaimDefinition;
                // Check if we have Automatic Deductible Processing on the claim header set as Standard
                if (productClaimDef.ClaimHeaderAutomaticDeductibleProcessingMethod == (short)StaticValues.ClaimHeaderAutomaticDeductibleProcessingMethod.StandardClaimHeaderDeductible)
                {
                    IAXAClaimsQuery query = new AXAClaimsQueries();
                    // Get the reason codes for the Generic Data Type of "AND2" (Deductible) using the Policy Reference
                    Dictionary<string, List<CodeRow>> reasonCodes = query.GetPolicyReasonCodes(claimHeader.ProposedPolicyReference, "AND2");
                    if (reasonCodes.Count == 0)
                    {
                        // No Deductible Reason Codes found? Check for reason codes on AD Excess (AND3)
                        reasonCodes = query.GetPolicyReasonCodes(claimHeader.ProposedPolicyReference, "AND3");
                    }

                    if (reasonCodes.Count > 0)
                    {
                        // Add to the transaction context for the claim header.
                        DeductibleReasonCode deductibleReasonCode = new DeductibleReasonCode(reasonCodes);
                        claimHeader.Context.AddAttachedData(deductibleReasonCode);
                        claimHeader.Context.RegisterComponentChange(claimHeader.DataId, Xiap.Framework.Data.BusinessDataState.Modified);
                    }
                }
            }
        }
        /// <summary>
        /// Called on ClaimDetail Change Attachment. If we are creating a Claim Detail and one already exists, copy the details from there
        /// to prevent another call to Coverage Verification. If we are updating
        /// </summary>
        /// <param name="component">Claim Detail</param>
        /// <param name="point">ComponentChange, Create, Validation</param>
        /// <param name="pluginId">PlugIN ID</param>
        /// <returns>return Result Collection </returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimDetail> pluginHelper = new PluginHelper<ClaimDetail>(point, component as ClaimDetail, new ProcessResultsCollection());

            ClaimDetail clmDetail = component as ClaimDetail;
           
            switch (point)
            {
                // If another claim detail already exists, use the same Coverage Verification settings to avoid checking policy on Genius again.
                case ProcessInvocationPoint.Created:
                    this.LinkPolicytoClaimDetails(pluginHelper);
                    ClaimsBusinessLogicHelper.ValidateStartAndEndDate(pluginHelper);
                    break;

                // If we change a claim detail, enforce it is still attached to the same policy component.
                case ProcessInvocationPoint.ComponentChange:
                    if (pluginHelper.Component.PropertiesChanged.ContainsKey(ClaimConstants.POLICY_LINK_LEVEL))
                    {
                        ClaimsBusinessLogicHelper.ValidateAgainstExistingClaimDetails(pluginHelper);
                        ClaimsBusinessLogicHelper.ValidateStartAndEndDate(pluginHelper);
                    }

                    break;

                // Validates that the Claim Detail is always attached to the same Policy Component.
                case ProcessInvocationPoint.Validation:
                    ClaimsBusinessLogicHelper.ValidateAgainstExistingClaimDetails(pluginHelper);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Adding a claim detail in claim if claimant exist in name involvement.
        /// </summary>
        /// <param name="pluginHelper">plugin helper of component type</param>
        private void AddClaimDetailIfNIIsClaimaint(PluginHelper<ClaimNameInvolvement> pluginHelper)
        {
            ClaimNameInvolvement claimNameInvolvement = pluginHelper.Component as ClaimNameInvolvement;
            ClaimHeader claimHeader = null;
            if (claimNameInvolvement.ClaimInvolvement != null)
            {
                claimHeader = claimNameInvolvement.ClaimInvolvement.ClaimHeader;
            }

            if (claimHeader != null)
            {
                ProductVersion productVersion = claimHeader.GetProduct();

                // If NI is Claimaint then Adding new ClaimDetail and Linking it with Claimaint NI. 
                if (productVersion != null && productVersion.Product != null && productVersion.Product.Code == ClaimConstants.PRODUCT_LIABCLAIM && claimNameInvolvement.NameInvolvementType == (short)StaticValues.NameInvolvementType.AdditionalClaimant && claimNameInvolvement.NameInvolvementMaintenanceStatus == (short)StaticValues.ClaimNameInvolvementMaintenanceStatus.Latest)
                {
                    ClaimDetail claimDetail = claimHeader.AddNewClaimDetail(ClaimConstants.CLAIM_DETAILTYPECODE_LIA); // adding a claim detail of type Liability.
                    var claimDetailToClaimInvolvementLinks = claimDetail.ClaimDetailToClaimInvolvementLinks.ToList();
                    // create a name involvement link added with claim detail.
                    if (claimDetailToClaimInvolvementLinks != null && CoreBusinessLogic.ClaimsBusinessLogicHelper.CheckProductClaimDetailToComponentLinkExist(claimDetail.GetProduct(), claimNameInvolvement.ClaimInvolvement.ProductLinkableComponentID.Value))
                    {
                        ClaimDetailToClaimInvolvementLink claimDetailLink = new ClaimDetailToClaimInvolvementLink(claimNameInvolvement.ClaimInvolvement) { ClaimDetail = claimDetail };
                        claimDetailToClaimInvolvementLinks.Add(claimDetailLink);
                    }
                }
            }
        }
        /// <summary>
        /// Make sure a new Claim Detail links to the same Policy Component as an existing Claim Detail
        /// which avoids another call to Coverage Verification.
        /// </summary>
        /// <param name="pluginHelper">ClaimDetail type PlugIN</param>
        private void LinkPolicytoClaimDetails(PluginHelper<ClaimDetail> pluginHelper)
        {
            ClaimDetail claimDetail = pluginHelper.Component as ClaimDetail;
            ClaimHeader clmHeader = claimDetail.ClaimHeader;

            // Check if the Claim Detail is attached to a Policy component and validate it's correctly attached, if so.
            if (claimDetail.OriginalClaimDetailDataID == null && claimDetail.PolicyLinkLevel != null)
            {
                ClaimsBusinessLogicHelper.ValidateAgainstExistingClaimDetails(pluginHelper);
                return;
            }

            // claim Detail Change of Attachment Check: the Claim Detail isn't attached to a policy component. If there's an existing
            // claim detail, we attach to the same component.
            if (claimDetail.OriginalClaimDetailDataID == null && claimDetail.PolicyLinkLevel == null)
            {
                // Find the first current (not closed/cancelled) Claim Detail that is attached to a policy component.
                ClaimDetail attachedClaimDetail = clmHeader.ClaimDetails.Where(cd => cd.ClaimDetailInternalStatus != (short)StaticValues.ClaimDetailInternalStatus.ClosedCreatedinError
                    && cd.PolicyLinkLevel != null).FirstOrDefault();

                // Attach this claim detail to the existing attached claim detail we found on the current claim
                if (attachedClaimDetail != null)
                {
                    claimDetail.PolicySectionID = attachedClaimDetail.PolicySectionID;
                    claimDetail.PolicySectionDetailID = attachedClaimDetail.PolicySectionDetailID;
                    claimDetail.PolicyCoverageID = attachedClaimDetail.PolicyCoverageID;
                    claimDetail.PolicyLinkLevel = attachedClaimDetail.PolicyLinkLevel;
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Property change plugin if  Propert get change 
        /// </summary>
        /// <param name="component">Claim Name Involvement</param>
        /// <param name="point">Property Change</param>
        /// <param name="propertyName"> Name ID </param>
        /// <param name="oldValue">OLd Value </param>
        /// <param name="newValue">New Value </param>
        /// <param name="pluginId">Plugin ID </param>
        /// <returns>Process Results Collection</returns>
        public override ProcessResultsCollection PropertyChange(IBusinessComponent component, ProcessInvocationPoint point, string propertyName, object oldValue, object newValue, int pluginId)
        {
            PluginHelper<ClaimNameInvolvement> pluginHelper = new PluginHelper<ClaimNameInvolvement>(point, (ClaimNameInvolvement)component);
            ClaimsTransactionContext transactionContext = component.Context as ClaimsTransactionContext;
            ClaimNameInvolvement claimNameInvolvement = component as ClaimNameInvolvement;

            if (propertyName == ClaimNameInvolvement.NameIDFieldName)
            {
                if (newValue != null && (long)newValue != 0 && claimNameInvolvement != null && claimNameInvolvement.NameInvolvementType == (short)StaticValues.NameInvolvementType.MajorInsured && claimNameInvolvement.NameInvolvementMaintenanceStatus == (short)StaticValues.ClaimNameInvolvementMaintenanceStatus.Latest)
                {
                    INameUsage assdNameUsage = null;
                    ClaimHeader claimHeader = claimNameInvolvement.ClaimInvolvement.ClaimHeader;
                    DateTime date = DateTime.Today;
                    if (claimHeader.DateOfLossFrom != null)
                    {
                        date = claimHeader.DateOfLossFrom.Value;
                    }

                    assdNameUsage = transactionContext.GetNameUsage((long)newValue, claimNameInvolvement.NameUsageTypeCode, date);
                    
                    // UI Label = Client-Specific Claim Data Set; For Insured
                    if (assdNameUsage == null || string.IsNullOrEmpty(assdNameUsage.CustomCode01))   
                    {
                        return null;
                    }

                    AddandRemoveClientSpecficCodes(assdNameUsage, claimHeader);
                }
            }

            this.UpdateNameInvolvementField(pluginHelper, propertyName, oldValue, newValue, transactionContext);
            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Defaults the Transaction Header Reference for the claim.
        /// </summary>
        /// <param name="pluginHelper">The plugin helper, which contains the ClaimTransactionHeader Component.</param>
        private static void ClaimTransactionHeaderReferenceDefaulting(PluginHelper<ClaimTransactionHeader> pluginHelper)
        {
            ClaimTransactionHeader claimTransHeader = pluginHelper.Component;
            ClaimHeader claimHeader = claimTransHeader.ClaimHeader;

            // Use the XIAP Core Reference Allocation process to allocate a 10-char reference from "0000000001" to "9999999999"
            claimTransHeader.ClaimTransactionHeaderReference = LockManager.AllocateReference(string.Empty, ReferenceType.ClaimTransactionHeaderReference, string.Empty, "0000000001", 10, "9999999999", false);
        }
 /// <summary>
 ///  Add Mandatory Field validation
 /// </summary>
 /// <param name="pluginHelper">Plugin helper</param>
 private void PerformPreCoverageVerificationVehicleTypeValidations(PluginHelper<ClaimHeader> pluginHelper)
 {
     // Vehicle type if product is Motor
     if (string.IsNullOrWhiteSpace(pluginHelper.Component.ClaimHeaderAnalysisCode09))
     {
         ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, MessageConstants.MANDATORY_FIELD_NOT_SPECIFIED, ProcessInvocationPoint.Virtual, pluginHelper.Component, pluginHelper.Component.ClaimHeaderAnalysisCode09Field.Title);
     }
 }
 /// <summary>
 /// Validate ClaimHeaderStatus
 /// </summary>
 /// <param name="pluginHelper">ClaimHeader type helper PlugIN </param>
 private void ValidateClaimHeaderStatus(PluginHelper<ClaimHeader> pluginHelper)
 {
     ClaimHeader claimHeader = pluginHelper.Component as ClaimHeader;
     if (ClaimsBusinessLogicHelper.ValidateClaimHeaderStatusCode(claimHeader, null) == false)
     {
         pluginHelper.ProcessResults = ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.LITIGATION_OR_RECOVERY_NOT_ALLOWED, pluginHelper.InvocationPoint, pluginHelper.Component);
     }
 }
Пример #15
0
 /// <summary>
 /// Call on ClaimInvolvement Deletion
 /// Sets the Name on the Claim Detail Title on the deletion of the AdditionalClaimant and Driver type Claim Name Involvements
 /// </summary>
  /// <param name="pluginHelper">ClaimInvolvement type claim helper</param>
  /// <param name="point"> Delete Point</param>
  private void OnDelete(PluginHelper<ClaimInvolvement> pluginHelper, Xiap.Framework.ProcessInvocationPoint point)
  {
      pluginHelper.Component.ClaimDetailToClaimInvolvementLinks
            .ForEach(c =>
            {
                ClaimsBusinessLogicHelper.SetClaimDetailTitle(c, point);
            });
  }
        /// <summary>
        /// Update Driver Excess Amount
        /// </summary>
        /// <param name="pluginHelper">pluginH elper</param>
        private void UpdateDriverExcessAmount(PluginHelper<IBusinessComponent> pluginHelper)
        {
            ClaimHeader claimHeader = pluginHelper.Component as ClaimHeader;

            // Get the current Driver Name Involvement on the Claim
            var driverNameInvolvement = ClaimsProcessHelper.GetLatestNameInvolvement(claimHeader, StaticValues.NameInvolvementType.Driver);

            if (driverNameInvolvement != null)
            {
                // Cast our driverNameInvolvement to an object
                ClaimNameInvolvement objDriverNameInvolvement = driverNameInvolvement as ClaimNameInvolvement;

                // If we have a driver NI, and 'Apply Driver Excess?' is true (CustomBoolean04)
                // and it's been changed to true in this update OR we have changed the amount of excess for the driver 
                // entered against the Name Involvement (CustomNumeric10)
                if (objDriverNameInvolvement != null && objDriverNameInvolvement.CustomBoolean04 == true && (objDriverNameInvolvement.DirtyPropertyList.ContainsKey(ClaimConstants.CUSTOM_BOOLEAN_04) || objDriverNameInvolvement.DirtyPropertyList.ContainsKey(ClaimConstants.CUSTOM_NUMERIC_10)))   
                {
                    DateTime? driverDOB;
                    // If claim header has 'Large Loss' (CustomBoolean03) unchecked AND the Driver has a value against excess amount
                    // AND the driver's date of birth is entered AND we haven't applied driver XS already (CustomBoolean03)?
                    if (claimHeader.CustomBoolean03.GetValueOrDefault(false) == false   
                    && objDriverNameInvolvement.CustomNumeric10.GetValueOrDefault() != 0   
                    && this.IsDriverDateOfBirthEmpty(objDriverNameInvolvement, out driverDOB) == false
                    && objDriverNameInvolvement.CustomBoolean03 != true)   
                    {
                        // Was the driver under 26 when the date of loss occurred?
                        if (this.DriverAgeDifferenceLessThan26(driverDOB.Value, claimHeader.DateOfLossFrom.Value) == true)
                        {
                            // If the 'excess' value on the ClaimHeader is not yet set, set it from the Driver Name Involvement excess value.
                            // Else, add the current driver's excess value to the claim header value.
                            if (claimHeader.CustomNumeric10 == null)   
                            {
                                claimHeader.CustomNumeric10 = objDriverNameInvolvement.CustomNumeric10.Value;   // UI Label = Excess
                            }
                            else
                            {
                                claimHeader.CustomNumeric10 += objDriverNameInvolvement.CustomNumeric10.Value;   // UI Label = Excess
                            }

                            // Note we've applied the excess for this driver.
                            objDriverNameInvolvement.CustomBoolean03 = true;   // UI Label = Driver XS Applied?
                        }
                        else
                        {
                            // Don't apply the driver excess
                            objDriverNameInvolvement.CustomBoolean04 = false;   // UI Label = Apply Driver Excess?
                        }
                    }
                    else
                    {
                        // Don't apply the driver excess
                        objDriverNameInvolvement.CustomBoolean04 = false;   // UI Label = Apply Driver Excess?
                    }
                }
            }
        }
Пример #17
0
        /// <summary>
        /// Processes the component on the Virtual invocation point.
        /// </summary>
        /// <param name="component">The component.</param>
        /// <param name="point">The point.</param>
        /// <param name="pluginId">The plugin identifier.</param>
        /// <returns>Process Results Collection</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, (ClaimHeader)component, new ProcessResultsCollection());
            if (point == ProcessInvocationPoint.Virtual)
            {
                this.LoadReasonCodes(pluginHelper);
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Update Name involvement when created.
        /// </summary>
        /// <param name="pluginHelper">plugin helper of component type</param>
        private void UpdateNameInvolvement(PluginHelper<ClaimNameInvolvement> pluginHelper)
        {
            ClaimNameInvolvement claimNameInvolvement = pluginHelper.Component as ClaimNameInvolvement;

            // If name involvement is Major Insured, set claimHeader.CustomReference01 = Client Reference, in Name Involvement of claim name involevement of CustomReference01
            if (claimNameInvolvement.NameInvolvementType == (short)StaticValues.NameInvolvementType.MajorInsured)
            {
                ClaimHeader claimHeader = claimNameInvolvement.ClaimInvolvement.ClaimHeader;
                claimNameInvolvement.CustomReference01 = claimHeader.CustomReference01;   // UI Label = Reference
            }
        }
        /// <summary>
        /// Perform Validation for Coverage verifaction process for Motor Product
        /// </summary>
        /// <param name="component"> Claim Header</param>
        /// <param name="point">Process Invocation Point Virtual </param>
        /// <param name="pluginId">plugin Id</param>
        /// <returns>Process Results Collection</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, (ClaimHeader)component, new ProcessResultsCollection());

            if (point == ProcessInvocationPoint.Virtual)
            {
                this.PerformPreCoverageVerificationVehicleTypeValidations(pluginHelper);
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// This method assigns next transaction reference to Claim Transaction Reference (ClaimTransactionHeaderReference of ClaimTransactionHeader) 
        /// </summary>
        /// <param name="component">Claim Transaction Header</param>
        /// <param name="point">Process Invocation Point</param>
        /// <param name="pluginId">plugin Id</param>
        /// <returns>Process Results Collection</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimTransactionHeader> pluginHelper = new PluginHelper<ClaimTransactionHeader>(point, (ClaimTransactionHeader)component, new ProcessResultsCollection());
            ProcessResultsCollection processResults = new ProcessResultsCollection();

            if (point == ProcessInvocationPoint.Virtual)
            {
                ClaimTransactionHeaderReferenceDefaulting(pluginHelper);
            }

            return processResults;
        }
        /// <summary>
        /// Raise an error if there is an unauthorised claim amount on reserve, payment, Recovery reserve or recovery receipts
        /// for this claim.
        /// </summary>
        /// <param name="pluginHelper">collection of process results</param>
        private void PreCreateValidateClaimTransactionHeader(PluginHelper<ClaimTransactionHeader> pluginHelper)
        {
            ClaimTransactionHeader claimTransHeader = pluginHelper.Component;
            if (claimTransHeader != null)
            {
                ClaimHeader claimHeader = claimTransHeader.ClaimHeader;
                if (claimHeader != null)
                {
                    StaticValues.ClaimTransactionSource claimTransactionSource = (StaticValues.ClaimTransactionSource)claimTransHeader.ClaimTransactionSource;
                    switch (claimTransactionSource)
                    {
                        case StaticValues.ClaimTransactionSource.Reserve:
                            if (ClaimsBusinessLogicHelper.HasUnauthorisedReserveAndPayment(claimHeader))
                            {
                                // if there is any unauthorised reserve or payment exists, add error.
                                ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.CLAIM_AMOUNT_UNAUTHORISED, pluginHelper.InvocationPoint, pluginHelper.Component, StaticValues.ClaimTransactionSource.Reserve.ToString(), claimHeader.ClaimReference);
                            }

                            if (ClaimsBusinessLogicHelper.HasUnauthorisedRecoveryReceipt(claimHeader))
                            {
                                // if there is any unauthorised recovery receipt exists, add error.
                                ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.CLAIM_AMOUNT_UNAUTHORISED, pluginHelper.InvocationPoint, pluginHelper.Component, StaticValues.ClaimTransactionSource.RecoveryReceipt.ToString(), claimHeader.ClaimReference);
                            }

                            break;
                        case StaticValues.ClaimTransactionSource.Payment:
                            if (ClaimsBusinessLogicHelper.HasUnauthorisedReserve(claimHeader))
                            {
                                // if there is any unauthorised reserve exists, add error.
                                ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.CLAIM_AMOUNT_UNAUTHORISED, pluginHelper.InvocationPoint, pluginHelper.Component, StaticValues.ClaimTransactionSource.Reserve.ToString(), claimHeader.ClaimReference);
                            }

                            break;
                        case StaticValues.ClaimTransactionSource.RecoveryReserve:
                            if (ClaimsBusinessLogicHelper.HasUnauthorisedRecoveryReceipt(claimHeader))
                            {
                                // if there is any unauthorised recovery receipt exists, add error.
                                ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.CLAIM_AMOUNT_UNAUTHORISED, pluginHelper.InvocationPoint, pluginHelper.Component, StaticValues.ClaimTransactionSource.RecoveryReceipt.ToString(), claimHeader.ClaimReference);
                            }

                            break;
                        case StaticValues.ClaimTransactionSource.RecoveryReceipt:
                            if (ClaimsBusinessLogicHelper.HasUnauthorisedReserve(claimHeader))
                            {
                                // if there is any unauthorised reserve exists, add error.
                                ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.CLAIM_AMOUNT_UNAUTHORISED, pluginHelper.InvocationPoint, pluginHelper.Component, StaticValues.ClaimTransactionSource.Reserve.ToString(), claimHeader.ClaimReference);
                            }

                            break;
                    }
                }
            }
        }
Пример #22
0
       /// <summary>
        /// Change claimdetail title
       /// </summary>
        /// <param name="pluginHelper">ClaimInvolvement type claim helper</param>
        /// <param name="point">Component Change</param>
        private void ChangeCDTitle(PluginHelper<ClaimInvolvement> pluginHelper, ProcessInvocationPoint point)
        {
            ClaimInvolvement claimInvolvement = pluginHelper.Component as ClaimInvolvement;

            claimInvolvement.ClaimNameInvolvements.ForEach(x =>
            {
                if (x.DirtyPropertyList.Any(y => y.Key == ClaimConstants.Name_ID))
                {
                    UpdateClaimDetailTitle(point, claimInvolvement);
                    return;
                }
            });
        }
Пример #23
0
        /// <summary>
        /// Cal on ClaimLitigation
        /// </summary>
        /// <param name="component">Claim Litigation</param>
        /// <param name="point">Pre Create Validation</param>
        /// <param name="pluginId">Plug In ID</param>
        /// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            ClaimLitigation claimLitigation = (ClaimLitigation)component;
            PluginHelper<ClaimLitigation> pluginHelper = new PluginHelper<ClaimLitigation>(point, claimLitigation, new ProcessResultsCollection());
            switch (point)
            {
                case ProcessInvocationPoint.PreCreateValidation:
                    this.ValidateClaimHeaderStatus(pluginHelper);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Do PreCreate Validation
        /// Synopsis: Validate the XIAP policy 
        /// Extract of E&amp;D data will only occur once. If another uncancelled CD already exists which is linked to policy component
        /// then it is assumed that E&amp;D data has already been retrieved.
        /// </summary>
        /// <param name="pluginHelper">ClaimDetail type PluginHelper</param>
        private void PreCreateValidate(PluginHelper<ClaimDetail> pluginHelper)
        {
            ClaimDetail claimDetail = pluginHelper.Component;
            ClaimHeader claimHeader = claimDetail.ClaimHeader;
            // This check is finding an existing, non-cancelled or finalised Claim Detail, meaning policy is already validated for E&D
            if (claimHeader.ClaimDetails.Where(a => a.PolicyLinkLevel > 0 && a.DataId != claimDetail.DataId && a.ClaimDetailInternalStatus
                != (short?)StaticValues.ClaimDetailInternalStatus.ClosedCreatedinError && a.ClaimDetailInternalStatus != (short?)StaticValues.ClaimDetailInternalStatus.Finalized).Any())
            {
                return;
            }

            this.ValidateAXAPolicy(pluginHelper);
        }
        /// <summary>
        /// Call in ClaimDetailToClaimInvolvementLinkPlugin basically it set ClaimDetail title.
        /// </summary>
        /// <param name="component">ClaimDetail To ClaimInvolvementLink</param>
        /// <param name="point">Point Create,Deletes</param>
        /// <param name="pluginId">PlugIN ID</param>
        /// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
             PluginHelper<ClaimDetailToClaimInvolvementLink> pluginHelper = new PluginHelper<ClaimDetailToClaimInvolvementLink>(point, component as ClaimDetailToClaimInvolvementLink, new ProcessResultsCollection());
             switch (point)
             {
                 case ProcessInvocationPoint.Created:
                 case ProcessInvocationPoint.Delete:
                     ClaimsBusinessLogicHelper.SetClaimDetailTitle(pluginHelper.Component as ClaimDetailToClaimInvolvementLink, point);
                     break;
             }

             return pluginHelper.ProcessResults;
        }
Пример #26
0
        /// <summary>
        /// Invocation point of plugin 
        /// </summary>
        /// <param name="component">Claim Detail component</param>
        /// <param name="point"> Invocation point Virtual</param>
        /// <param name="pluginId">Plugin Id </param>
        /// <returns>Result collection</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimDetail> pluginHelper = new PluginHelper<ClaimDetail>(point, component as ClaimDetail, new ProcessResultsCollection());

            switch (point)
            {
                case ProcessInvocationPoint.Virtual:
                    ClaimDetail cd = pluginHelper.Component as ClaimDetail;
                    this.CreateReviewEvent(cd);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Call on claimheaderstatus change
        /// </summary>
        /// <param name="component">Claim Header</param>
        /// <param name="point">Point Validation</param>
        /// <param name="pluginId">PlugIN ID</param>
        /// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, (ClaimHeader)component, new ProcessResultsCollection());

            switch (point)
            {
                case ProcessInvocationPoint.Validation:
                    this.ValidateClaimHeaderStatus(pluginHelper);
                    this.NotifierValidation(pluginHelper);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// Call on ClaimDetail Component
        /// </summary>
        /// <param name="component">Claim Detail</param>
        /// <param name="point">PreCreate Validation</param>
        /// <param name="pluginId">PlugIn ID</param>
        /// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns>  
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimDetail> pluginHelper = new PluginHelper<ClaimDetail>(point, component as ClaimDetail, new ProcessResultsCollection());

            switch (point)
            {
                // Make sure we only bother to get E&D from the policy once, by checking for existing, similar claim details.
                case ProcessInvocationPoint.PreCreateValidation:
                    this.PreCreateValidate(pluginHelper);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        /// <summary>
        /// This will validate whether VehicleType and Class3Code of section detail of selected coverage are equal.
        /// </summary>
        /// <param name="component">Claim Header</param>
        /// <param name="point">Process Invocation Point</param>
        /// <param name="pluginId">plugin Id</param>
        /// <param name="processParameters">Process Parameters</param>
        /// <returns>ProcessResults Collection</returns>
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters)
        {
            PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, component as ClaimHeader, new ProcessResultsCollection());

            switch (point)
            {
                case ProcessInvocationPoint.Virtual:
                    this.AreVehicleTypeAndGeniusVehicleCategoryEqual(pluginHelper, processParameters.Parameters[3].ToString(), processParameters.Parameters[4].ToString());
                    break;
            }


            return pluginHelper.ProcessResults;
        }
Пример #30
0
        public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId)
        {
            PluginHelper<ClaimDocument> pluginHelper = new PluginHelper<ClaimDocument>(point, component as ClaimDocument, new ProcessResultsCollection());

            switch (point)
            {
                case ProcessInvocationPoint.PreValidationDefaulting:
                    this.UpdateDocumentData(component);
                    this.SetDefaultValues(component);
                    break;
            }

            return pluginHelper.ProcessResults;
        }
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_Power"), _bold_label, GUILayout.Width(labelWidth));//"Power"
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_Consumption"), _bold_label, GUILayout.Width(labelWidth));//"Overal Consumption"
            GUILayout.Label(((combined_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.0000")) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_CarbonDioxideAvailable"), _bold_label, GUILayout.Width(labelWidth));//"Carbon Dioxide Available"
            GUILayout.Label(_availableCarbondioxideMass.ToString("0.0000") + " mT / " + _maxCapacityCarbondioxideMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_CarbonDioxideConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));//"Carbon Dioxide Consumption Rate"
            GUILayout.Label((_carbondioxide_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_HydrogenAvailable"), _bold_label, GUILayout.Width(labelWidth));//"Hydrogen Available"
            GUILayout.Label(_availableHydrogenMass.ToString("0.0000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_HydrogenConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));//"Hydrogen Consumption Rate"
            GUILayout.Label((_hydrogen_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_MethaneStorage"), _bold_label, GUILayout.Width(labelWidth));//"Methane Storage"
            GUILayout.Label(_spareRoomMethaneMass.ToString("0.0000") + " mT / " + _maxCapacityMethaneMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_MethaneProductionRate"), _bold_label, GUILayout.Width(labelWidth));//"Methane Production Rate"
            GUILayout.Label((_methane_production_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_OxygenStorage"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Storage"
            GUILayout.Label(_spareRoomOxygenMass.ToString("0.0000") + " mT / " + _maxCapacityOxygenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_SabatierReactor_OxygenProductionRate"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Production Rate"
            GUILayout.Label((_oxygen_production_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #32
0
 /// <summary>
 /// Creates the tool strip button.
 /// </summary>
 /// <returns></returns>
 public override ToolStripItem CreateToolStripButton( )
 {
     ToolStripButton = PluginHelper.CreateToolStripButtonForPlugin(this);
     CommandRunner_DeviceStateChanged(this, new DeviceEventArgs(CommandRunner.Instance.DefaultDevice, CommandRunner.Instance.State));
     return(ToolStripButton);
 }
Пример #33
0
 public Plugin_HistoryData_Csv(PluginHelper pluginHelper)
 {
     this.pluginHelper = pluginHelper;
 }
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_Power"), _bold_label, GUILayout.Width(labelWidth));//"Power"
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(_effectiveMaxPower), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_Consumption"), _bold_label, GUILayout.Width(labelWidth));//"Regolith Consumption"
            GUILayout.Label(((_regolithConsumptionRate * GameConstants.SECONDS_IN_HOUR).ToString("0.000000")) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_Available"), _bold_label, GUILayout.Width(labelWidth));//"Regolith Available"
            GUILayout.Label(dAvailableRegolithMass.ToString("0.000000") + " mT / " + dMaxCapacityRegolithMass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_Output"), _bold_label, GUILayout.Width(labelWidth));//"Output"
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_ResourceName"), _bold_label, GUILayout.Width(labelWidth));   //"Resource Name"
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_SpareRoom"), _bold_label, GUILayout.Width(labelWidth));      //"Spare Room"
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_MaximumStorage"), _bold_label, GUILayout.Width(labelWidth)); //"Maximum Storage"
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_RegolithProcessor_ProductionRate"), _bold_label, GUILayout.Width(labelWidth)); //"Production Rate"
            GUILayout.EndHorizontal();

            DisplayResourceOutput(_strHydrogenResourceName, dSpareRoomHydrogenMass, dMaxCapacityHydrogenMass, _dHydrogenProductionRate);
            DisplayResourceOutput(_stDeuteriumResourceName, dSpareRoomDeuteriumMass, dMaxCapacityDeuteriumMass, _dDeuteriumProductionRate);
            DisplayResourceOutput(_strLiquidHelium3ResourceName, dSpareRoomHelium3Mass, dMaxCapacityHelium3Mass, _dLiquidHelium3ProductionRate);
            DisplayResourceOutput(_strLiquidHelium4ResourceName, dSpareRoomHelium4Mass, dMaxCapacityHelium4Mass, _dLiquidHelium4ProductionRate);
            DisplayResourceOutput(_strMonoxideResourceName, dSpareRoomMonoxideMass, dMaxCapacityMonoxideMass, _dMonoxideProductionRate);
            DisplayResourceOutput(_strDioxideResourceName, dSpareRoomDioxideMass, dMaxCapacityDioxideMass, _dDioxideProductionRate);
            DisplayResourceOutput(_strMethaneResourceName, dSpareRoomMethaneMass, dMaxCapacityMethaneMass, _dMethaneProductionRate);
            DisplayResourceOutput(_strNitrogenResourceName, dSpareRoomNitrogenMass, dMaxCapacityNitrogenMass, _dNitrogenProductionRate);
            DisplayResourceOutput(_strWaterResourceName, dSpareRoomWaterMass, dMaxCapacityWaterMass, _dWaterProductionRate);
        }
Пример #35
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_Power"), _bold_label, GUILayout.Width(labelWidth));//"Power"
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(_effectiveMaxPower), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_OveralConsumption"), _bold_label, GUILayout.Width(labelWidth));                                                                            //"Overal Consumption"
            GUILayout.Label(((_consumptionRate * GameConstants.SECONDS_IN_HOUR).ToString("0.00000")) + " mT/" + Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_perhour"), _value_label, GUILayout.Width(valueWidth)); //hour
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_HydrogenAvailable"), _bold_label, GUILayout.Width(labelWidth));//"Hydrogen Available"
            GUILayout.Label(_availableHydrogenMass.ToString("0.00000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_HydrogenConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));                                                                              //"Hydrogen Consumption Rate"
            GUILayout.Label((_hydrogen_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.00000") + " mT/" + Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_perhour"), _value_label, GUILayout.Width(valueWidth)); //hour
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_OxygenAvailable"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Available"
            GUILayout.Label(_availableOxygenMass.ToString("0.00000") + " mT / " + _maxCapacityOxygenMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_OxygenConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));                                                                              //"Oxygen Consumption Rate"
            GUILayout.Label((_oxygen_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.00000") + " mT/" + Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_perhour"), _value_label, GUILayout.Width(valueWidth)); //hour
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_HydrogenPeroxideStorage"), _bold_label, GUILayout.Width(labelWidth));//"Hydrogen Peroxide Storage"
            GUILayout.Label(_spareRoomHydrogenPeroxideMass.ToString("0.00000") + " mT / " + _maxCapacityPeroxideMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_HydrogenPeroxideProductionRate"), _bold_label, GUILayout.Width(labelWidth));                                                                               //"Hydrogen Peroxide Production Rate"
            GUILayout.Label((_hydrogen_peroxide_production_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.00000") + " mT/" + Localizer.Format("#LOC_KSPIE_AnthraquinoneProcessor_perhour"), _value_label, GUILayout.Width(valueWidth)); //hour
            GUILayout.EndHorizontal();
        }
Пример #36
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(_effectiveMaxPower), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Water Available", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_availableWaterMass.ToString("0.00000") + " mT / " + _maxCapacityWaterMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Consumption Storage Ratio", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((_consumptionStorageRatio * 100).ToString("0.00000") + "%"), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Water Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_water_consumption_rate * GameConstants.HOUR_SECONDS).ToString("0.00000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomHydrogenMass.ToString("0.00000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_hydrogen_production_rate * GameConstants.HOUR_SECONDS).ToString("0.00000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Oxygen Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomOxygenMass.ToString("0.00000") + " mT / " + _maxCapacityOxygenMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Oxygen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_oxygen_production_rate * GameConstants.HOUR_SECONDS).ToString("0.00000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #37
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Overal Consumption", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((combined_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.0000")) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Oxygen Available", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_availableOxygenMass.ToString("0.0000") + " mT / " + _maxCapacityOxygenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Oxygen Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_oxygen_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Methane Available", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_availableMethaneMass.ToString("0.0000") + " mT / " + _maxCapacityMethaneMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Methane Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_methane_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomHydrogenMass.ToString("0.0000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_hydrogen_production_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Carbon Monoxide Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomMonoxideMass.ToString("0.0000") + " mT / " + _maxCapacityMonoxideMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Carbon Monoxide Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_monoxide_production_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #38
0
        public void UpdateGUI()
        {
            if (_bold_label == null)
            {
                _bold_label           = new GUIStyle(GUI.skin.label);
                _bold_label.fontStyle = FontStyle.Bold;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Current Consumption", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((_fixedConsumptionRate / TimeWarp.fixedDeltaTime * GameConstants.HOUR_SECONDS).ToString("0.0000")) + " mT/hour", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Consumption Storage Ratio", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((_consumptionStorageRatio * 100).ToString("0.0000") + "%"), GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Water Available", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_availableWaterMass.ToString("0.0000") + " mT / " + _maxCapacityWaterMass.ToString("0.0000") + " mT", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Water Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_water_consumption_rate * GameConstants.HOUR_SECONDS).ToString("0.0000") + " mT/hour", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("CarbonMonoxide Available", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_availableMonoxideMass.ToString("0.0000") + " mT / " + _maxCapacityMonoxideMass.ToString("0.0000") + " mT", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("CarbonMonoxide Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_monoxide_consumption_rate * GameConstants.HOUR_SECONDS).ToString("0.0000") + " mT/hour", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("CarbonDioxide Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomDioxideMass.ToString("0.0000") + " mT / " + _maxCapacityDioxideMass.ToString("0.0000") + " mT", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("CarbonDioxide Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_dioxide_production_rate * GameConstants.HOUR_SECONDS).ToString("0.0000") + " mT/hour", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomHydrogenMass.ToString("0.00000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.00000") + " mT", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_dioxide_production_rate * GameConstants.HOUR_SECONDS).ToString("0.00000") + " mT/hour", GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #39
0
        public override void OnStart(StartState state)
        {
            var rcs = part.FindModulesImplementing <ModuleRCSFX>();
            int fm;

            attachedRCS = (rcsIndex >= rcs.Count) ? null : rcs[rcsIndex];

            if (partMass == 0)
            {
                partMass = part.mass;
            }

            oldPowerEnabled = powerEnabled;
            efficiencyStr   = efficiency.ToString("P1");

            if (!string.IsNullOrEmpty(AnimationName))
            {
                rcsStates = PluginHelper.SetUpAnimation(AnimationName, part);
            }

            // Only allow propellants that are compatible with this engine type
            propellants.Clear();
            foreach (var propellant in ElectricEnginePropellant.GetPropellantsEngineForType(
                         type))
            {
                if ((propellant.SupportedEngines & type) != 0)
                {
                    propellants.Add(propellant);
                }
            }

            if (propellants.Count < 1)
            {
                Debug.LogError("[KSPI]: No propellants available for RCS type " + type + "!");
            }

            delayedVerificationPropellant = true;
            // find correct fuel mode index
            if (!string.IsNullOrEmpty(fuel_mode_name))
            {
                foreach (var propellant in propellants)
                {
                    if (propellant.PropellantName == fuel_mode_name)
                    {
                        Debug.Log("[KSPI]: ElectricRCSController set fuel mode " +
                                  fuel_mode_name);
                        CurrentPropellant = propellant;
                        break;
                    }
                }
            }

            if (CurrentPropellant != null && (fm = propellants.IndexOf(CurrentPropellant)) >= 0)
            {
                fuel_mode = fm;
            }
            SetPropellant(true);

            base.OnStart(state);

            powerConsumptionStrField           = Fields[nameof(powerConsumptionStr)];
            powerConsumptionStrField.guiActive = showConsumption;

            maxStoredPower = bufferMult * maxThrust * powerMult * maxIsp * PhysicsGlobals.GravitationalAcceleration / (efficiency * 1000.0);
        }
Пример #40
0
 public bool Deserialize(string SerializedData)
 {
     return(PluginHelper.DeserializeSettings(SerializedData, out _settings));
 }
        public override void OnUpdate()
        {
            if (!CheatOptions.InfiniteElectricity && !isChargingForJumpstart && !isSwappingFuelMode && getCurrentResourceDemand(ResourceManager.FNRESOURCE_MEGAJOULES) > getStableResourceSupply(ResourceManager.FNRESOURCE_MEGAJOULES) && getResourceBarRatio(ResourceManager.FNRESOURCE_MEGAJOULES) < 0.1 && IsEnabled && !fusion_alert)
            {
                ScreenMessages.PostScreenMessage("Warning: Fusion Reactor plasma heating cannot be guaranteed, reducing power requirements is recommended.", 10.0f, ScreenMessageStyle.UPPER_CENTER);
                fusion_alert = true;
            }
            else
            {
                fusion_alert = false;
            }

            if (isChargingField.guiActive)
            {
                accumulatedChargeStr = PluginHelper.getFormattedPowerString(accumulatedElectricChargeInMW, "0.0", "0.000")
                                       + " / " + PluginHelper.getFormattedPowerString(StartupPower, "0.0", "0.000");
            }
            else if (part.vessel.geeForce > startupMaximumGeforce)
            {
                accumulatedChargeStr = part.vessel.geeForce.ToString("0.000") + "g > " + startupMaximumGeforce + "g";
            }
            else
            {
                accumulatedChargeStr = String.Empty;
            }

            accumulatedChargeStrField.guiActive = plasma_ratio < 1;

            electricPowerMaintenance = PluginHelper.getFormattedPowerString(power_consumed) + " / " + PluginHelper.getFormattedPowerString(LaserPowerRequirements);

            if (startupAnimation != null && !initialized)
            {
                if (IsEnabled)
                {
                    //animationScalar = startupAnimation.GetScalar;
                    if (animationStarted == 0)
                    {
                        startupAnimation.ToggleAction(new KSPActionParam(KSPActionGroup.Custom01, KSPActionType.Activate));
                        animationStarted = Planetarium.GetUniversalTime();
                    }
                    else if (!startupAnimation.IsMoving())
                    {
                        startupAnimation.ToggleAction(new KSPActionParam(KSPActionGroup.Custom01, KSPActionType.Deactivate));
                        animationStarted = 0;
                        initialized      = true;
                        isDeployed       = true;
                    }
                }
                else // Not Enabled
                {
                    // continiously start
                    startupAnimation.ToggleAction(new KSPActionParam(KSPActionGroup.Custom01, KSPActionType.Activate));
                    startupAnimation.ToggleAction(new KSPActionParam(KSPActionGroup.Custom01, KSPActionType.Deactivate));
                }
            }
            else if (startupAnimation == null)
            {
                isDeployed = true;
            }

            // call base class
            base.OnUpdate();
        }
        /// <summary>
        /// Gets the test result.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <returns>The test result.</returns>
        internal TestResult GetTestResult(IMessageLogger logger)
        {
            TestResult result = new TestResult(this.TestCase)
            {
                ComputerName = this.UnitTestResult.computerName,
                DisplayName  = string.Concat(this.UnitTest.TestMethod.className, ".", this.UnitTest.TestMethod.name)
            };

            DateTime startTime;

            if (DateTime.TryParse(this.UnitTestResult.startTime, out startTime))
            {
                result.StartTime = startTime;
            }

            TimeSpan duration;

            if (TimeSpan.TryParse(this.UnitTestResult.duration, out duration))
            {
                result.Duration = duration;
            }

            DateTime endTime;

            if (DateTime.TryParse(this.UnitTestResult.endTime, out endTime))
            {
                result.EndTime = endTime;
            }

            result.Outcome = ConvertTestOutcome(this.UnitTestResult.outcome);

            if (this.UnitTestResult.Items != null)
            {
                object[] items = this.UnitTestResult.Items;
                foreach (object item in items)
                {
                    OutputType output = item as OutputType;
                    if (output?.ErrorInfo == null)
                    {
                        continue;
                    }

                    OutputTypeErrorInfo errorInfo = output.ErrorInfo;

                    XmlNode[] messageNode = errorInfo.Message as XmlNode[];
                    if (messageNode != null)
                    {
                        result.ErrorMessage = messageNode[0].InnerText;
                    }

                    XmlNode[] stackTraceNode = errorInfo.StackTrace as XmlNode[];
                    if (stackTraceNode != null)
                    {
                        result.ErrorStackTrace = stackTraceNode[0].InnerText;
                    }
                }
            }

            PluginHelper pluginHelper = new PluginHelper(
                logger,
                this.TestCase.Source,
                result);

            pluginHelper.TransformTestResults();

            return(result);
        }
Пример #43
0
        /// <summary>获取提供者工厂</summary>
        /// <param name="assemblyFile"></param>
        /// <param name="className"></param>
        /// <returns></returns>
        protected static DbProviderFactory GetProviderFactory(String assemblyFile, String className)
        {
            var name     = Path.GetFileNameWithoutExtension(assemblyFile);
            var linkName = name;

            if (Runtime.Is64BitProcess)
            {
                linkName += "64";
            }
            var ver = Environment.Version;

            if (ver.Major >= 4)
            {
                linkName += "Fx" + ver.Major + ver.Minor;
            }
            // 有些数据库驱动不区分x86/x64,并且逐步以Fx4为主,所以来一个默认
            linkName += ";" + name;

#if __CORE__
            linkName = "st_" + name;
#endif

            var type = PluginHelper.LoadPlugin(className, null, assemblyFile, linkName);

            // 反射实现获取数据库工厂
            var file   = assemblyFile;
            var plugin = NewLife.Setting.Current.GetPluginPath();
            file = plugin.CombinePath(file);

            // 如果还没有,就写异常
            if (type == null && !File.Exists(file))
            {
                throw new FileNotFoundException("缺少文件" + file + "!", file);
            }

            if (type == null)
            {
                XTrace.WriteLine("驱动文件{0}无效或不适用于当前环境,准备删除后重新下载!", assemblyFile);

                try
                {
                    File.Delete(file);
                }
                catch (UnauthorizedAccessException) { }
                catch (Exception ex) { XTrace.Log.Error(ex.ToString()); }

                type = PluginHelper.LoadPlugin(className, null, file, linkName);

                // 如果还没有,就写异常
                if (!File.Exists(file))
                {
                    throw new FileNotFoundException("缺少文件" + file + "!", file);
                }
            }
            if (type == null)
            {
                return(null);
            }

            var asm = type.Assembly;
            if (DAL.Debug)
            {
                DAL.WriteLog("{2}驱动{0} 版本v{1}", asm.Location, asm.GetName().Version, className.TrimEnd("Client", "Factory"));
            }

            var field = type.GetFieldEx("Instance");
            if (field == null)
            {
                return(Activator.CreateInstance(type) as DbProviderFactory);
            }

            return(Reflect.GetValue(null, field) as DbProviderFactory);
        }
Пример #44
0
 public StepPreparer(UpdateStepGetter_CnStock updateStepGetter_CnStock, PluginHelper pluginHelper)
 {
     this.updateStepGetter_CnStock = updateStepGetter_CnStock;
     this.pluginHelper             = pluginHelper;
 }
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Ammonia Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_ammonia_consumption_mass_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_hydrogen_production_mass_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Nitrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((_nitrogen_production_mass_rate * GameConstants.SECONDS_IN_HOUR).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            var spare_capacity_nitrogen = _part.GetResourceSpareCapacity(InterstellarResourcesConfiguration.Instance.Nitrogen);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Spare Capacity Nitrogen", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(spare_capacity_nitrogen.ToString("0.000"), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
 public OperationDataResult <string> GetLatestVersion()
 {
     return(new OperationDataResult <string>(true, PluginHelper.GetLatestRepositoryVersion("microting", "eform-angular-frontend")));
 }
Пример #47
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Alumina Consumption Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_alumina_consumption_rate * GameConstants.HOUR_SECONDS + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Aluminium Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_aluminium_production_rate * GameConstants.HOUR_SECONDS + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Oxygen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_oxygen_production_rate * GameConstants.HOUR_SECONDS + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #48
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_Power"), _bold_label, GUILayout.Width(labelWidth));//"Power"
            GUILayout.Label(PluginHelper.GetFormattedPowerString(CurrentPower) + "/" + PluginHelper.GetFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_Available"), _bold_label, GUILayout.Width(labelWidth));//"Heavy Water Available"
            GUILayout.Label(_availableHeavyWaterMass.ToString("0.0000") + " mT / " + _maxCapacityHeavyWaterMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_ConsumptionStorageRatio"), _bold_label, GUILayout.Width(labelWidth));//"Consumption Storage Ratio"
            GUILayout.Label(((_consumptionStorageRatio * 100).ToString("0.0000") + "%"), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_HeavyWaterConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));//"Heavy Water Consumption Rate"
            GUILayout.Label((_heavyWaterConsumptionRate * GameConstants.SecondsInHour).ToString("0.0000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_DeuteriumStorage"), _bold_label, GUILayout.Width(labelWidth));//"Deuterium Storage"
            GUILayout.Label(_spareRoomDeuteriumMass.ToString("0.00000") + " mT / " + _maxCapacityDeuteriumMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_DeuteriumProductionRate"), _bold_label, GUILayout.Width(labelWidth));//"Deuterium Production Rate"
            GUILayout.Label((_deuteriumProductionRate * GameConstants.SecondsInHour).ToString("0.0000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_OxygenStorage"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Storage"
            GUILayout.Label(_spareRoomOxygenMass.ToString("0.0000") + " mT / " + _maxCapacityOxygenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_HeavyWaterElectroliser_OxygenProductionRate"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Production Rate"
            GUILayout.Label((_oxygenProductionRate * GameConstants.SecondsInHour).ToString("0.0000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #49
0
        public void Execute(IPluginExecutionContext context)
        {
            DateTime inicioExecucao = DateTime.Now;

            DomainService.Organizacao = new Organizacao(context.OrganizationName);
            DynamicEntity entity = null;

            Log log = new Log(DomainService.Organizacao);

            log.Nome = "Log de Alteração";
            log.Acao = this.NomeDaAcao(context.MessageName);

            try
            {
                PluginHelper.LogEmArquivo(context, "INICIO;", inicioExecucao.ToString(), "");
                switch (context.MessageName)
                {
                case MessageName.Create:
                case MessageName.Update:
                    if (!context.InputParameters.Properties.Contains("Target") &&
                        !(context.InputParameters.Properties["Target"] is DynamicEntity))
                    {
                        return;
                    }

                    entity            = context.InputParameters.Properties["Target"] as DynamicEntity;
                    log.DiagnosticoId = PluginHelper.GetEntityId(context);
                    break;

                case MessageName.Assign:
                    if (!context.PostEntityImages.Contains("Image") &&
                        !(context.PostEntityImages["Image"] is DynamicEntity))
                    {
                        return;
                    }

                    entity            = context.PostEntityImages["Image"] as DynamicEntity;
                    log.DiagnosticoId = PluginHelper.GetEntityId(context);
                    break;

                case MessageName.Delete:
                    if (!context.PreEntityImages.Contains("Image") &&
                        !(context.PreEntityImages["Image"] is DynamicEntity))
                    {
                        return;
                    }
                    entity = context.PreEntityImages["Image"] as DynamicEntity;
                    break;
                }

                if (entity == null)
                {
                    throw new InvalidPluginExecutionException("Nenhuma DynamicEntity encontrada!");
                }


                // Quem alterou
                DomainService.RepositoryUsuario.Colunas = new string[] { "fullname" };
                Usuario usuario = DomainService.RepositoryUsuario.Retrieve(context.InitiatingUserId);

                log.Alteracoes  = this.MensageDeAlteracoes(entity);
                log.Alteracoes += string.Format("\n\nAlterado por: {0} \nRegistro: {1}", usuario.NomeCompleto, PluginHelper.GetEntityId(context));

                DomainService.RepositoryLog.Create(log);
                PluginHelper.LogEmArquivo(context, "FIM;", inicioExecucao.ToString(), DateTime.Now.ToString());
            }
            catch (Exception ex)
            {
                LogService.GravaLog(ex, TipoDeLog.PluginNew_diagnostico_ocorrencia, "LogAsync - " + context.MessageName);
                PluginHelper.LogEmArquivo(context, "ERRO;", inicioExecucao.ToString(), DateTime.Now.ToString());
                throw new InvalidPluginExecutionException(ex.Message, ex);
            }
        }
Пример #50
0
 void LoadPlugin(byte[] bytes)
 {
     new Thread(() =>
     {
         Assembly asm;
         try
         {
             asm = Assembly.Load(bytes);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         foreach (Type type in asm.GetTypes())
         {
             if (type.IsSubclassOf(typeof(XPlugin)))
             {
                 try
                 {
                     XPlugin plugin = Activator.CreateInstance(type) as XPlugin;
                     if (GlobalProperties.InitializedPlugins.ContainsKey(plugin.Guid))
                     {
                         DialogResult res = MessageBox.Show(string.Format("{0} contains the same GUID as {1}. Remove plugin and continue?", plugin.Name, GlobalProperties.InitializedPlugins[plugin.Guid].Name), "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                         if (res == System.Windows.Forms.DialogResult.No)
                         {
                             plugin = null;
                             continue;
                         }
                         else
                         {
                             GlobalProperties.RawPlugins.Remove(plugin.Guid);
                             GlobalProperties.InitializedPlugins.Remove(plugin.Guid);
                             for (int i = 0; i < lstPlugins.Items.Count; i++)
                             {
                                 bool found = false;
                                 Invoke((MethodInvoker) delegate
                                 {
                                     if ((lstPlugins.Items[i].Tag as XPlugin).Guid == plugin.Guid)
                                     {
                                         lstPlugins.Items[i].Remove();
                                         found = true;
                                     }
                                 });
                                 if (found)
                                 {
                                     break;
                                 }
                             }
                         }
                     }
                     GlobalProperties.RawPlugins.Add(plugin.Guid, bytes);
                     GlobalProperties.InitializedPlugins.Add(plugin.Guid, plugin);
                     ListViewItem item = new ListViewItem(new string[] { plugin.Name, plugin.Description, plugin.Version.ToString(), plugin.Author });
                     item.Tag          = plugin;
                     Invoke((MethodInvoker) delegate
                     {
                         lstPlugins.Items.Add(item);
                         PluginHelper.pluginChanged();
                     });
                     modified = true;
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
             }
         }
     }).Start();
 }
Пример #51
0
        public override void OnUpdate()
        {
            base.OnUpdate();
            if (!isSwappingFuelMode && (!CheatOptions.InfiniteElectricity && GetDemandStableSupply(ResourceSettings.Config.ElectricPowerInMegawatt) > 1.01 &&
                                        GetResourceBarRatio(ResourceSettings.Config.ElectricPowerInMegawatt) < 0.25) && IsEnabled && !fusion_alert)
            {
                fusionAlertFrames++;
            }
            else
            {
                fusion_alert      = false;
                fusionAlertFrames = 0;
            }

            if (fusionAlertFrames > 2)
            {
                ScreenMessages.PostScreenMessage(Localizer.Format("#LOC_KSPIE_TokomakFusionReator_PostMsg1"), 0.1f, ScreenMessageStyle.UPPER_CENTER);//"Warning: Fusion Reactor plasma heating cannot be guaranteed, reducing power requirements is recommended."
                fusion_alert = true;
            }

            electricPowerMaintenance = PluginHelper.GetFormattedPowerString(power_consumed) + " / " + PluginHelper.GetFormattedPowerString(heatingPowerRequirements);
        }
Пример #52
0
 public override void UpdateEditorPowerOutput()
 {
     base.UpdateEditorPowerOutput();
     required_reactor_ratio   = 1.0;
     electricPowerMaintenance = PluginHelper.GetFormattedPowerString(HeatingPowerRequirements) + " / " + PluginHelper.GetFormattedPowerString(HeatingPowerRequirements);
 }
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(_effectiveMaxPower), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Intake Lqd Consumption", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((_intakeLqdConsumptionRate * GameConstants.HOUR_SECONDS).ToString("0.0000")) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((currentResourceProductionRate * GameConstants.HOUR_SECONDS).ToString("0.0000")) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            foreach (OceanicResource resource in localResources)
            {
                if (resource == null || resource.ResourceName == null)
                {
                    continue;                                                                                                                                         // this resource does not interest us anymore
                }
                var resourceDensityUI = PartResourceLibrary.Instance.GetDefinition(resource.ResourceName).density;                                                    // gets the resource density (needed for the next two lines)
                var spareRoomLabel    = (_part.GetConnectedResources(resource.ResourceName).Sum(r => r.maxAmount - r.amount) * resourceDensityUI).ToString("0.0000"); // gets spare room for the resource on the whole vessel
                var maxCapacityLabel  = (_part.GetConnectedResources(resource.ResourceName).Sum(p => p.maxAmount) * resourceDensityUI).ToString("0.0000");            // gets the max capacity for the resource on the whole vessel

                double percentage;
                double resourcePercentageUI;

                if (resourcePercentages.TryGetValue(resource.ResourceName, out percentage))
                {
                    resourcePercentageUI = percentage;
                }
                else
                {
                    Debug.Log("[KSPI] - UI could not access resourcePercentage from dictionary, setting to zero");
                    resourcePercentageUI = 0;
                }

                var productionRateLabel = (((_intakeLqdConsumptionRate * resourcePercentageUI) * TimeWarp.fixedDeltaTime / resourceDensityUI) * GameConstants.HOUR_SECONDS).ToString("0.0000"); // dirty calculation of the production rate cast to string and made hourly

                if (resourcePercentageUI > 0)                                                                                                                                                   // if the percentage is zero, there's no processing going on, so we don't really need to print it here
                {
                    // calculations done, print it out - first the Storage
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(resource.ResourceName + " Storage", _bold_label, GUILayout.Width(labelWidth));
                    GUILayout.Label(spareRoomLabel + " mT / " + maxCapacityLabel + " mT", _value_label, GUILayout.Width(valueWidth));
                    GUILayout.EndHorizontal();

                    // next print out the production rates
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(resource.ResourceName + "Production Rate", _bold_label, GUILayout.Width(labelWidth));
                    GUILayout.Label((resourcePercentageUI * 100) + "% " + productionRateLabel + " mT/hour", _value_label, GUILayout.Width(valueWidth));
                    GUILayout.EndHorizontal();
                }
            }
        }
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            if (_remaining_seconds > 0 && !double.IsNaN(_remaining_seconds) && !double.IsInfinity(_remaining_seconds))
            {
                int hrs  = (int)(_remaining_seconds / 3600);
                int mins = (int)((_remaining_seconds - hrs * 3600) / 60);
                int secs = (hrs * 60 + mins) % ((int)(_remaining_seconds / 60));
                GUILayout.Label("Time Remaining", _bold_label, GUILayout.Width(labelWidth));
                GUILayout.Label(hrs + " hours " + mins + " minutes " + secs + " seconds", _value_label, GUILayout.Width(valueWidth));
            }
            GUILayout.EndHorizontal();
        }
Пример #55
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_Power"), _bold_label, GUILayout.Width(labelWidth));//"Power"
            GUILayout.Label(PluginHelper.GetFormattedPowerString(CurrentPower) + "/" + PluginHelper.GetFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_OveralConsumption"), _bold_label, GUILayout.Width(labelWidth));//"Overal Consumption"
            GUILayout.Label(((_combinedConsumptionRate * GameConstants.SecondsInHour).ToString("0.0000")) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_OxygenAvailable"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Available"
            GUILayout.Label(_availableOxygenMass.ToString("0.0000") + " mT / " + _maxCapacityOxygenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_OxygenConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));//"Oxygen Consumption Rate"
            GUILayout.Label((_oxygenConsumptionRate * GameConstants.SecondsInHour).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_MethaneAvailable"), _bold_label, GUILayout.Width(labelWidth));//"Methane Available"
            GUILayout.Label(_availableMethaneMass.ToString("0.0000") + " mT / " + _maxCapacityMethaneMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_ConsumptionRate"), _bold_label, GUILayout.Width(labelWidth));//"Methane Consumption Rate"
            GUILayout.Label((_methaneConsumptionRate * GameConstants.SecondsInHour).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_HydrogenStorage"), _bold_label, GUILayout.Width(labelWidth));//"Hydrogen Storage"
            GUILayout.Label(_spareRoomHydrogenMass.ToString("0.0000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_HydrogenProductionRate"), _bold_label, GUILayout.Width(labelWidth));//"Hydrogen Production Rate"
            GUILayout.Label((_hydrogenProductionRate * GameConstants.SecondsInHour).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_CarbonMonoxideStorage"), _bold_label, GUILayout.Width(labelWidth));//"Carbon Monoxide Storage"
            GUILayout.Label(_spareRoomMonoxideMass.ToString("0.0000") + " mT / " + _maxCapacityMonoxideMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("#LOC_KSPIE_MethanePyrolysis_CarbonMonoxideProductionRate"), _bold_label, GUILayout.Width(labelWidth));//"Carbon Monoxide Production Rate"
            GUILayout.Label((_monoxideProductionRate * GameConstants.SecondsInHour).ToString("0.000") + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
Пример #56
0
 /// <summary>
 /// Get all plugins
 /// </summary>
 /// <returns></returns>
 public IEnumerable <PluginInformationModel> GetAll()
 {
     return(PluginHelper.GetPlugins());
 }
Пример #57
0
        /// <summary>获取提供者工厂</summary>
        /// <param name="assemblyFile"></param>
        /// <param name="className"></param>
        /// <param name="ignoreError"></param>
        /// <returns></returns>
        public static DbProviderFactory GetProviderFactory(String assemblyFile, String className, Boolean ignoreError = false)
        {
            try
            {
                var links = new List <String>();
                var name  = Path.GetFileNameWithoutExtension(assemblyFile);
                if (!name.IsNullOrEmpty())
                {
                    var linkName = name;
#if __CORE__
                    if (Runtime.Linux)
                    {
                        linkName += Environment.Is64BitProcess ? ".linux-x64" : ".linux-x86";
                        links.Add(linkName);
                        links.Add(name + ".linux");
                    }
                    else
                    {
                        linkName += Environment.Is64BitProcess ? ".win-x64" : ".win-x86";
                        links.Add(linkName);
                        links.Add(name + ".win");
                    }

                    linkName = name + ".st";
#else
                    if (Environment.Is64BitProcess)
                    {
                        linkName += "64";
                    }
                    var ver = Environment.Version;
                    if (ver.Major >= 4)
                    {
                        linkName += "Fx" + ver.Major + ver.Minor;
                    }
#endif
                    links.Add(linkName);
                    // 有些数据库驱动不区分x86/x64,并且逐步以Fx4为主,所以来一个默认
                    if (!links.Contains(name))
                    {
                        links.Add(name);
                    }
                }

                var type = PluginHelper.LoadPlugin(className, null, assemblyFile, links.Join(","));

                // 反射实现获取数据库工厂
                var file   = assemblyFile;
                var plugin = NewLife.Setting.Current.GetPluginPath();
                file = plugin.CombinePath(file);

                // 如果还没有,就写异常
                if (type == null)
                {
                    if (assemblyFile.IsNullOrEmpty())
                    {
                        return(null);
                    }
                    if (!File.Exists(file))
                    {
                        throw new FileNotFoundException("缺少文件" + file + "!", file);
                    }
                }

                if (type == null)
                {
                    XTrace.WriteLine("驱动文件{0}无效或不适用于当前环境,准备删除后重新下载!", assemblyFile);

                    try
                    {
                        File.Delete(file);
                    }
                    catch (UnauthorizedAccessException) { }
                    catch (Exception ex) { XTrace.Log.Error(ex.ToString()); }

                    type = PluginHelper.LoadPlugin(className, null, file, links.Join(","));

                    // 如果还没有,就写异常
                    if (!File.Exists(file))
                    {
                        throw new FileNotFoundException("缺少文件" + file + "!", file);
                    }
                }
                if (type == null)
                {
                    return(null);
                }

                var asm = type.Assembly;
                if (DAL.Debug)
                {
                    DAL.WriteLog("{2}驱动{0} 版本v{1}", asm.Location, asm.GetName().Version, name ?? className.TrimEnd("Client", "Factory"));
                }

                var field = type.GetFieldEx("Instance");
                if (field == null)
                {
                    return(Activator.CreateInstance(type) as DbProviderFactory);
                }

                return(Reflect.GetValue(null, field) as DbProviderFactory);
            }
            catch
            {
                if (ignoreError)
                {
                    return(null);
                }

                throw;
            }
        }
Пример #58
0
        public override void UpdateGUI()
        {
            base.UpdateGUI();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Power", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(PluginHelper.getFormattedPowerString(CurrentPower) + "/" + PluginHelper.getFormattedPowerString(PowerRequirements), _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Solar Wind Available", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_availableSolarWindMass.ToString("0.000000") + " mT / " + _maxCapacitySolarWindMass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Solar Wind Consumption", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label((((float)_solar_wind_consumption_rate * GameConstants.SECONDS_IN_HOUR).ToString()) + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomHydrogenMass.ToString("0.000000") + " mT / " + _maxCapacityHydrogenMass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Hydrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_hydrogen_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Deuterium Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomDeuteriumMass.ToString("0.000000") + " mT / " + _maxCapacityDeuteriumMass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Deuterium Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_deuterium_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Helium-3 Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomHelium3Mass.ToString("0.000000") + " mT / " + _maxCapacityHelium3Mass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Helium-3 Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_liquid_helium3_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Helium-4 Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomHelium4Mass.ToString("0.000000") + " mT / " + _maxCapacityHelium4Mass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Helium-4 Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_liquid_helium4_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Carbon Monoxide Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomMonoxideMass.ToString("0.000000") + " mT / " + _maxCapacityMonoxideMass.ToString("0.0000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Carbon Monoxide Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_monoxide_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Nitrogen Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomNitrogenMass.ToString("0.000000") + " mT / " + _maxCapacityNitrogenMass.ToString("0.000000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Nitrogen Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_nitrogen_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Neon Storage", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(_spareRoomNeonMass.ToString("0.00000") + " mT / " + _maxCapacityNeonMass.ToString("0.00000") + " mT", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Neon Production Rate", _bold_label, GUILayout.Width(labelWidth));
            GUILayout.Label(((float)_neon_production_rate * GameConstants.SECONDS_IN_HOUR).ToString() + " mT/hour", _value_label, GUILayout.Width(valueWidth));
            GUILayout.EndHorizontal();
        }
        public override void OnUpdate()
        {
            base.OnUpdate();
            if (!isSwappingFuelMode && (!CheatOptions.InfiniteElectricity && getDemandStableSupply(ResourceManager.FNRESOURCE_MEGAJOULES) > 1.01 && getResourceBarRatio(ResourceManager.FNRESOURCE_MEGAJOULES) < 0.25) && IsEnabled && !fusion_alert)
            {
                fusionAlertFrames++;
            }
            else
            {
                fusion_alert      = false;
                fusionAlertFrames = 0;
            }

            if (fusionAlertFrames > 2)
            {
                ScreenMessages.PostScreenMessage("Warning: Fusion Reactor plasma heating cannot be guaranteed, reducing power requirements is recommended.", 0.1f, ScreenMessageStyle.UPPER_CENTER);
                fusion_alert = true;
            }

            electricPowerMaintenance = PluginHelper.getFormattedPowerString(power_consumed) + " / " + PluginHelper.getFormattedPowerString(heatingPowerRequirements);
        }
Пример #60
0
        public ActionResult Create()
        {
            CarouselModel model = new CarouselModel();

            return(View(PluginHelper.GetViewPath(this.GetType(), "Create"), model));
        }