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


C# ShareType类代码示例

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


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


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