public ServiceProviderEndpoint(EndpointType type, string localPath, string redirectUrl = null, BindingType bindingType = BindingType.NotSet) : this()
 {
     Type = type;
     LocalPath = localPath;
     RedirectUrl = redirectUrl;
     Binding = bindingType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EntityBindingDetail"/> class.
 /// </summary>
 /// <param name="entityProperty">The entity property.</param>
 /// <param name="valueKey">The value key.</param>
 /// <param name="converter">The converter.</param>
 /// <param name="bindingType">Type of the binding.</param>
 public EntityBindingDetail(PropertyInfo entityProperty, string valueKey, IConverter converter, BindingType bindingType)
 {
     this.EntityProperty = entityProperty;
     this.ValueKey = valueKey;
     this.Converter = converter;
     this.BindingType = bindingType;
 }
        public string CalculateRegexFromMethod(BindingType bindingType, MethodInfo methodInfo)
        {
            // if method name seems to contain regex, we use it as-is
            if (nonIdentifierRe.Match(methodInfo.Name).Success)
            {
                return methodInfo.Name;
            }

            string stepText = methodInfo.Name;
            stepText = RemoveStepPrefix(bindingType, stepText);

            var parameters = methodInfo.GetParameters();

            int processedPosition = 0;
            var reBuilder = new StringBuilder("(?i)");
            foreach (var paramPosition in parameters.Select((p, i) => CalculateParamPosition(stepText, p, i)).Where(pp => pp.Position >= 0).OrderBy(pp => pp.Position))
            {
                if (paramPosition.Position < processedPosition)
                    continue; //this is an error case -> overlapping parameters

                reBuilder.Append(CalculateRegex(stepText.Substring(processedPosition, paramPosition.Position - processedPosition)));
                reBuilder.Append(CalculateParamRegex(parameters[paramPosition.ParamIndex]));
                processedPosition = paramPosition.Position + paramPosition.Lenght;
            }

            reBuilder.Append(CalculateRegex(stepText.Substring(processedPosition, stepText.Length - processedPosition)));
            reBuilder.Append(@"\W*");

            return reBuilder.ToString();
        }
Example #4
0
		internal void Finalize(MapTemplate map)
		{
			Map = map;
			if (ResetTime == 0)
			{
				ResetTime = map.DefaultResetTime;
			}

			//if (Map.Type == MapType.Dungeon)
			//{
			//    IsHeroic = Index == 1;
			//}
			//else if (MaxPlayerCount != 0)
			//{
			//    // use heuristics to determine whether we have heroic difficulty:
			//    foreach (var diff in Map.Difficulties)
			//    {
			//        if (diff != null && diff.MaxPlayerCount == MaxPlayerCount)
			//        {
			//            // Second entry with the same player count -> Probably heroic
			//            IsHeroic = true;
			//            break;
			//        }
			//    }
			//}
			IsHeroic = ResetTime == HeroicResetTime;
			IsRaid = MaxPlayerCount == MaxDungeonPlayerCount;

			BindingType = IsDungeon ? BindingType.Soft : BindingType.Hard;
		}
 internal BindingSignatureAttribute(BindingType bindingType, string bindingName, params string[] arguments)
     : base()
 {
     this.bindingType = bindingType;
     this.bindingName = bindingName;
     this.arguments = arguments;
 }
Example #6
0
 public StepBinding(BindingType type, string regexString, MethodInfo methodInfo)
     : base(methodInfo)
 {
     Type = type;
     Regex regex = new Regex("^" + regexString + "$", RegexOptions.Compiled | RegexOptions.CultureInvariant);
     Regex = regex;
 }
Example #7
0
 public StepArgs(BindingType type, StepDefinitionKeyword stepDefinitionKeyword, string text, string multilineTextArgument, Table tableArgument)
 {
     Type = type;
     StepDefinitionKeyword = stepDefinitionKeyword;
     Text = text;
     MultilineTextArgument = multilineTextArgument;
     TableArgument = tableArgument;
 }
Example #8
0
 public StepInstance(BindingType bindingType, StepDefinitionKeyword stepDefinitionKeyword, string keyword, string stepText, StepScopeNew stepScope)
 {
     BindingType = bindingType;
     StepDefinitionKeyword = stepDefinitionKeyword;
     Keyword = keyword;
     Text = stepText;
     StepScope = stepScope;
 }
Example #9
0
        protected StepDefinitionBaseAttribute(string regex, BindingType[] types)
        {
            if (types == null) throw new ArgumentNullException("types");
            if (types.Length == 0) throw new ArgumentException("List cannot be empty", "types");

            Regex = regex;
            Types = types;
        }
Example #10
0
 public StepBinding(BindingType type, Regex regex, Delegate bindingAction, Type[] parameterTypes, MethodInfo methodInfo)
 {
     Type = type;
     Regex = regex;
     BindingAction = bindingAction;
     ParameterTypes = parameterTypes;
     MethodInfo = methodInfo;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityBindingDetail"/> class.
        /// </summary>
        /// <param name="entityProperty">The entity property.</param>
        /// <param name="valueKey">The value key.</param>
        /// <param name="bindingType">Type of the binding.</param>
        /// <param name="valueWriter">Value writer for the associated value type</param>
        /// <param name="valueReader">Value reader for the associated value type</param>
        public EntityPropertyConversionDetail(PropertyInfo entityProperty, string valueKey, BindingType bindingType, IBaseValueWriter valueWriter, IBaseValueReader valueReader)
        {
            this.EntityProperty = entityProperty;
            this.ValueKey = valueKey;
            this.BindingType = bindingType;

            this.ValueWriter = valueWriter;
            this.ValueReader = valueReader;
        }
Example #12
0
        public Binding(MemberInfo toMemberInfo, BindingType bindingType, Mapper mapper,
            FromDefinition fromDefinition = null)
        {
            Require.NotNull(toMemberInfo, "toMemberInfo");

            BindingType = bindingType;
            Mapper = mapper;
            ToDefinition = new ToDefinition(toMemberInfo);
            FromDefinition = fromDefinition ?? FromUndefinedDefinition.Default;
        }
 private string RemoveStepPrefix(BindingType bindingType, string stepText)
 {
     var prefixesToRemove = GetPrefixesToRemove(bindingType);
     foreach (var prefixToRemove in prefixesToRemove)
     {
         if (stepText.StartsWith(prefixToRemove, StringComparison.CurrentCultureIgnoreCase))
         {
             stepText = stepText.Substring(prefixToRemove.Length).TrimStart('_', ' ');
             break; // we only stip one prefix
         }
     }
     return stepText;
 }
Example #14
0
        public BindingEngine Bind(
            string destinationProperty,
            string sourceProperty,
            BindingType bindingType = BindingType.OneWayToDestination)
        {
            var destinationPropInfo = _destination.GetType().GetProperty(destinationProperty);
            var sourcePropInfo = _source.GetType().GetProperty(sourceProperty);

            if (destinationPropInfo == null || sourcePropInfo == null) return this;
            if (destinationPropInfo.PropertyType != sourcePropInfo.PropertyType) return this;

            AssignBindersWith(destinationPropInfo, sourcePropInfo, bindingType);

            return this;
        }
        private static string CreateBinding(string webSiteName, string ip, string hostHeader, string port, BindingType bindingType)
        {
            var ipAddress = string.IsNullOrWhiteSpace(ip)
                                ? ""
                                : "-IPAddress \"" + ip + "\"";

            var hostHeader2 = string.IsNullOrWhiteSpace(hostHeader)
                                 ? ""
                                 : "-HostHeader \"" + hostHeader + "\"";

            var commandParams = string.Format("-Name \"{0}\" -Protocol \"{1}\" -Port {2} {3} {4}; ",
                              webSiteName, bindingType, port, ipAddress, hostHeader2);

            var newBinding = "New-WebBinding " + commandParams;
            var getBinding = string.Format("$binding = Get-WebBinding " + commandParams + "; if($binding -eq $null) {{ {0} }}", newBinding);
            return getBinding;
        }
        public static ServiceHost GetServiceHost(BindingType bindingType, string externalEndpoint, string authKey, StoreLocation storeLocation, StoreName storeName, string subjectName)
        {
            // Create an instance of the backup service
            BackupService backupService = new BackupService(authKey);

            // Add instance to service host
            ServiceHost serviceHost = new ServiceHost(backupService);

            // Create binding with transport security
            Binding binding;
            string protocol;

            switch (bindingType)
            {
                case BindingType.Https:
                    WebHttpBinding httpBinding = new WebHttpBinding(WebHttpSecurityMode.Transport);
                    httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
                    binding = httpBinding;
                    protocol = "https";
                    break;

                default: //Tcp
                    NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.Transport);
                    tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.None;
                    binding = tcpBinding;
                    protocol = "net.tcp";
                    break;
            }

            // Add the service endpoint
            ServiceEndpoint ep = serviceHost.AddServiceEndpoint(
               typeof(IBackupService),
               binding,
               String.Format(protocol + "://{0}/BackupService", externalEndpoint));

            // Set the x.509 certificate
            serviceHost.Credentials.ServiceCertificate.SetCertificate(
                storeLocation,
                storeName,
                X509FindType.FindBySubjectName,
                subjectName);

            return serviceHost;
        }
        private IEnumerable<string> GetPrefixesToRemove(BindingType bindingType)
        {
            yield return bindingType.ToString();

            var cultureToSearch = runtimeConfiguration.BindingCulture ?? runtimeConfiguration.FeatureLanguage;

            foreach (var keyword in LanguageHelper.GetKeywords(cultureToSearch, bindingType))
            {
                if (keyword.Contains(' '))
                {
                    yield return keyword.Replace(" ", "_");
                    yield return keyword.Replace(" ", "");
                }
                else
                {
                    yield return keyword;
                }
            }
        }
Example #18
0
		public void Finalize(RegionTemplate region)
		{
			Region = region;
			if (ResetTime == 0)
			{
				ResetTime = region.DefaultResetTime;
			}

			foreach (var diff in Region.Difficulties)
			{
				if (diff.MaxPlayerCount == MaxPlayerCount)
				{
					// Second entry with the same player count -> Probably heroic
					IsHeroic = true;
					break;
				}
			}

			BindingType = !IsHeroic && Region.Type == MapType.Dungeon ? BindingType.Soft : BindingType.Hard;
		}
Example #19
0
        protected void AssignBindersWith(PropertyInfo destinationPropInfo, PropertyInfo sourcePropInfo, BindingType bindingType)
        {
            ValidateBinding(destinationPropInfo, sourcePropInfo, bindingType);

            if ((bindingType & BindingType.OneWayToDestination) == BindingType.OneWayToDestination)
            {
                GetSourceBindersFor(sourcePropInfo.Name)
                    .Add(new PropertyBinder(destinationPropInfo, sourcePropInfo, _destination, _source));
            }

            if ((bindingType & BindingType.OneWayToSource) == BindingType.OneWayToSource)
            {
                GetDestinationBindersFor(destinationPropInfo.Name)
                    .Add(new PropertyBinder(sourcePropInfo, destinationPropInfo, _source, _destination));
            }

            if (bindingType == BindingType.OneWayToSource)
                RunDestinationBindingFor(destinationPropInfo.Name);
            else
                RunSourceBindingFor(sourcePropInfo.Name);
        }
Example #20
0
		internal void Finalize(RegionTemplate region)
		{
			Region = region;
			if (ResetTime == 0)
			{
				ResetTime = region.DefaultResetTime;
			}

			if (MaxPlayerCount != 0)
			{
				// use heuristics to determine whether we have a heroic difficulty:
				foreach (var diff in Region.Difficulties)
				{
					if (diff != null && diff.MaxPlayerCount == MaxPlayerCount)
					{
						// Second entry with the same player count -> Probably heroic
						IsHeroic = true;
						break;
					}
				}
			}

			BindingType = !IsHeroic && Region.Type == MapType.Dungeon ? BindingType.Soft : BindingType.Hard;
		}
Example #21
0
        public Binding(IPropertyChanged source, string sourcePropertyName, IPropertyChanged target, string targetPropertyName, BindingType type = BindingType.TwoWay, IValueConverter converter = null)
        {
            this.source = source;
            this.sourcePropertyName = sourcePropertyName;
            this.target = target;
            this.targetPropertyName = targetPropertyName;
            this.type = type;

            this.converter = converter == null ? new NoOpCoverter() : converter;

            if (type == BindingType.TwoWay || type == BindingType.OneWay)
            {
                sourceToTarget = true;
                source.PropertyChanged += SourceChanged;
            }

            if (type == BindingType.TwoWay || type == BindingType.OneWayToSource)
            {
                targetToSource = true;
                target.PropertyChanged += TargetChanged;
            }

            ValidateBinding();
        }
Example #22
0
 internal ScenarioStepAttribute(BindingType type, string regex)
 {
     Type  = type;
     Regex = regex;
 }
Example #23
0
 public static bool Equals(this ScenarioBlock block, BindingType bindingType)
 {
     return (int)block == (int)bindingType;
 }
        private static Binding FindBinding(BindingType bType)
        {
            switch (bType)
            {
            case BindingType.WebHttp:
                WebHttpBinding webHttpBinding = new WebHttpBinding();
                webHttpBinding.UseDefaultWebProxy     = false;
                webHttpBinding.Security.Mode          = WebHttpSecurityMode.None;
                webHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                webHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                webHttpBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                webHttpBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                webHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                webHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                return(webHttpBinding);

            case BindingType.BasicHttp:
                BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
                basicHttpBinding.UseDefaultWebProxy     = false;
                basicHttpBinding.Security.Mode          = BasicHttpSecurityMode.None;
                basicHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                basicHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                basicHttpBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                basicHttpBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                basicHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                basicHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                return(basicHttpBinding);

            case BindingType.MsmqIntegration:
                MsmqIntegrationBinding msmqIntegrationBinding = new MsmqIntegrationBinding();
                msmqIntegrationBinding.ExactlyOnce            = false;
                msmqIntegrationBinding.UseSourceJournal       = true;
                msmqIntegrationBinding.Security.Mode          = MsmqIntegrationSecurityMode.None;
                msmqIntegrationBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                return(msmqIntegrationBinding);

            case BindingType.MsmqIntegrationForPubsub:
                MsmqIntegrationBinding msmqIntegrationForPubsubBinding = new MsmqIntegrationBinding();
                msmqIntegrationForPubsubBinding.ExactlyOnce      = false;
                msmqIntegrationForPubsubBinding.UseSourceJournal = true;
                msmqIntegrationForPubsubBinding.Security.Mode    = MsmqIntegrationSecurityMode.Transport;
                msmqIntegrationForPubsubBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.WindowsDomain;
                msmqIntegrationForPubsubBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                return(msmqIntegrationForPubsubBinding);

            case BindingType.NetMsmq:
                NetMsmqBinding netMsmqBinding = new NetMsmqBinding();
                //netMsmqBinding.ReaderQuotas.MaxStringContentLength = serviceClient.ReaderQuotasMaxStringContentLength;
                netMsmqBinding.ExactlyOnce            = false;
                netMsmqBinding.UseSourceJournal       = true;
                netMsmqBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                netMsmqBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                netMsmqBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                netMsmqBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                netMsmqBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                netMsmqBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                //if (credentialType.HasValue)
                //{
                //    netMsmqBinding.Security.Mode = NetMsmqSecurityMode.Message;
                //    netMsmqBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value);
                //    netMsmqBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
                //}
                return(netMsmqBinding);

            case BindingType.NetTcp:
                NetTcpBinding netTcpBinding = new NetTcpBinding();
                //netTcpBinding.ReaderQuotas.MaxStringContentLength = serviceClient.ReaderQuotasMaxStringContentLength;
                //netTcpBinding.ReliableSession.Enabled = serviceClient.ReliableSessionEnabled;
                //netTcpBinding.ReliableSession.Ordered = serviceClient.ReliableSessionOrdered;
                netTcpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                netTcpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                netTcpBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                netTcpBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                netTcpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                netTcpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                //if (credentialType.HasValue)
                //{
                //    netTcpBinding.Security.Mode = SecurityMode.Message;
                //    netTcpBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value);
                //    netTcpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
                //}
                return(netTcpBinding);

            case BindingType.NetNamedPipe:
                NetNamedPipeBinding netNamedPipeBinding = new NetNamedPipeBinding();
                netNamedPipeBinding.Security.Mode   = NetNamedPipeSecurityMode.None;
                netNamedPipeBinding.TransactionFlow = false;
                //netNamedPipeBinding.MaxConnections = 100;
                netNamedPipeBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                netNamedPipeBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                netNamedPipeBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                netNamedPipeBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                netNamedPipeBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                netNamedPipeBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                return(netNamedPipeBinding);

            case BindingType.WSDualHttp:
                WSDualHttpBinding wsDualHttpBinding = new WSDualHttpBinding();
                //wsDualHttpBinding.ReaderQuotas.MaxStringContentLength = serviceClient.ReaderQuotasMaxStringContentLength;
                wsDualHttpBinding.UseDefaultWebProxy = false;
                //wsDualHttpBinding.ReliableSession.Ordered = serviceClient.ReliableSessionOrdered;
                wsDualHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                wsDualHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                wsDualHttpBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                wsDualHttpBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                wsDualHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                wsDualHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                //if (credentialType.HasValue)
                //{
                //    wsDualHttpBinding.Security.Mode = WSDualHttpSecurityMode.Message;
                //    wsDualHttpBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value);
                //    wsDualHttpBinding.Security.Message.NegotiateServiceCredential = true;
                //    wsDualHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
                //}
                return(wsDualHttpBinding);

            default:
                WSHttpBinding wsHttpBinding = new WSHttpBinding();
                wsHttpBinding.UseDefaultWebProxy = false;
                //wsHttpBinding.ReliableSession.Enabled = serviceClient.ReliableSessionEnabled;
                //wsHttpBinding.ReliableSession.Ordered = serviceClient.ReliableSessionOrdered;
                wsHttpBinding.MaxReceivedMessageSize = MAX_MSG_SIZE;
                wsHttpBinding.ReaderQuotas.MaxStringContentLength = MAX_MSG_SIZE;
                wsHttpBinding.ReaderQuotas.MaxArrayLength         = MAX_MSG_SIZE;
                wsHttpBinding.ReaderQuotas.MaxBytesPerRead        = MAX_MSG_SIZE;
                wsHttpBinding.ReaderQuotas.MaxDepth = MAX_MSG_SIZE;
                wsHttpBinding.ReaderQuotas.MaxNameTableCharCount = MAX_MSG_SIZE;
                wsHttpBinding.ReceiveTimeout = new TimeSpan(23, 59, 59);
                //if (credentialType.HasValue)
                //{
                //    wsHttpBinding.Security.Mode = SecurityMode.Message;
                //    wsHttpBinding.Security.Message.ClientCredentialType = GetMessageCredentialType(credentialType.Value);
                //    wsHttpBinding.Security.Message.NegotiateServiceCredential = true;
                //    wsHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
                //    wsHttpBinding.Security.Message.EstablishSecurityContext = true;
                //}
                return(wsHttpBinding);
            }
        }
Example #25
0
        private void AddComplexCurve(float time, BindingType bindType, IReadOnlyList <float> curveValues, int offset, string path)
        {
            switch (bindType)
            {
            case BindingType.Translation:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                if (!m_translations.TryGetValue(path, out Vector3Curve transCurve))
                {
                    transCurve = new Vector3Curve(path);
                }

                Vector3f trans     = new Vector3f(x, y, z);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> transKey = new KeyframeTpl <Vector3f>(time, trans, defWeight);
                transCurve.Curve.Curve.Add(transKey);
                m_translations[path] = transCurve;
            }
            break;

            case BindingType.Rotation:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];
                float w = curveValues[offset + 3];

                if (!m_rotations.TryGetValue(path, out QuaternionCurve rotCurve))
                {
                    rotCurve = new QuaternionCurve(path);
                }

                Quaternionf rot                  = new Quaternionf(x, y, z, w);
                Quaternionf defWeight            = new Quaternionf(1.0f / 3.0f);
                KeyframeTpl <Quaternionf> rotKey = new KeyframeTpl <Quaternionf>(time, rot, defWeight);
                rotCurve.Curve.Curve.Add(rotKey);
                m_rotations[path] = rotCurve;
            }
            break;

            case BindingType.Scaling:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                if (!m_scales.TryGetValue(path, out Vector3Curve scaleCurve))
                {
                    scaleCurve = new Vector3Curve(path);
                }

                Vector3f scale     = new Vector3f(x, y, z);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> scaleKey = new KeyframeTpl <Vector3f>(time, scale, defWeight);
                scaleCurve.Curve.Curve.Add(scaleKey);
                m_scales[path] = scaleCurve;
            }
            break;

            case BindingType.EulerRotation:
            {
                float x = curveValues[offset + 0];
                float y = curveValues[offset + 1];
                float z = curveValues[offset + 2];

                if (!m_eulers.TryGetValue(path, out Vector3Curve eulerCurve))
                {
                    eulerCurve = new Vector3Curve(path);
                }

                Vector3f euler     = new Vector3f(x, y, z);
                Vector3f defWeight = new Vector3f(1.0f / 3.0f);
                KeyframeTpl <Vector3f> eulerKey = new KeyframeTpl <Vector3f>(time, euler, defWeight);
                eulerCurve.Curve.Curve.Add(eulerKey);
                m_eulers[path] = eulerCurve;
            }
            break;

            case BindingType.Floats:
            {
                float value = curveValues[offset];

                if (!m_floats.TryGetValue(path, out FloatCurve floatCurve))
                {
                    floatCurve = new FloatCurve(path);
                }

                Float @float    = new Float(value);
                Float defWeight = new Float(1.0f / 3.0f);
                KeyframeTpl <Float> floatKey = new KeyframeTpl <Float>(time, @float, defWeight);
                floatCurve.Curve.Curve.Add(floatKey);
                m_floats[path] = floatCurve;
            }
            break;

            default:
                throw new NotImplementedException(bindType.ToString());
            }
        }
