• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ShareType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SmbFile

 /// <summary>
 /// SMB file constructor.
 /// </summary>
 /// <param name="shareType">The type of resource the client intends to access.</param>
 /// <param name="name">The name of the file.</param>
 /// <param name="treeId">This is used to indicate the share that the client is accessing.</param>
 /// <param name="accessRights">Access right.</param>
 public SmbFile(ShareType shareType, string name, int treeId, int accessRights)
 {
     this.shareType = shareType;
     this.name = name;
     this.treeId = treeId;
     this.accessRights = accessRights;
 }
开发者ID:pyq881120,项目名称:WindowsProtocolTestSuites,代码行数:14,代码来源:File.cs


示例2: SmbMailslot

 public SmbMailslot(ShareType shareType, string pipeName, int treeId)
 {
     this.shareType = shareType;
     this.pipeName = pipeName;
     this.treeId = treeId;
     this.avaiableDataBytes = 0;
 }
开发者ID:LiuXiaotian,项目名称:WindowsProtocolTestSuites,代码行数:7,代码来源:Pipe.cs


示例3: Share

        public Share(string server, string netName, ShareType shareType)
        {
            if(ShareType.Special == shareType && "IPC$" == netName)
            {
                shareType |= ShareType.IPC;
            }

            _shareServer = server;
            _networkName = netName;
            _shareType = shareType;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:11,代码来源:NetworkShareInformation.cs


示例4: ShareInfo

 public ShareInfo(string serverName, string netName, string path, ShareType shareType, string remark)
 {
     if (shareType == ShareType.Special && netName == "IPC$")
     {
         shareType |= ShareType.IPC;
     }
     _serverName = serverName;
     _netName = netName;
     _path = path;
     _shareType = shareType;
     _remark = remark;
 }
开发者ID:ARGUS-TV,项目名称:ARGUS-TV-Recorders,代码行数:12,代码来源:ShareInfo.cs


示例5: Share

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="netName">Name of the net.</param>
        /// <param name="path">The path.</param>
        /// <param name="shareType">Type of the share.</param>
        /// <param name="remark">The remark.</param>
        public Share(string server, string netName, string path, ShareType shareType, string remark)
        {
            if (ShareType.Special == shareType && "IPC$" == netName)
            {
                shareType |= ShareType.IPC;
            }

            _server = server;
            _netName = netName;
            _path = path;
            _shareType = shareType;
            _remark = remark;
        }
开发者ID:jabbera,项目名称:MediaBrowser,代码行数:21,代码来源:NetworkShares.cs


示例6: ShareMonitor

      internal ShareMonitor(string shareName, string hostName, string userName)
      {
        _share = shareName.Trim();
        _host = hostName.Trim();
        _user = userName.Trim();

        if (_share.Equals(string.Empty))
        {
          if (_host.Equals(string.Empty))
          {
            if (_user.Equals(string.Empty))
            {
              MonitoringType = ShareType.Undefined;
            }
            else
            {
              MonitoringType = ShareType.UserOnly;
            }
          }
          else if (_user.Equals(string.Empty))
          {
            MonitoringType = ShareType.HostOnly;
          }
          else
          {
            MonitoringType = ShareType.UserFromHostConnected;
          }
        }
        else if (_host.Equals(string.Empty))
        {
          if (_user.Equals(string.Empty))
          {
            MonitoringType = ShareType.ShareOnly;
          }
          else
          {
            MonitoringType = ShareType.UserUsingShare;
          }
        }
        else if (_user.Equals(string.Empty))
        {
          MonitoringType = ShareType.HostUsingShare;
        }
        else
        {
          MonitoringType = ShareType.UserFromHostUsingShare;
        }
        Log.Debug("ShareMonitor: Monitor user '{0}' from host '{1}' on share '{2}' Type '{3}'", _user, _host, _share,
                  MonitoringType);
      }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:50,代码来源:ActiveSharesHandler.cs


示例7: ShareMonitor

      internal ShareMonitor(string shareName, string clientName, string userName)
      {
        _share = shareName.Trim();
        _client = clientName.Trim();
        _user = userName.Trim();

        if (_share.Equals(string.Empty))
        {
          if (_client.Equals(string.Empty))
          {
            if (_user.Equals(string.Empty))
            {
              MonitoringType = ShareType.Any;
            }
            else
            {
              MonitoringType = ShareType.UserOnly;
            }
          }
          else if (_user.Equals(string.Empty))
          {
            MonitoringType = ShareType.ClientOnly;
          }
          else
          {
            MonitoringType = ShareType.UserFromClientConnected;
          }
        }
        else if (_client.Equals(string.Empty))
        {
          if (_user.Equals(string.Empty))
          {
            MonitoringType = ShareType.ShareOnly;
          }
          else
          {
            MonitoringType = ShareType.UserUsingShare;
          }
        }
        else if (_user.Equals(string.Empty))
        {
          MonitoringType = ShareType.ClientUsingShare;
        }
        else
        {
          MonitoringType = ShareType.UserFromClientUsingShare;
        }
        Log.Debug("ActiveSharesHandler: Monitor connections to share '{0}' from client '{1}' by user '{2}' (Type '{3}')", _share, _client, _user, MonitoringType);
      }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:49,代码来源:ActiveSharesStandbyHandler.cs


示例8: GetUserFavorites

		public override ShareCollection GetUserFavorites(int favOwnerID, ShareType? favType, int pageNumber, int pageSize, ref int? totalCount)
		{
			using (SqlQuery query = new SqlQuery())
			{
                query.Pager.TableName = "[bx_SharesView]";
				query.Pager.SortField = "[ShareID]";
				query.Pager.IsDesc = true;
				query.Pager.PageNumber = pageNumber;
				query.Pager.PageSize = pageSize;
				query.Pager.TotalRecords = totalCount;
				query.Pager.SelectCount = true;

				SqlConditionBuilder cb = new SqlConditionBuilder(SqlConditionStart.None);

				cb.Append("[UserID] = @UserID");

				query.CreateParameter<int>("@UserID", favOwnerID, SqlDbType.Int);

				if (favType.HasValue && favType.Value != ShareType.All)
				{
					cb.Append("[Type] = @Type");

					query.CreateParameter<ShareType>("@Type", favType.Value, SqlDbType.TinyInt);
				}

				cb.Append("[PrivacyType] = 2");

				query.Pager.Condition = cb.ToString();

				using (XSqlDataReader reader = query.ExecuteReader())
				{
                    ShareCollection shares = new ShareCollection(reader);

                    if (reader.NextResult())
					{
                        if (totalCount == null && reader.Read())
						{
                            totalCount = reader.Get<int>(0);
						}

						shares.TotalRecords = totalCount.GetValueOrDefault();
					}

					return shares;
				}
			}
		}
开发者ID:huchao007,项目名称:bbsmax,代码行数:47,代码来源:ShareDao.cs


示例9: ToNetworkShareType

 /// <summary>
 /// To the type of the network share.
 /// </summary>
 /// <param name="shareType">Type of the share.</param>
 /// <returns>NetworkShareType.</returns>
 /// <exception cref="System.ArgumentException">Unknown share type</exception>
 private NetworkShareType ToNetworkShareType(ShareType shareType)
 {
     if (shareType.HasFlag(ShareType.Special))
     {
         return NetworkShareType.Special;
     }
     if (shareType.HasFlag(ShareType.Device))
     {
         return NetworkShareType.Device;
     }
     if (shareType.HasFlag(ShareType.Disk))
     {
         return NetworkShareType.Disk;
     }
     if (shareType.HasFlag(ShareType.IPC))
     {
         return NetworkShareType.Ipc;
     }
     if (shareType.HasFlag(ShareType.Printer))
     {
         return NetworkShareType.Printer;
     }
     throw new ArgumentException("Unknown share type");
 }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:30,代码来源:NetworkManager.cs


示例10: UpdateTreeConnectResponse

        /// <summary>
        /// Update SMB_COM_TREE_CONNECT_ANDX response.
        /// </summary>
        /// <param name="connection">It represents the SMB connection.</param>
        /// <param name="messageId">This is used to associate a response with a request.</param>
        /// <param name="treeId">This is used to indicate the share that the client is accessing.</param>
        /// <param name="shareType">The type of resource the client intends to access.</param>
        /// <param name="sessionId">
        /// Set this value to 0 to request a new session setup, or set this value to a previously established session
        /// identifier to request the re-authentication of an existing session.
        /// </param>
        public static void UpdateTreeConnectResponse(
            SmbConnection connection,
            int messageId, 
            int sessionId,
            int treeId,
            ShareType shareType)
        {
            TreeConnectRequest request = (TreeConnectRequest)connection.sentRequest[messageId];
            connection.treeConnectList.Add(
                treeId,
                new SmbTree(treeId, new SmbShare(request.shareName, shareType), sessionId));

            switch (shareType)
            {
                case ShareType.Disk:
                    Parameter.shareFileNames.Remove(request.shareName);
                    break;
                case ShareType.NamedPipe:
                    Parameter.sharePipeNames.Remove(request.shareName);
                    break;
                case ShareType.Printer:
                    Parameter.sharePrinterNames.Remove(request.shareName);
                    break;
                case ShareType.CommunicationDevice:
                    Parameter.shareDeviceNames.Remove(request.shareName);
                    break;
                default:
                    break;
            }

            connection.SutSendSequenceNumber.Remove(messageId);
            connection.SutSendSequenceNumber.Remove(messageId);
            connection.sentRequest.Remove(messageId);
            connection.SutNextReceiveSequenceNumber++;
            connection.treeId++;
        }
开发者ID:LiuXiaotian,项目名称:WindowsProtocolTestSuites,代码行数:47,代码来源:Update.cs


示例11: GetShareInfo

 public static List<ShareInfo> GetShareInfo(ShareType shareType)
 {
     IList<ShareType> shareTypeList = new List<ShareType>();
     shareTypeList.Add(shareType);
     return GetShareInfo(Environment.MachineName, shareTypeList);
 }
开发者ID:dot-i,项目名称:ARGUS-TV-Clients,代码行数:6,代码来源:ShareExplorer.cs


示例12: VerifyMessageSystaxAccessMasksForPrinter

        /// <summary>
        /// Verify Access Masks.
        /// </summary>
        /// <param name="smbTreeConnectAndxPacket">Packets for SmbTreeConnectAndxPacket Response.</param>
        /// <param name="shareType">To judge if the share type is the Printer</param>
        private void VerifyMessageSystaxAccessMasksForPrinter(
            SmbTreeConnectAndxResponsePacket smbTreeConnectAndxPacket,
            ShareType shareType)
        {
            if (shareType == ShareType.Printer)
            {
                //
                // The following statement code will be run only when debugging.
                //
                Site.Log.Add(LogEntryKind.Debug,
                    @"Verify MS-SMB_R109080");
                //
                // Verify MS-SMB requirement: MS-SMB_R109080.
                //
                bool isContainFILE_WRITE_DATA = (smbTreeConnectAndxPacket.SmbParameters.MaximalShareAccessRights &
                    (uint)CIFS.NtTransactDesiredAccess.FILE_WRITE_DATA) == (uint)CIFS.NtTransactDesiredAccess.FILE_WRITE_DATA;
                bool isContainFile_APPEND_DATA = (smbTreeConnectAndxPacket.SmbParameters.MaximalShareAccessRights &
                    (uint)CIFS.NtTransactDesiredAccess.FILE_APPEND_DATA) == (uint)CIFS.NtTransactDesiredAccess.FILE_APPEND_DATA;
                bool isContainGENERIC_WRITE = (smbTreeConnectAndxPacket.SmbParameters.MaximalShareAccessRights &
                    (uint)CIFS.NtTransactDesiredAccess.GENERIC_WRITE) == (uint)CIFS.NtTransactDesiredAccess.GENERIC_WRITE;
                bool isContainValue = isContainFILE_WRITE_DATA || isContainFile_APPEND_DATA || isContainGENERIC_WRITE;

                // If the value has at least one of the following: FILE_WRITE_DATA, FILE_APPEND_DATA, or GENERIC_WRITE,
                // then the isContainValue equals true, this requirement is captured.
                Site.CaptureRequirementIfIsTrue(
                    isContainValue,
                    109080,
                    "[In File_Pipe_Printer_Access_Mask]File_Pipe_Printer_Access_Mask (4 bytes): For a printer, the value MUST have at least one of the following: FILE_WRITE_DATA, FILE_APPEND_DATA, or GENERIC_WRITE.");
            }
        }
开发者ID:pyq881120,项目名称:WindowsProtocolTestSuites,代码行数:35,代码来源:ServerRoleCaptureCode.cs


示例13: NtTransactCreateRequest

 public static void NtTransactCreateRequest(
     int messageId,
     int sessionId,
     int treeId,
     [Domain("ImpersonationLevel")] int impersonationLevel,
     [Domain("FileDomain")] string fileName,
     ShareType shareType,
     bool isSigned)
 {
     smbRequest = new NtTransactCreateRequest(
         messageId,
         sessionId,
         treeId,
         impersonationLevel,
         fileName,
         shareType,
         isSigned);
     Checker.CheckNtTransactCreateRequest(
         smbConnection,
         messageId,
         sessionId,
         treeId,
         shareType,
         isSigned,
         fileName,
         smbState);
     Requirement.AssumeCaptured("Send NT_TRANSACT_CREATE request");
     Update.UpdateNTTransactCreateRequest(smbConnection, smbRequest);
 }
开发者ID:pyq881120,项目名称:WindowsProtocolTestSuites,代码行数:29,代码来源:NTTransactionModel.cs


示例14: Share

	  /// <summary>
	  /// Constructor.
	  /// </summary>
	  /// <param name="server">Server of the new share.</param>
	  /// <param name="netName">Name of the new share.</param>
	  /// <param name="path">Local path of the new share.</param>
	  /// <param name="shareType">Type of the new share.</param>
	  /// <param name="remark">Comment of the new share.</param>
	  public Share(string server, string netName, string path, ShareType shareType, string remark) 
		{
			if (ShareType.Special == shareType && "IPC$" == netName)
				shareType |= ShareType.IPC;

			if (server.StartsWith("\\\\"))
        server = server.Substring(2);
			_server = server;
			_netName = netName;
			_path = path;
			_shareType = shareType;
			_remark = remark;
		}
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:21,代码来源:Share.cs


示例15: NtTransactCreateRequest

        public void NtTransactCreateRequest(
            int messageId,
            int sessionId,
            int treeId,
            [Domain("ImpersonationLevel")] int impersonationLevel,
            [Domain("FileDomain")] string fileName,
            ShareType shareType,
            bool isSigned)
        {
            #region Create Packet

            SmbNtCreateAndxRequestPacket smbPacket = new SmbNtCreateAndxRequestPacket();

            ushort uid = (ushort)this.uId[(uint)sessionId];
            ushort tid = (ushort)this.tId[(uint)treeId];
            string shareName = string.Empty;
            if (shareType == ShareType.NamedPipe)
            {
                if (SmbAdapter.isMessageModePipe)
                {
                    shareName = Site.Properties["SutShareMessagePipe"];
                }
                else
                {
                    shareName = Site.Properties["SutShareStreamPipe"];
                }
            }
            else
            {
                if (fileName == Site.Properties["SutShareTest1"])
                {
                    shareName = Site.Properties["SutShareTest1"];
                }
                else if (fileName == Site.Properties["SutShareTest2"])
                {
                    shareName = Site.Properties["SutShareTest2"];
                }
                else if (fileName == Site.Properties["SutShareExistFile"])
                {
                    shareName = Site.Properties["SutShareExistFile"];
                }
                else if (fileName.Contains("."))
                {
                    shareName = fileName;
                }
                else
                {
                    shareName = fileName;
                }
            }

            this.openedFileName = shareName;
            uint nTDesiredAccess = (uint)NamespaceCifs.NtTransactDesiredAccess.GENERIC_ALL;

            NamespaceCifs.SMB_EXT_FILE_ATTR extFileAttributes = NamespaceCifs.SMB_EXT_FILE_ATTR.NONE;

            NtTransactCreateOptions createOption = NtTransactCreateOptions.FILE_NON_DIRECTORY_FILE;

            smbPacket = this.smbClientStack.CreateCreateRequest(
                tid,
                shareName,
                (NamespaceCifs.NtTransactDesiredAccess)nTDesiredAccess,
                extFileAttributes,
                NamespaceCifs.NtTransactShareAccess.NONE,
                NamespaceCifs.NtTransactCreateDisposition.FILE_OPEN_IF,
                createOption,
                (NamespaceCifs.NtTransactImpersonationLevel)impersonationLevel,
                CreateFlags.NT_CREATE_REQUEST_OPLOCK);

            if (isSigned)
            {
                NamespaceCifs.CifsClientPerConnection connection =
                    this.smbClientStack.Context.GetConnection(ConnectionId);

                NamespaceCifs.CifsClientPerSession session = this.smbClientStack.Context.GetSession(ConnectionId, uid);

                smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey);
            }

            #endregion

            #region Send and Receive ExpectPacket

            this.smbClientStack.SendPacket(smbPacket);
            StackPacket response = this.smbClientStack.ExpectPacket(this.timeout);

            NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response;

            this.QueryUidTable(smbPacketResponse);
            this.QueryTidTable(smbPacketResponse);

            VerifyTransport(smbPacketResponse);
            VerifyCommonMessageSyntax(smbPacketResponse);

            if (response.GetType() == typeof(SmbErrorResponsePacket))
            {
                SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket;
                NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader;
                this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status);
            }
