当前位置: 首页>>代码示例>>C#>>正文


C# ConnectionInfo类代码示例

本文整理汇总了C#中ConnectionInfo的典型用法代码示例。如果您正苦于以下问题:C# ConnectionInfo类的具体用法?C# ConnectionInfo怎么用?C# ConnectionInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionInfo类属于命名空间,在下文中一共展示了ConnectionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Arrange

        protected void Arrange()
        {
            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Loose);
            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);

            _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
            _operationTimeout = TimeSpan.FromSeconds(new Random().Next(1, 10));
            _sftpClient = new SftpClient(_connectionInfo, false, _serviceFactoryMock.Object);
            _sftpClient.OperationTimeout = _operationTimeout;

            _serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo))
                .Returns(_sessionMock.Object);
            _sessionMock.Setup(p => p.Connect());
            _serviceFactoryMock.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding))
                .Returns(_sftpSessionMock.Object);
            _sftpSessionMock.Setup(p => p.Connect());

            _sftpClient.Connect();
            _sftpClient = null;

            _serviceFactoryMock.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding))
                .Returns((ISftpSession)  null);
            _serviceFactoryMock.ResetCalls();

            // we need to dereference all other mocks as they might otherwise hold the target alive
            _sessionMock = null;
            _connectionInfo = null;
            _serviceFactoryMock = null;
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:30,代码来源:SftpClientTest_Finalize_Connected.cs

示例2: DeleteNode

        public void DeleteNode(ConnectionInfo connectionInfo)
        {
            if (connectionInfo is RootNodeInfo)
                return;

            connectionInfo?.RemoveParent();
        }
开发者ID:mRemoteNG,项目名称:mRemoteNG,代码行数:7,代码来源:ConnectionTreeModel.cs

示例3: btnSearch_Click

        private void btnSearch_Click(object sender, EventArgs e)
        {
            int DoctorID;
            DoctorID = Convert.ToInt32(cbDoctor.SelectedValue.ToString());
            ReportDocument reportDocument = new ReportDocument();
            ParameterField paramField = new ParameterField();
            ParameterFields paramFields = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
            string ReportPath = ConfigurationManager.AppSettings["ReportPath"];

            paramField.Name = "@DoctorID";

            paramDiscreteValue.Value = DoctorID;
            reportDocument.Load(ReportPath + "Report\\DoctorCrystalReport.rpt");

            ConnectionInfo connectionInfo = new ConnectionInfo();
            connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM";
            //connectionInfo.UserID = "wms";
            //connectionInfo.Password = "wms";
            connectionInfo.IntegratedSecurity = true;
            SetDBLogonForReport(connectionInfo, reportDocument);

            reportDocument.SetParameterValue("@DoctorID", DoctorID);
            DoctorCrystalRpt.ReportSource = reportDocument;

            DoctorCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
        }
开发者ID:Anshul0305,项目名称:lotas,代码行数:27,代码来源:Form_Doctor_Detail_Report.cs

示例4: DefaultMongoAbstractFactory

		public DefaultMongoAbstractFactory(ConnectionInfo connectionInfo)
		{
			RepositoryFactory = new DefaultMongoRepositoryFactory(connectionInfo);
			ErrorHandlingFactory = new DefaultMongoErrorHandlingFactory();
			IdGeneratorFactory = new DefaultMongoIdGeneratorFactory(connectionInfo);
			HashGeneratorFactory = new DefaultMongoHashGeneratorFactory();
		}
开发者ID:krigans,项目名称:Mongo.Framework,代码行数:7,代码来源:DefaultMongoAbstractFactory.cs