Example #26
0
 public void Type(BindingType bindingType) => BindingType = bindingType;
Example #27
0
        private string writeFunctions()
        {
            StringBuilder sb = new StringBuilder();

            foreach (Function ft in model.Functions)
            {
                List <string> parameters = new List <string>();



                sb.AppendLine("    /**");
                sb.AppendLine(string.Format("    * {0}", ft.Description));
                bool isBound = ft.BoundTypes.Count > 0;


                if (isBound)
                {
                    List <string> boundToTypes = new List <string>();
                    BindingType   bindingtype  = ft.BoundTypes.FirstOrDefault().BoundTo;

                    foreach (Binding b in ft.BoundTypes)
                    {
                        boundToTypes.Add(b.Type);
                    }

                    parameters.Add("uri: string");
                    if (bindingtype == BindingType.Collection)
                    {
                        sb.AppendLine(string.Format("    * @param uri A url for a collection of {0} to apply the function to.", string.Join(",", boundToTypes.ToArray())));
                    }
                    else
                    {
                        sb.AppendLine(string.Format("    * @param uri A url for a {0} to apply the function to.", string.Join(",", boundToTypes.ToArray())));
                    }
                }
                foreach (Parameter p in ft.Parameters)
                {
                    sb.AppendLine(string.Format("    * @param {0} {1}", lowerCaseFirstLetter(p.Name), p.Description));
                    string typeName = trimNameSpace(getJSType(p.Type), RootNameSpace, SubNamespace);
                    parameters.Add(string.Format("{0}: {1}", lowerCaseFirstLetter(p.Name), typeName));
                }
                if (ft.IsComposable)
                {
                    parameters.Add("query?: string");
                    parameters.Add("includeFormattedValues?: boolean");
                }
                if (!excludeCallerId.Contains(ft.Name))
                {
                    parameters.Add("callerId?: string");
                    sb.AppendLine(string.Format("    * @param {0} {1}", "callerId", "A string representation of the GUID value for the user to impersonate"));
                }

                sb.AppendLine("    */");
                sb.Append(string.Format("    function {0}(", ft.Name));
                if (parameters.Count > 0)
                {
                    sb.AppendLine();
                    sb.Append("        ");
                    sb.Append(string.Format("{0}", string.Join("," + Environment.NewLine + "        ", parameters.ToArray())));
                    sb.AppendLine();
                }

                string returnTypeName = trimNameSpace(getJSType(ft.ReturnType), RootNameSpace, SubNamespace);
                sb.Append(string.Format("): Promise<{0}>;", returnTypeName));
                sb.AppendLine();
            }

            return(sb.ToString());
        }
