Esempio n. 1
0
        public IEnumerator Build(OutputDetails details)
        {
            if (details == null)
            {
                throw new Exception("The details parameter cannot be null");
            }
            BuildInternal(null);
            yield return(new WaitUntil(() => !Building));

            yield return(null);

            details.Success          = Output.Success;
            details.OutputPath       = Output.OutputPath;
            details.CompilerMessages = Output.CompilerMessages;
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append("class PaymentResponse {\n");
            sb.Append("  Action: ").Append(Action).Append("\n");
            sb.Append("  AdditionalData: ").Append(AdditionalData.ToCollectionsString()).Append("\n");
            sb.Append("  Amount: ").Append(Amount).Append("\n");
            sb.Append("  Authentication: ").Append(Authentication.ToCollectionsString()).Append("\n");
            sb.Append("  Details: ").Append(Details.ObjectListToString()).Append("\n");
            sb.Append("  DonationToken: ").Append(DonationToken).Append("\n");
            sb.Append("  FraudResult: ").Append(FraudResult).Append("\n");
            sb.Append("  MerchantReference: ").Append(MerchantReference).Append("\n");
            sb.Append("  Order: ").Append(Order).Append("\n");
            sb.Append("  OutputDetails: ").Append(OutputDetails.ToCollectionsString()).Append("\n");
            sb.Append("  PaymentData: ").Append(PaymentData).Append("\n");
            sb.Append("  PspReference: ").Append(PspReference).Append("\n");
            sb.Append("  Redirect: ").Append(Redirect).Append("\n");
            sb.Append("  RefusalReason: ").Append(RefusalReason).Append("\n");
            sb.Append("  RefusalReasonCode: ").Append(RefusalReasonCode).Append("\n");
            sb.Append("  ResultCode: ").Append(ResultCode).Append("\n");
            sb.Append("}\n");
            return(sb.ToString());
        }
Esempio n. 3
0
        void BuildInternal(buildCompleteAction onComplete)
        {
            Output = null;
            if (!BuildDirectory.Exists)
            {
                BuildDirectory.Create();
            }
            var outputPath = PathUtilities.AddSlash(BuildDirectory.FullName) + FileName;
            //Debug.Log("Build Output Path = " + outputPath);
            //Debug.Log("Build Directory = " + BuildDirectory.FullName);
            //Debug.Log("Filename = " + FileName);
            AssemblyBuilder builder = new AssemblyBuilder(outputPath, Scripts.ToArray());

            builder.additionalDefines    = Defines.ToArray();
            builder.additionalReferences = References.ToArray();
            builder.buildTarget          = Target;
            builder.buildTargetGroup     = TargetGroup;
            builder.excludeReferences    = VerifyPaths(ExcludedReferences);
            builder.flags = Flags;
            Action <string, CompilerMessage[]> buildCompleteAction = null;
            var outputInfo = new OutputDetails();

            outputInfo.OutputPath = outputPath;
            buildCompleteAction   = (dest, messages) =>
            {
                //Debug.Log("---------Dest = " + dest);
                outputInfo.CompilerMessages = messages;
                Building = false;
                if (messages.Any(cm => cm.type == CompilerMessageType.Error))
                {
                    Debug.LogError("Error building assembly = " + FileName);
                    string assemblyReferences = "References: " + Environment.NewLine;
                    foreach (var reference in References.Concat(GetDefaultReferences()))
                    {
                        assemblyReferences += reference + Environment.NewLine;
                    }
                    Debug.LogError(assemblyReferences);

                    string assemblyExclusions = "Exclusions: " + Environment.NewLine;
                    foreach (var exclusion in ExcludedReferences)
                    {
                        assemblyExclusions += exclusion + Environment.NewLine;
                    }
                    Debug.LogError(assemblyExclusions);
                    outputInfo.Success = false;
                    foreach (var message in messages)
                    {
                        if (message.type == CompilerMessageType.Error)
                        {
                            Debug.LogError(message.message);
                        }
                        else
                        {
                            //Debug.LogWarning(message.message);
                        }
                    }
                }
                else
                {
                    outputInfo.Success = true;
                }
                //Debug.Log("_____SUCCESS = " + outputInfo.Success);
                builder.buildFinished -= buildCompleteAction;
                Output = outputInfo;
                if (onComplete != null)
                {
                    onComplete(Output);
                }
            };
            Building = true;
            try
            {
                builder.buildFinished += buildCompleteAction;
                builder.Build();
            }
            catch (Exception)
            {
                builder.buildFinished -= buildCompleteAction;
                Building = false;
                throw;
            }
        }