示例5: SaveExportFile

 private static void SaveExportFile(string fileName, ConnectionsSaver.Format saveFormat, SaveFilter saveFilter, ConnectionInfo exportTarget)
 {
     try
     {
         ISerializer<string> serializer;
         switch (saveFormat)
         {
             case ConnectionsSaver.Format.mRXML:
                 var factory = new CryptographyProviderFactory();
                 var cryptographyProvider = factory.CreateAeadCryptographyProvider(mRemoteNG.Settings.Default.EncryptionEngine, mRemoteNG.Settings.Default.EncryptionBlockCipherMode);
                 cryptographyProvider.KeyDerivationIterations = Settings.Default.EncryptionKeyDerivationIterations;
                 serializer = new XmlConnectionsSerializer(cryptographyProvider);
                 ((XmlConnectionsSerializer) serializer).SaveFilter = saveFilter;
                 break;
             case ConnectionsSaver.Format.mRCSV:
                 serializer = new CsvConnectionsSerializerMremotengFormat();
                 ((CsvConnectionsSerializerMremotengFormat)serializer).SaveFilter = saveFilter;
                 break;
             default:
                 throw new ArgumentOutOfRangeException(nameof(saveFormat), saveFormat, null);
         }
         var serializedData = serializer.Serialize(exportTarget);
         var fileDataProvider = new FileDataProvider(fileName);
         fileDataProvider.Save(serializedData);
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddExceptionStackTrace($"Export.SaveExportFile(\"{fileName}\") failed.", ex);
     }
     finally
     {
         Runtime.RemoteConnectionsSyncronizer?.Enable();
     }
 }
开发者ID:mRemoteNG,项目名称:mRemoteNG,代码行数:34,代码来源:Export.cs

示例6: Uninitialize

 public virtual void Uninitialize()
 {
     _features = default(FeatureReferences<FeatureInterfaces>);
     if (_request != null)
     {
         UninitializeHttpRequest(_request);
         _request = null;
     }
     if (_response != null)
     {
         UninitializeHttpResponse(_response);
         _response = null;
     }
     if (_authenticationManager != null)
     {
         UninitializeAuthenticationManager(_authenticationManager);
         _authenticationManager = null;
     }
     if (_connection != null)
     {
         UninitializeConnectionInfo(_connection);
         _connection = null;
     }
     if (_websockets != null)
     {
         UninitializeWebSocketManager(_websockets);
         _websockets = null;
     }
 }
开发者ID:leloulight,项目名称:HttpAbstractions,代码行数:29,代码来源:DefaultHttpContext.cs

示例7: GetConnectionInfo

 /// <summary>
 /// Gets the connection info. (some fields of <see cref="T:System.Data.Odbc.OdbcConnection"/>)
 /// If specified <c>odbcConnectionString</c> doesn`t work empty strings are returned in
 /// result fields.
 /// </summary>
 /// <param name="odbcConnectionString">The ODBC connection string.</param>
 /// <param name="boxIdentity">The box identity.</param>
 /// <returns>
 /// <see cref="Ferda.Modules.Boxes.DataMiningCommon.Database.ConnectionInfo"/>
 /// </returns>
 public static ConnectionInfo GetConnectionInfo(string odbcConnectionString, string boxIdentity)
 {
     ConnectionInfo result = new ConnectionInfo();
     try
     {
         OdbcConnection conn = Ferda.Modules.Helpers.Data.OdbcConnections.GetConnection(odbcConnectionString, boxIdentity);
         result.databaseName = conn.Database;
         result.dataSource = conn.DataSource;
         result.driver = conn.Driver;
         try
         {
             result.serverVersion = conn.ServerVersion;
         }
         catch (InvalidOperationException)
         {
             result.serverVersion = String.Empty;
         }
     }
     catch (Ferda.Modules.BadParamsError ex)
     {
         if (ex.restrictionType != Ferda.Modules.restrictionTypeEnum.DbConnectionString)
             throw ex;
         result.databaseName = String.Empty;
         result.dataSource = String.Empty;
         result.driver = String.Empty;
         result.serverVersion = String.Empty;
     }
     return result;
 }
