private string GenerateSettingKey(ConnectionType connectionType, DownloadContentType downloadContentType) { var res = ""; switch (connectionType) { case ConnectionType.Mobile: res += "Mobile"; break; case ConnectionType.Wlan: res += "Wlan"; break; case ConnectionType.None: res += "None"; break; } switch (downloadContentType) { case DownloadContentType.Any: res += "Any"; break; case DownloadContentType.Article: res += "Article"; break; case DownloadContentType.Feed: res += "Feed"; break; case DownloadContentType.Image: res += "Image"; break; } return res; }
public void SetConfig(ConnectionType conType, string host, int port, bool useSSL, string username, string password) { // Get new Worker by conType // For now only use IMAP createWorker(conType); _emailWorker.SetConfig(host, port, useSSL, username, password); }
public void AttemptConnection( string ipAddressString, string portString ) { debugLog.ReceiveMessage ( "\tAttempting Connection to " + ipAddressString + " on " + portString ); connecting = true; connectionType = ConnectionType.Connecting; debugLog.ReceiveMessage ( "\tConnection Type Set to Connecting" ); try { IPAddress ipAddress = Dns.GetHostEntry ( ipAddressString ).AddressList[0]; IPEndPoint remoteEndPoint = new IPEndPoint ( ipAddress, Convert.ToInt32 ( portString )); Socket client = new Socket ( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); client.BeginConnect ( remoteEndPoint, new AsyncCallback ( ConnectCallback ), client ); Send ( client, "This is a test<EOF>" ); Receive ( client ); UnityEngine.Debug.Log ( "Response received : " + response ); client.Shutdown ( SocketShutdown.Both ); client.Close (); } catch ( Exception connectionError ) { UnityEngine.Debug.LogError ( connectionError ); } }
public static List<MobileConnection> GetPhoneNumbers(int customerid,ConnectionType type) { List<MobileConnection> mobileConnectionList = new List<MobileConnection>(); using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[Connection.ConnectionName].ConnectionString)) { string sqlstmt = "select c.customerid, c.pnumber, c.schemeid \"schemeid\", s.ctype, s.provider from [dbo].[MobileConnection] c INNER JOIN [dbo].[MobileScheme] s ON c.schemeid = s.id where c.customerid = @customerid and s.ctype = @type"; SqlCommand myCommand = new SqlCommand(sqlstmt, myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@customerid", customerid); myCommand.Parameters.AddWithValue("@type", type); myConnection.Open(); using (SqlDataReader myReader = myCommand.ExecuteReader()) { while (myReader.Read()) { MobileConnection mobileConnection = FillDataRecord(myReader); mobileConnectionList.Add(mobileConnection); } myReader.Close(); } myConnection.Close(); } return mobileConnectionList; }
public void Add(string key, Guid connectionId, ConnectionType connectionType) { lock (_connections) { Connections connection; if (!_connections.TryGetValue(key, out connection)) { connection = new Connections(); if (connectionType == ConnectionType.Device) { connection.DeviceConnectionId = connectionId; } else { connection.UserConnectionId = connectionId; } _connections.Add(key, connection); } lock (connection) { if (connectionType == ConnectionType.Device) { connection.DeviceConnectionId = connectionId; } else { connection.UserConnectionId = connectionId; } } } }
public QBSessionFactory(string appName, string appId, string qbXmlVersion, string fileName, FileMode fileMode, ConnectionType connectionType) { _log.Info("Instantiating new QBSession Factory"); _log.InfoFormat("App Name: {0}", appName); _log.InfoFormat("App Id: {0}", appId); _log.InfoFormat("QBXML Version: {0}", qbXmlVersion); _log.InfoFormat("File Name: {0}", fileName); _log.InfoFormat("File Mode: {0}", Enum.GetName(typeof(FileMode), fileMode)); _log.InfoFormat("Connection Type: {0}", Enum.GetName(typeof(ConnectionType), connectionType)); _requestProcessor = new RequestProcessor2Class(); _appName = appName; _appId = appId; _fileName = fileName; _qbXmlVersion = qbXmlVersion; //Converting enums to QBXMLRP2Lib namespace enums _fileMode = QBFileMode.qbFileOpenDoNotCare; _connectionType = QBXMLRPConnectionType.localQBD; //_fileMode = (QBFileMode)Enum.Parse( // typeof(QBFileMode), // Enum.GetName(typeof(FileMode), fileMode)); //_connectionType = (QBXMLRPConnectionType)Enum.Parse( // typeof(QBXMLRPConnectionType), // Enum.GetName(typeof(ConnectionType), connectionType)); _connectionIsOpen = false; }
public TestConnection(ConnectionType type, string serverName) : this(type) { if (serverName.Length == 0) throw new ArgumentNullException("serverName"); sServerName = serverName; }
internal LayerConnections(ConnectionType type, Layer connectedLayer) { Debug.Assert(connectedLayer != null); ConnectedLayer = connectedLayer; Type = type; }
public static List<MobileScheme> GetMobileSchemes(int providerid,ConnectionType type) { List<MobileScheme> MobileSchemes = new List<MobileScheme>(); using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[Connection.ConnectionName].ConnectionString)) { string sqlstmt = "select id, name, provider, ctype, deposit, activationcharge, rent, price, talktime, localtosame, localtoother, localtolandline, stdtosame, stdtoother, stdtolandline,international, nationalsms, internationalsms from [dbo].[MobileScheme] where provider=@providerid and ctype=@ctype"; SqlCommand myCommand = new SqlCommand(sqlstmt, myConnection); myCommand.CommandType = CommandType.Text; myCommand.Parameters.AddWithValue("@providerid", providerid); myCommand.Parameters.AddWithValue("@ctype", type); myConnection.Open(); using (SqlDataReader myReader = myCommand.ExecuteReader()) { MobileScheme scheme; while (myReader.Read()) { scheme = FillDataRecord(myReader); MobileSchemes.Add(scheme); } myReader.Close(); } myConnection.Close(); } return MobileSchemes; }
public void AddConnection(TermNode termNode, ConnectionType type) { if (this._connectedTerms == null) this._connectedTerms = new Dictionary<TermNode, ConnectionType>(); this._connectedTerms.Add(termNode, type); }
public Instance(AppSettings settings, string instanceName, ConnectionType type) { //is this necessary to store? _connectionType = type; _settings = settings; if (!_settings.WorkingPath.Exists) { _settings.WorkingPath.Create(); } if (!_settings.TransferPath.Exists) { _settings.TransferPath.Create(); } Connection = new Connection(type, settings, instanceName); Connection.Service.Instance = this; Connection.LostConnection += new EventHandler<ExceptionEventArgs>(Connection_LostConnection); Connection.MessageReceived += new EventHandler<MessageEventArgs>(Connection_MessageReceived); Connection.MessageSending += new EventHandler<MessageEventArgs>(Connection_MessageSending); Connection.ConnectionMade += new EventHandler(Connection_ConnectionMade); Connection.ConnectionTermainated += new EventHandler(Connection_ConnectionTermainated); }
public bool connection(ConnectionType connectionType) { bool bRet = false; try { switch (connectionType) { case ConnectionType.WindowsAuthentication: _objDataAccess = new clDataAccess(string.Format(strTemplateWindowsAut, _strServerName)); bRet = _objDataAccess.verificaConnexao(clDataAccess.TipoBanco.SQLServer); break; case ConnectionType.SQLAuthentication: _objDataAccess = new clDataAccess(string.Format(strTemplateSqlAut, _strServerName, _strUser, _strPWD)); bRet = _objDataAccess.verificaConnexao(clDataAccess.TipoBanco.SQLServer); break; default: break; } } catch (Exception ex) { bRet = false; throw ex; } return bRet; }
public Connection(string source, string destination, ConnectionType type, string fbType) { Source = source; Destination = destination; Type = type; FBType = fbType; }
internal static List<string> GetListenerPrefixes(ConnectionType connection, string[] hosts, int[] ports) { List<string> prefixes = new List<string>(); foreach (string ip in hosts) { //Go through each port on that IP foreach (int port in ports) { //If only http, then add that suffix and continue if (connection == ConnectionType.Http) { prefixes.Add("http://" + ip + ":" + port + "/"); continue; } //If only https, add that suffix and continue if (connection == ConnectionType.Https) { prefixes.Add("https://" + ip + ":" + port + "/"); continue; } if (connection == ConnectionType.Both) { //Http and Https prefixes.Add("http://" + ip + ":" + port + "/"); prefixes.Add("https://" + ip + ":" + port + "/"); } } } return prefixes; }
static void ReadConfig() { if (!IsInitialized) throw new InvalidOperationException("AuthServer config not initialized."); AuthDBType = config.Read("AuthDB.Type", ConnectionType.MySql); AuthDBHost = config.Read("AuthDB.Host", "127.0.0.1"); AuthDBPort = config.Read("AuthDB.Port", 3306); AuthDBUser = config.Read("AuthDB.User", "root"); AuthDBPassword = config.Read("AuthDB.Password", ""); AuthDBDataBase = config.Read("AuthDB.Database", "AuthDB"); AuthDBMinPoolSize = config.Read("AuthDB.MinPoolSize", 5); AuthDBMaxPoolSize = config.Read("AuthDB.MaxPoolSize", 30); BindIP = config.Read("Bind.IP", "0.0.0.0"); BindPort = config.Read("Bind.Port", 1119); RealmListUpdateTime = config.Read("RealmList.UpdateTime", 5) * 60000; PatchFileDirectory = config.Read("Patch.File.Directory", "PatchFiles"); WorldServiceHost = config.Read("WorldService.Host", "127.0.0.1"); WorldServiceName = config.Read("WorldService.Name", "WorldService"); }
public override bool Parse(List<string> aAnswer) { if (base.Parse(aAnswer)) { string[] zSplit = aAnswer[0].Split(new Char[] { ':', ',', ','}); if (zSplit.Count() == 3) { String zCleanMode = TrimValue(zSplit[1]); String zCleanType = TrimValue(zSplit[2]); if (Enum.IsDefined(typeof(ConnectionMode), zCleanMode) && Enum.IsDefined(typeof(ConnectionType), zCleanType)) { DeviceConnectionMode = (ConnectionMode)Enum.Parse(typeof(ConnectionMode), zCleanMode); DeviceConnectionType = (ConnectionType)Enum.Parse(typeof(ConnectionType), zCleanType); return true; } else { _logger.Debug("InCorrect Params Count: {0}", zSplit.Count()); return false; } } else return false; } else return false; }
public bool Initialize(string connString, ConnectionType type = ConnectionType.MYSQL) { connectionString = connString; connSettings = new ConnectorSettings(type); querySettings = new QuerySettings(type); if (type == ConnectionType.MYSQL) db = new MySqlDatabase(this); else if (type == ConnectionType.MSSQL) db = new MSSqlDatabase(this); var isOpen = false; try { using (var connection = CreateConnection()) isOpen = connection.State == ConnectionState.Open; } catch { return false; } return isOpen; }
/// <summary> /// Constructor to set up a Database /// </summary> /// <param name="connType">Connection-Type the Database should use</param> /// <param name="connString">Connection-String to indicate the Parameters of the Datasource. /// XML = Directory where the XML-Files should be stored /// MYSQL = ADO.NET ConnectionString /// MSSQL = ADO.NET ConnectionString /// OLEDB = ADO.NET ConnectionString /// ODBC = ADO.NET ConnectionString /// </param> public DataConnection(ConnectionType connType, string connString) { this.connType = connType; //if Directory has no trailing \ than append it ;-) if (connType == ConnectionType.DATABASE_XML) { if (connString[connString.Length - 1] != Path.DirectorySeparatorChar) this.connString = connString + Path.DirectorySeparatorChar; if (!Directory.Exists(connString)) { try { Directory.CreateDirectory(connString); } catch (Exception) { } } } else { // Options of MySQL connection string if (!connString.Contains("Treat Tiny As Boolean")) { connString += ";Treat Tiny As Boolean=False"; } this.connString = connString; } }
public ServerThread(string localAddress, int localPort, ConnectionType connectionType) { _LocalAddress = localAddress; _LocalPort = localPort; _ConnectionType = connectionType; _Paused = false; }
public Connection(Point e1, Point e2, ConnectionType t, Figure so) { endpoint1 = e1; endpoint2 = e2; type = t; segmentOrArc = so; }
private void NetworkInformationOnNetworkStatusChanged(object sender) { ConnectionType = GetConnectionType(); if(ConnectionChanged != null) ConnectionChanged(); }
/// <summary> /// /// </summary> /// <param name="builder"></param> internal Connection(Server server, ConnectionBuilder builder) { _connectionType = builder.ConnectionType; _bufferSize = builder.BufferSize; Created = DateTime.UtcNow; Server = server; var socket = new TSocket(server.Host, server.Port, server.Timeout * 1000); switch (_connectionType) { case ConnectionType.Simple: _transport = socket; break; case ConnectionType.Buffered: _transport = new TBufferedTransport(socket, _bufferSize); break; case ConnectionType.Framed: _transport = new TFramedTransport(socket); break; } _protocol = new TBinaryProtocol(_transport); _client = new Cassandra.Client(_protocol); }
/** * @param t connection type * @param target the Address of the target node * @param token unique token used to associate all connection setup messages * with each other */ public ConnectToMessage(ConnectionType t, NodeInfo target, string token) { _ct = Connection.ConnectionTypeToString(t); _target_ni = target; _neighbors = new NodeInfo[0]; //Make sure this isn't null _token = token; }
public AddConnectionAction(uint page, uint sentence, string term, ConnectionType connectionType) { this.Page = page; this.Sentence = sentence; this.Term = term; this.ConnectionType = connectionType; }
public Connector() { Type[] types = new Type[] { typeof(Connector), typeof(PuzzleElement),typeof(PageElement), typeof(GoalElement), typeof(MissionElement), typeof(ContextSoundElement), typeof(UG_Elements.UG_ContentItem), typeof(QuestionElement)}; ConnectionType acceptedBottom = new ConnectionType(ThumbPosition.Bottom, typeof(Connector), ThumbPosition.Top, types); ConnectionType acceptedRight = new ConnectionType(ThumbPosition.Right, typeof(Connector), ThumbPosition.Top, types); ConnectionType acceptedLeft= new ConnectionType(ThumbPosition.Left, typeof(Connector), ThumbPosition.Top, types); Connections.Add(ThumbPosition.Bottom,acceptedBottom); Connections.Add(ThumbPosition.Right, acceptedRight); Connections.Add(ThumbPosition.Left, acceptedLeft); }
internal ConnectorSettings(ConnectionType cType) { ConnectionType = cType; if (cType == ConnectionType.MYSQL) { if (!File.Exists(Environment.CurrentDirectory + "/MySql.Data.dll")) { Console.WriteLine("MySql.Data.dll doesn't exist."); return; } assembly = Assembly.LoadFile(Environment.CurrentDirectory + "/MySql.Data.dll"); type = "MySql.Data.MySqlClient.MySql"; } else if (cType == ConnectionType.MSSQL) { // System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 #pragma warning disable 612 // For mono... #pragma warning disable 618 // Visual studio... assembly = Assembly.LoadWithPartialName("System.Data"); #pragma warning restore 612 #pragma warning restore 618 type = "System.Data.SqlClient.Sql"; } }
public ConnectionSet GetConnection(INode node, IRelationship relationship, ConnectionType connectionType) { if (Connections.ContainsKey(node)) { if (Connections[node].ContainsKey(relationship)) { if (Connections[node][relationship].ContainsKey(connectionType)) { return Connections[node][relationship][connectionType]; } } else { Connections[node][relationship] = new Dictionary<ConnectionType, ConnectionSet>(); } } else { Connections[node] = new Dictionary<IRelationship, Dictionary<ConnectionType, ConnectionSet>>(); Connections[node][relationship] = new Dictionary<ConnectionType, ConnectionSet>(); } ConnectionSet newConnectionSet = new ConnectionSet() { Node = node, Relationship = relationship, ConnectionType = connectionType }; Connections[node][relationship][connectionType] = newConnectionSet; return newConnectionSet; }
public DBHelper(ConnectionType conncetionType, DataBaseType DBMSType,string strDBFileNamePath) { DbConnectionType = conncetionType; dbType = DBMSType; S_DBFILENAME = strDBFileNamePath; oFactory = DbProviderFactories.GetFactory(RetreiveConnectionString()); }
public QuerySettings(ConnectionType type) { if (type == ConnectionType.MSSQL) { UpdateQuery = "UPDATE [{1}] SET "; UpdateQueryEnd = "FROM [{0}] AS [{1}] WHERE "; DeleteQuery = "DELETE FROM [{0}] FROM [{0}] [{1}] WHERE "; Equal = "[{0}] = '{1}'"; AndEqual = " AND [{0}] = '{1}'"; Part0 = "[{0}]"; Part1 = "[{1}]"; Part2 = "[{2}]"; } else if (type == ConnectionType.MYSQL) { UpdateQuery = "UPDATE `{0}` `{1}` SET "; UpdateQueryEnd = "WHERE "; DeleteQuery = "DELETE FROM `{1}` USING `{0}` AS `{1}` WHERE "; Equal = "{0} = '{1}'"; AndEqual = " AND {0} = '{1}'"; Part0 = "`{0}`"; Part1 = "`{1}`"; Part2 = "`{2}`"; } }
public PhysicalBridge(ServerEndPoint serverEndPoint, ConnectionType type) { this.serverEndPoint = serverEndPoint; this.connectionType = type; this.multiplexer = serverEndPoint.Multiplexer; this.Name = Format.ToString(serverEndPoint.EndPoint) + "/" + connectionType.ToString(); this.completionManager = new CompletionManager(multiplexer, Name); }
public async Task <DataSet> ExecuteQueryAsync(string query, List <StorageProviderParameter> inputParameterList, List <StorageProviderParameter> outputParameterList, string returnParameter, ConnectionType connectionType = ConnectionType.READ, CommandType?commandType = CommandType.Text) { using (SqlConnection connection = ConnectionManager.EstablishConnection(connectionType)) { connection.Open(); using (SqlCommand command = connection.CreateCommand()) { command.CommandText = query; command.CommandType = commandType.Value; command.CommandTimeout = connectionType == ConnectionType.WRITE ? ConnectionManager.Settings.WriteCommandTimeout : ConnectionManager.Settings.ReadCommandTimeout; foreach (var parameter in inputParameterList) { var param = new SqlParameter(parameter.ParameterName, parameter.SqlDbType) { Value = parameter.ParameterValue }; if (parameter.Size.HasValue) { param.Size = parameter.Size.Value; } if (parameter.Precision.HasValue) { param.Precision = parameter.Precision.Value; } if (parameter.Scale.HasValue) { param.Scale = parameter.Scale.Value; } command.Parameters.Add(param); } var resultedOutputParameters = new List <SqlParameter>(); foreach (var parameter in outputParameterList) { var outputParameter = new SqlParameter(parameter.ParameterName, parameter.SqlDbType) { Value = parameter.ParameterValue }; outputParameter.Direction = ParameterDirection.Output; if (parameter.Size.HasValue) { outputParameter.Size = parameter.Size.Value; } resultedOutputParameters.Add(outputParameter); command.Parameters.Add(outputParameter); } var returnParam = new SqlParameter(returnParameter, SqlDbType.Int); returnParam.Direction = ParameterDirection.ReturnValue; command.Parameters.Add(returnParam); DataSet dataSet = new DataSet(); using (SqlDataAdapter adapter = new SqlDataAdapter(command)) { dataSet = await Task.Run(() => { DataSet _dataSet = new DataSet(); adapter.Fill(_dataSet); return(_dataSet); }); if ((int)returnParam.Value != 0) { return(null); } if (dataSet.Tables.Count > 1) { for (int i = 1; i < dataSet.Tables.Count; i++) { dataSet.Tables[0].Merge(dataSet.Tables[i]); } } } return(dataSet); } } }
public bool DoesDownConnectTo(ConnectionType type) { return(Options.Any(item => item.Down == type)); }
public bool DoesRightConnectTo(ConnectionType type) { return(Options.Any(item => item.Right == type)); }
public void SetConnection(ConnectionType c) { ConnectionType = c; }
/// <summary> /// Найти кратчайший путь из источника в цель в кеше или на графе. /// </summary> /// <param name="source">Вершина графа - источник пути.</param> /// <param name="target">Вершина пути - цель пути.</param> /// <param name="connectionType">Тип связи.</param> /// <returns>Найденный заново или взятый из кэша путь.</returns> public static IEnumerable <TopologyEdge> GetShortestPath(TopologyGraph graph, TopologyVertex source, TopologyVertex target, ConnectionType connectionType) { try { var cachedPath = PathesCache.SingleOrDefault(q => // Пытаемся найти такой прямой или обратный путь в кэше q.ConnectionType == connectionType && ((q.Source == source && q.Target == target) || (q.Target == source && q.Source == target))); if (cachedPath != null) { return(cachedPath.Path); } // Если не нашли, ищем путь в графе var tryGetPath = graph.ShortestPathsDijkstra((edge) => { return(edge.Weights[connectionType]); }, source); tryGetPath(target, out var path); // Сохраняем найденный путь в кэше и возвращаем PathesCache.Add(new TopologyPathesCacheItem(source, target, connectionType, path)); return(path); } catch (Exception ex) { Console.WriteLine("GetPath failed! {0}", ex.Message); return(null); } }
public UmlTransitionModel(ConnectionType type, IBoundedSketchItemModel from, IBoundedSketchItemModel to, Point connectorStartHint, Point connectorEndHint, ISketchItemContainer container) : base(type, from, to, connectorStartHint, connectorEndHint, container) { }
public Connection(ConnectionType type, int id, CommunicationType communication) { Type = type; Index = id; Communication = communication; }
internal void Activate(ConnectionType type, TextWriter log) { GetBridge(type, true, log); }
public static string CreateConnectionString(string host, string user, string password, string database, int port, int minPoolSize, int maxPoolSize, ConnectionType connType) { if (connType == ConnectionType.MYSQL) { return($"Server={host};User Id={user};Port={port};Password={password};Database={database};Allow Zero Datetime=True;Pooling=True;Min Pool Size={minPoolSize};Max Pool Size={maxPoolSize};CharSet=utf8"); } if (connType == ConnectionType.MSSQL) { return($"Data Source={host}; Initial Catalog = {database}; User ID = {user}; Password = {password};Pooling=True;Min Pool Size={minPoolSize};Max Pool Size={maxPoolSize}"); } return(null); }
public static IDisposable SetupConnection(ConnectionType type) { return(new ClearConnection(type)); }
public ResumeComms(ConnectionType connection) : base(ServerOpcodes.ResumeComms, connection) { }
/// <summary> /// 获取客户端本地 SDK 网络状态 /// </summary> /// <param name="type"></param> /// <returns></returns> public bool GetNetworkState(ConnectionType type) { var socket = Sdk.Instance.GetSocket(type); return(socket != null && socket.IsSocketStatus("connect")); }
/// <summary> /// Executes the bulk copy function /// </summary> /// <param name="destinationTableName"></param> /// <param name="table"></param> /// <param name="columnMappings"></param> /// <param name="connectionType"></param> /// <returns></returns> public async Task <object> BulkCopyAsync(string destinationTableName, DataTable table, Dictionary <string, string> columnMappings, ConnectionType connectionType = ConnectionType.READ) { var connectionString = connectionType == ConnectionType.WRITE ? ConnectionManager.Settings.WriteConnectionString : ConnectionManager.Settings.ReadConnectionString; using (SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(connectionString, SqlBulkCopyOptions.FireTriggers)) { sqlBulkCopy.DestinationTableName = destinationTableName; foreach (var item in columnMappings) { sqlBulkCopy.ColumnMappings.Add(item.Key, item.Value); } await sqlBulkCopy.WriteToServerAsync(table); } return(true); }
public async Task <object> ExecuteScalarAsync(string query, List <StorageProviderParameter> inputParameterList, List <StorageProviderParameter> outputParameterList, string returnParameter, ConnectionType connectionType = ConnectionType.READ, CommandType?commandType = CommandType.Text) { using (SqlConnection connection = ConnectionManager.EstablishConnection(connectionType)) { connection.Open(); using (SqlCommand command = connection.CreateCommand()) { command.CommandText = query; command.CommandType = commandType.Value; command.CommandTimeout = connectionType == ConnectionType.WRITE ? ConnectionManager.Settings.WriteCommandTimeout : ConnectionManager.Settings.ReadCommandTimeout; foreach (var parameter in inputParameterList) { var param = new SqlParameter(parameter.ParameterName, parameter.SqlDbType) { Value = parameter.ParameterValue }; if (parameter.Size.HasValue) { param.Size = parameter.Size.Value; } if (parameter.Precision.HasValue) { param.Precision = parameter.Precision.Value; } if (parameter.Scale.HasValue) { param.Scale = parameter.Scale.Value; } command.Parameters.Add(param); } var resultedOutputParameters = new List <SqlParameter>(); foreach (var parameter in outputParameterList) { var outputParameter = new SqlParameter(parameter.ParameterName, parameter.SqlDbType) { Value = parameter.ParameterValue }; outputParameter.Direction = ParameterDirection.Output; if (parameter.Size.HasValue) { outputParameter.Size = parameter.Size.Value; } resultedOutputParameters.Add(outputParameter); command.Parameters.Add(outputParameter); } var returnParam = new SqlParameter(returnParameter, SqlDbType.Int); returnParam.Direction = ParameterDirection.ReturnValue; command.Parameters.Add(returnParam); object result = await command.ExecuteScalarAsync(); return(result); } } }
internal PnPConnection(GenericToken tokenResult, ConnectionMethod connectionMethod, ConnectionType connectionType, int minimalHealthScore, int retryCount, int retryWait, string pnpVersionTag, PSHost host, bool disableTelemetry, InitializationType initializationType) { if (!disableTelemetry) { InitializeTelemetry(null, host, initializationType); } var coreAssembly = Assembly.GetExecutingAssembly(); UserAgent = $"NONISV|SharePointPnP|PnPPS/{((AssemblyFileVersionAttribute)coreAssembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute))).Version}"; ConnectionType = connectionType; MinimalHealthScore = minimalHealthScore; RetryCount = retryCount; RetryWait = retryWait; PnPVersionTag = pnpVersionTag; ConnectionMethod = connectionMethod; }
private PnPConnection(ClientContext context, ConnectionType connectionType, PSCredential credential, string clientId, string clientSecret, string url, string tenantAdminUrl, string pnpVersionTag, InitializationType initializationType) : this(context, connectionType, credential, url, tenantAdminUrl, pnpVersionTag, initializationType) { ClientId = clientId; ClientSecret = clientSecret; }
internal PnPConnection(ClientContext context, ConnectionType connectionType, int minimalHealthScore, int retryCount, int retryWait, PSCredential credential, string clientId, string clientSecret, string url, string tenantAdminUrl, string pnpVersionTag, PSHost host, bool disableTelemetry, InitializationType initializationType) : this(context, connectionType, minimalHealthScore, retryCount, retryWait, credential, url, tenantAdminUrl, pnpVersionTag, host, disableTelemetry, initializationType) { ClientId = clientId; ClientSecret = clientSecret; }
private void SandboxConnectionType_onHandshakeComplete(ConnectionType sender, Connection connection) { STEM.Sys.Global.ThreadPool.BeginAsync(new System.Threading.ThreadStart(Timeout), TimeSpan.FromSeconds(30)); }
private ConnectionInfo(uint bits, ConnectionType type, int rotation) { Bits = bits; Type = type; Rotation = rotation; }
/// <summary> /// Creates new Input box element description. /// </summary> /// <param name="ylevel">The y level.</param> /// <param name="text">The text.</param> /// <param name="single">If true then box can have only one connection, otherwise multiple connections are allowed.</param> /// <param name="type">The type.</param> /// <param name="id">The unique box identifier.</param> /// <param name="valueIndex">The index of the node variable linked as the input. Useful to make a physical connection between input box and default value for it.</param> /// <returns>The archetype.</returns> public static NodeElementArchetype Input(float ylevel, string text, bool single, ConnectionType type, int id, int valueIndex = -1) { return(new NodeElementArchetype { Type = NodeElementType.Input, Position = new Vector2( Constants.NodeMarginX - Constants.BoxOffsetX, Constants.NodeMarginY + Constants.NodeHeaderSize + ylevel * Constants.LayoutOffsetY), Text = text, Single = single, ValueIndex = valueIndex, BoxID = id, ConnectionsType = type }); }
public static Connection Create(Node n1, Node n2, ConnectionType c) { var con = new Connection(n1, n2, c); return(con); }
public static void HandlePacket(ConnectionType type, ClientPacket packet, Session session) { if (!CheckPacketHeader(packet, session)) { // server treats all packets sent during the first 30 seconds as invalid packets due to server crash, this will move clients to the disconnect screen if (DateTime.Now < WorldManager.WorldStartTime.AddSeconds(30d)) { session.SendCharacterError(CharacterError.ServerCrash); } return; } // CLinkStatusAverages::OnPingResponse if (packet.Header.HasFlag(PacketHeaderFlags.EchoRequest)) { var connectionData = (type == ConnectionType.Login ? session.LoginConnection : session.WorldConnection); // used to calculate round trip time (ping) // client calculates: currentTime - requestTime - serverDrift var echoResponse = new ServerPacket((ushort)(type == ConnectionType.Login ? 0x0B : 0x18), PacketHeaderFlags.EncryptedChecksum | PacketHeaderFlags.EchoResponse); echoResponse.Payload.Write(packet.HeaderOptional.ClientTime); echoResponse.Payload.Write((float)connectionData.ServerTime - packet.HeaderOptional.ClientTime); NetworkManager.SendPacket(type, echoResponse, session); } // ClientNet::HandleTimeSynch if (packet.Header.HasFlag(PacketHeaderFlags.TimeSynch)) { var connectionData = (type == ConnectionType.Login ? session.LoginConnection : session.WorldConnection); // used to update time at client and check for overspeed (60s desync and client will disconenct with speed hack warning) var timeSynchResponse = new ServerPacket((ushort)(type == ConnectionType.Login ? 0x0B : 0x18), PacketHeaderFlags.EncryptedChecksum | PacketHeaderFlags.TimeSynch); timeSynchResponse.Payload.Write(connectionData.ServerTime); NetworkManager.SendPacket(type, timeSynchResponse, session); } if (packet.Header.HasFlag(PacketHeaderFlags.RequestRetransmit)) { foreach (uint sequence in packet.HeaderOptional.RetransmitData) { CachedPacket cachedPacket; if (session.CachedPackets.TryGetValue(sequence, out cachedPacket)) { if (!cachedPacket.Packet.Header.HasFlag(PacketHeaderFlags.Retransmission)) { cachedPacket.Packet.Header.Flags |= PacketHeaderFlags.Retransmission; uint issacXor; cachedPacket.Packet.Header.Checksum = packet.CalculateChecksum(session, ConnectionType.World, cachedPacket.IssacXor, out issacXor); } NetworkManager.SendPacketDirect(ConnectionType.World, cachedPacket.Packet, session); } } } if (packet.Header.HasFlag(PacketHeaderFlags.LoginRequest)) { AuthenticationHandler.HandleLoginRequest(packet, session); return; } if (packet.Header.HasFlag(PacketHeaderFlags.WorldLoginRequest)) { AuthenticationHandler.HandleWorldLoginRequest(packet, session); return; } if (packet.Header.HasFlag(PacketHeaderFlags.ConnectResponse)) { if (type == ConnectionType.Login) { AuthenticationHandler.HandleConnectResponse(packet, session); return; } AuthenticationHandler.HandleWorldConnectResponse(packet, session); return; } if (packet.Header.HasFlag(PacketHeaderFlags.Disconnect)) { HandleDisconnectResponse(packet, session); } foreach (ClientPacketFragment fragment in packet.Fragments) { var opcode = (FragmentOpcode)fragment.Payload.ReadUInt32(); if (!fragmentHandlers.ContainsKey(opcode)) { Console.WriteLine($"Received unhandled fragment opcode: 0x{(uint)opcode:X4}"); } else { FragmentHandlerInfo fragmentHandlerInfo; if (fragmentHandlers.TryGetValue(opcode, out fragmentHandlerInfo)) { if (fragmentHandlerInfo.Attribute.State == session.State) { fragmentHandlerInfo.Handler.Invoke(fragment, session); } } } } }
public Connection(Node n1, Node n2, ConnectionType c, bool diagonal = false) : this(n1, n2) { ConnectionType = c; Diagonal = diagonal; }
internal void Activate(ConnectionType type) { GetBridge(type, true); }
public SqlConnector(ConnectionType connectionType) { this.ConnectionType = connectionType; }
private static string GetDefaultConnectionString(ConnectionType connectionType, string app, ToolsOptions toolsOptions) { switch (connectionType) { case ConnectionType.MongoDB: if (app == "portal") { return(toolsOptions.MongoStoringConnections.PortalConnection.ConnectionString); } else if (app == "identity") { return(toolsOptions.MongoStoringConnections.IdentityConnection.ConnectionString); } else { return(null); } case ConnectionType.SQLServer: if (app == "portal") { return(toolsOptions.SqlServerStoringConnections.PortalConnection.ConnectionString); } else if (app == "identity") { return(toolsOptions.SqlServerStoringConnections.IdentityConnection.ConnectionString); } else { return(null); } case ConnectionType.PostgreSQL: if (app == "portal") { return(toolsOptions.PostgreSqlStoringConnections.PortalConnection.ConnectionString); } else if (app == "identity") { return(toolsOptions.PostgreSqlStoringConnections.IdentityConnection.ConnectionString); } else { return(null); } case ConnectionType.MySQL: if (app == "portal") { return(toolsOptions.MySqlStoringConnections.PortalConnection.ConnectionString); } else if (app == "identity") { return(toolsOptions.MySqlStoringConnections.IdentityConnection.ConnectionString); } else { return(null); } default: return(null); } }
public bool DoesUpConnectTo(ConnectionType type) { return(Options.Any(item => item.Up == type)); }
public void log_and_traverse(MigrationsFolder folder, long version_id, string new_version, ConnectionType connection_type) { Log.bound_to(this).log_an_info_event_containing("{0}", "-".PadRight(50, '-')); Log.bound_to(this).log_an_info_event_containing("Looking for {0} scripts in \"{1}\".{2}{3}", folder.friendly_name, folder.folder_full_path, folder.should_run_items_in_folder_once ? " These should be one time only scripts." : string.Empty, folder.should_run_items_in_folder_every_time ? " These scripts will run every time" : string.Empty); Log.bound_to(this).log_an_info_event_containing("{0}", "-".PadRight(50, '-')); traverse_files_and_run_sql(folder.folder_full_path, version_id, folder, environment, new_version, connection_type); }
public ClearConnection(ConnectionType type) { this.type = type; GetConnectionForType(type); }
public bool DoesLeftConnectTo(ConnectionType type) { return(Options.Any(item => item.Left == type)); }