//.........这里部分代码省略.........
开发者ID:pyq881120,项目名称:WindowsProtocolTestSuites,代码行数:101,代码来源:Adapter.cs


示例16: UpdatePerson

        public PersonWrapper UpdatePerson(
            int personid,
            string firstName,
            string lastName,
            string jobTitle,
            int companyId,
            string about,
            ShareType shareType,
            IEnumerable<Guid> managerList,
            IEnumerable<ItemKeyValuePair<int, string>> customFieldList,
            IEnumerable<HttpPostedFileBase> photo)
        {
            if (personid <= 0 || string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(lastName)) throw new ArgumentException();

            var peopleInst = new Person
                {
                    ID = personid,
                    FirstName = firstName,
                    LastName = lastName,
                    JobTitle = jobTitle,
                    CompanyID = companyId,
                    About = about,
                    ShareType = shareType
                };

            DaoFactory.GetContactDao().UpdateContact(peopleInst);

            peopleInst = (Person)DaoFactory.GetContactDao().GetByID(peopleInst.ID);

            var managerListLocal = managerList != null ? managerList.ToList() : new List<Guid>();
            if (managerListLocal.Any())
            {
                CRMSecurity.SetAccessTo(peopleInst, managerListLocal);
            }

            if (customFieldList != null)
            {
                var existingCustomFieldList = DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Person).Select(fd => fd.ID).ToList();
                foreach (var field in customFieldList)
                {
                    if (string.IsNullOrEmpty(field.Value) || !existingCustomFieldList.Contains(field.Key)) continue;
                    DaoFactory.GetCustomFieldDao().SetFieldValue(EntityType.Person, peopleInst.ID, field.Key, field.Value);
                }
            }

            var wrapper = (PersonWrapper)ToContactWrapper(peopleInst);

            var photoList = photo != null ? photo.ToList() : new List<HttpPostedFileBase>();
            if (photoList.Any())
            {
                wrapper.SmallFotoUrl = ChangeContactPhoto(peopleInst.ID, photoList);
            }

            MessageService.Send(Request, MessageAction.PersonUpdated, peopleInst.GetTitle());

            return wrapper;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:57,代码来源:CRMApi.Contacts.cs