Example #28
0
 public Shape(string name, BindingType bindingType)
 {
     this.name        = name;
     this.bindingType = bindingType;
 }
        private void GetCompletionsForBindingType(BindingType bindingType, out IEnumerable<Completion> completions, out IEnumerable<Completion> completionBuilders)
        {
            completionBuilders = null;

            var suggestionProvider = languageService.ProjectScope.StepSuggestionProvider;
            if (suggestionProvider == null)
            {
                completions = Enumerable.Empty<Completion>();
                return;
            }

            if (!suggestionProvider.Populated)
            {
                string percentText = string.Format("({0}% completed)", suggestionProvider.GetPopulationPercent());
                completionBuilders = new[] {new Completion(
                    (!suggestionProvider.BindingsPopulated ? 
                        "step suggestion list is being populated... " : 
                        "step suggestion list from existing feature files is being populated... ") + percentText)};
            }

            try
            {
                completions = suggestionProvider.GetNativeSuggestionItems(bindingType);
            }
            catch(Exception)
            {
                //fallback case
                completions = Enumerable.Empty<Completion>();
            }
        }
Example #30
0
 public DataBindingTargetResolver(FieldCollection fields, PathCollection paths)
     : this(fields)
 {
     this.items       = paths;
     this.BindingType = BindingType.Paths;
 }
