Пример #1
0
 public void Load(string path, ClientType type)
 {
     BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open));
     int num = binaryReader.ReadInt32();
     for (int i = 0; i < num; i++)
     {
         int num2 = binaryReader.ReadInt32();
         LIT.Object item = default(LIT.Object);
         item.objectID = binaryReader.ReadInt32();
         for (int j = 0; j < num2; j++)
         {
             LIT.Object.Part item2 = default(LIT.Object.Part);
             item2.name = RoseFile.ReadBString(ref binaryReader);
             item2.partID = binaryReader.ReadInt32();
             item2.ddsName = RoseFile.ReadBString(ref binaryReader);
             item2.ddsID = binaryReader.ReadInt32();
             item2.ddsDivisionSize = binaryReader.ReadInt32();
             item2.ddsDivisionCount = binaryReader.ReadInt32();
             item2.ddsPartID = binaryReader.ReadInt32();
             item.listParts.Add(item2);
         }
         this.listObject.Add(item);
     }
     int num3 = binaryReader.ReadInt32();
     for (int i = 0; i < num3; i++)
     {
         string item3 = RoseFile.ReadBString(ref binaryReader);
         this.listDDSName.Add(item3);
     }
     binaryReader.Close();
 }
Пример #2
0
        public void StartSendingAndReceiving(ClientType typeOfClient)
        {
            m_CurrentClientType = typeOfClient;

            if (m_CurrentClientType == ClientType.MultiCast)
            {
                m_Multicast = new Multicast(m_Port, m_MultiCastEndpoint);
                m_Multicast.Start();
                m_Multicast.StartPulse(((int)MessageHeaders.USERSNAMES).ToString() + m_UserName);
            }

            if (m_CurrentClientType == ClientType.TCP)
            {
                m_TCPClient = new TCPClient();
                m_TCPClient.Start();
            }

            m_displayAllMessages = false;

            m_ProcessorThread = new Thread(new ThreadStart(Processor));
            m_ProcessorThread.IsBackground = true;
            m_ProcessorThread.Start();

            AssembleSendString(MessageHeaders.CONNECT, " Has Connected");
        }
        public Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType = ClientType.Consumer)
        {
            if (clientType == ClientType.Business)
            {
                throw new OneDriveException(
                    new Error
                    {
                        Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
                        Message = "OnlineIdServiceProvider only supports Microsoft Account authentication."
                    });
            }

            var microsoftAccountServiceInfo = new MicrosoftAccountServiceInfo
            {
                AppId = appConfig.MicrosoftAccountAppId,
                ClientSecret = appConfig.MicrosoftAccountClientSecret,
                CredentialCache = credentialCache,
                HttpProvider = httpProvider,
                Scopes = appConfig.MicrosoftAccountScopes,
            };

            microsoftAccountServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new OnlineIdAuthenticationProvider(microsoftAccountServiceInfo);
            return Task.FromResult<ServiceInfo>(microsoftAccountServiceInfo);
        }
Пример #4
0
		private ClientInformation(PacketIn packet)
		{
            try
            {
                ProtocolVersion = packet.ReadByte();
                var claimedRemainingLength = packet.ReadUInt16();
                if (packet.RemainingLength != claimedRemainingLength)
                {
                    Log.Warn(WCell_Core.Auth_Logon_with_invalid_length, claimedRemainingLength, packet.RemainingLength);
                }

                var clientInstallationType = packet.ReadFourCC();
                _clientInstallationType = ClientTypeUtility.Lookup(clientInstallationType);

                Version = new ClientVersion(packet.ReadBytes(5));
                Architecture = packet.ReadFourCC().TrimEnd('\0');
                OS = packet.ReadFourCC().TrimEnd('\0');

                var locale = packet.ReadFourCC();
                _locale = ClientLocaleUtility.Lookup(locale);

                TimeZone = BitConverter.ToUInt32(packet.ReadBytes(4), 0);
                IPAddress = new XmlIPAddress(packet.ReadBytes(4));

                Log.Info(WCell_Core.ClientInformationFourCCs, ProtocolVersion, ClientInstallationType, Version, Architecture, OS, Locale, TimeZone, IPAddress);
            }
            catch
            {
            }
		}
Пример #5
0
 private IEnumerable<dynamic> GetRequestsOfType(int count, ClientType clientType)
 {
     using (var db = GetDB())
     {
         return db.Query("select top (@Count) * from ClientRequests where UserType = @ClientType order by [Timestamp] desc", new { Count = count, ClientType = clientType });
     }
 }
        /// <summary>
        /// Generates the <see cref="ServiceInfo"/> for the current application configuration.
        /// </summary>
        /// <param name="appConfig">The <see cref="AppConfig"/> for the current application.</param>
        /// <param name="credentialCache">The cache instance for storing user credentials.</param>
        /// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
        /// <param name="clientType">The <see cref="ClientType"/> to specify the business or consumer service.</param>
        /// <returns>The <see cref="ServiceInfo"/> for the current session.</returns>
        public virtual Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType)
        {
            if (clientType == ClientType.Consumer)
            {
                var microsoftAccountServiceInfo = new MicrosoftAccountServiceInfo
                {
                    AppId = appConfig.MicrosoftAccountAppId,
                    ClientSecret = appConfig.MicrosoftAccountClientSecret,
                    CredentialCache = credentialCache,
                    HttpProvider = httpProvider,
                    ReturnUrl = appConfig.MicrosoftAccountReturnUrl,
                    Scopes = appConfig.MicrosoftAccountScopes,
                    WebAuthenticationUi = this.webAuthenticationUi,
                };

                microsoftAccountServiceInfo.AuthenticationProvider = this.AuthenticationProvider?? new MicrosoftAccountAuthenticationProvider(microsoftAccountServiceInfo);
                return Task.FromResult<ServiceInfo>(microsoftAccountServiceInfo);
            }

            var activeDirectoryServiceInfo = new ActiveDirectoryServiceInfo
            {
                AppId = appConfig.ActiveDirectoryAppId,
                AuthenticationProvider = this.AuthenticationProvider,
                ClientSecret = appConfig.ActiveDirectoryClientSecret,
                CredentialCache = credentialCache,
                HttpProvider = httpProvider,
                ReturnUrl = appConfig.ActiveDirectoryReturnUrl,
            };
            
            return Task.FromResult<ServiceInfo>(activeDirectoryServiceInfo);
        }
Пример #7
0
        public static string Connect(ClientType clientType, string serverAddress, string login, string password)
        {
            string clientCallbackAddress;
            if (serverAddress.StartsWith("net.pipe:"))
            {
                clientCallbackAddress = "net.pipe://127.0.0.1/FiresecCallbackService_" + clientType.ToString() + "/";
            }
            else
            {
                clientCallbackAddress = CallbackAddressHelper.GetFreeClientCallbackAddress();
            }
            FiresecCallbackServiceManager.Open(clientCallbackAddress);

            ClientCredentials = new ClientCredentials()
            {
                UserName = login,
                Password = password,
                ClientType = clientType,
                ClientCallbackAddress = clientCallbackAddress,
                ClientUID = Guid.NewGuid()
            };

            FiresecService = new SafeFiresecService(serverAddress);

            var operationResult = FiresecService.Connect(ClientCredentials, true);
            if (operationResult.HasError)
            {
                return operationResult.Error;
            }

            _userLogin = login;
            OnUserChanged();
            return null;
        }
Пример #8
0
		public LoginViewModel(ClientType clientType, PasswordViewType passwordViewType)
		{
			TopMost = true;
			ClientType = clientType;
			_passwordViewType = passwordViewType;

			switch (_passwordViewType)
			{
				case PasswordViewType.Connect:
					UserName = Settings.Default.UserName;
					CanEditUserName = true;
					break;
				case PasswordViewType.Validate:
					UserName = ClientManager.CurrentUser.Login;
					Settings.Default.SavePassword = false;
					CanEditUserName = false;
					break;
			}
			CanSavePassword = _passwordViewType != PasswordViewType.Validate;
			Password = Settings.Default.SavePassword ? Settings.Default.Password : string.Empty;
			SavePassword = Settings.Default.SavePassword;

			IsConnected = false;
			IsCanceled = false;
			Message = null;
			Sizable = false;
		}
        public async override Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType = ClientType.Business)
        {
            if (clientType == ClientType.Consumer)
            {
                throw new OneDriveException(
                    new Error
                    {
                        Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
                        Message = "AdalServiceInfoProvider only supports Active Directory authentication."
                    });
            }

            var serviceInfo = await base.GetServiceInfo(appConfig, null, httpProvider, clientType);

            serviceInfo.ServiceResource = appConfig.ActiveDirectoryServiceResource;

            if (string.IsNullOrEmpty(serviceInfo.BaseUrl) && !string.IsNullOrEmpty(serviceInfo.ServiceResource))
            {
                serviceInfo.BaseUrl = string.Format(
                    Constants.Authentication.OneDriveBusinessBaseUrlFormatString,
                    serviceInfo.ServiceResource.TrimEnd('/'),
                    "v2.0");
            }

            if (serviceInfo.AuthenticationProvider == null)
            {
                serviceInfo.AuthenticationProvider = new AdalAuthenticationProvider(serviceInfo);
            }

            return serviceInfo;
        }
