static void CometWorker_OnClientJoined(ConnectionDetails details, string jointId, ref Dictionary<string, object> classList) { //in this sample project we used jointId to carry session ids to locate the user string sessionId = jointId; UserDefinition userDefinition = null; lock (MessageBroker.PreUserDefinitions) { string userName; MessageBroker.SessionUserPair.TryGetValue(sessionId, out userName); if (userName == null) { return; } MessageBroker.PreUserDefinitions.TryGetValue(userName, out userDefinition); } //independent object instance if(userDefinition.Role== UserRole.User) classList.Add("User", new SimpleUserClass(details.ClientId)); else classList.Add("Admin", new AdminUserClass(details.ClientId)); }
public BadgerControlStatusView() { InitializeComponent(); joystickQueryThread = null; CompositionTarget.Rendering += OnRender; _eventAggregator = ApplicationService.Instance.EventAggregator; _eventAggregator.GetEvent<DeliverJoystickEvent>().Subscribe((joystick) => { // send a confirmation back when we receive a joystick joystickQueryThread = joystick; _eventAggregator.GetEvent<ConfirmJoystickEvent>().Publish(JOYSTICK_ID); }); _eventAggregator.GetEvent<ConnectionDetailsEvent>().Subscribe((connection) => { UpdateConnection(connection); }); // create a ConnectionDetails to keep around. its fields will be used to help organize which // components have which connection statuses ConnectionDetails connectionDetails = new ConnectionDetails(); connectionDetails.ai = ConnectionOption.DISCONNECTED; connectionDetails.remote = ConnectionOption.DISCONNECTED; connectionDetails.direct = ConnectionOption.DISCONNECTED; UpdateConnection(connectionDetails); }
public BadgerControlDrive() { isEnabled = false; hasControl = false; isReady = false; triedJoystick = false; joystickMessageGiven = false; componentOneActive = componentTwoActive = componentThreeActive = false; joystickConfirmedFromVisualView = false; joystickConfirmedFromStatusView = false; _eventAggregator = ApplicationService.Instance.EventAggregator; // create an empty ConnectionDetails struct and keep it around connectionDetails = new ConnectionDetails(); connectionDetails.ai = ConnectionOption.DISCONNECTED; connectionDetails.remote = ConnectionOption.DISCONNECTED; connectionDetails.direct = ConnectionOption.DISCONNECTED; // record which classes have confirmed the joystick. write to the console only when both have confirmed _eventAggregator.GetEvent<ConfirmJoystickEvent>().Subscribe((confirmationID) => { if (confirmationID == BadgerControlStatusView.JOYSTICK_ID) joystickConfirmedFromStatusView = true; else if (confirmationID == BadgerControlVisualView.JOYSTICK_ID) joystickConfirmedFromVisualView = true; if (JoyStickConfirmed && !joystickMessageGiven) { _eventAggregator.GetEvent<LoggerEvent>().Publish("Joystick connected."); joystickMessageGiven = true; // jank hack to fix the duplicate event publishing due to multithreading } }); }
// Don't worry guys, I write clean code! // Dispatcher.Invoke must be used because the thread that calls this function is not the same thread that the original instance // of the class is on. // This function will do the actual updating of the connection icons public void UpdateConnection(ConnectionDetails connection) { if (connection.ai == ConnectionOption.CONNECTED) aiDot.Dispatcher.Invoke(() => { aiDot.Fill = new SolidColorBrush(Colors.Green); }); else if (connection.ai == ConnectionOption.REQUESTING_CONTROL) aiDot.Dispatcher.Invoke(() => { aiDot.Fill = new SolidColorBrush(Colors.Orange); }); else if (connection.ai == ConnectionOption.AWAITING_STATUS) aiDot.Dispatcher.Invoke(() => { aiDot.Fill = new SolidColorBrush(Colors.Yellow); }); else aiDot.Dispatcher.Invoke(() => { aiDot.Fill = new SolidColorBrush(Colors.Red); }); if (connection.remote == ConnectionOption.CONNECTED) remoteDot.Dispatcher.Invoke(() => { remoteDot.Fill = new SolidColorBrush(Colors.Green); }); else if (connection.remote == ConnectionOption.REQUESTING_CONTROL) remoteDot.Dispatcher.Invoke(() => { remoteDot.Fill = new SolidColorBrush(Colors.Orange); }); else if (connection.remote == ConnectionOption.AWAITING_STATUS) remoteDot.Dispatcher.Invoke(() => { remoteDot.Fill = new SolidColorBrush(Colors.Yellow); }); else remoteDot.Dispatcher.Invoke(() => { remoteDot.Fill = new SolidColorBrush(Colors.Red); }); if (connection.direct == ConnectionOption.CONNECTED) directDot.Dispatcher.Invoke(() => { directDot.Fill = new SolidColorBrush(Colors.Green); }); else if (connection.direct == ConnectionOption.REQUESTING_CONTROL) directDot.Dispatcher.Invoke(() => { directDot.Fill = new SolidColorBrush(Colors.Orange); }); else if (connection.direct == ConnectionOption.AWAITING_STATUS) directDot.Dispatcher.Invoke(() => { directDot.Fill = new SolidColorBrush(Colors.Yellow); }); else directDot.Dispatcher.Invoke(() => { directDot.Fill = new SolidColorBrush(Colors.Red); }); }
public static bool TryExtract(string connectionString, out ConnectionDetails details) { details = null; if(connectionString==null) { return false; } connectionString = connectionString.Trim(); var connectionDetails = new ConnectionDetails(); var items = connectionString.Split(';'); if (ExtractEventHubNamespace(connectionDetails, items) && ExtractEventHubName(connectionDetails, items) && ExtractSharedAccessKey(connectionDetails, items) && ExtractSharedAccessKeyName(connectionDetails, items) ) { details = connectionDetails; return true; } return false; }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { //There is a new connection attempt from the browser side and //PokeIn wants you to define a class for this connection request classList.Add("StockDemo", new MyStockDemo(details.ClientId)); //Please notice that the connection has not completed in this step yet. //If you need the exact moment of "client connection completed" then you should be listening OnClientCreated event }
private static bool ExtractSharedAccessKeyName(ConnectionDetails connectionDetails, string[] allItems) { var items = allItems.Where(i => i.StartsWith("SharedAccessKeyName=")); if (items.Count() != 1) { return false; } connectionDetails.SharedAccessKeyName = items.Single().Replace("SharedAccessKeyName=", ""); return true; }
private static bool ExtractEventHubName(ConnectionDetails connectionDetails, string[] allItems) { var items = allItems.Where(i => i.StartsWith("EntityPath=")); if (items.Count() != 1) { return false; } connectionDetails.EventHubName = items.Single().Replace("EntityPath=", ""); return true; }
private static bool ExtractEventHubNamespace(ConnectionDetails connectionDetails, string[] allItems) { var items = allItems.Where(i => i.StartsWith("Endpoint=sb://")); if (items.Count() != 1) { return false; } connectionDetails.EventHubNamespace = items.Single().Replace("Endpoint=sb://", "").Replace(".servicebus.windows.net/", ""); return true; }
/// <summary> /// Transfer terminated /// </summary> public static string Init_HKCSE(ConnectionDetails connectionDetails, string ReceiverName, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage, DateTime ExecutionDay) { Log.Write("Starting job HKCSE: Transfer money terminated"); string segments = string.Empty; string sepaMessage = string.Empty; if (Segment.HISPAS == 1) { segments = "HKCSE:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03+@@"; sepaMessage = pain00100103.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); } else if (Segment.HISPAS == 2) { segments = "HKCSE:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; sepaMessage = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); } else if (Segment.HISPAS == 3) { segments = "HKCSE:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03+@@"; sepaMessage = pain00100303.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); } segments = segments.Replace("@@", "@" + (sepaMessage.Length - 1) + "@") + sepaMessage; segments = HKTAN.Init_HKTAN(segments); SEG.NUM = SEGNUM.SETInt(4); var message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); var TAN = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
public bool SaveConnectionDetails(ConnectionDetails connectionDetails) { try { ManageConnectionDetails manageConnectionDetails = new ManageConnectionDetails(connectionDetails.ConnParam); long id = manageConnectionDetails.ChkIfRecentConnIsInDb(); IObjectContainer dbrecentConn = Db4oClient.OMNConnection; ConnectionDetails temprc = null; if (id > 0) { temprc = dbrecentConn.Ext().GetByID(id) as ConnectionDetails; dbrecentConn.Ext().Activate(temprc, 3); if (temprc != null) { temprc.Timestamp = DateTime.Now; temprc.ConnParam.ConnectionReadOnly = connectionDetails.ConnParam.ConnectionReadOnly; } } else { temprc = connectionDetails; temprc.Timestamp = DateTime.Now; temprc.TimeOfCreation = Sharpen.Runtime.CurrentTimeMillis(); } dbrecentConn.Store(temprc); dbrecentConn.Commit(); } catch (Exception oEx) { LoggingHelper.HandleException(oEx); return(false); } finally { Db4oClient.CloseRecentConnectionFile(); } return(true); }
internal long ChkIfRecentConnIsInDb() { long id = 0; try { IObjectContainer container = Db4oClient.OMNConnection; IQuery qry = container.Query(); qry.Constrain(typeof(ConnectionDetails)); IObjectSet objSet; if (currConnParams.Host == null) { qry.Descend("m_connParam").Descend("m_connection").Constrain(currConnParams.Connection); objSet = qry.Execute(); } else { qry.Descend("m_connParam").Descend("m_host").Constrain(currConnParams.Host); qry.Descend("m_connParam").Descend("m_port").Constrain(currConnParams.Port); qry.Descend("m_connParam").Descend("m_userName").Constrain(currConnParams.UserName); qry.Descend("m_connParam").Descend("m_passWord").Constrain(currConnParams.PassWord); objSet = qry.Execute(); } if (objSet.Count > 0) { ConnectionDetails connectionDetails = (ConnectionDetails)objSet.Next(); id = Db4oClient.OMNConnection.Ext().GetID(connectionDetails); } } catch (Exception oEx) { LoggingHelper.HandleException(oEx); } finally { Db4oClient.CloseRecentConnectionFile(); } return(id); }
public bool SessionExists(ConnectionDetails connection, int sessionId) { using (ImpersonationHelper.Impersonate(connection)) { using (var server = GetServer(connection.Server)) { server.Open(); try { var session = server.GetSession(sessionId); // Windows XP sometimes connects you to session 0, and that session still exists after // logging the user off, as a disconnected console session but with no associated username. return(session.ConnectionState != ConnectionState.Disconnected || !string.IsNullOrEmpty(session.UserName)); } catch (Exception) { return(false); } } } }
public void ConnectionDetailsWithoutAnyOptionShouldReturnNullOrDefaultForOptions() { ConnectionDetails details = new ConnectionDetails(); var expectedForStrings = default(string); var expectedForInt = default(int?); var expectedForBoolean = default(bool?); Assert.Equal(details.ApplicationIntent, expectedForStrings); Assert.Equal(details.ApplicationName, expectedForStrings); Assert.Equal(details.AttachDbFilename, expectedForStrings); Assert.Equal(details.AuthenticationType, expectedForStrings); Assert.Equal(details.CurrentLanguage, expectedForStrings); Assert.Equal(details.DatabaseName, expectedForStrings); Assert.Equal(details.FailoverPartner, expectedForStrings); Assert.Equal(details.Password, expectedForStrings); Assert.Equal(details.ServerName, expectedForStrings); Assert.Equal(details.TypeSystemVersion, expectedForStrings); Assert.Equal(details.UserName, expectedForStrings); Assert.Equal(details.WorkstationId, expectedForStrings); Assert.Equal(details.ConnectRetryInterval, expectedForInt); Assert.Equal(details.ConnectRetryCount, expectedForInt); Assert.Equal(details.ConnectTimeout, expectedForInt); Assert.Equal(details.LoadBalanceTimeout, expectedForInt); Assert.Equal(details.MaxPoolSize, expectedForInt); Assert.Equal(details.MinPoolSize, expectedForInt); Assert.Equal(details.PacketSize, expectedForInt); Assert.Equal(details.ColumnEncryptionSetting, expectedForStrings); Assert.Equal(details.EnclaveAttestationUrl, expectedForStrings); Assert.Equal(details.EnclaveAttestationProtocol, expectedForStrings); Assert.Equal(details.Encrypt, expectedForBoolean); Assert.Equal(details.MultipleActiveResultSets, expectedForBoolean); Assert.Equal(details.MultiSubnetFailover, expectedForBoolean); Assert.Equal(details.PersistSecurityInfo, expectedForBoolean); Assert.Equal(details.Pooling, expectedForBoolean); Assert.Equal(details.Replication, expectedForBoolean); Assert.Equal(details.TrustServerCertificate, expectedForBoolean); Assert.Equal(details.Port, expectedForInt); }
public string ConnectToDatabase(ConnectionDetails currConnectionDetails, bool checkCustomConfig) { string exceptionString = dbInteraction.ConnectoToDB(currConnectionDetails, checkCustomConfig); try { OMETrace.Initialize(); } catch (Exception ex) { ex.ToString(); //ignore } try { ExceptionHandler.Initialize(); } catch (Exception ex) { ex.ToString(); //ignore } return(exceptionString); }
public void GetActiveConnection() { ActiveConnection = DependencyService.Get <IConnectionStatus>().GetCurrentConnection(); if (ActiveConnection == null) { ConnectionStatusDescriptionText = AppStrings.NoActiveConnection; } else { if (ActiveConnection.IsSafe) { ConnStatusColor = Color.Green; ConnectionStatusDescriptionText = AppStrings.TrafficAnonymized; } else { ConnStatusColor = Color.Red; ConnectionStatusDescriptionText = AppStrings.TrafficNotAnonymized.Replace("8000", Settings.GetInt("Polipo port", 8000).ToString()); } } }
/// <summary> /// Generate a unique key based on the ConnectionInfo object /// </summary> /// <param name="connInfo"></param> private string GetConnectionContextKey(ConnectionInfo connInfo) { ConnectionDetails details = connInfo.ConnectionDetails; string key = string.Format("{0}_{1}_{2}_{3}", details.ServerName ?? "NULL", details.DatabaseName ?? "NULL", details.UserName ?? "NULL", details.AuthenticationType ?? "NULL" ); if (!string.IsNullOrEmpty(details.DatabaseDisplayName)) { key += "_" + details.DatabaseDisplayName; } if (!string.IsNullOrEmpty(details.GroupId)) { key += "_" + details.GroupId; } return(key); }
public NodeTests() { defaultServerInfo = TestObjects.GetTestServerInfo(); serverConnection = new ServerConnection(new SqlConnection(fakeConnectionString)); defaultConnectionDetails = new ConnectionDetails() { DatabaseName = "master", ServerName = "localhost", UserName = "******", Password = "******" }; defaultConnParams = new ConnectionCompleteParams() { ServerInfo = defaultServerInfo, ConnectionSummary = defaultConnectionDetails != null ? ((IConnectionSummary)defaultConnectionDetails).Clone(): null, OwnerUri = defaultOwnerUri }; // TODO can all tests use the standard service provider? ServiceProvider = ExtensionServiceProvider.CreateDefaultServiceProvider(); }
/// <summary> /// Rebooking /// </summary> public static string Init_HKCUM(ConnectionDetails connectionDetails, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage) { Log.Write("Starting job HKCUM: Rebooking money"); string segments = "HKCUM:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var message = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; segments = HKTAN.Init_HKTAN(segments); SEG.NUM = SEGNUM.SETInt(4); var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.Blz, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Collect /// </summary> public static string Init_HKDSE(ConnectionDetails connectionDetails, string Payer, string PayerIBAN, string PayerBIC, decimal Amount, string Usage, DateTime SettlementDate, string MandateNumber, DateTime MandateDate, string CreditorIDNumber) { Log.Write("Starting job HKDSE: Collect money"); string segments = "HKDSE:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.002.02+@@"; var message = pain00800202.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, Payer, PayerIBAN, PayerBIC, Amount, Usage, SettlementDate, MandateNumber, MandateDate, CreditorIDNumber); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; segments = HKTAN.Init_HKTAN(segments); SEG.NUM = SEGNUM.SETInt(4); var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
public static void CheckMissingValues(ConnectionDetails connectionDetails) { if (string.IsNullOrEmpty(connectionDetails.ALMOctaneUrl)) { throw new ArgumentException("ALM Octane Url is not specified"); } if (!connectionDetails.ALMOctaneUrl.Contains("p=")) { throw new ArgumentException("ALM Octane Url is missing sharedspace id"); } if (string.IsNullOrEmpty(connectionDetails.ClientId)) { throw new ArgumentException("ClientId is missing"); } if (string.IsNullOrEmpty(connectionDetails.ClientSecret)) { throw new ArgumentException("Client secret is missing"); } if (string.IsNullOrEmpty(connectionDetails.Pat)) { //throw new ArgumentException("Pat is missing"); } if (string.IsNullOrEmpty(connectionDetails.TfsLocation)) { throw new ArgumentException("TFS Location not specified"); } if (connectionDetails.TfsLocation.Contains("localhost")) { throw new ArgumentException("TFS Location should contain external domain and not 'localhost'"); } if (string.IsNullOrEmpty(connectionDetails.InstanceId)) { throw new ArgumentException("InstanceId is missing"); } if (connectionDetails.InstanceId.Length > 40) { throw new ArgumentException("InstanceId length must be less than or equal to 40 characters"); } }
public static TfsApis CreateTfsConnection(ConnectionDetails connectionDetails) { var tfsServerUriStr = connectionDetails.TfsLocation ?? GetTfsLocationFromHostName(); var tfsManager = TfsApis.CreateForPatAuthentication(tfsServerUriStr, connectionDetails.Pat); try { var start = DateTime.Now; Log.Debug($"Validate connection to TFS {tfsServerUriStr}"); tfsManager.ConnectionValidation("connection-validation"); var end = DateTime.Now; Log.Debug($"Validate connection to TFS finished in {(long)((end - start).TotalMilliseconds)} ms"); } catch (Exception e) { const string tfsNotFoundError = "Please check that TFS Location URL is valid and TFS server is online"; const string msgPrefix = "Generic error connecting to TFS server: "; var innerException = e.InnerException; if (innerException is HttpRequestException) { Log.Error(tfsNotFoundError); throw new Exception(tfsNotFoundError); } if (e is HttpException httpException) { if (httpException.GetHttpCode() == 404) { Log.Error(tfsNotFoundError); throw new Exception(tfsNotFoundError); } } var msg = msgPrefix + (e.InnerException != null ? e.InnerException.Message : e.Message); throw new Exception(msg); } return(tfsManager); }
/// <inheritdoc /> public virtual async Task AcceptRequestAsync(Wallet wallet, string connectionId) { Logger.LogInformation(LoggingEvents.AcceptConnectionRequest, "ConnectionId {0}", connectionId); var connection = await GetAsync(wallet, connectionId); await connection.TriggerAsync(ConnectionTrigger.Request); await Pairwise.CreateAsync(wallet, connection.TheirDid, connection.MyDid, connection.Endpoint.ToJson()); await RecordService.UpdateAsync(wallet, connection); // Send back response message var provisioning = await ProvisioningService.GetProvisioningAsync(wallet); var response = new ConnectionDetails { Did = connection.MyDid, Endpoint = provisioning.Endpoint, Verkey = connection.MyVk }; var responseMessage = await MessageSerializer.PackSealedAsync <ConnectionResponseMessage>(response, wallet, connection.MyVk, connection.TheirVk); responseMessage.Type = MessageUtils.FormatDidMessageType(connection.TheirDid, MessageTypes.ConnectionResponse); responseMessage.To = connection.TheirDid; var forwardMessage = new ForwardEnvelopeMessage { Type = MessageUtils.FormatDidMessageType(connection.TheirDid, MessageTypes.Forward), Content = responseMessage.ToJson() }; await RouterService.ForwardAsync(forwardMessage, connection.Endpoint); }
/// <summary> /// Create a copy of a connection details object. /// </summary> public static ConnectionDetails Clone(this ConnectionDetails details) { return(new ConnectionDetails() { ServerName = details.ServerName, DatabaseName = details.DatabaseName, UserName = details.UserName, Password = details.Password, AuthenticationType = details.AuthenticationType, ColumnEncryptionSetting = details.ColumnEncryptionSetting, EnclaveAttestationProtocol = details.EnclaveAttestationProtocol, EnclaveAttestationUrl = details.EnclaveAttestationUrl, Encrypt = details.Encrypt, TrustServerCertificate = details.TrustServerCertificate, PersistSecurityInfo = details.PersistSecurityInfo, ConnectTimeout = details.ConnectTimeout, ConnectRetryCount = details.ConnectRetryCount, ConnectRetryInterval = details.ConnectRetryInterval, ApplicationName = details.ApplicationName, WorkstationId = details.WorkstationId, ApplicationIntent = details.ApplicationIntent, CurrentLanguage = details.CurrentLanguage, Pooling = details.Pooling, MaxPoolSize = details.MaxPoolSize, MinPoolSize = details.MinPoolSize, LoadBalanceTimeout = details.LoadBalanceTimeout, Replication = details.Replication, AttachDbFilename = details.AttachDbFilename, FailoverPartner = details.FailoverPartner, MultiSubnetFailover = details.MultiSubnetFailover, MultipleActiveResultSets = details.MultipleActiveResultSets, PacketSize = details.PacketSize, TypeSystemVersion = details.TypeSystemVersion, ConnectionString = details.ConnectionString, Port = details.Port, AzureAccountToken = details.AzureAccountToken }); }
public GondorGame(ConnectionDetails _details) { details = _details; string oldClid = ""; lock (sessionKeys) { //kick the other player first if (sessionKeys.ContainsKey(_details.SessionId)) { oldClid = sessionKeys[_details.SessionId]; } sessionKeys[_details.SessionId] = _details.ClientId; } if (oldClid != string.Empty) { lock (waitingRoom) { waitingRoom.Remove(oldClid); } } }
/// <summary> /// Load prepaid /// </summary> public static string Init_HKPPD(ConnectionDetails connectionDetails, int MobileServiceProvider, string PhoneNumber, int Amount) { Log.Write("Starting job HKPPD: Load prepaid"); SEG.NUM = SEGNUM.SETInt(3); string segments = "HKPPD:" + SEG.NUM + ":2+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+" + MobileServiceProvider + "+" + PhoneNumber + "+" + Amount + ",:EUR'"; if (Helper.IsTANRequired("HKPPD")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); var TAN = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
public static IBClient StartIbClient(IBClient ibClient, ConnectionDetails connectionDetails) { ibClient.ClientSocket.eConnect(connectionDetails.Host, connectionDetails.Port, connectionDetails.ClientId); var reader = new EReader(ibClient.ClientSocket, ibClient.Signal); reader.Start(); new Thread(() => { while (ibClient.ClientSocket.IsConnected()) { ibClient.Signal.waitForSignal(); reader.processMsgs(); } }) { IsBackground = true }.Start(); //Force the thread to sleep in order to get all notifications from the gateway before going ahead Thread.Sleep(TimeSpan.FromSeconds(5)); return(ibClient); }
public void DefaultConstructorShouldUseDefaultValue() { var details = new ConnectionDetails(); details .Should() .NotBeNull(); details.Database .Should() .BeEmpty(); details.User .Should() .BeEmpty(); details.Password .Should() .BeEmpty(); details.Host .Should() .BeEmpty(); details.Port .Should() .Be(5432); }
public void WillGetAccountDetailsOnLocalAC() { var login = "******"; var password = "******"; var apiUrl = new Uri("https://connect.fiu.edu"); var connectionDetails = new ConnectionDetails(apiUrl); var provider = new AdobeConnectProvider(connectionDetails); var userCredentials = new UserCredentials(login, password); LoginResult loginResult = provider.Login(userCredentials); if (!loginResult.Success) { throw new InvalidOperationException("Invalid login"); } var fakeLogger = new FakeLogger(); var service = new AdobeConnectAccountService(fakeLogger); var principalId = loginResult.User.UserId; var proxy = new AdobeConnectProxy(provider, fakeLogger, apiUrl, principalId); var details = service.GetAccountDetails(proxy); var t = 1; }
public void OverloadConstructorShouldUseDefaultValueWhenNullIsPassed() { var details = new ConnectionDetails(null, null, null, null, null); details .Should() .NotBeNull(); details.Database .Should() .BeEmpty(); details.User .Should() .BeEmpty(); details.Password .Should() .BeEmpty(); details.Host .Should() .BeEmpty(); details.Port .Should() .Be(5432); }
/// <summary> /// Get terminated transfers /// </summary> public static string Init_HKCSB(ConnectionDetails connectionDetails) { Log.Write("Starting job HKCSB: Get terminated transfers"); SEG.NUM = SEGNUM.SETInt(3); string segments = "HKCSB:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+sepade?:xsd?:pain.001.001.03.xsd'"; if (Helper.IsTANRequired("HKCSB")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); string response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
public void ShouldParsePostgresUrlStringWithoutPort() { var details = ConnectionDetails.Parse("postgres://*****:*****@localhost/somedatabase"); details .Should() .NotBeNull(); details.Database .Should() .Be("somedatabase"); details.User .Should() .Be("someuser"); details.Password .Should() .Be("somepassword"); details.Host .Should() .Be("localhost"); details.Port .Should() .Be(5432); }
public void ShouldParsePostgresUrlString() { var details = ConnectionDetails.Parse("postgres://*****:*****@somehost:381/somedatabase"); details .Should() .NotBeNull(); details.Database .Should() .Be("somedatabase"); details.User .Should() .Be("someuser"); details.Password .Should() .Be("somepassword"); details.Host .Should() .Be("somehost"); details.Port .Should() .Be(381); }
public void ShouldParsePostgresUrlStringWithoutAuthInfo() { var details = ConnectionDetails.Parse("postgres://@somehost:381/somedatabase"); details .Should() .NotBeNull(); details.Database .Should() .Be("somedatabase"); details.User .Should() .BeEmpty(); details.Password .Should() .BeEmpty(); details.Host .Should() .Be("somehost"); details.Port .Should() .Be(381); }
public async void ConnectingWithInvalidCredentialsYieldsErrorMessage() { var testConnectionDetails = TestObjects.GetTestConnectionDetails(); var invalidConnectionDetails = new ConnectionDetails(); invalidConnectionDetails.ServerName = testConnectionDetails.ServerName; invalidConnectionDetails.DatabaseName = testConnectionDetails.DatabaseName; invalidConnectionDetails.UserName = "******"; // triggers exception when opening mock connection invalidConnectionDetails.Password = "******"; // Connect to test db with invalid credentials var connectionResult = await TestObjects.GetTestConnectionService() .Connect(new ConnectParams() { OwnerUri = "file://my/sample/file.sql", Connection = invalidConnectionDetails }); // check that an error was caught Assert.NotNull(connectionResult.Messages); Assert.NotEqual(String.Empty, connectionResult.Messages); }
public async Task SendUpdatedCode(string group, string connectionid) { // send the code for this user to the caller // get the group if (ConnectionDetails.TryGetGroup(group, out GroupDetails groupdetails)) { // get the user if (groupdetails.TryGetUser(connectionid, out UserDetails userdetails)) { // share with all clients await Clients.Caller.SendAsync("ReceiveCode", userdetails.ConnectionId, userdetails.UserName, userdetails.Code, userdetails.Rating); } else { await Clients.Caller.SendAsync("ReceiveMessage", "unable to find user (please reload)"); } } else { await Clients.Caller.SendAsync("ReceiveMessage", "unable to find group (please reload)"); } }
public IAdobeConnectProxy GetProvider(IAdobeConnectAccess credentials, bool login) { if (credentials == null) { throw new ArgumentNullException(nameof(credentials)); } var connectionDetails = new ConnectionDetails(credentials.Domain); var provider = new AdobeConnectProvider(connectionDetails); if (login) { var userCredentials = new UserCredentials(credentials.Login, credentials.Password); LoginResult result = provider.Login(userCredentials); if (!result.Success) { _logger.Error("AdobeConnectAccountService.GetProvider. Login failed. Status = " + result.Status.GetErrorInfo()); throw new InvalidOperationException("Login to Adobe Connect failed. Status = " + result.Status.GetErrorInfo()); } } return(new AdobeConnectProxy(provider, _logger, credentials.Domain)); }
public GondorGame(ConnectionDetails _details) { details = _details; string oldClid = ""; lock(sessionKeys) { //kick the other player first if(sessionKeys.ContainsKey(_details.SessionId)) { oldClid = sessionKeys[_details.SessionId]; } sessionKeys[_details.SessionId] = _details.ClientId; } if(oldClid!=string.Empty) { lock(waitingRoom) { waitingRoom.Remove(oldClid); } } }
private void CreateMQTTClient(ConnectionDetails connectionDetails) { var factory = new MqttFactory(); var mqttClient = factory.CreateManagedMqttClient(); var options = new ManagedMqttClientOptionsBuilder().WithAutoReconnectDelay(TimeSpan.FromSeconds(connectionDetails.AutoReconnectTime)) .WithClientOptions(new MqttClientOptionsBuilder() .WithClientId(connectionDetails.ClientId) .WithTcpServer(connectionDetails.Server) .WithCredentials(connectionDetails.Username, connectionDetails.Password) .WithTls() .WithCleanSession() .Build()) .Build(); //mqttClient.PublishAsync() //mqttClient.ConnectAsync(options).Wait(); //mqttClient.Disconnected += async (s, e) => //{ // this.IsConnected = false; // log.Warn("### DISCONNECTED FROM SERVER ###"); // await Task.Delay(TimeSpan.FromSeconds(2)); // try // { // await mqttClient.ConnectAsync(options); // this.IsConnected = true; // } // catch // { // log.Error("### RECONNECTING FAILED ###"); // } //}; msgClient = mqttClient; }
private void PanelEnvoiUdp_Load(object sender, EventArgs e) { if (!Execution.DesignMode) { switchBoutonMove.Value = true; switchBoutonIO.Value = true; foreach (UDPConnection conn in Connections.AllConnections.OfType <UDPConnection>()) { ConnectionDetails details = new ConnectionDetails(); details.Connection = conn; _pnlConnections.Controls.Add(details); } IPAddress[] adresses = Dns.GetHostAddresses(Dns.GetHostName()); bool ipTrouvee = false; foreach (IPAddress ip in adresses) { if (ip.ToString().Length > 7) { String ipString = ip.ToString().Substring(0, 7); if (ipString == "10.1.0.") { lblMonIP.Text = ip.ToString(); ipTrouvee = true; } } } if (!ipTrouvee) { lblMonIP.Text = "Incorrecte"; lblMonIP.ForeColor = Color.Red; } } }
static void CometWorker_OnReConnectionDecision(ConnectionDetails details, ref bool accepted) { //You may check the parameters from "details" object to decide accept //reconnection to same client id and its objects or not accepted = true; }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("SQL", new SQLInterface(details.ClientId)); }
//PokeIn OnClientConnected Event void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("Sample", new ServerInstance(details.ClientId, details.IsDesktopClient)); }
public static void OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> list) { list.Add("Chat", new PubSubNotification(details.ClientId)); }
//!!!!!!!!!!!!!!!!!EVENT LISTENERS MUST BE STATIC (SHARED for VB.NET) //First OnClientConnected Event Handler Called By Default.aspx public static void OnClientConnectedToFirst(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("FirstClass", new FirstSample(details.ClientId)); }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("StockDemo", new MyStockDemo(details.ClientId)); }
static void CometWorker_OnClientJoined(ConnectionDetails details, string jointId, ref Dictionary<string, object> classList) { //The below class will be unique for each member of joint //this is optional, not a requirement for joints classList.Add("MyIndividualClass", new MyIndividualClass(details.ClientId, jointId)); }
//!!!!!!!!!!!!!!!!!EVENT LISTENERS MUST BE STATIC (SHARED for VB.NET) //Second OnClientConnected Event Handler Called By SamplePage.aspx public static void OnClientConnectedToSecond(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("SecondSample", new SecondSample(details.ClientId)); }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { //classList.Add("Draw", new DataApp(details.ClientId)); //classList.Add("Dummy", new DataApp(details.ClientId)); }
public RestUriAndSharedAccessSignatureGenerator(ConnectionDetails connectionDetails, string publisherName, TimeSpan tokenLifeTime) { _connectionDetails = connectionDetails; _publisherName = publisherName; _tokenLifeTime = tokenLifeTime; }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("WCFSample", new WCFSample(details.ClientId)); }
void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("Server", new GondorGame(details)); }
static void CometWorker_OnFirstJoint(ConnectionDetails details, string jointId, ref Dictionary<string, object> classList) { //Shared object instance for all the joint members //In this sample there is no shared instance but we want use Joint feature for other reasons }
//The below event will be fired when a specific named client opens a connection for first time static void CometWorker_OnFirstJoint(ConnectionDetails details, string jointId, ref Dictionary<string, object> classList) { //The below class instance will be shared by all the members of joint //You should add at least 1 instance to the classList parameter classList.Add("MySharedClass", new MySharedClass(jointId)); }
void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("MyPokeInClass", new MyPokeInClass(details.ClientId)); }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("Chat", new ChatApp(details.ClientId) ); }
static void CometWorker_OnClientConnected(ConnectionDetails details, ref Dictionary<string, object> classList) { classList.Add("Dummy", new Dummy(details.ClientId, HttpContext.Current.Server.MapPath(""))); }