开发者ID:BackupTheBerlios,项目名称:ferdadataminer-svn,代码行数:39,代码来源:Database.cs

示例8: AcceptCallback

        private void AcceptCallback(IAsyncResult result)
        {
            ConnectionInfo connection = new ConnectionInfo();
            try
            {
            // Завершение операции Accept
            Socket s = (Socket)result.AsyncState;
            connection.Socket = s.EndAccept(result);
            connection.Buffer = new byte[255];
            lock (_connections) _connections.Add(connection);

            // Начало операции Receive и новой операции Accept // запрашиваем выполнение операции асинхронного чтения
            //(читаем данные из сокета без явного опроса сокета или создания потока)
              connection.Socket.BeginReceive(connection.Buffer,0, connection.Buffer.Length, SocketFlags.None,
              new AsyncCallback(ReceiveCallback),connection);

            _serverSocket.BeginAccept(new AsyncCallback(AcceptCallback), result.AsyncState);
            }
            catch (SocketException exc)
            {
            CloseConnection(connection);
            Console.WriteLine("Socket exception: " +
                exc.SocketErrorCode);
            }
            catch (Exception exc)
            {
            CloseConnection(connection);
            Console.WriteLine("Exception: " + exc);
            }
        }
开发者ID:VladimirTsy,项目名称:Party,代码行数:30,代码来源:Program.cs

示例9: Arrange

        protected void Arrange()
        {
            _serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
            _connectionInfo = new ConnectionInfo(
                _serverEndPoint.Address.ToString(),
                _serverEndPoint.Port,
                "user",
                new PasswordAuthenticationMethod("user", "password"));
            _connectionInfo.Timeout = TimeSpan.FromMilliseconds(200);
            _actualException = null;

            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);

            _serverListener = new AsyncSocketListener(_serverEndPoint);
            _serverListener.Connected += (socket) =>
                {
                    _serverSocket = socket;

                    socket.Send(Encoding.ASCII.GetBytes("\r\n"));
                    socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
                    socket.Send(Encoding.ASCII.GetBytes("SSH-2.0-SshStub\r\n"));
                };
            _serverListener.BytesReceived += (received, socket) =>
                {
                    var badPacket = new byte[] {0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05};
                    _serverSocket.Send(badPacket, 0, badPacket.Length, SocketFlags.None);
                    _serverSocket.Shutdown(SocketShutdown.Send);
                };
            _serverListener.Start();
        }
开发者ID:delfinof,项目名称:ssh.net,代码行数:30,代码来源:SessionTest_SocketConnected_BadPacketAndDispose.cs

示例10: CopyingAConnectionInfoAlsoCopiesItsInheritance

 public void CopyingAConnectionInfoAlsoCopiesItsInheritance()
 {
     _connectionInfo.Inheritance.Username = true;
     var secondConnection = new ConnectionInfo {Inheritance = {Username = false}};
     secondConnection.CopyFrom(_connectionInfo);
     Assert.That(secondConnection.Inheritance.Username, Is.True);
 }
开发者ID:mRemoteNG,项目名称:mRemoteNG,代码行数:7,代码来源:ConnectionInfoTests.cs

示例11: frmReport_Load

        private void frmReport_Load(object sender, EventArgs e)
        {
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            Tables CrTables;
            string[] Account = help.GetAccount().Split(' ');
            crConnectionInfo.ServerName = Account[0];
            crConnectionInfo.DatabaseName = Account[1];
            crConnectionInfo.UserID = Account[2];
            object pwd = Account[3];
            crConnectionInfo.Password=(pwd.ToString());
            //---------Xét account truy cập vào các table
            CrTables = rpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            //----------set resource---------------

              rpt.SetParameterValue("tu",tu);
              rpt.SetParameterValue("den", den);
            cryRViewer.ReportSource = rpt;
            cryRViewer.Refresh();
        }
开发者ID:Smalldeviltk,项目名称:hctt-ood,代码行数:26,代码来源:frmReport.cs