Пример #10
0
        public string GetParamTag(ClientType clientType)
        {
            switch (clientType)
            {
                case ClientType.ctMsSql:
                    paramTag = "@";
                    break;
                case ClientType.ctMySql:
                    paramTag = "@";
                    break;
                case ClientType.ctNone:
                    paramTag = "@";
                    break;
                case ClientType.ctODBC:
                    paramTag = "@";
                    break;
                case ClientType.ctOleDB:
                    paramTag = "?";
                    break;
                case ClientType.ctOracle:
                    paramTag = ":";
                    break;
                case ClientType.ctInformix:
                    paramTag = "?";
                    break;
            }

            return paramTag;
        }
Пример #11
0
 public void Load(string Path, ClientType clientType)
 {
     this.path = Path;
     this.clientType = clientType;
     BinaryReader binaryReader = new BinaryReader(File.Open(Path, FileMode.Open));
     short num = binaryReader.ReadInt16();
     for (int i = 0; i < (int)num; i++)
     {
         ZSC.Mesh mesh = new ZSC.Mesh();
         mesh.read(ref binaryReader);
         this.listMesh.Add(mesh);
     }
     short num2 = binaryReader.ReadInt16();
     for (int i = 0; i < (int)num2; i++)
     {
         ZSC.Materiel materiel = new ZSC.Materiel();
         materiel.read(ref binaryReader);
         this.listMateriel.Add(materiel);
     }
     short num3 = binaryReader.ReadInt16();
     for (int i = 0; i < (int)num3; i++)
     {
         ZSC.Effect effect = new ZSC.Effect();
         effect.read(ref binaryReader);
         this.listEffect.Add(effect);
     }
     short num4 = binaryReader.ReadInt16();
     for (int i = 0; i < (int)num4; i++)
     {
         ZSC.Object @object = new ZSC.Object();
         @object.read(ref binaryReader);
         this.listObject.Add(@object);
     }
     binaryReader.Close();
 }
Пример #12
0
 private void AddSuperPeerNodeToConnectionsRepository(ClientType clientType, SuperPeerNode superPeerNode)
 {
     if (clientType == ClientType.Client)
         ConnectionsRepository.AddClient((SuperPeerClient) superPeerNode);
     else
         ConnectionsRepository.AddServer((SuperPeerServer) superPeerNode);
 }
        private async void InitializeClient(ClientType clientType, RoutedEventArgs e)
        {
            if (((App)Application.Current).OneDriveClient == null)
            {
                var client = clientType == ClientType.Consumer
                    ? OneDriveClientExtensions.GetUniversalClient(this.scopes) as OneDriveClient
                    : BusinessClientExtensions.GetActiveDirectoryClient(
                        oneDriveForBusinessAppId,
                        oneDriveForBusinessReturnUrl) as OneDriveClient;

                try
                {
                    await client.AuthenticateAsync();
                    ((App)Application.Current).OneDriveClient = client;
                    ((App)Application.Current).NavigationStack.Add(new ItemModel(new Item()));
                    Frame.Navigate(typeof(MainPage), e);
                }
                catch (OneDriveException exception)
                {
                    // Swallow the auth exception but write message for debugging.
                    Debug.WriteLine(exception.Error.Message);
                    client.Dispose();
                }
            }
            else
            {
                Frame.Navigate(typeof(MainPage), e);
            }
        }
        private static object ReadPropertyValue(object element, ClientType resourceType, string[] srcPathSegments, int currentSegment)
        {
            if (element == null || currentSegment == srcPathSegments.Length)
            {
                return element;
            }
            else
            {
                String srcPathPart = srcPathSegments[currentSegment];

                ClientType.ClientProperty resourceProperty = resourceType.GetProperty(srcPathPart, true);
                if (resourceProperty == null)
                {
                    throw Error.InvalidOperation(Strings.EpmSourceTree_InaccessiblePropertyOnType(srcPathPart, resourceType.ElementTypeName));
                }

                if (resourceProperty.IsKnownType ^ (currentSegment == srcPathSegments.Length - 1))
                {
                    throw Error.InvalidOperation(!resourceProperty.IsKnownType ? Strings.EpmClientType_PropertyIsComplex(resourceProperty.PropertyName) :
                                                                                 Strings.EpmClientType_PropertyIsPrimitive(resourceProperty.PropertyName));
                }

                PropertyInfo pi = element.GetType().GetProperty(srcPathPart, BindingFlags.Instance | BindingFlags.Public);
                Debug.Assert(pi != null, "Cannot find property " + srcPathPart + "on type " + element.GetType().Name);

                return ReadPropertyValue(
                            pi.GetValue(element, null),
                            resourceProperty.IsKnownType ? null : ClientType.Create(resourceProperty.PropertyType),
                            srcPathSegments,
                            ++currentSegment);
            }
        }
        public HttpResponseMessage Get(long clientId, ClientType clientType)
        {
            ClientViewModel client;
            switch (clientType)
            {
                case ClientType.Individual:
                    {
                        client = individualClientsService.GetIndividualClient(clientId);
                    return client != null
                               ? this.Request.CreateResponse(HttpStatusCode.OK, client)
                               : this.Request.CreateErrorResponse(
                                   HttpStatusCode.BadRequest,
                                   String.Format(ErrorMessages.InvalidClientId, clientId));
                }

                case ClientType.JuridicalPerson:
                {
                    client = juridicalClientsService.GetJuridicalClient(clientId);
                    return client != null ? this.Request.CreateResponse(HttpStatusCode.OK, client) :
                        this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, String.Format(ErrorMessages.InvalidClientId, clientId));
                }
                default:
                    return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, ErrorMessages.InvalidClientType);
            }
        }
Пример #16
0
 public void Load(string mypath, ClientType myclientType)
 {
     this.path = mypath;
     this.clientType = myclientType;
     BinaryReader binaryReader = new BinaryReader(File.Open(mypath, FileMode.Open));
     this.formatCode = new string(binaryReader.ReadChars(4));
     int num = binaryReader.ReadInt32();
     this.rowCount = binaryReader.ReadInt32();
     this.columnCount = binaryReader.ReadInt32();
     this.column = new STB.Column[this.columnCount + 1];
     this.cell = new string[this.rowCount, this.columnCount];
     this.RowHeight = binaryReader.ReadInt32();
     for (int i = 0; i < this.columnCount + 1; i++)
     {
         this.column[i].width = binaryReader.ReadInt16();
     }
     for (int i = 0; i < this.columnCount + 1; i++)
     {
         this.column[i].title = RoseFile.ReadSString(ref binaryReader);
     }
     for (int i = 0; i < this.rowCount - 1; i++)
     {
         this.cell[i, 0] = RoseFile.ReadSString(ref binaryReader);
     }
     binaryReader.BaseStream.Seek((long)num, SeekOrigin.Begin);
     for (int i = 0; i < this.rowCount - 1; i++)
     {
         for (int j = 0; j < this.columnCount - 1; j++)
         {
             this.cell[i, j + 1] = RoseFile.ReadSString(ref binaryReader);
         }
     }
     binaryReader.Close();
 }
        public async override Task<ServiceInfo> GetServiceInfo(
            AppConfig appConfig,
            CredentialCache credentialCache,
            IHttpProvider httpProvider,
            ClientType clientType = ClientType.Business)
        {
            if (clientType == ClientType.Consumer)
            {
                throw new OneDriveException(
                    new Error
                    {
                        Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
                        Message = "AdalServiceInfoProvider only supports Active Directory authentication."
                    });
            }

            var serviceInfo = await base.GetServiceInfo(appConfig, credentialCache, httpProvider, clientType);

            serviceInfo.BaseUrl = appConfig.ActiveDirectoryServiceEndpointUrl;
            serviceInfo.ServiceResource = appConfig.ActiveDirectoryServiceResource;

            if (serviceInfo.AuthenticationProvider == null)
            {
                serviceInfo.AuthenticationProvider = new AdalAuthenticationProvider(serviceInfo);
            }

            return serviceInfo;
        }
Пример #18
0
        public GenerateRequestMessage(string pxPayUserId,
            string pxPayKey,
            string urlSuccess,
            string urlFail,
            Currency currencyInput,
            TxnType txnType,
            decimal amount = 0,
            ClientType clientType = DpsPayfit.Client.ClientType.Internet,
            DateTimeOffset? timeout = null)
        {
            if (string.IsNullOrWhiteSpace(pxPayUserId)) throw new ArgumentNullException(nameof(pxPayUserId));
            if (string.IsNullOrWhiteSpace(pxPayKey)) throw new ArgumentNullException(nameof(pxPayKey));
            if (string.IsNullOrWhiteSpace(urlSuccess)) throw new ArgumentNullException(nameof(urlSuccess));
            if (string.IsNullOrWhiteSpace(urlFail)) throw new ArgumentNullException(nameof(urlFail));

            PxPayUserId = pxPayUserId;
            PxPayKey = pxPayKey;
            UrlSuccess = urlSuccess;
            UrlFail = urlFail;
            Amount = amount;
            CurrencyInput = currencyInput;
            TxnType = txnType.ToString();
            ClientType = clientType.ToString();
            if (timeout.HasValue)
            {
                Timeout = $"{timeout:yyMMddHHmm}";
            }
        }