Example #31
0
 public DataBindingTargetResolver(FieldCollection fields, GroupCollection groups)
     : this(fields)
 {
     this.items       = groups;
     this.BindingType = BindingType.Groups;
 }
Example #32
0
 public DataBindingTargetResolver(FieldCollection fields, ShapeCollection shapes)
     : this(fields)
 {
     this.items       = shapes;
     this.BindingType = BindingType.Shapes;
 }
Example #33
0
 public void SetBindingType(BindingType type, IDataSetProvider provider)
 {
     OnBindingTypeChanged(type, provider);
 }
 public static void AddServiceInfo(string adress, BindingType bType, string contract)
 {
     s_List.Add(new ServiceInfo {
         Address = adress, Binding = bType, Contract = contract
     });
 }
 public StandardServiceFactory(BindingType bindingType, string bizExceptionTypeName, string exceptionHandlerTypeName)
 {
     m_BindingType              = bindingType;
     m_BizExceptionTypeName     = bizExceptionTypeName;
     m_ExceptionHandlerTypeName = exceptionHandlerTypeName;
 }
        private static BindingMetadata ParseBindingMetadata(JObject binding, INameResolver nameResolver)
        {
            BindingMetadata  bindingMetadata       = null;
            string           bindingTypeValue      = (string)binding["type"];
            string           bindingDirectionValue = (string)binding["direction"];
            string           connection            = (string)binding["connection"];
            BindingType      bindingType           = default(BindingType);
            BindingDirection bindingDirection      = default(BindingDirection);

            if (!string.IsNullOrEmpty(bindingDirectionValue) &&
                !Enum.TryParse <BindingDirection>(bindingDirectionValue, true, out bindingDirection))
            {
                throw new FormatException(string.Format(CultureInfo.InvariantCulture, "'{0}' is not a valid binding direction.", bindingDirectionValue));
            }

            if (!string.IsNullOrEmpty(bindingTypeValue) &&
                !Enum.TryParse <BindingType>(bindingTypeValue, true, out bindingType))
            {
                throw new FormatException(string.Format("'{0}' is not a valid binding type.", bindingTypeValue));
            }

            if (!string.IsNullOrEmpty(connection) &&
                string.IsNullOrEmpty(Utility.GetAppSettingOrEnvironmentValue(connection)))
            {
                throw new FormatException("Invalid Connection value specified.");
            }

            switch (bindingType)
            {
            case BindingType.EventHubTrigger:
            case BindingType.EventHub:
                bindingMetadata = binding.ToObject <EventHubBindingMetadata>();
                break;

            case BindingType.QueueTrigger:
            case BindingType.Queue:
                bindingMetadata = binding.ToObject <QueueBindingMetadata>();
                break;

            case BindingType.BlobTrigger:
            case BindingType.Blob:
                bindingMetadata = binding.ToObject <BlobBindingMetadata>();
                break;

            case BindingType.ServiceBusTrigger:
            case BindingType.ServiceBus:
                bindingMetadata = binding.ToObject <ServiceBusBindingMetadata>();
                break;

            case BindingType.HttpTrigger:
                bindingMetadata = binding.ToObject <HttpTriggerBindingMetadata>();
                break;

            case BindingType.Http:
                bindingMetadata = binding.ToObject <HttpBindingMetadata>();
                break;

            case BindingType.Table:
                bindingMetadata = binding.ToObject <TableBindingMetadata>();
                break;

            case BindingType.ManualTrigger:
                bindingMetadata = binding.ToObject <BindingMetadata>();
                break;

            case BindingType.TimerTrigger:
                bindingMetadata = binding.ToObject <TimerBindingMetadata>();
                break;

            case BindingType.MobileTable:
                bindingMetadata = binding.ToObject <MobileTableBindingMetadata>();
                break;

            case BindingType.DocumentDB:
                bindingMetadata = binding.ToObject <DocumentDBBindingMetadata>();
                break;

            case BindingType.NotificationHub:
                bindingMetadata = binding.ToObject <NotificationHubBindingMetadata>();
                break;

            case BindingType.ApiHubFile:
            case BindingType.ApiHubFileTrigger:
                bindingMetadata = binding.ToObject <ApiHubBindingMetadata>();
                break;

            case BindingType.ApiHubTable:
                bindingMetadata = binding.ToObject <ApiHubTableBindingMetadata>();
                break;
            }

            bindingMetadata.Type       = bindingType;
            bindingMetadata.Direction  = bindingDirection;
            bindingMetadata.Connection = connection;

            nameResolver.ResolveAllProperties(bindingMetadata);

            return(bindingMetadata);
        }
        public StepDefinitionBinding(RuntimeConfiguration runtimeConfiguration, IErrorProvider errorProvider, BindingType type, string regexString, MethodInfo methodInfo, BindingScope bindingScope)
            : base(runtimeConfiguration, errorProvider, methodInfo)
        {
            Type = type;
            Regex regex = new Regex("^" + regexString + "$", RegexOptions);

            Regex             = regex;
            this.BindingScope = bindingScope;
        }