示例12: MainMenu

    void MainMenu()
    {
        float stdW = 100;
        float stdH = 20;
        float currY = 0;
        if (GUI.Button(new Rect(0, currY, stdW, stdH), "Host Game"))
        {
            SendMessage("StartServer");
            SendMessage("GoToNextScene");
        }
        currY += stdH;

        GUI.Label(new Rect(0, currY, stdW, stdH), "IP Address");
        currY += stdH;

        ipAddress = GUI.TextArea(new Rect(0, currY, stdW, stdH), ipAddress);
        currY += stdH;

        portNumber = GUI.TextArea(new Rect(0, currY, stdW, stdH), portNumber);
        currY += stdH;

        if (GUI.Button(new Rect(0, currY, stdW, stdH), "Connect to Server"))
        {
            ConnectionInfo info = new ConnectionInfo();
            info.ipAddress = ipAddress;
            int iPortNum = 0;
            if (Int32.TryParse(portNumber, out iPortNum))
            {
                info.port = iPortNum;
            }

            SendMessage("ConnectToServer", info);
        }
    }
开发者ID:hamodm,项目名称:TDG,代码行数:34,代码来源:MenuGUI.cs

示例13: Arrange

        protected void Arrange()
        {
            var random = new Random();
            _fileName = CreateTemporaryFile(new byte[] {1});
            _connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
            _fileInfo = new FileInfo(_fileName);
            _path = random.Next().ToString(CultureInfo.InvariantCulture);
            _uploadingRegister = new List<ScpUploadEventArgs>();

            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
            _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
            _pipeStreamMock = new Mock<PipeStream>(MockBehavior.Strict);

            var sequence = new MockSequence();
            _serviceFactoryMock.InSequence(sequence)
                .Setup(p => p.CreateSession(_connectionInfo))
                .Returns(_sessionMock.Object);
            _sessionMock.InSequence(sequence).Setup(p => p.Connect());
            _serviceFactoryMock.InSequence(sequence).Setup(p => p.CreatePipeStream()).Returns(_pipeStreamMock.Object);
            _sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
            _channelSessionMock.InSequence(sequence).Setup(p => p.Open());
            _channelSessionMock.InSequence(sequence)
                .Setup(
                    p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path))).Returns(false);
            _channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
            _pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());

            _scpClient = new ScpClient(_connectionInfo, false, _serviceFactoryMock.Object);
            _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args);
            _scpClient.Connect();
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:32,代码来源:ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs

示例14: ConnectionTreeNode

        public ConnectionTreeNode(ProjectSchemaTreeNode parent, ConnectionInfo connectionInfo)
            : base(parent)
        {
            this.ConnectionInfo = connectionInfo;

            Initialize();
        }
开发者ID:QuantumConcepts,项目名称:CodeGenerator,代码行数:7,代码来源:ConnectionTreeNode.cs

示例15: LaunchSelected

        private void LaunchSelected()
        {
            if (listView1.SelectedIndices.Count == 0)
                return;

            if (listView1.SelectedIndices[0] > _filtered.Count() - 1)
                return;

            var selected = _filtered[listView1.SelectedIndices[0]];
            var info = new ConnectionInfo {
                Mppass = selected.Mppass,
                Ip = selected.Ip,
                Port = selected.Port,
                Username = _service.Username
            };

            ClassicalSharp.Launch(info);

            if (Preferences.Settings.Launcher.RememberServers) {
                Preferences.Settings.Launcher.ResumeUrl = string.Format("mc://{0}:{1}/{2}/{3}", info.Ip, info.Port,
                    info.Username, info.Mppass);

                Preferences.Save();
            }

            if (!Preferences.Settings.Launcher.KeepLauncherOpen)
                Application.Exit();
        }
开发者ID:umby24,项目名称:CSLauncher,代码行数:28,代码来源:ListForm.cs


注:本文中的ConnectionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。