Пример #19
0
 public void Load(string filePath, ClientType clientType)
 {
     this.Path = filePath;
     this.clientType = clientType;
     BinaryReader binaryReader = new BinaryReader(File.Open(filePath, FileMode.Open));
     short num = binaryReader.ReadInt16();
     this.listDDS = new List<TSI.DDS>((int)num);
     for (int i = 0; i < (int)num; i++)
     {
         TSI.DDS dDS = new TSI.DDS();
         dDS.Path = RoseFile.ReadSString(ref binaryReader);
         dDS.ColourKey = binaryReader.ReadInt32();
         this.listDDS.Add(dDS);
     }
     short num2 = binaryReader.ReadInt16();
     for (int i = 0; i < (int)num; i++)
     {
         short num3 = binaryReader.ReadInt16();
         this.listDDS[i].ListDDS_element = new List<TSI.DDS.DDSElement>((int)num3);
         for (int j = 0; j < (int)num3; j++)
         {
             TSI.DDS.DDSElement dDSElement = new TSI.DDS.DDSElement();
             dDSElement.OwnerId = binaryReader.ReadInt16();
             dDSElement.X = binaryReader.ReadInt32();
             dDSElement.Y = binaryReader.ReadInt32();
             dDSElement.Width = binaryReader.ReadInt32() - dDSElement.X;
             dDSElement.Height = binaryReader.ReadInt32() - dDSElement.Y;
             dDSElement.Color = binaryReader.ReadInt32();
             dDSElement.Name = RoseFile.ReadFString(ref binaryReader, 32);
             this.listDDS[i].ListDDS_element.Add(dDSElement);
         }
     }
     binaryReader.Close();
 }
        public static void Init(ClientType clientType, string host, int port)
        {
            if (host == null) throw new ArgumentNullException("host");

            _clientType = clientType;
            _host = host;
            _port = port;
        }
Пример #21
0
 public TransSQLBuilder(Transaction transaction, DataRow srcRow, DataTable srcSchema, String writeBackSQLPart)
 {
     _transaction = transaction;
     _srcRow = srcRow;
     _srcSchema = srcSchema;
     _writeSQLBackWherePart = writeBackSQLPart;
     type = DBUtils.GetDatabaseType((transaction.Owner as InfoTransaction).UpdateComp.conn);
 }
Пример #22
0
 public ActionResult Login(string account, string password, ClientType clientype, string clientsn)
 {
     client = new ServicePassport.ServiceReceptionClient();
     var ret = client.Login(account, password, clientype, clientsn);
     //IServiceAuthentication serv = new ServiceAuthentication();
     //ComRet ret = serv.Login(account, password, client, clientsn);
     return JResult(ret);
 }
 public async Task SendConnectAsJsonAsync(Guid clientId, ClientType clientType)
 {
     var token = CancellationToken.None;
     var type = WebSocketMessageType.Text;
     var buffer = new ArraySegment<byte>(_clientMessageFactory.CreateJsonMessage<object>(
         Resolvers.NotifyConnected, new { ClientId = clientId, ClientType = clientType }));
     await _webSocket.SendAsync(buffer, type, true, token);
 }
Пример #24
0
        private bool IsKnownType(HttpRequest request, ClientType clientType)
        {
            using (var db = GetDB())
            {
                var count = db.Query<int>(@"select count([IP]) from ClientRequests where IP = @IP and UserAgent = @UserAgent and UserType = @ClientType", ClientRequest.FromHttpRequest(request, clientType)).Single();

                return count > 0;
            }
        }
 public MasterMessageDispatcher(
     IOptions<ServerSettings> settings,
     IClientMessageFactory clientMessageFactory,
     WebSocket webSocket,
     Guid masterClientId,
     ClientType clientType)
     :base(settings, clientMessageFactory, webSocket, masterClientId, clientType)
 {
 }
 /// <summary>
 /// Instantiates a new OneDriveClient.
 /// </summary>
 public OneDriveClient(
     AppConfig appConfig,
     CredentialCache credentialCache = null,
     IHttpProvider httpProvider = null,
     IServiceInfoProvider serviceInfoProvider = null,
     ClientType clientType = ClientType.Consumer)
     : base(appConfig, credentialCache, httpProvider, serviceInfoProvider, clientType)
 {
 }
Пример #27
0
		public static void Add(CallbackResult callbackResult, ClientType? clientType = null, Guid? clientUID = null)
		{
			lock (CallbackResultItems)
			{
				var minIndex = ClientsManager.ClientInfos.Any() ?
					ClientsManager.ClientInfos.Min(x => x.CallbackIndex) :
					0;
				CallbackResultItems.RemoveAll(x => x.CallbackResult.Index <= minIndex || (DateTime.Now - x.DateTime) > TimeSpan.FromDays(1));

				callbackResult.Index = ++Index;
				var newCallbackResultItem = new CallbackResultItem()
				{
					CallbackResult = callbackResult,
					DateTime = DateTime.Now,
					ClientType = clientType,
					ClientUID = clientUID
				};
				CallbackResultItems.Add(newCallbackResultItem);

				if (callbackResult.CallbackResultType == CallbackResultType.GKProgress)
				{
					var callbackResultItem = CallbackResultItems.FirstOrDefault(x => x.CallbackResult.GKProgressCallback != null && x.CallbackResult.GKProgressCallback.UID == callbackResult.GKProgressCallback.UID);
					if (callbackResultItem != null && callbackResult.GKProgressCallback.LastActiveDateTime > callbackResultItem.CallbackResult.GKProgressCallback.LastActiveDateTime)
						CallbackResultItems.Remove(callbackResultItem);
				}

				if (callbackResult.AutomationCallbackResult != null && callbackResult.AutomationCallbackResult.Data is PlanCallbackData)
				{
					var callbackResultData = callbackResult.AutomationCallbackResult.Data as PlanCallbackData;
					foreach (var callbackResultItem in CallbackResultItems)
						if (callbackResultItem.CallbackResult.AutomationCallbackResult != null && callbackResultItem.CallbackResult.AutomationCallbackResult.Data is PlanCallbackData)
						{
							var callbackResuultItemData = callbackResultItem.CallbackResult.AutomationCallbackResult.Data as PlanCallbackData;
							if (callbackResultData.ElementUid == callbackResuultItemData.ElementUid &&
								callbackResultData.ElementPropertyType == callbackResuultItemData.ElementPropertyType &&
								callbackResultData.ElementUid == callbackResuultItemData.ElementUid &&
								callbackResult.AutomationCallbackResult.CallbackUID != callbackResultItem.CallbackResult.AutomationCallbackResult.CallbackUID)
							{
								CallbackResultItems.Remove(callbackResultItem);
								break;
							}
						};
				}

				foreach (var clientInfo in ClientsManager.ClientInfos)
				{
					if (clientType.HasValue && (clientType.Value & clientInfo.ClientCredentials.ClientType) == ClientType.None)
						continue;
					if (clientUID.HasValue && clientUID.Value != clientInfo.UID)
						continue;
					if (!AutomationHelper.CheckLayoutFilter(callbackResult.AutomationCallbackResult, clientInfo.LayoutUID))
						continue;
					clientInfo.WaitEvent.Set();
				}
			}
		}
Пример #28
0
 public Client(uint clientId_, string clientFio_, string clientAdress_, string clientPhone_, uint orderCount_, double orderSumma_)
 {
     clientId = clientId_;
     clientFio = clientFio_;
     clientAdress = clientAdress_;
     clientPhone = clientPhone_;
     orderCount = orderCount_;
     orderSumma = orderSumma_;
     enumClientType = ClientType.Important;
 }
		public ClientVersion(int maj, int min, int rev, int pat, ClientType type)
		{
			m_Major = maj;
			m_Minor = min;
			m_Revision = rev;
			m_Patch = pat;
			m_Type = type;

			m_SourceString = _ToStringImpl();
		}
Пример #30
0
        public ClientVersion(int maj, int min, int rev, int pat, ClientType type)
        {
            this.m_Major = maj;
            this.m_Minor = min;
            this.m_Revision = rev;
            this.m_Patch = pat;
            this.m_Type = type;

            this.m_SourceString = this.ToString();
        }
Пример #31
0
 public static bool RemovedInVersion(ClientType expansion)
 {
     return(_expansion < expansion);
 }
Пример #32
0
 /// <summary>
 /// 构造函数(重载)
 /// </summary>
 /// <param name="invokeType">调用类型</param>
 /// <param name="sessionId">调用者会话标识</param>
 /// <param name="clientType">客户端类型</param>
 public NetworkInvokePackage(NetworkInvokeType invokeType, string sessionId, ClientType clientType)
     : this(invokeType, sessionId)
 {
     this.clientType = clientType;
 }