示例17: SetShareType

 /// <summary>
 /// Sets value for share_type
 /// </summary>
 /// <param name="share_type">flag of share type</param>
 public void SetShareType( ShareType share_type )
 {
     switch (share_type) {
         case ShareType.Public: {
             this.share_type = "P";
             break;
         }
         case ShareType.Tracked: {
             this.share_type = "T";
             break;
         }
         case ShareType.Confidential: {
             this.share_type = "C";
             break;
         }
     }
 }
开发者ID:antonmashko,项目名称:quatrix-api-csharp,代码行数:21,代码来源:ShareParameters.cs


示例18: UpdateCompany

        public CompanyWrapper UpdateCompany(
            int companyid,
            string companyName,
            string about,
            ShareType shareType,
            IEnumerable<Guid> managerList,
            IEnumerable<ItemKeyValuePair<int, string>> customFieldList)
        {
            var companyInst = new Company
                {
                    ID = companyid,
                    CompanyName = companyName,
                    About = about,
                    ShareType = shareType
                };

            DaoFactory.GetContactDao().UpdateContact(companyInst);

            companyInst = (Company)DaoFactory.GetContactDao().GetByID(companyInst.ID);

            var managerListLocal = managerList != null ? managerList.ToList(): new List<Guid>();
            if (managerListLocal.Any())
            {
                CRMSecurity.SetAccessTo(companyInst, managerListLocal);
            }

            if (customFieldList != null)
            {
                var existingCustomFieldList = DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Company).Select(fd => fd.ID).ToList();
                foreach (var field in customFieldList)
                {
                    if (string.IsNullOrEmpty(field.Value) || !existingCustomFieldList.Contains(field.Key)) continue;
                    DaoFactory.GetCustomFieldDao().SetFieldValue(EntityType.Company, companyInst.ID, field.Key, field.Value);
                }
            }

            MessageService.Send(Request, MessageAction.CompanyUpdated, companyInst.GetTitle());

            return (CompanyWrapper)ToContactWrapper(companyInst);
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:40,代码来源:CRMApi.Contacts.cs