Example #38
0
		/// <summary>
		/// Warning: Requires Character to be logged in and to be in Character's context.
		/// Often you might want to use ForeachBinding() instead.
		/// </summary>
		public void ForeachBinding(BindingType type, Action<InstanceBinding> callback)
		{
			var bindings = m_bindings[(int)type];
			if (bindings != null)
			{
				lock (bindings)
				{
					foreach (var binding in bindings)
					{
						callback(binding);
					}
				}
			}
		}
Example #39
0
        public static void HandleKeyBinding(BindingType bindingType, string bindingsPath, string bindsName)
        {
            Logger.Instance.LogMessage(TracingLevel.INFO, "handle key binding " + bindsName);

            if (KeyBindingWatcher[(int)bindingType] != null)
            {
                KeyBindingWatcher[(int)bindingType].StopWatching();
                KeyBindingWatcher[(int)bindingType].Dispose();
                KeyBindingWatcher[(int)bindingType] = null;
            }

            var fileName = Path.Combine(bindingsPath, bindsName + ".4.0.binds");

            if (!File.Exists(fileName))
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, "file not found " + fileName);

                fileName = fileName.Replace(".4.0.binds", ".3.0.binds");

                if (!File.Exists(fileName))
                {
                    fileName = fileName.Replace(".3.0.binds", ".binds");

                    if (!File.Exists(fileName))
                    {
                        Logger.Instance.LogMessage(TracingLevel.ERROR, "file not found " + fileName);
                    }
                }
            }

            // steam
            if (!File.Exists(fileName))
            {
                bindingsPath = SteamPath.FindSteamEliteDirectory();

                if (!string.IsNullOrEmpty(bindingsPath))
                {
                    fileName = Path.Combine(bindingsPath, bindsName + ".4.0.binds");

                    if (!File.Exists(fileName))
                    {
                        Logger.Instance.LogMessage(TracingLevel.ERROR, "steam file not found " + fileName);

                        fileName = fileName.Replace(".4.0.binds", ".3.0.binds");

                        if (!File.Exists(fileName))
                        {
                            fileName = fileName.Replace(".3.0.binds", ".binds");

                            if (!File.Exists(fileName))
                            {
                                Logger.Instance.LogMessage(TracingLevel.ERROR, "steam file not found " + fileName);
                            }
                        }
                    }
                }
            }

            // epic
            if (!File.Exists(fileName))
            {
                bindingsPath = EpicPath.FindEpicEliteDirectory();

                if (!string.IsNullOrEmpty(bindingsPath))
                {
                    fileName = Path.Combine(bindingsPath, bindsName + ".4.0.binds");

                    if (!File.Exists(fileName))
                    {
                        Logger.Instance.LogMessage(TracingLevel.ERROR, "epic file not found " + fileName);

                        fileName = fileName.Replace(".4.0.binds", ".3.0.binds");

                        if (!File.Exists(fileName))
                        {
                            fileName = fileName.Replace(".3.0.binds", ".binds");

                            if (!File.Exists(fileName))
                            {
                                Logger.Instance.LogMessage(TracingLevel.ERROR, "epic file not found " + fileName);
                            }
                        }
                    }
                }
            }

            if (File.Exists(fileName))
            {
                var serializer = new XmlSerializer(typeof(UserBindings));

                //Logger.Instance.LogMessage(TracingLevel.INFO, "using " + fileName);

                var reader = new StreamReader(fileName);
                Binding[bindingType] = (UserBindings)serializer.Deserialize(reader);
                reader.Close();


                var keyBindingPath = Path.GetDirectoryName(fileName);
                Logger.Instance.LogMessage(TracingLevel.INFO, "monitoring key binding path #2 " + keyBindingPath);
                var keyBindingFileName = Path.GetFileName(fileName);


                Logger.Instance.LogMessage(TracingLevel.INFO, "monitoring key binding file name #2 " + keyBindingFileName);

                KeyBindingWatcher[(int)bindingType] = new KeyBindingWatcher(keyBindingPath, keyBindingFileName);
                KeyBindingWatcher[(int)bindingType].KeyBindingUpdated += HandleKeyBindingEvents;
                KeyBindingWatcher[(int)bindingType].StartWatching();
            }
            else
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, "file not found " + fileName);
            }
        }