Пример #33
0
        private static List <TargetedDatabase> GetExpectedTargetDatabasesForExpansion(ClientType expansion)
        {
            switch (expansion)
            {
            case ClientType.TheBurningCrusade:
                return(new List <TargetedDatabase> {
                    TargetedDatabase.TheBurningCrusade
                });

            case ClientType.WrathOfTheLichKing:
                return(new List <TargetedDatabase> {
                    TargetedDatabase.WrathOfTheLichKing
                });

            case ClientType.Cataclysm:
                return(new List <TargetedDatabase> {
                    TargetedDatabase.Cataclysm
                });

            case ClientType.WarlordsOfDraenor:
                return(new List <TargetedDatabase> {
                    TargetedDatabase.WarlordsOfDraenor
                });

            case ClientType.Legion:
                return(new List <TargetedDatabase> {
                    TargetedDatabase.Legion
                });

            case ClientType.BattleForAzeroth:     // == ClientType.Classic
                return(new List <TargetedDatabase> {
                    TargetedDatabase.BattleForAzeroth, TargetedDatabase.Classic
                });

            case ClientType.Shadowlands:     // == ClientType.BurningCrusadeClassic
                return(new List <TargetedDatabase> {
                    TargetedDatabase.Shadowlands, TargetedDatabase.Classic
                });

            default:
                return(new List <TargetedDatabase>());
            }
        }
Пример #34
0
 public Client(NetSession ses)
 {
     session = ses;
     cType   = ClientType.QueueCaller;
 }
 public bool CanShowTelephoneNumber(ClientType clientType)
 {
     return(clientType.Accept(new CanTelephoneVisitor()));
 }
Пример #36
0
 internal void AddServiceClient(ClientType clientType, IServiceClient serviceClient, string baseUri)
 {
     ServiceClients.Add(clientType, serviceClient);
     AddBaseUri(serviceClient, baseUri);
 }
Пример #37
0
        public ClientVersion(string fmt)
        {
            m_SourceString = fmt;

            try
            {
                fmt = fmt.ToLower();

                int br1 = fmt.IndexOf('.');
                int br2 = fmt.IndexOf('.', br1 + 1);

                int br3 = br2 + 1;
                while (br3 < fmt.Length && Char.IsDigit(fmt, br3))
                {
                    br3++;
                }

                m_Major    = Utility.ToInt32(fmt.Substring(0, br1));
                m_Minor    = Utility.ToInt32(fmt.Substring(br1 + 1, br2 - br1 - 1));
                m_Revision = Utility.ToInt32(fmt.Substring(br2 + 1, br3 - br2 - 1));

                if (br3 < fmt.Length)
                {
                    if (m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6)                     //Anything before 5.0.7
                    {
                        if (!Char.IsWhiteSpace(fmt, br3))
                        {
                            m_Patch = (fmt[br3] - 'a') + 1;
                        }
                    }
                    else
                    {
                        m_Patch = Utility.ToInt32(fmt.Substring(br3 + 1, fmt.Length - br3 - 1));
                    }
                }

                if (m_Major >= 67)
                {
                    m_Type = ClientType.SA;
                }
                else if (fmt.IndexOf("god") >= 0 || fmt.IndexOf("gq") >= 0)
                {
                    m_Type = ClientType.God;
                }
                else if (fmt.IndexOf("third dawn") >= 0 || fmt.IndexOf("uo:td") >= 0 || fmt.IndexOf("uotd") >= 0 ||
                         fmt.IndexOf("uo3d") >= 0 || fmt.IndexOf("uo:3d") >= 0)
                {
                    m_Type = ClientType.UOTD;
                }
                else
                {
                    m_Type = ClientType.Regular;
                }
            }
            catch
            {
                m_Major    = 0;
                m_Minor    = 0;
                m_Revision = 0;
                m_Patch    = 0;
                m_Type     = ClientType.Regular;
            }
        }
Пример #38
0
        public void WriteToTextBox(List <Messages> discordMessages)
        {
            var discordMessages2 = discordMessages.OrderBy(a => a.id).ToList();

            foreach (var discordMessage in discordMessages2)
            {
                // get channel paragraph
                var para = GetChannelParagraph(discordMessage.channel);

                if (discordMessage.message.Contains('\n'))
                {
                    // new line characters
                    discordMessage.message = "\n\t\t" + discordMessage.message.Replace(Environment.NewLine, "\n\t\t");
                    //para.Inlines.Add(new Run(" " + "\t\t\t\t"));
                    //discordMessage.message = discordMessage.message.Replace('\n', '\t');
                }

                else
                {
                    // timestamp
                    string stamp = discordMessage.postedOn.ToShortTimeString();
                    para.Inlines.Add(new Run(" " + stamp + " ")
                    {
                        Foreground = Brushes.Silver
                    });

                    // username formatting
                    ClientType ct = new ClientType();
                    if (discordMessage.user.discordId == null || discordMessage.user.discordId == "")
                    {
                        ct = ClientType.medlaunch;
                    }
                    else
                    {
                        ct = ClientType.discord;
                    }


                    if (ct == ClientType.discord)
                    {
                        para.Inlines.Add(new Run(" " + discordMessage.user.username + "   ")
                        {
                            Foreground = Brushes.CadetBlue
                        });
                    }
                    else if (ct == ClientType.medlaunch)
                    {
                        // see if this is YOUR username
                        if (discordMessage.user.username == tbDiscordName.Text)
                        {
                            para.Inlines.Add(new Run(" " + discordMessage.user.username + "   ")
                            {
                                Foreground = Brushes.Red
                            });
                        }
                        else
                        {
                            para.Inlines.Add(new Run(" " + discordMessage.user.username + "   ")
                            {
                                Foreground = Brushes.ForestGreen
                            });
                        }
                    }
                    else
                    {
                        // no formatting
                        para.Inlines.Add(new Run(" " + discordMessage.user.username + "   "));
                    }
                }

                ParseMessage(para, discordMessage.message);
                para.Inlines.Add(new LineBreak());

                rtbDocument.ScrollToEnd();
            }
        }
Пример #39
0
        /// <summary>
        /// update the chatbox
        /// </summary>
        /// <param name="message"></param>
        private async void ChatUpdater(List <MednaNetAPIClient.Models.Messages> discordMessages)
        {
            await mw.Dispatcher.BeginInvoke((Action)(() =>
            {
                var discordMessages2 = discordMessages.OrderBy(a => a.id).ToList();

                foreach (var discordMessage in discordMessages2)
                {
                    // get channel paragraph
                    var para = GetChannelParagraph(discordMessage.channel);

                    if (discordMessage.message.Contains('\n'))
                    {
                        //para.Inlines.Add(new Run(" " + "\t\t\t\t"));
                        //discordMessage.message = discordMessage.message.Replace('\n', '\t');
                    }

                    else
                    {
                        // timestamp
                        string stamp = discordMessage.postedOn.ToShortTimeString();
                        para.Inlines.Add(new Run(" " + stamp + " ")
                        {
                            Foreground = Brushes.Silver
                        });

                        // username formatting
                        ClientType ct = new ClientType();
                        if (discordMessage.user.discordId == null || discordMessage.user.discordId == "")
                        {
                            ct = ClientType.medlaunch;
                        }
                        else
                        {
                            ct = ClientType.discord;
                        }


                        if (ct == ClientType.discord)
                        {
                            para.Inlines.Add(new Run(" " + discordMessage.user.username + "   ")
                            {
                                Foreground = Brushes.CadetBlue
                            });
                        }
                        else if (ct == ClientType.medlaunch)
                        {
                            // see if this is YOUR username
                            if (discordMessage.user.username == tbDiscordName.Text)
                            {
                                para.Inlines.Add(new Run(" " + discordMessage.user.username + "   ")
                                {
                                    Foreground = Brushes.Red
                                });
                            }
                            else
                            {
                                para.Inlines.Add(new Run(" " + discordMessage.user.username + "   ")
                                {
                                    Foreground = Brushes.ForestGreen
                                });
                            }
                        }
                        else
                        {
                            // no formatting
                            para.Inlines.Add(new Run(" " + discordMessage.user.username + "   "));
                        }
                    }



                    ParseMessage(para, discordMessage.message);
                    para.Inlines.Add(new LineBreak());

                    rtbDocument.ScrollToEnd();
                }
            }));
        }
        public IReceiverClient GetDataReceiver(ClientType type, string endpoint, string path, string subscription = null, bool isSessionEnabled = false, Action <TextMessage> handler = null)
        {
            if (type == ClientType.Topic && isSessionEnabled)
            {
                throw new ArgumentException("Service bus topic does not support session.");
            }

            if (type == ClientType.Topic && string.IsNullOrEmpty(subscription))
            {
                throw new ArgumentException("To get a client of service bus topic, a subscription name must be provided.");
            }

            var             policy = new RetryExponential(TimeSpan.Zero, TimeSpan.FromSeconds(30), 5);
            IReceiverClient client;

            switch (type)
            {
            case ClientType.Queue:
                client = new QueueClient(endpoint, path, createTokenProvider(), TransportType.Amqp, ReceiveMode.PeekLock, policy);
                break;

            case ClientType.Topic:
                client = new SubscriptionClient(endpoint, path, subscription, createTokenProvider(), TransportType.Amqp, ReceiveMode.PeekLock, policy);
                break;

            default:
                throw new ArgumentException("Unknown type");
            }

            if (handler != null)
            {
                if (isSessionEnabled)
                {
                    var options = new SessionHandlerOptions(exceptionReceivedHandlerAsync);
                    options.AutoComplete          = false;
                    options.MaxConcurrentSessions = 10;
                    options.MaxAutoRenewDuration  = new TimeSpan(0, 5, 0);
                    ((IQueueClient)client).RegisterSessionHandler(async(messageSession, message, cancellationToken) =>
                    {
                        if (cancellationToken.IsCancellationRequested)
                        {
                            return;
                        }
                        try
                        {
                            handler?.Invoke(JsonConvert.DeserializeObject <TextMessage>(Encoding.ASCII.GetString(message.Body)));
                            await completeAsync(message, client);
                        }
                        catch (Exception)
                        {
                            await abandonAsync(message, client);
                        }
                        finally
                        {
                            await messageSession.CloseAsync();
                        }
                    }, options);
                }
                else
                {
                    var options = new MessageHandlerOptions(exceptionReceivedHandlerAsync);
                    options.AutoComplete         = false;
                    options.MaxConcurrentCalls   = 10;
                    options.MaxAutoRenewDuration = new TimeSpan(0, 5, 0);
                    client.RegisterMessageHandler(async(message, cancellationToken) =>
                    {
                        if (cancellationToken.IsCancellationRequested)
                        {
                            return;
                        }
                        try
                        {
                            handler?.Invoke(JsonConvert.DeserializeObject <TextMessage>(Encoding.ASCII.GetString(message.Body)));
                            await completeAsync(message, client);
                        }
                        catch (Exception)
                        {
                            await abandonAsync(message, client);
                        }
                    }, options);
                }
            }

            return(client);
        }
