private void MenuItem7_Click(object sender, EventArgs e)
        {
            IEnumerator enumerator = null;

            Transition.Transition transition      = new Transition.Transition();
            TransitionTable       transitionTable = new TransitionTable();

            if (this.Select_Group_A != null)
            {
                if (this.Select_Group_B != null)
                {
                    if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
                    {
                        #region Label Formatting

                        //Edit The '↔' To Change How You Want Your Labels To Look
                        //Original 'To' Was The Transition Keyword For The Labels
                        //This Keyword Was Changed To Arrows To Show The Back And Forth Between Transitions
                        string str = string.Format("{0} ↔ {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));

                        #endregion

                        string      str1        = string.Format("{0}Data\\Engine\\Templates\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                        XmlDocument xmlDocument = new XmlDocument();
                        transitionTable.Clear();
                        try
                        {
                            xmlDocument.Load(str1);
                            try
                            {
                                enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    XmlElement            current     = (XmlElement)enumerator.Current;
                                    string                attribute   = current.GetAttribute("Pattern");
                                    string                attribute1  = current.GetAttribute("MapTile");
                                    string                attribute2  = current.GetAttribute("StaticTile");
                                    Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                                    transitionTable.Add(transition1);
                                }
                            }
                            finally
                            {
                                if (enumerator is IDisposable)
                                {
                                    ((IDisposable)enumerator).Dispose();
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            ProjectData.SetProjectError(exception);
                            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        transitionTable.Save(string.Format("{0}.xml", str));
                    }
                }
            }
        }
示例#2
0
            public FullTrustEvaluationStrategy(string expression, VsaEngine engine)
                : base(engine)
            {
                //
                // Equivalent to following in JScript:
                // new Function('$context', 'with ($context) return (' + expression + ')');
                //
                // IMPORTANT! Leave the closing parentheses surrounding the
                // return expression on a separate line. This is to guard
                // against someone using a double-slash (//) to comment out
                // the remainder of an expression.
                //

                const string context = "$context";

                _function = LateBinding.CallValue(
                    DefaultThisObject(engine),
                    engine.LenientGlobalObject.Function,
                    new object[] {
                    /* parameters */ context + ",$", /* body... */ @"
                        with (" + context + @") {
                            return (
                                " + expression + @"
                            );
                        }"
                },
                    /* construct */ true, /* brackets */ false, engine);
            }
        /// <summary>
        /// Get instance of content creator
        /// </summary>
        /// <param name="context">
        /// Commerce context
        /// </param>
        /// <returns>
        /// Instnace of content creator
        /// </returns>
        public static INotificationContentCreator NotificationContentCreator(CommerceContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context", "Parameter config cannot be null.");
            }

            if (notificationContentCreator == null)
            {
                if (context.Config.UseMockPartnerDependencies)
                {
                    //TODO: create mock
                    notificationContentCreator = LateBinding.BuildObjectFromLateBoundAssembly <INotificationContentCreator>("MockNotificationContentCreator",
                                                                                                                            LateBoundMocksAssemblyTypes);
                }
                else
                {
                    notificationContentCreator = new NotificationContentCreator()
                    {
                        TemplateServiceBaseAddress = CloudConfigurationManager.GetSetting("Lomo.Commerce.TemplateServiceUri"),
                        Logger = context.Log
                    };
                }
            }

            return(notificationContentCreator);
        }
示例#4
0
        public static object LateCall(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack, bool IgnoreReturn)
        {
            if (Arguments == null)
            {
                Arguments = Symbols.NoArguments;
            }
            if (ArgumentNames == null)
            {
                ArgumentNames = Symbols.NoArgumentNames;
            }
            if (TypeArguments == null)
            {
                TypeArguments = Symbols.NoTypeArguments;
            }
            Symbols.Container BaseReference = Type == null ? new Symbols.Container(Instance) : new Symbols.Container(Type);
            if (BaseReference.IsCOMObject)
            {
                return(LateBinding.InternalLateCall(Instance, Type, MemberName, Arguments, ArgumentNames, CopyBack, IgnoreReturn));
            }
            BindingFlags InvocationFlags = BindingFlags.InvokeMethod | BindingFlags.GetProperty;

            if (IgnoreReturn)
            {
                InvocationFlags |= BindingFlags.IgnoreReturn;
            }
            OverloadResolution.ResolutionFailure Failure = OverloadResolution.ResolutionFailure.None;
            return(NewLateBinding.CallMethod(BaseReference, MemberName, Arguments, ArgumentNames, TypeArguments, CopyBack, InvocationFlags, true, ref Failure));
        }
示例#5
0
 internal static object InternalLateIndexGet(object Instance, object[] Arguments, string[] ArgumentNames, bool ReportErrors, ref OverloadResolution.ResolutionFailure Failure)
 {
     Failure = OverloadResolution.ResolutionFailure.None;
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container BaseReference = new Symbols.Container(Instance);
     if (BaseReference.IsCOMObject)
     {
         return(LateBinding.LateIndexGet(Instance, Arguments, ArgumentNames));
     }
     if (!BaseReference.IsArray)
     {
         return(NewLateBinding.CallMethod(BaseReference, "", Arguments, ArgumentNames, Symbols.NoTypeArguments, (bool[])null, BindingFlags.InvokeMethod | BindingFlags.GetProperty, ReportErrors, ref Failure));
     }
     if (ArgumentNames.Length <= 0)
     {
         return(BaseReference.GetArrayValue(Arguments));
     }
     Failure = OverloadResolution.ResolutionFailure.InvalidArgument;
     if (ReportErrors)
     {
         throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
     }
     return((object)null);
 }
示例#6
0
        // Perform a late bound call.
        public static Object CallByName
            (Object ObjectRef, String ProcName,
            CallType UseCallType, Object[] Args)
        {
            switch (UseCallType)
            {
            case CallType.Method:
            {
                return(LateBinding.LateCallWithResult
                           (ObjectRef, null, ProcName, Args, null, null));
            }
            // Not reached.

            case CallType.Get:
            {
                return(LateBinding.LateGet
                           (ObjectRef, null, ProcName, Args, null, null));
            }
            // Not reached.

            case CallType.Set:
            case CallType.Let:
            {
                LateBinding.LateSet
                    (ObjectRef, null, ProcName, Args, null);
                return(null);
            }
                // Not reached.
            }
            throw new ArgumentException(S._("VB_InvalidCallType"));
        }
示例#7
0
 public static void LateIndexSetComplex(object Instance, object[] Arguments, string[] ArgumentNames, bool OptimisticSet, bool RValueBase)
 {
     if (Arguments == null)
     {
         Arguments = Symbols.NoArguments;
     }
     if (ArgumentNames == null)
     {
         ArgumentNames = Symbols.NoArgumentNames;
     }
     Symbols.Container BaseReference = new Symbols.Container(Instance);
     if (BaseReference.IsArray)
     {
         if (ArgumentNames.Length > 0)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidNamedArgs"));
         }
         BaseReference.SetArrayValue(Arguments);
     }
     else
     {
         if (ArgumentNames.Length > Arguments.Length)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         if (Arguments.Length < 1)
         {
             throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
         }
         string MemberName = "";
         if (BaseReference.IsCOMObject)
         {
             LateBinding.LateIndexSetComplex(Instance, Arguments, ArgumentNames, OptimisticSet, RValueBase);
         }
         else
         {
             BindingFlags bindingFlags = BindingFlags.SetProperty;
             MemberInfo[] members      = BaseReference.GetMembers(ref MemberName, true);
             OverloadResolution.ResolutionFailure Failure = OverloadResolution.ResolutionFailure.None;
             Symbols.Method TargetProcedure = NewLateBinding.ResolveCall(BaseReference, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, bindingFlags, false, ref Failure);
             if (Failure == OverloadResolution.ResolutionFailure.None)
             {
                 if (RValueBase && BaseReference.IsValueType)
                 {
                     throw new Exception(Utils.GetResourceString("RValueBaseForValueType", BaseReference.VBFriendlyName, BaseReference.VBFriendlyName));
                 }
                 BaseReference.InvokeMethod(TargetProcedure, Arguments, (bool[])null, bindingFlags);
             }
             else if (!OptimisticSet)
             {
                 NewLateBinding.ResolveCall(BaseReference, MemberName, members, Arguments, ArgumentNames, Symbols.NoTypeArguments, bindingFlags, true, ref Failure);
                 throw new InternalErrorException();
             }
         }
     }
 }
示例#8
0
        /// <summary>
        /// Creates an instance of the rebate confirmation file FTP client.
        /// </summary>
        /// <param name="log">
        /// The CommerceLog object through which log entries can be made.
        /// </param>
        /// <returns>
        /// An instance of the rebate confirmation file FTP client.
        /// </returns>
        public static IFtpClient RebateConfirmationFtpClient(CommerceLog log)
        {
            IFtpClient result = new RebateConfirmationFtpClient(log);

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <IFtpClient>("MockMasterCardFtpClient", LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#9
0
        /// <summary>
        /// Gets the object to use to process Visa rebater transactions.
        /// </summary>
        /// <returns>
        /// The ISettlementProcessor object to use.
        /// </returns>
        public static ISettlementProcessor VisaRebateProcessor()
        {
            ISettlementProcessor result = new VisaRebaterProcessor();

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <ISettlementProcessor>("MockVisaRebaterProcessor", LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#10
0
        /// <summary>
        /// Creates instance of FDC Pts FTP Client
        /// </summary>
        /// <param name="log">
        /// Commerce Logger
        /// </param>
        /// <returns>
        /// Instance of ftp client
        /// </returns>
        public static IFtpClient FirstDataPtsFtpClient(CommerceLog log)
        {
            IFtpClient result = new FirstDataPtsFtpClient(log);

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <IFtpClient>("MockFirstDataFtpClient",
                                                                                   LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
        //Save
        private void MenuItem7_Click(object sender, EventArgs e)
        {
            IEnumerator enumerator = null;

            Transition.Transition transition      = new Transition.Transition();
            TransitionTable       transitionTable = new TransitionTable();

            if (this.Select_Group_A != null)
            {
                if (this.Select_Group_B != null)
                {
                    if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
                    {
                        string      str         = string.Format("{0} To {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));
                        string      str1        = string.Format("{0}Data\\System\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                        XmlDocument xmlDocument = new XmlDocument();
                        transitionTable.Clear();
                        try
                        {
                            xmlDocument.Load(str1);
                            try
                            {
                                enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    XmlElement            current     = (XmlElement)enumerator.Current;
                                    string                attribute   = current.GetAttribute("Pattern");
                                    string                attribute1  = current.GetAttribute("MapTile");
                                    string                attribute2  = current.GetAttribute("StaticTile");
                                    Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                                    transitionTable.Add(transition1);
                                }
                            }
                            finally
                            {
                                if (enumerator is IDisposable)
                                {
                                    ((IDisposable)enumerator).Dispose();
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            ProjectData.SetProjectError(exception);
                            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        transitionTable.Save(string.Format("{0}.xml", str));
                    }
                }
            }
        }
示例#12
0
        /// <summary>
        /// Gets the object to use to perform user services client operations.
        /// </summary>
        /// <param name="onRewardsPtsBuild">
        /// Action to be performed once we have pts file contents built in memory
        /// </param>
        public static RewardsPtsProcessor RewardsPtsProcessor(Func <string, Task> onRewardsPtsBuild)
        {
            RewardsPtsProcessor result = new RewardsPtsProcessor()
            {
                OnRewardsPtsBuild = onRewardsPtsBuild,
            };

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <RewardsPtsProcessor>("MockRewardsPtsProcessor", LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#13
0
            public override bool Eval(object context)
            {
                //
                // Following is equivalent to calling apply in JScript.
                // See http://msdn.microsoft.com/en-us/library/84ht5z59.aspx.
                //

                object result = LateBinding.CallValue(
                    DefaultThisObject(Engine),
                    _function, /* args */ new object[] { context, context },
                    /* construct */ false, /* brackets */ false, Engine);

                return(Convert.ToBoolean(result));
            }
示例#14
0
        /// <summary>
        /// Creates an instance of a MasterCard Rebate blob client.
        /// </summary>
        /// <param name="log">
        /// The CommerceLog object within which to place log entries.
        /// </param>
        /// <returns>
        /// And instace of the MasterCard Rebate blob client.
        /// </returns>
        public static MasterCardRebateBlobClient MasterCardRebateBlobClient(CommerceLog log)
        {
            MasterCardRebateBlobClient result = null;

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <MasterCardRebateBlobClient>("MockMasterCardRebateBlobClient", LateBoundMocksAssemblyTypes);
            }
            else
            {
                result = new MasterCardRebateBlobClient(log);
            }

            return(result);
        }
示例#15
0
        /// <summary>
        ///  Gets the Rewards Pts Blob Client
        /// </summary>
        /// <param name="connectionString">
        /// Storage connection string
        /// </param>
        /// <param name="log">
        /// Commerce Logger
        /// </param>
        /// <returns>
        /// Instace of Rewards Pts Blob Client
        /// </returns>
        public static RewardsPtsBlobClient RewardsPtsBlobClient(string connectionString, CommerceLog log)
        {
            RewardsPtsBlobClient result = null;

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <RewardsPtsBlobClient>("MockRewardsPtsBlobClient", LateBoundMocksAssemblyTypes);
            }
            else
            {
                result = new RewardsPtsBlobClient(connectionString, log);
            }

            return(result);
        }
        /// <summary>
        /// Gets the object to use to process MasterCard rebate files.
        /// </summary>
        /// <param name="uploadRebateFile">
        /// The delegate to call to upload the file to its various destinations.
        /// </param>
        /// <returns>
        /// The ISettlementFileProcessor object to use.
        /// </returns>
        public static ISettlementFileProcessor MasterCardRebateProcessor(Func <string, Task> uploadRebateFile)
        {
            ISettlementFileProcessor result = new MasterCardRebateProcessor()
            {
                UploadRebateFile = uploadRebateFile
            };

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <ISettlementFileProcessor>("MockMasterCardRebateProcessor",
                                                                                                 LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#17
0
        /// <summary>
        /// Get the object to request simple web tokens.
        /// </summary>
        /// <returns>
        /// The ISimpleWebTokenRequestor instance to use.
        /// </returns>
        public static ISimpleWebTokenRequestor SimpleWebTokenRequestor()
        {
            if (simpleWebTokenRequestor == null)
            {
                simpleWebTokenRequestor = new SimpleWebTokenRequestor();
                if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
                {
                    simpleWebTokenRequestor =
                        LateBinding.BuildObjectFromLateBoundAssembly <ISimpleWebTokenRequestor>("MockSimpleWebTokenRequestor",
                                                                                                LateBoundMocksAssemblyTypes);
                }
            }

            return(simpleWebTokenRequestor);
        }
        /// <summary>
        /// Gets the object to use to process MasterCard clearing files.
        /// </summary>
        /// <param name="stream">
        /// The stream containing clearing file contents.
        /// </param>
        /// <param name="fileName">
        /// The name of the clearing file.
        /// </param>
        /// <returns>
        /// The ISettlementFileProcessor object to use.
        /// </returns>
        public static ISettlementFileProcessor MasterCardClearingProcessor(Stream stream,
                                                                           string fileName)
        {
            ISettlementFileProcessor result = new MasterCardClearingProcessor()
            {
                Stream   = stream,
                FileName = fileName
            };

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <ISettlementFileProcessor>("MockMasterCardClearingProcessor", LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#19
0
        /// <summary>
        /// Gets the object to use to perform user services client operations.
        /// </summary>
        /// <param name="acknowledgmentFileName">
        /// Name of the ack file
        /// </param>
        /// <param name="acknowledgmentFileStream">
        /// Ack file data stream
        /// </param>
        public static ISettlementFileProcessor FirstDataAcknowledgmentProcessor(string acknowledgmentFileName, Stream acknowledgmentFileStream)
        {
            ISettlementFileProcessor result = new FirstDataAcknowledgmentProcessor()
            {
                AcknowledgmentFileName   = acknowledgmentFileName,
                AcknowledgmentFileStream = acknowledgmentFileStream
            };

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <ISettlementFileProcessor>("MockFirstDataAcknowledgmentProcessor",
                                                                                                 LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#20
0
        /// <summary>
        /// Offer Registration Record Blob Client Factory Method
        /// </summary>
        /// <param name="connectionString">
        /// Storage account connection string
        /// </param>
        /// <param name="log">
        /// Commerce Logger
        /// </param>
        /// <returns>
        /// Instance of OfferRegistrationRecordBlobClient
        /// </returns>
        public static OfferRegistrationRecordBlobClient OfferRegistrationRecordBlobClient(string connectionString, CommerceLog log)
        {
            OfferRegistrationRecordBlobClient result = null;

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <OfferRegistrationRecordBlobClient>("MockAmexOfferRegistrationRecordBlobClient",
                                                                                                          LateBoundMocksAssemblyTypes);
            }
            else
            {
                result = new OfferRegistrationRecordBlobClient(connectionString, log);
            }

            return(result);
        }
示例#21
0
        /// <summary>
        ///  Gets the FDC Ack Blob Client
        /// </summary>
        /// <param name="connectionString">
        /// Storage connection string
        /// </param>
        /// <param name="log">
        /// Commerce Logger
        /// </param>
        /// <returns>
        /// Instace of FDC Ack Blob Client
        /// </returns>
        public static FirstDataAcknowledgmentBlobClient FirstDataAcknowledgmentBlobClient(string connectionString, CommerceLog log)
        {
            FirstDataAcknowledgmentBlobClient result = null;

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <FirstDataAcknowledgmentBlobClient>("MockFirstDataAcknowledgmentBlobClient",
                                                                                                          LateBoundMocksAssemblyTypes);
            }
            else
            {
                result = new FirstDataAcknowledgmentBlobClient(connectionString, log);
            }

            return(result);
        }
        /// <summary>
        /// Gets the object to use to perform operations on deals.
        /// </summary>
        /// <param name="context">
        /// The context in which operations will be performed.
        /// </param>
        /// <returns>
        /// The IDealOperations instance to use.
        /// </returns>
        public static IDealOperations DealOperations(CommerceContext context)
        {
            ValidateContext(context);

            IDealOperations result = new DealOperations();

            if (context.Config.DataStoreMockLevel != CommerceDataStoreMockLevel.None)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <IDealOperations>("MockDealOperations",
                                                                                        LateBoundMocksAssemblyTypes);
            }

            result.Context = context;

            return(result);
        }
示例#23
0
        /// <summary>
        /// Gets the object to use to perform user services client operations.
        /// </summary>
        /// <param name="commerceConfig">
        /// The CommerceConfig object to use to determine if mock partner dependencies are being used.
        /// </param>
        /// <param name="userServicesUri">
        /// The Uri at which the User Services can be found.
        /// </param>
        /// <returns>
        /// The IUserServicesClient instance to use.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// Parameter commerceConfig cannot be null.
        /// </exception>
        public static IUserServicesClient UserServicesClient(Uri userServicesUri, CommerceConfig commerceConfig)
        {
            if (commerceConfig == null)
            {
                throw new ArgumentNullException("commerceConfig", "Parameter commerceConfig cannot be null.");
            }

            IUserServicesClient result = new UserServiceClient(userServicesUri);

            if (commerceConfig.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <IUserServicesClient>("MockUserServicesClient",
                                                                                            LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#24
0
        /// <summary>
        /// Initializes a new instance of the SimpleWebTokenAuthAttribute class.
        /// </summary>
        public SimpleWebTokenAuthAttribute()
        {
            // If configuration app settings do not include an assembly from which to create a mock SimpleWebTokenAuthAttribute
            // instance, use this object. Otherwise, create an instance of the mock class.
            string mockApiAuthAssembly = ConfigurationManager.AppSettings["mockApiAuth"];

            if (string.IsNullOrWhiteSpace(mockApiAuthAssembly))
            {
                this.simpleWebTokenAuthAttributeInstance = this;
            }
            else
            {
                this.simpleWebTokenAuthAttributeInstance =
                    LateBinding.BuildObjectFromLateBoundAssembly <IApiAuthAttribute>(
                        "SimpleWebTokenAuthAttribute", LateBinding.GetLateBoundAssemblyTypes(mockApiAuthAssembly));
            }
        }
示例#25
0
        /// <summary>
        /// Amex Transaction Log File Blob Client Factory Method
        /// </summary>
        /// <param name="connectionString">
        /// Storage account connection string
        /// </param>
        /// <param name="log">
        /// Commerce Logger
        /// </param>
        /// <returns>
        /// Instance of AmexTransactionLogFileBlobClient
        /// </returns>
        public static AmexTransactionLogFileBlobClient TransactionLogBlobClient(string connectionString, CommerceLog log)
        {
            AmexTransactionLogFileBlobClient result = null;

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result =
                    LateBinding.BuildObjectFromLateBoundAssembly <AmexTransactionLogFileBlobClient>(
                        "MockAmexTransactionLogFileBlobClient",
                        LateBoundMocksAssemblyTypes);
            }
            else
            {
                result = new AmexTransactionLogFileBlobClient(connectionString, log);
            }
            return(result);
        }
示例#26
0
        public static ISftpClient SftpClient(string username, string password, string uri, CommerceConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config", "Parameter config cannot be null.");
            }
            if (sftpClient == null)
            {
                sftpClient = new DefaultSftpClient(username, password, uri);
                if (config.UseMockPartnerDependencies)
                {
                    sftpClient = LateBinding.BuildObjectFromLateBoundAssembly <ISftpClient>("MockSftpClient",
                                                                                            LateBoundMocksAssemblyTypes);
                }
            }

            return(sftpClient);
        }
示例#27
0
        /// <summary>
        /// Gets the object to use to perform user services client operations.
        /// </summary>
        /// <param name="onPtsBuild">
        /// Action to be performed once we have pts file contents built in memory
        /// </param>
        public static ISettlementFileProcessor FirstDataPtsProcessor(Func <string, Task> onPtsBuild)
        {
            ISettlementFileProcessor result = new FirstDataPtsProcessor()
            {
                OnPtsBuild           = onPtsBuild,
                TransactionPublisher = new FirstDataTransactionPublisher
                {
                    Queue = new AzureQueueClient(UserServicesStorageConnectionString, TransactionQueueName)
                }
            };

            if (CommerceWorkerConfig.Instance.UseMockPartnerDependencies == true)
            {
                result = LateBinding.BuildObjectFromLateBoundAssembly <ISettlementFileProcessor>("MockFirstDataPtsProcessor",
                                                                                                 LateBoundMocksAssemblyTypes);
            }

            return(result);
        }
示例#28
0
 internal override object GetMemberValue(string name)
 {
     MemberInfo[] members = this.GetMember(name, BindingFlags.Instance | BindingFlags.Public);
     if (members.Length == 0)
     {
         lock (sync)
         {
             if (vars.ContainsKey(name))
             {
                 return(vars[name]);
             }
             else
             {
                 return(Microsoft.JScript.Missing.Value);
             }
         }
     }
     return(LateBinding.GetMemberValue(this, name, LateBinding.SelectMember(members), members));
 }
示例#29
0
        internal override void SetMemberValue(string name, object value)
        {
            MemberInfo[] members = this.GetMember(name, BindingFlags.Instance | BindingFlags.Public);

            if (members.Length == 0)
            {
                lock (sync)
                {
                    if (vars.ContainsKey(name))
                    {
                        vars.Add(name, value);
                    }
                }
            }
            else
            {
                LateBinding.SetMemberValue(this, name, value, LateBinding.SelectMember(members), members);
            }
        }
示例#30
0
        /// <summary>
        /// Get the object to add analytics data
        /// </summary>
        /// <param name="commerceConfig">
        /// The CommerceConfig object to use to determine if mock partner dependencies are being used.
        /// </param>
        /// <returns>
        /// The IAnalytics client instance to use.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// Parameter commerceConfig cannot be null.
        /// </exception>
        public static IAnalyticsClient AnalyticsClient(CommerceConfig commerceConfig)
        {
            if (commerceConfig == null)
            {
                throw new ArgumentNullException("commerceConfig", "Parameter commerceConfig cannot be null.");
            }

            if (analyticsClient == null)
            {
                analyticsClient = new AnalyticsClient();

                if (commerceConfig.UseMockPartnerDependencies == true)
                {
                    analyticsClient = LateBinding.BuildObjectFromLateBoundAssembly <IAnalyticsClient>("MockAnalyticsClient",
                                                                                                      LateBoundMocksAssemblyTypes);
                }
            }

            return(analyticsClient);
        }