Example #40
0
 /// <summary>
 /// Munges a binding name.
 /// </summary>
 /// <param name="name">The binding name to munge.</param>
 /// <param name="paramCount">
 /// The number of parameters in the binding.
 /// </param>
 /// <returns>The munged name</returns>
 public static string MungeName(BindingType type, string name, int paramCount)
 {
     return(string.Format("{0}:{1}@{2}", type, name, paramCount));
 }
Example #41
0
        private string writeActions()
        {
            StringBuilder sb = new StringBuilder();

            foreach (CrmWebAPIModel.Action at in model.Actions)
            {
                List <string> parameters = new List <string>();



                sb.AppendLine("    /**");
                sb.AppendLine(string.Format("    * {0}", at.Description));
                bool isBound = at.BoundTypes.Count > 0;


                if (isBound)
                {
                    List <string> boundToTypes = new List <string>();
                    BindingType   bindingtype  = at.BoundTypes.FirstOrDefault().BoundTo;

                    foreach (Binding b in at.BoundTypes)
                    {
                        boundToTypes.Add(b.Type);
                    }

                    parameters.Add("uri: string");
                    if (bindingtype == BindingType.Collection)
                    {
                        sb.AppendLine(string.Format("    * @param uri A url for a collection of {0} to apply the action to.", string.Join(",", boundToTypes.ToArray())));
                    }
                    else
                    {
                        sb.AppendLine(string.Format("    * @param uri A url for a {0} to apply the action to.", string.Join(",", boundToTypes.ToArray())));
                    }
                }
                foreach (Parameter p in at.Parameters)
                {
                    sb.AppendLine(string.Format("    * @param {0} {1} {2}", lowerCaseFirstLetter(p.Name), p.Description, (p.Nullable)? "(Required parameter can be null)" : "(Required)"));
                    string typeName = trimNameSpace(getJSType(p.Type), RootNameSpace, SubNamespace);
                    parameters.Add(string.Format("{0}: {1}", lowerCaseFirstLetter(p.Name), typeName));
                }

                parameters.Add("callerId?: string");
                sb.AppendLine(string.Format("    * @param {0} {1}", "[callerId]", "A string representation of the GUID value for the user to impersonate"));


                sb.AppendLine("    */");
                sb.Append(string.Format("    function {0}(", at.Name));
                if (parameters.Count > 0)
                {
                    sb.Append(Environment.NewLine + "        ");
                    sb.Append(string.Format("{0}", string.Join("," + Environment.NewLine + "        ", parameters.ToArray())));
                    sb.Append(Environment.NewLine + "    ");
                }


                if (at.ReturnType != null)
                {
                    string returnTypeName = trimNameSpace(getJSType(at.ReturnType), RootNameSpace, SubNamespace);
                    sb.Append(string.Format("): Promise<{0}>;", returnTypeName));
                }
                else
                {
                    sb.Append("): Promise<void>;");
                }

                sb.AppendLine();
            }

            return(sb.ToString());
        }
Example #42
0
 public Shape(string name, BindingType bindingType)
 {
     this.name = name;
     this.bindingType = bindingType;
 }
Example #43
0
 public BindingKey(object target, BindingType type)
 {
     this.Target = target;
     this.Type   = type;
 }
Example #44
0
 /// <summary>
 /// Converts the <paramref name="sourceValue" /> parameter to the <paramref name="destinationType" /> parameter using <paramref
 /// name="formatProvider" /> and <paramref name="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="BindingType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => BindingType.CreateFrom(sourceValue);
Example #45
0
 // Which SubIndexes have subscriptions?
 public IEnumerable <int> GetKeys(BindingType bindingType, int index)
 {
     return(_bindings[bindingType][index].GetKeys());
 }
Example #46
0
 public SearchOptions(string nameRegex = null, string assemblyRegex = null, ScopeType scope = ScopeType.All, BindingType binding = BindingType.All, object instance = null)
 {
     NameRegex     = ((nameRegex == null) ? null : new Regex(nameRegex));
     AssemblyRegex = ((assemblyRegex == null) ? null : new Regex(assemblyRegex));
     Scope         = scope;
     Binding       = binding;
     weakInstance  = ((instance != null) ? new WeakReference(instance) : null);
 }
Example #47
0
 internal StepDefinitionBaseAttribute(string regex, BindingType type)
     : this(regex, new[] { type })
 {
 }