Пример #41
0
        public void Load(string mypath, ClientType myclientType)
        {
            this.path       = mypath;
            this.clientType = myclientType;
            BinaryReader binaryReader = new BinaryReader(new FileStream(this.path, FileMode.Open));

            this.type       = RoseFile.ReadBString(ref binaryReader);
            this.entryCount = binaryReader.ReadInt32();
            this.entry      = new STL.STLEntry[this.entryCount];
            for (int i = 0; i < this.entryCount; i++)
            {
                this.entry[i].string_ID = RoseFile.ReadBString(ref binaryReader);
                this.entry[i].ID        = binaryReader.ReadUInt32();
            }
            if (this.clientType == ClientType.JROSE)
            {
                this.languageCount = 1;
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].text    = new string[1];
                    this.entry[j].comment = new string[1];
                    this.entry[j].quest1  = new string[1];
                    this.entry[j].quest2  = new string[1];
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].text[0] = RoseFile.ReadBString(ref binaryReader);
                    if (this.type == "QEST01" || this.type == "ITST01")
                    {
                        this.entry[j].comment[0] = RoseFile.ReadBString(ref binaryReader);
                        if (this.type == "QEST01")
                        {
                            this.entry[j].quest1[0] = RoseFile.ReadBString(ref binaryReader);
                            this.entry[j].quest2[0] = RoseFile.ReadBString(ref binaryReader);
                        }
                    }
                }
            }
            else
            {
                this.languageCount  = binaryReader.ReadInt32();
                this.languageOffset = new uint[this.languageCount];
                for (int i = 0; i < this.languageCount; i++)
                {
                    this.languageOffset[i] = binaryReader.ReadUInt32();
                }
                for (int j = 0; j < this.entryCount; j++)
                {
                    this.entry[j].Offset  = new uint[this.languageCount];
                    this.entry[j].text    = new string[this.languageCount];
                    this.entry[j].comment = new string[this.languageCount];
                    this.entry[j].quest1  = new string[this.languageCount];
                    this.entry[j].quest2  = new string[this.languageCount];
                }
                for (int i = 0; i < this.languageCount; i++)
                {
                    binaryReader.BaseStream.Seek((long)((ulong)this.languageOffset[i]), SeekOrigin.Begin);
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        this.entry[j].Offset[i] = binaryReader.ReadUInt32();
                    }
                }
                for (int i = 0; i < this.languageCount; i++)
                {
                    for (int j = 0; j < this.entryCount; j++)
                    {
                        binaryReader.BaseStream.Seek((long)((ulong)this.entry[j].Offset[i]), SeekOrigin.Begin);
                        this.entry[j].text[i] = RoseFile.ReadBString(ref binaryReader);
                        if (this.type == "QEST01" || this.type == "ITST01")
                        {
                            this.entry[j].comment[i] = RoseFile.ReadBString(ref binaryReader);
                            if (this.type == "QEST01")
                            {
                                this.entry[j].quest1[i] = RoseFile.ReadBString(ref binaryReader);
                                this.entry[j].quest2[i] = RoseFile.ReadBString(ref binaryReader);
                            }
                        }
                    }
                }
            }
            binaryReader.Close();
        }
Пример #42
0
 public async Task <SocialNetworkStatus> CreateStatusAsync(ClientType clientType)
 {
     _logger.LogInformation("User requested term status creation on Twitter.");
     return(await _statusCreationService.CreateStatusAsync(clientType));
 }
Пример #43
0
 public static bool AddedInVersion(ClientType expansion)
 {
     return(_expansion >= expansion);
 }
Пример #44
0
 /// <summary>
 /// Creates the connection.
 /// </summary>
 /// <returns>The connection.</returns>
 /// <param name="dbType">Db type.</param>
 public static IDbConnection CreateConnection(ClientType dbType)
 {
     return(CreateConnection(dbType + ""));
 }
Пример #45
0
 /// <summary>
 /// Creates the data adapter.
 /// </summary>
 /// <returns>The data adapter.</returns>
 /// <param name="dbType">Db type.</param>
 public static IDbDataAdapter CreateDataAdapter(ClientType dbType)
 {
     return(CreateDataAdapter(dbType + ""));
 }
Пример #46
0
        public bool RemoveAllHomeTopics(ClientType client, int supplierId)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(string.Format("DELETE FROM Vshop_HomeTopics where Client = {0} and supplierId={1}", (int)client, supplierId));

            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Пример #47
0
 private void AddServiceClient(ClientType clientType, string baseUri)
 {
     AddServiceClient(clientType, CreateClient(baseUri), baseUri);
 }
Пример #48
0
 public ClientInvoice(ClientType clientType, Invoice invoice)
 {
     this.clientType = clientType;
     this.invoice    = invoice;
 }
Пример #49
0
        /// <summary>
        /// Creates default client configuration based on <see cref="ClientType"/>.
        /// </summary>
        /// <param name="clientType">The type of the client.</param>
        /// <param name="authorityUri">The IdentityServer instance URI.</param>
        /// <param name="clientRequest">Client information provided by the user.</param>
        private Entities.Client CreateForType(ClientType clientType, string authorityUri, CreateClientRequest clientRequest)
        {
            var client = new Entities.Client {
                ClientId       = clientRequest.ClientId,
                ClientName     = clientRequest.ClientName,
                Description    = clientRequest.Description,
                ClientUri      = clientRequest.ClientUri,
                LogoUri        = clientRequest.LogoUri,
                RequireConsent = clientRequest.RequireConsent,
                BackChannelLogoutSessionRequired = true,
                AllowedScopes = clientRequest.IdentityResources.Union(clientRequest.ApiResources).Select(scope => new ClientScope {
                    Scope = scope
                }).ToList()
            };

            if (!string.IsNullOrEmpty(clientRequest.RedirectUri))
            {
                client.RedirectUris = new List <ClientRedirectUri> {
                    new ClientRedirectUri {
                        RedirectUri = clientRequest.RedirectUri
                    }
                };
            }
            if (!string.IsNullOrEmpty(clientRequest.PostLogoutRedirectUri))
            {
                client.PostLogoutRedirectUris = new List <ClientPostLogoutRedirectUri> {
                    new ClientPostLogoutRedirectUri {
                        PostLogoutRedirectUri = clientRequest.PostLogoutRedirectUri
                    }
                };
            }
            if (clientRequest.Secrets.Any())
            {
                client.ClientSecrets = clientRequest.Secrets.Select(x => new ClientSecret {
                    Type        = IdentityServerConstants.SecretTypes.SharedSecret,
                    Description = x.Description,
                    Expiration  = x.Expiration,
                    Value       = x.Value.ToSha256()
                })
                                       .ToList();
            }
            switch (clientType)
            {
            case ClientType.SPA:
                client.AllowedGrantTypes = new List <ClientGrantType> {
                    new ClientGrantType {
                        GrantType = GrantType.AuthorizationCode
                    }
                };
                client.RequirePkce         = true;
                client.RequireClientSecret = false;
                client.AllowedCorsOrigins  = new List <ClientCorsOrigin> {
                    new ClientCorsOrigin {
                        Origin = clientRequest.ClientUri ?? authorityUri
                    }
                };
                break;

            case ClientType.WebApp:
                client.AllowedGrantTypes = new List <ClientGrantType> {
                    new ClientGrantType {
                        GrantType = GrantType.Hybrid
                    }
                };
                client.RequirePkce = true;
                break;

            case ClientType.Native:
                client.AllowedGrantTypes = new List <ClientGrantType> {
                    new ClientGrantType {
                        GrantType = GrantType.AuthorizationCode
                    }
                };
                client.RequirePkce         = true;
                client.RequireClientSecret = false;
                break;

            case ClientType.Machine:
                client.AllowedGrantTypes = new List <ClientGrantType> {
                    new ClientGrantType {
                        GrantType = GrantType.ClientCredentials
                    }
                };
                client.RequireConsent = false;
                break;

            case ClientType.Device:
                client.AllowedGrantTypes = new List <ClientGrantType> {
                    new ClientGrantType {
                        GrantType = GrantType.DeviceFlow
                    }
                };
                break;

            case ClientType.SPALegacy:
                client.AllowedGrantTypes = new List <ClientGrantType> {
                    new ClientGrantType {
                        GrantType = GrantType.Implicit
                    }
                };
                client.RequirePkce                 = false;
                client.RequireClientSecret         = false;
                client.AllowAccessTokensViaBrowser = true;
                client.AllowedCorsOrigins          = new List <ClientCorsOrigin> {
                    new ClientCorsOrigin {
                        Origin = clientRequest.ClientUri ?? authorityUri
                    }
                };
                break;

            default:
                throw new ArgumentNullException(nameof(clientType), "Cannot determine the type of the client.");
            }
            return(client);
        }
