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


C# ShareType.ToString方法代码示例

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


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

示例1: OpenRequest

        public static void OpenRequest(
            ClientGuidType clientGuidType,
            PathNameType pathNameType,
            CreateType createType,
            ShareType shareType,
            AppInstanceIdType appInstanceIdType)
        {
            Condition.IsTrue(State == ModelState.Connected);
            Condition.IsNotNull(Open);

            // Isolate below params to limite the expanded test cases.
            Combination.Isolated(clientGuidType == ClientGuidType.SameClientGuid);
            Combination.Isolated(pathNameType == PathNameType.DifferentPathName);
            Combination.Isolated(shareType == ShareType.DifferentShareDifferentLocal);
            Combination.Isolated(shareType == ShareType.DifferentShareSameLocal);
            Combination.Isolated(appInstanceIdType == AppInstanceIdType.InvalidAppInstanceId);
            Combination.Isolated(appInstanceIdType == AppInstanceIdType.NoAppInstanceId);

            // "AppInstanceId is zero" is only applicable for the first Create Request.
            // For the second Create Request, only valid/notvalid/none make sense.
            Condition.IsFalse(appInstanceIdType == AppInstanceIdType.AppInstanceIdIsZero);

            // CreateDurableThenDisconnect is only applicable for the first Create Request.
            Condition.IsFalse(createType == CreateType.CreateDurableThenDisconnect);

            // If the client doesn't disconnect from the server after sending the first Create Request,
            // then the second Create Request does not need to contain reconnect context.
            // And vice versa.
            Condition.IfThen(Open.CreateTypeWhenPrepare != CreateType.CreateDurableThenDisconnect, createType != CreateType.ReconnectDurable);
            Condition.IfThen(Open.CreateTypeWhenPrepare == CreateType.CreateDurableThenDisconnect, createType == CreateType.ReconnectDurable);

            if (createType == CreateType.ReconnectDurable)
            {
                ModelHelper.Log(LogType.Requirement,
                    "3.3.5.9.13: If the create request also includes the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context, " +
                    "the server MUST process the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context as specified in section 3.3.5.9.12, " +
                    "and this section MUST be skipped.");
                ModelHelper.Log(LogType.TestInfo, "SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 create context is included.");
                return;
            }

            if (!ModelUtility.IsSmb3xFamily(MaxSmbVersionSupported))
            {
                ModelHelper.Log(LogType.Requirement,
                    "2.2.13.2.13: The SMB2_CREATE_APP_INSTANCE_ID context is valid only for the SMB 3.x dialect family.");
                ModelHelper.Log(LogType.TestInfo, "The dialect version of the server is {0}.", MaxSmbVersionSupported);
                return;
            }

            if (appInstanceIdType == AppInstanceIdType.ValidAppInstanceId && Open.AppInstanceId != AppInstanceIdType.NoAppInstanceId
                && pathNameType == PathNameType.SamePathName
                && shareType == ShareType.SameShare
                && clientGuidType == ClientGuidType.DifferentClientGuid)
            {
                ModelHelper.Log(LogType.Requirement,
                    "3.3.5.9.13: The server MUST attempt to locate an Open in GlobalOpenTable where:");
                ModelHelper.Log(LogType.Requirement,
                    "\tAppInstanceId in the request is equal to Open.AppInstanceId.");
                ModelHelper.Log(LogType.Requirement,
                    "\tTarget path name is equal to Open.PathName.");
                ModelHelper.Log(LogType.Requirement,
                    "\tOpen.TreeConnect.Share is equal to TreeConnect.Share.");
                ModelHelper.Log(LogType.Requirement,
                    "\tOpen.Session.Connection.ClientGuid is not equal to the current Connection.ClientGuid.");
                ModelHelper.Log(LogType.TestInfo, "All the above conditions are met.");

                ModelHelper.Log(LogType.Requirement,
                    "If an Open is found, the server MUST calculate the maximal access that the user, " +
                    "identified by Session.SecurityContext, has on the file being opened<277>. " +
                    "If the maximal access includes GENERIC_READ access, the server MUST close the open as specified in 3.3.4.17.");
                // The user used in this model is administrator, so maximal access always includes GENERIC_READ access.
                ModelHelper.Log(LogType.TestInfo, "The maximal access includes GENERIC_READ access. So open is closed.");

                // close open
                Open = null;
            }
            else
            {
                ModelHelper.Log(LogType.TestInfo, "appInstanceIdType is {0}.", appInstanceIdType.ToString());
                ModelHelper.Log(LogType.TestInfo, "pathNameType is {0}.", pathNameType.ToString());
                ModelHelper.Log(LogType.TestInfo, "shareType is {0}.", shareType.ToString());
                ModelHelper.Log(LogType.TestInfo, "clientGuidType is {0}.", clientGuidType.ToString());
                ModelHelper.Log(LogType.TestInfo, "All the above conditions do not match the requirement, so open will not be closed.");

                ModelHelper.Log(LogType.TestTag, TestTag.UnexpectedFields);
            }
        }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:87,代码来源:AppInstanceIdModel.cs


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