Example #48
0
 public int Count(BindingType bindingType)
 {
     return(ContainsKey(bindingType) ? _bindings[bindingType].Count() : 0);
 }
Example #49
0
        private void ValidateBinding(PropertyInfo destinationPropInfo, PropertyInfo sourcePropInfo, BindingType bindingType)
        {
            if ((bindingType & BindingType.OneWayToDestination) == BindingType.OneWayToDestination)
            {
                if (!sourcePropInfo.CanRead)
                    throw new PropertyIsNotReadableException(sourcePropInfo);
                if (!destinationPropInfo.CanWrite)
                    throw new PropertyIsNotWritableException(destinationPropInfo);
            }

            if ((bindingType & BindingType.OneWayToSource) == BindingType.OneWayToSource)
            {
                if (!destinationPropInfo.CanRead)
                    throw new PropertyIsNotReadableException(destinationPropInfo);
                if (!sourcePropInfo.CanWrite)
                    throw new PropertyIsNotWritableException(sourcePropInfo);
            }
        }
Example #50
0
 public int Count(BindingType bindingType, int index)
 {
     return(ContainsKey(bindingType, index) ? _bindings[bindingType][index].Count() : 0);
 }
Example #51
0
 // Are there any Axis / Button / POV subscriptions?
 public bool ContainsKey(BindingType bindingType)
 {
     return(_bindings.ContainsKey(bindingType));
 }
Example #52
0
 // Which Axes / Buttons have subscriptions?
 public bool ContainsKey(BindingType bindingType, int index)
 {
     return(_bindings.ContainsKey(bindingType) && _bindings[bindingType].ContainsKey(index));
 }
Example #53
0
 internal ScenarioStepAttribute(BindingType type, string regex)
 {
     Type = type;
     Regex = regex;
 }
Example #54
0
 public bool ContainsKey(BindingType bindingType, int index, int subIndex)
 {
     return(ContainsKey(bindingType, index) && _bindings[bindingType][index].ContainsKey(subIndex));
 }
        private Task CompleteSsoAsync(HttpContext context, SamlResponse response, Uri destination, BindingType binding)
        {
            var base64 = SerializeSamlResponse(response, binding);

            if (binding == BindingType.Post)
            {
                return(PostAsync(context, base64, destination, response.RelayState));
            }
            if (binding == BindingType.Redirect)
            {
                return(RedirectAsync(context, base64, destination, response.RelayState));
            }

            throw new ArgumentException($"Unsupported binding type: '{binding}'");
        }
Example #56
0
 public BindToInfo(string name, object handlers, BindingType type)
 {
     Name     = name;
     Handlers = HtmlHelper.AnonymousObjectToHtmlAttributes(handlers);
     Type     = type;
 }
Example #57
0
		/// <summary>
		/// Returns the Cooldown object for the Instance with the given MapId.
		/// </summary>
		/// <param name="map">The MapId of the Instance in question.</param>
		/// <returns></returns>
		public InstanceBinding GetBinding(MapId map, BindingType type)
		{
			var bindings = m_bindings[(int)type];
			if (bindings == null)
			{
				return null;
			}

			lock (bindings)
			{
				foreach (var binding in bindings)
				{
					if (binding.MapId == map)
					{
						return binding;
					}
				}
			}
			return null;
		}
Example #58
0
 public MvxWindowsBindingBuilder(
     BindingType bindingType = BindingType.MvvmCross)
 {
     _bindingType = bindingType;
 }
Example #59
0
		private List<InstanceBinding> GetOrCreateBindingList(BindingType type)
		{
			lock (m_bindings)
			{
				var bindings = m_bindings[(int)type];
				if (bindings == null)
				{
					m_bindings[(int)type] = bindings = InstanceBindingListPool.Obtain();
				}
				return bindings;
			}
		}
Example #60
0
 // Which Indexes have subscriptions?
 public IEnumerable <int> GetKeys(BindingType bindingType)
 {
     return(_bindings[bindingType].GetKeys());
 }