Пример #50
0
        public void UpgradeClient()
        {
            int type = ((int)this.clientType);

            this.clientType = (ClientType)(++type);
        }
Пример #51
0
 /// <summary>
 /// Метод создания депозита
 /// </summary>
 /// <param name="depositBalance">баланс</param>
 /// <param name="depositCapitalization">капитализация</param>
 /// <param name="clientType">тип клиента</param>
 /// <returns>депозит</returns>
 public override Deposit CreateDeposit(decimal depositBalance, bool depositCapitalization, ClientType clientType) =>
 new DefaultDeposit(depositBalance, depositCapitalization, DepositRates.GetDepositRate(clientType));
Пример #52
0
        public LoginInfo oldCheckIn(String UserID, String Password, String countryCODE, String HostIP, String HostName, ClientType ClientType, Module ModuleType, String HelpList, String hdn_FBLoginFlag)
        {
            //DS_Masters objDS_Masters = new DS_Masters();
            LoginInfo obj_LoginInfo = new LoginInfo();

            obj_LoginInfo.ds_BusinessAreaInfo = new DataSet();

            String SessionID;

            try
            {
                #region BASIC VALIDATIONS
                //-------------------------------------------------------------
                //Basic Validations //MessageBox.Show("Basic Validation");
                //-------------------------------------------------------------
                UserID = UserID.Trim();
                if (hdn_FBLoginFlag == string.Empty || hdn_FBLoginFlag == null || hdn_FBLoginFlag == "")
                {
                    Password = Password.Trim();
                }

                //Store the information to be returned back to client in this object

                //Both userid and password are compulsory
                if (UserID == "")
                {
                    obj_LoginInfo.ServerMessage = "Please provide USERID";
                    obj_LoginInfo.LoginStatus   = 2;
                    if (DBConnection.State == ConnectionState.Open)
                    {
                        DBConnection.Close();
                    }
                    return(obj_LoginInfo);
                }
                if (hdn_FBLoginFlag == string.Empty || hdn_FBLoginFlag == null || hdn_FBLoginFlag == "")
                {
                    if (Password == "")
                    {
                        obj_LoginInfo.ServerMessage = "Please provide PASSWORD";
                        obj_LoginInfo.LoginStatus   = 3;
                        if (DBConnection.State == ConnectionState.Open)
                        {
                            DBConnection.Close();
                        }
                        return(obj_LoginInfo);
                    }
                }
                #endregion

                //-------------------------------------------------------------
                DBConnection.Open();
                //-------------------------------------------------------------
                //Major Validations
                //-------------------------------------------------------------
                //Authenticate the user	Get Existing Information of user Byte ret_val;

                #region GET USER INFORMANTION
                DataTable dt_usermst = new DataTable();
                String    msg        = "";

                //pooja vachhani on 2/7/15
                dt_usermst = this.GetUserTypeFromUserId(DBDataAdpterObject, UserID, ref msg);

                if (dt_usermst != null && dt_usermst.Rows.Count == 1)
                {
                    if (hdn_FBLoginFlag == null && hdn_FBLoginFlag == "")
                    {
                        if (dt_usermst.Rows[0]["password"].ToString() != Password)
                        {
                            //Validate Password
                            //ServerLog.InvalidLoginLog(dt_usermst.Rows[0]["user_id"].ToString() + " - Attemting to login With Invalid Password on " + DateTime.Now + " By IP " + HostIP.ToString());
                            obj_LoginInfo.ServerMessage = "Invalid Password.";
                            obj_LoginInfo.LoginStatus   = 5;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }
                    String    country_code  = dt_usermst.Rows[0]["country_code"].ToString();
                    DataTable dtUserCountry = getUserCountry(DBDataAdpterObject, country_code, ref msg);
                    if (dtUserCountry == null || dtUserCountry.Rows.Count == 0)
                    {
                        //No rows found
                        //ServerLog.InvalidLoginLog(UserID.ToString() + " - Attemting to login. " + DateTime.Now + " By IP " + HostIP.ToString() + "User Details Not Found");
                        obj_LoginInfo.ServerMessage = "Country is Deactivated";
                        obj_LoginInfo.LoginStatus   = 15;
                        if (DBConnection.State == ConnectionState.Open)
                        {
                            DBConnection.Close();
                        }
                        return(obj_LoginInfo);
                    }

                    if (dt_usermst.Rows[0]["user_type"].ToString() != "RU" || dt_usermst.Rows[0]["user_type"].ToString() != "AG")
                    {
                        if (dt_usermst.Rows[0]["is_active"].ToString() == "N")
                        {
                            obj_LoginInfo.ServerMessage = "You Are Not Active User.";
                            obj_LoginInfo.LoginStatus   = 10;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }
                    //pooja vachhani on 20/6/15
                    if (dt_usermst.Rows[0]["user_type"].ToString() != "SA")
                    {
                        DataTable dtUserGrpRights = this.GetUserGroupRights(DBDataAdpterObject, UserID, ref msg);
                        if (dtUserGrpRights != null)
                        {
                            if (dtUserGrpRights.Rows.Count > 0)
                            {
                                if (dtUserGrpRights.Rows[0]["is_active"].ToString() == "N")
                                {
                                    obj_LoginInfo.ServerMessage = "Your Role is not activated now.";
                                    obj_LoginInfo.LoginStatus   = 8;
                                    if (DBConnection.State == ConnectionState.Open)
                                    {
                                        DBConnection.Close();
                                    }
                                    return(obj_LoginInfo);
                                }
                            }
                        }
                        else
                        {
                            obj_LoginInfo.ServerMessage = "Your Group is not defined";
                            obj_LoginInfo.LoginStatus   = 9;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }



                    if (dt_usermst.Rows[0]["user_type"].ToString() != "SA")
                    {
                        //dt_usermst = null;
                        //dt_usermst = this.GetUserInformation(DBDataAdpterObject, UserID,ref msg);

                        HttpContext.Current.Session["country_code"] = dt_usermst.Rows[0]["country_code"].ToString();
                        if (dt_usermst == null)
                        {
                            //No rows found
                            //ServerLog.InvalidLoginLog(UserID.ToString() + " - Attemting to login. " + DateTime.Now + " By IP " + HostIP.ToString() + "User Details Not Found");
                            obj_LoginInfo.ServerMessage = "User Detail Not Found.";
                            obj_LoginInfo.LoginStatus   = 4;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }



                    if (dt_usermst.Rows[0]["end_date"] == DBNull.Value)
                    {
                        if (Convert.ToDateTime(dt_usermst.Rows[0]["start_date"]) >= System.DateTime.UtcNow)
                        {
                            //ServerLog.InvalidLoginLog(dt_usermst.Rows[0]["user_id"].ToString() + " - Attemting to login With Expired Account on " + DateTime.Now + " By IP " + HostIP.ToString());
                            obj_LoginInfo.ServerMessage = "Your Account has been expire.";
                            obj_LoginInfo.LoginStatus   = 6;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }
                    else if (!(Convert.ToDateTime(dt_usermst.Rows[0]["start_date"]) <= System.DateTime.UtcNow && Convert.ToDateTime(dt_usermst.Rows[0]["end_date"]) >= System.DateTime.UtcNow))
                    {
                        //ServerLog.InvalidLoginLog(dt_usermst.Rows[0]["user_id"].ToString() + " - Attemting to login With Account Which Not Start Yet on " + DateTime.Now + " By IP " + HostIP.ToString());
                        obj_LoginInfo.ServerMessage = "Your Account not Started Yet.";
                        obj_LoginInfo.LoginStatus   = 11;
                        if (DBConnection.State == ConnectionState.Open)
                        {
                            DBConnection.Close();
                        }
                        return(obj_LoginInfo);
                    }

                    //if (dt_usermst.Rows[0]["user_status_flag"].ToString() == "D")
                    //{

                    //    //User account is deactivated
                    //    //ServerLog.InvalidLoginLog(dt_usermst.Rows[0]["user_id"].ToString() + " - Attemting to login With Deactivated Account on " + DateTime.Now + " By IP " + HostIP.ToString());
                    //    obj_LoginInfo.ServerMessage = "Your account has been deactivated";
                    //    obj_LoginInfo.LoginStatus = 12;
                    //    if (DBConnection.State == ConnectionState.Open) DBConnection.Close();
                    //    return obj_LoginInfo;
                    //}
                    if (dt_usermst.Rows[0]["user_type"].ToString() == "RU" || dt_usermst.Rows[0]["user_type"].ToString() == "AG")
                    {
                        if (dt_usermst.Rows[0]["is_active"].ToString() == "N")
                        {
                            obj_LoginInfo.ServerMessage = "Please active your membership from your Gmail Account.";
                            obj_LoginInfo.LoginStatus   = 7;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }
                    //by pooja vachhani on 20/6/15


                    #endregion

                    //String UserName = dt_usermst.Rows[0]["first_name"].ToString() + " " + dt_usermst.Rows[0]["middle_name"].ToString() + " " + dt_usermst.Rows[0]["last_name"].ToString();
                    String UserName = dt_usermst.Rows[0]["user_name"].ToString();
                    SessionID = SessionManager.GenerateNewSession(UserID, UserName, HostIP, HostName, ClientType, ModuleType);
                    if (SessionID == "-1")
                    {
                        obj_LoginInfo.ServerMessage = "Your license limit has exceeded.";
                        obj_LoginInfo.LoginStatus   = 13;
                        if (DBConnection.State == ConnectionState.Open)
                        {
                            DBConnection.Close();
                        }
                        return(obj_LoginInfo);
                    }

                    if (dt_usermst != null)
                    {
                        if (dt_usermst.Rows.Count > 0)
                        {
                            dt_usermst.TableName = "dt_usermst";
                            obj_LoginInfo.ds_BusinessAreaInfo.Tables.Add(dt_usermst.Copy());
                            //obj_LoginInfo.ds_BusinessAreaInfo.Tables["dt_usermst"].Columns.Add("sa_id");
                            //obj_LoginInfo.ds_BusinessAreaInfo.Tables["dt_usermst"].Rows[0]["sa_id"] = "H01";
                        }
                    }

                    obj_LoginInfo.LoginStatus   = 1;
                    obj_LoginInfo.ServerMessage = DateTime.UtcNow.ToString();
                    //SessionID for user
                    obj_LoginInfo.SessionId = SessionID;



                    dt_usermst.Rows[0]["last_login_date"] = DateTime.UtcNow;
                    DBCommand.Transaction = DBConnection.BeginTransaction();
                    DBCommand.Parameters.Clear();
                    DBCommand.CommandText = "";
                    BLGeneralUtil.UpdateTableInfo objUpdateTableInfo = new BLGeneralUtil.UpdateTableInfo();
                    dt_usermst.TableName = "user_mst";
                    //Update User Master modified by sanket on 26-08-09
                    if (dt_usermst.Rows.Count > 0)
                    {
                        objUpdateTableInfo = BLGeneralUtil.UpdateTable(ref DBCommand, dt_usermst, BLGeneralUtil.UpdateWhereMode.KeyAndModifiedColumns);
                        if (objUpdateTableInfo.Status == false && objUpdateTableInfo.TotalRowsAffected != 1)
                        {
                            DBCommand.Transaction.Rollback();
                            obj_LoginInfo.ServerMessage = "An error occured while recording the login time.";
                            obj_LoginInfo.LoginStatus   = 16;
                            if (DBConnection.State == ConnectionState.Open)
                            {
                                DBConnection.Close();
                            }
                            return(obj_LoginInfo);
                        }
                    }
                }
                else if (dt_usermst.Rows.Count > 1)
                {
                    obj_LoginInfo.ServerMessage = "More than one user registerd with same userId";
                    obj_LoginInfo.LoginStatus   = 18;
                    if (DBConnection.State == ConnectionState.Open)
                    {
                        DBConnection.Close();
                    }
                    return(obj_LoginInfo);
                }

                DBCommand.Transaction.Commit();
                if (DBConnection.State == ConnectionState.Open)
                {
                    DBConnection.Close();
                }
                return(obj_LoginInfo);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
                //SessionInfo sess = new SessionInfo("Unknown", UserID, "Anonymous", HostIP, ClientType, ModuleType, DateTime.Now);
                //throw ExceptionManager.Help(ex, sess);
                ServerLog.Log(ex.Message + Environment.NewLine + ex.StackTrace);
                obj_LoginInfo.ServerMessage = ex.Message + " " + ex.StackTrace.Replace('\n', ' ').Replace('\r', ' ');
                obj_LoginInfo.LoginStatus   = 17;
                return(obj_LoginInfo);
            }
        }
Пример #53
0
        /// <summary>
        /// Loads clients with certain client types by <paramref name="repositoryHost"/>.
        /// </summary>
        /// <param name="repositoryHost">Host name of the repository without schema (e.g. "example.com").</param>
        /// <param name="type">One or more client type flags.</param>
        /// <param name="cancellation">The token to monitor for cancellation requests.</param>
        /// <returns>A Task that represents the asynchronous operation and wraps the loaded <see cref="Client"/>
        /// instances.</returns>
        public async Tasks.Task <Client[]> GetClientsByRepositoryAsync(string repositoryHost, ClientType type,
                                                                       CancellationToken cancellation = default)
        {
            var clients = await _storage.LoadClientsByRepositoryAsync(repositoryHost?.RemoveUrlSchema(), cancellation)
                          .ConfigureAwait(false);

            // return clients that have any of the requested types
            return(clients.Where(c => type.HasFlag(c.Type)).ToArray());
        }
Пример #54
0
        private DataTable GetAppMenuList(IDbDataAdapter adapter, string UserID, string countryCODE, ClientType ClientType)
        {
            try
            {
                //String Org_Codes = "";
                //for (int i = 0; i < Org_ID.Count; i++)
                //{
                //    Org_Codes += "'" + Org_ID[i].ToString() + "'";
                //    if (i != Org_ID.Count - 1)
                //        Org_Codes += ",";
                //}
                String client_type = String.Empty;
                if (ClientType == ClientType.DeskTop)
                {
                    client_type = "D";
                }
                else if (ClientType == ClientType.Browser)
                {
                    client_type = "B";
                }
                DataSet ds = new DataSet();


//                adapter.SelectCommand.CommandText = @"SELECT menu_id, parent_menu_id, menu_display_name, menu_page_heading, menu_sort_id,menu_type,transaction_label,is_active,
//                            transaction_page_name,menu_color,layout_id,is_default, menu_link, href_id FROM menu_master WHERE (menu_id IN (SELECT DISTINCT menu_id
//                            FROM group_rights WHERE (group_id IN (SELECT group_id FROM user_group_rights WHERE (user_id =  @user_id) ) )) ) ";

                adapter.SelectCommand.CommandText = @"SELECT menu_id, parent_menu_id, menu_display_name, menu_page_heading, menu_sort_id,menu_type,transaction_label,is_active,
                            transaction_page_name,menu_color,layout_id,is_default, menu_link, href_id FROM menu_master WHERE (menu_id IN (SELECT DISTINCT menu_id
                            FROM group_rights WHERE (group_id IN (SELECT group_id FROM user_group_rights WHERE (user_id =  @user_id AND country_code = '" + countryCODE + "') ) )) ) ";


                //adapter.SelectCommand.CommandText = @"SELECT menu_id, pmenu_id, parameter, sort_id, transaction_type, menu_desc, window_name FROM menu_mst WHERE (menu_id IN (SELECT DISTINCT menu_id FROM group_rights WHERE (group_id IN (SELECT group_id FROM user_group_rights WHERE (user_id = @user_id) AND (country_code IN ()) AND (menu_mst.client_type = 'B') AND (start_date <= @today) AND (end_date > @today OR end_date IS NULL))) AND (start_date <= @today) AND (end_date > @today OR end_date IS NULL)))";
                adapter.SelectCommand.Parameters.Clear();
                IDataParameter parma1 = DBObjectFactory.GetParameterObject();
                parma1.ParameterName = "@today";
                parma1.DbType        = DbType.DateTime;
                parma1.Value         = System.DateTime.UtcNow;

                IDataParameter parma2 = DBObjectFactory.GetParameterObject();
                parma2.ParameterName = "@user_id";
                parma2.DbType        = DbType.String;
                parma2.Value         = UserID;

                adapter.SelectCommand.Parameters.Add(parma1);
                adapter.SelectCommand.Parameters.Add(parma2);
                adapter.Fill(ds);
                //ds.Tables[0].TableName = "dt_menu_info";
                //MessageBox.Show("fill",ds.Tables[0].Rows.Count.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    //MessageBox.Show("return");
                    return(ds.Tables[0]);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                ServerLog.Log(ex.Message + " " + ex.StackTrace);
                return(null);
                //throw ExceptionManager.Help(ex, null);
            }
        }
Пример #55
0
 public StateObject(ref Socket workSocket, ClientType clientType)
 {
     WorkSocket = workSocket;
     Buffer     = new byte[BufferSize];
     ClientType = clientType;
 }
Пример #56
0
 /// <summary>
 /// Creates the command.
 /// </summary>
 /// <returns>The command.</returns>
 /// <param name="dbType">Db type.</param>
 public static IDbCommand CreateCommand(ClientType dbType)
 {
     return(CreateCommand(dbType + ""));
 }
Пример #57
0
 public void SetClientType(ClientType type)
 {
     ApolloConnector.apollo_connector_set_clientType(base.ObjectId, type);
 }
Пример #58
0
        public static void SendRequest(ServerType type, MsgCode protocolCode, byte[] data, ClientType clientType = ClientType.Tcp, Action onRequestSuccess = null, Action onResquestFailed = null, int resendTimes = 1)
        {
            NetworkClient client = null;

            instance.clients.TryGetValue(type, out client);
            if (client != null)
            {
                client.SendRequest(protocolCode, data, clientType, onRequestSuccess, onResquestFailed, resendTimes);
            }
            else
            {
                DebugUtils.LogError(DebugUtils.Type.Network, string.Format("the server {0} sent request to doesn't exist!", type));
            }
        }
Пример #59
0
        public static Message Parse(string s)
        {
            JSONNode message = JSON.Parse(s);

            if (message == null || message["type"] == null)
            {
                return(new TextResp(s));
            }
            var messageType = ToEnum <MessageType>(message["type"]);           //(MessageType) Enum.Parse(typeof(MessageType), message["type"]);

            if (messageType == MessageType.Info)
            {
                if (message["turnType"] == null)
                {
                    return(new TextResp(message["text"]));
                }


                var turnType = ToEnum <TurnType>(message["turnType"]);               //(TurnType) Enum.Parse(typeof(TurnType), message["turnType"]);

                if (!message["success"].AsBool)
                {
                    // RETURN ERROR MESSAGE
                    var currentPlayer = ToEnum <PlayerColor>(message["player"]);
                    var errorCode     = ToEnum <ErrorCode>(message["errorCode"]);

                    return(new TurnResp(errorCode, currentPlayer, turnType));
                }

                if (turnType == TurnType.BoardState)
                {
                    DestinationTicket[] ownDestinationTickets    = NodeToDestinationTickets(message["drawnDestinationTickets"]);
                    DestinationTicket[] activeDestinationTickets = NodeToDestinationTickets(message["toBeClaimedDestinationTickets"]);
                    Route[]             ownRoutes = new Route[message["ownRoutes"].Count];
                    PassengerCarColor[] faceUpPassengerCarDeck = new PassengerCarColor[message["faceUpPassengerCarDeck"].AsArray.Count];
                    int[] drawnPassengerCars = new int[message["drawnPassengerCars"].AsArray.Count];

                    // PARSE COLORS
                    int i = 0;
                    foreach (var color in message["faceUpPassengerCarDeck"].AsArray)
                    {
                        faceUpPassengerCarDeck[i++] = ToEnum <PassengerCarColor>(color.Value);
                    }
                    i = 0;
                    foreach (var amount in message["drawnPassengerCars"].AsArray)
                    {
                        drawnPassengerCars[i++] = amount.Value.AsInt;
                    }

                    int         topdownPassengerCarDeckCount = message["topdownPassengerCarDeckCount"].AsInt;
                    int         destinationTicketCount       = message["destinationTicketsCount"].AsInt;
                    int         leftPassengerCars            = message["leftPassengerCars"].AsInt;
                    bool        finalTurn  = message["finalTurn"].AsBool;
                    PlayerColor nextPlayer = ToEnum <PlayerColor>(message["player"]);

                    return(new BoardStateResp(faceUpPassengerCarDeck, topdownPassengerCarDeckCount, destinationTicketCount, nextPlayer, drawnPassengerCars, ownDestinationTickets, activeDestinationTickets, ownRoutes, leftPassengerCars, finalTurn));
                }
                else if (turnType == TurnType.DrawDestinationTickets)
                {
                    var player             = ToEnum <PlayerColor>(message["player"]);
                    var success            = message["success"].AsBool;
                    var destinationTickets = NodeToDestinationTickets(message["drawnCards"]);

                    return(new DrawDestinationTicketsResp(player, destinationTickets));
                }
                else if (turnType == TurnType.ClaimDestinationTickets)
                {
                    var player             = ToEnum <PlayerColor>(message["player"]);
                    var success            = message["success"].AsBool;
                    var destinationTickets = NodeToDestinationTickets(message["drawnCards"]);

                    return(new ClaimDestinationTicketsResp(player, destinationTickets));
                }
                else if (turnType == TurnType.ClaimRoute)
                {
                    var player       = ToEnum <PlayerColor>(message["player"]);
                    var destinationA = ToEnum <Destination>(message["d1"]);
                    var destinationB = ToEnum <Destination>(message["d2"]);
                    PassengerCarColor   routeColor = ToEnum <PassengerCarColor>(message["routeColor"]);
                    PassengerCarColor[] colors     = new PassengerCarColor[message["passengerCarColors"].Count];
                    int i = 0;
                    foreach (var color in message["passengerCarColors"].AsArray)
                    {
                        colors[i++] = ToEnum <PassengerCarColor>(color.Value);
                    }

                    return(new ClaimRouteResp(player, destinationA, destinationB, routeColor, colors));
                }
                else if (turnType == TurnType.DrawPassengerCars)
                {
                    PassengerCarColor drawnCard = ToEnum <PassengerCarColor>(message["drawnCard"]);
                    PlayerColor       player    = ToEnum <PlayerColor>(message["player"]);

                    JSONArray           array                  = message["faceUpPassengerCarDeck"].AsArray;
                    bool                hiddenDeck             = message["hiddenDeck"];
                    PassengerCarColor[] faceUpPassengerCarDeck = new PassengerCarColor[array.Count];

                    for (int i = 0; i < array.Count; i++)
                    {
                        faceUpPassengerCarDeck[i] = ToEnum <PassengerCarColor>(array[i]);
                    }

                    return(new DrawPassengerCarsResp(player, drawnCard, hiddenDeck, faceUpPassengerCarDeck));
                }
                else if (turnType == TurnType.FinalScore)
                {
                    var  playerColor  = ToEnum <PlayerColor>(message["player"]);
                    bool winner       = message["winner"].AsBool;
                    bool longestRoute = message["longestRoute"].AsBool;

                    int totalScore         = message["totalScore"].AsInt;
                    int scorePassengerCars = message["scorePassengerCars"].AsInt;
                    int longsetRouteLength = message["longestRouteLength"].AsInt;

                    string playerName = message["name"];

                    DestinationTicket[] claimedTickets    = NodeToDestinationTickets(message["claimedTickets"]);
                    DestinationTicket[] notClaimedTickets = NodeToDestinationTickets(message["notClaimedTickets"]);

                    return(new PlayerScore(playerColor, playerName, totalScore, scorePassengerCars, longsetRouteLength, longestRoute, winner, claimedTickets, notClaimedTickets));
                }
                else if (turnType == TurnType.Join)
                {
                    PlayerColor playerColor = ToEnum <PlayerColor>(message["player"]);
                    ClientType  clientType  = ToEnum <ClientType>(message["clientType"]);
                    string      playerName  = message["playerName"];

                    return(new JoinResp(playerColor, playerName, clientType));
                }
                else if (turnType == TurnType.ListAllRoutes)
                {
                    PlayerColor playerColor = PlayerColor.None;
                    if (message["player"] != null)
                    {
                        ToEnum <PlayerColor>(message["player"]);
                    }


                    Route[] routes = new Route[message["routes"].Count];
                    int     i      = 0;

                    foreach (JSONNode node in message["routes"])
                    {
                        var passengerColor = ToEnum <PassengerCarColor>(node["color"]);
                        var destinationA   = ToEnum <Destination>(node["d1"]);
                        var destinationB   = ToEnum <Destination>(node["d2"]);

                        routes[i++] = new Route(destinationA, destinationB, node["cost"].AsInt, passengerColor);
                    }

                    return(new ListAllRoutesResp(playerColor, routes));
                }
            }
            else if (messageType == MessageType.Request)
            {
                PlayerColor playerColor = PlayerColor.None;

                if (message["player"] != null)
                {
                    playerColor = ToEnum <PlayerColor>(message["player"]);
                }

                var turnType = ToEnum <TurnType>(message["turnType"]);

                return(new TurnReq(playerColor, turnType));
            }

            Debug.Log("Error couldn't parse request! " + s);
            return(null);
        }
Пример #60
0
 private static extern ApolloResult apollo_connector_set_clientType(ulong objId, ClientType type);