示例19: TreeConnectRequest

        /// <summary>
        /// Tree connect request.
        /// </summary>
        /// <param name="messageId">This is used to associate a response with a request.</param>
        /// <param name="sessionId">Session id. </param>
        /// <param name="isTidDisconnectionSet">Indicate whether the client sets the tid disconnection.</param>
        /// <param name="isRequestExtSignature">Indicate whether the client requests extended signature.</param>
        /// <param name="isRequestExtResponse">
        /// Indicate whether the client requests extended information on Tree connection response.
        /// </param>
        /// <param name="share">The share method.</param>
        /// <param name="shareType">The type of resource the client intends to access.</param>
        /// <param name="isSigned" >
        /// Indicate whether the SUT has message signing enabled or required.
        /// </param>
        public void TreeConnectRequest(
            int messageId,
            int sessionId,
            bool isTidDisconnectionSet,
            bool isRequestExtSignature,
            bool isRequestExtResponse,
            string share,
            ShareType shareType,
            bool isSigned)
        {
            #region Create Packet

            ushort sessionUid = ushort.MinValue;
            if (!this.uId.ContainsKey((uint)sessionId))
            {
                sessionUid = (ushort)sessionId;
            }
            else
            {
                sessionUid = (ushort)this.uId[(uint)sessionId];
            }

            SmbAdapter.ServiceShareType = shareType;
            string shareName = string.Empty;
            switch (shareType)
            {
                case ShareType.NamedPipe:
                    shareName = Site.Properties["SutNamedPipeFullName"];
                    break;
                case ShareType.Printer:
                    shareName = Site.Properties["SutSharePrinterFullName"];
                    break;
                case ShareType.Disk:
                    if (SmbAdapter.FsType == FileSystemType.Ntfs.ToString())
                    {
                        if (share == ShareName.Share1.ToString())
                        {
                            shareName = Site.Properties["SutNtfsShare1FullName"];
                        }
                        else
                        {
                            if (share == ShareName.Share2.ToString())
                            {
                                shareName = Site.Properties["SutNtfsShare2FullName"];
                            }
                            else if (share == ShareName.DfsShare.ToString())
                            {
                                shareName = Site.Properties["SutShareDfsTreeConnect"];
                            }
                            else if (share == ShareName.QuotaShare.ToString())
                            {
                                shareName = Site.Properties["SutNtfsQuotaShareFullName"];
                            }
                        }
                    }
                    else
                    {
                        if (share == ShareName.Share1.ToString())
                        {
                            shareName = Site.Properties["SutFatShare1FullName"];
                        }
                        else
                        {
                            if (share == ShareName.Share2.ToString())
                            {
                                shareName = Site.Properties["SutFatShare2FullName"];
                            }
                            else if (share == ShareName.DfsShare.ToString())
                                shareName = Site.Properties["SutShareDfsTreeConnect"];
                        }
                    }

                    break;
                default:
                    shareName = string.Empty;
                    break;
            }

            SmbTreeConnectAndxRequestPacket smbPacket = new SmbTreeConnectAndxRequestPacket();

            // Create TreeConnect Request.
            smbPacket = this.smbClientStack.CreateTreeConnectRequest(sessionUid, shareName);

            if (isSigned)
            {
//.........这里部分代码省略.........
开发者ID:pyq881120,项目名称:WindowsProtocolTestSuites,代码行数:101,代码来源:Adapter.cs


示例20: ReadRequest

        /// <summary>
        /// Read request.
        /// </summary>
        /// <param name="messageId">This is used to associate a response with a request.</param>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="treeId">The tree identifier.</param>
        /// <param name="fid">The file identifier.</param>
        /// <param name="shareType">The type of share.</param>
        /// <param name="isSigned">
        /// Indicate whether the SUT has message signing enabled or required.
        /// </param>
        public void ReadRequest(
            int messageId,
            int sessionId,
            int treeId,
            int fid,
            ShareType shareType,
            bool isSigned)
        {
            #region  Create Packet

            SmbReadAndxRequestPacket smbPacket = new SmbReadAndxRequestPacket();
            ushort fileId = this.smbFileId;
            ushort uid = (ushort)this.uId[(uint)sessionId];
            uint offset = (uint)uint.Parse(Site.Properties["SmbTransportReadOffset"]);
            ushort maxCount = (ushort)ushort.Parse(Site.Properties["SmbTransportMaxReadDataCount"]);
            smbPacket = this.smbClientStack.CreateReadRequest(fileId, maxCount, offset);
            if (isSigned)
            {
                NamespaceCifs.CifsClientPerConnection connection =
                    this.smbClientStack.Context.GetConnection(ConnectionId);

                NamespaceCifs.CifsClientPerSession session = this.smbClientStack.Context.GetSession(ConnectionId, uid);

                smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey);
            }

            #endregion

            #region Send and Receive ExpectPacket

            this.smbClientStack.SendPacket(smbPacket);
            StackPacket response = this.smbClientStack.ExpectPacket(this.timeout);

            NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response;

            this.QueryUidTable(smbPacketResponse);
            this.QueryTidTable(smbPacketResponse);

            VerifyTransport(smbPacketResponse);
            VerifyCommonMessageSyntax(smbPacketResponse);

            if (response.GetType() == typeof(SmbErrorResponsePacket))
            {
                SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket;
                NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader;
                this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status);
            }
            else
            {
                SmbReadAndxResponsePacket readAndxResponsePacket = response as SmbReadAndxResponsePacket;
                NamespaceCifs.SmbHeader readAndxResponseHeader = readAndxResponsePacket.SmbHeader;
                int minNumberOfBytesToReturn = int.Parse(Site.Properties["MinNumberOfBytesToReturn"]);
                bool isReadOnPipe = false;
                bool isReadOnFile = false;

                if (shareType == ShareType.NamedPipe)
                {
                    isReadOnPipe = true;
                }
                else if (shareType == ShareType.Disk)
                {
                    isReadOnFile = true;
                }

                VerifyReceiveSmbComReadAndXRequest(
                    readAndxResponsePacket,
                    minNumberOfBytesToReturn,
                    isReadOnPipe,
                    isReadOnFile);

                this.ReadResponse(
                    readAndxResponseHeader.Mid + this.addMidMark,
                    this.QueryUidTable(smbPacketResponse),
                    this.QueryTidTable(smbPacketResponse),
                    (smbPacketResponse).IsSignRequired,
                    true,
                    (MessageStatus)readAndxResponseHeader.Status);
            }

            #endregion
        }
开发者ID:pyq881120,项目名称:WindowsProtocolTestSuites,代码行数:92,代码来源:Adapter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Shared类代码示例发布时间:2022-05-24
下一篇:
C# ShareCacheStruct类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap