本文整理汇总了C#中Sequence.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Sequence.Contains方法的具体用法?C# Sequence.Contains怎么用?C# Sequence.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence.Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComNegotiateRequest
public static void ComNegotiateRequest(Sequence<string> dialects)
{
Condition.IsTrue(State == ModelState.Connected);
Condition.IsNull(Request);
Request = new ModelComNegotiateRequest(dialects);
if (MessageId > 0)
{
// Negotiate request is always expected to be the first message in a connection
State = ModelState.Disconnected;
return;
}
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3: This request is defined in [MS-SMB] section 2.2.4.5.1, with the SMB header defined in section 2.2.3.1." +
" If the request matches the format described there, and Connection.NegotiateDialect is 0xFFFF, processing MUST continue as specified in 3.3.5.3.1.");
if (NegotiateDialect != DialectRevision.Smb2Unknown)
//|| (!dialects.Contains(SMBDialects.SMB_2_002) && !dialects.Contains(SMBDialects.SMB_2_X))) // TODO: more comments?
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3: Otherwise, the server MUST disconnect the connection, as specified in section 3.3.7.1, without sending a response.");
ModelHelper.Log(LogType.TestTag, TestTag.Compatibility);
State = ModelState.Disconnected;
return;
}
if (!(Config.MaxSmbVersionSupported == DialectRevision.Smb21 || ModelUtility.IsSmb3xFamily(Config.MaxSmbVersionSupported)))
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.1: If the server does not implement the SMB 2.1 or 3.x dialect family, processing MUST continue as specified in 3.3.5.3.2.");
ComNegotiateHandleSmb2002InRequest(dialects);
}
else
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.1: Otherwise, the server MUST scan the dialects provided for the dialect string \"SMB 2.???\".");
if (!dialects.Contains(SMBDialects.SMB_2_X))
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.1: If the string is not present, continue to section 3.3.5.3.2.");
ComNegotiateHandleSmb2002InRequest(dialects);
}
else
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.1: If the string is present, the server MUST respond with an SMB2 NEGOTIATE Response as specified in 2.2.4");
ModelHelper.Log(
LogType.TestInfo,
"\"SMB 2.???\" is present in the dialects provided");
}
}
// After every successful call, messageId MUST be incremented by 1.
// But in this model it is set to 1 to avoid to generate duplicate cases which only have different messageId.
MessageId = 1;
}
示例2: SelectCommonDialect
/// <summary>
/// Select the greatest common dialect between the dialects it implements and the Dialects array of the SMB2 NEGOTIATE request.
/// </summary>
/// <param name="requestDialects">The Dialects array of the SMB2 NEGOTIATE request.</param>
/// <returns>Return a common dialect if found, otherwise return DialectRevision.Smb2Unknown(0xFFFF).</returns>
private static DialectRevision SelectCommonDialect(Sequence<DialectRevision> requestDialects)
{
if (Config.MaxSmbVersionSupported >= DialectRevision.Smb302
&& requestDialects.Contains(DialectRevision.Smb302))
{
return DialectRevision.Smb302;
}
else if (Config.MaxSmbVersionSupported >= DialectRevision.Smb30
&& requestDialects.Contains(DialectRevision.Smb30))
{
return DialectRevision.Smb30;
}
else if (Config.MaxSmbVersionSupported >= DialectRevision.Smb21
&& requestDialects.Contains(DialectRevision.Smb21))
{
return DialectRevision.Smb21;
}
else if (Config.MaxSmbVersionSupported >= DialectRevision.Smb2002
&& requestDialects.Contains(DialectRevision.Smb2002))
{
return DialectRevision.Smb2002;
}
return DialectRevision.Smb2Unknown;
}
示例3: SelectTrack
private void SelectTrack(Sequence sequence, Track track, GuitarDifficulty difficulty)
{
if (DesignMode)
return;
if (sequence != null && track != null)
{
if (lastTrack != null && sequence.Contains(lastTrack))
{
TrackProperties.FirstOrDefault(x => x.Track == lastTrack).IfObjectNotNull(x => UpdateWebTabTrack(x));
}
lastTrack = track;
if (!TrackProperties.Any(x => x.Track == track))
{
TrackProperties.Add(new WebTabTrackProperties(track, EditorPro));
}
}
else
{
TrackProperties.Clear();
lastTrack = null;
}
setWebTabTrackToScreen(track == null ? null : TrackProperties.FirstOrDefault(x => x.Track == track));
}
示例4: ComNegotiateHandleSmb2002InRequest
private static void ComNegotiateHandleSmb2002InRequest(Sequence<string> dialects)
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.2: The server MUST scan the dialects provided for the dialect string \"SMB 2.002\".<217>");
if (dialects.Contains(SMBDialects.SMB_2_002))
{
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.2: If the string is present, the client understands SMB2, and the server MUST respond with an SMB2 NEGOTIATE Response.");
}
else
{
// Assume SUT does not implement SMB
ModelHelper.Log(
LogType.Requirement,
"3.3.5.3.2: If the string is not present in the dialect list and the server does not implement SMB," +
" the server MUST disconnect the connection, as specified in section 3.3.7.1, without sending a response.");
State = ModelState.Disconnected;
}
}
示例5: SynchronizationImportDeletes
public static RopResult SynchronizationImportDeletes(int serverId, int uploadContextHandleIndex, Sequence<int> objIdIndexes, byte importDeleteFlag)
{
// The contractions conditions.
Condition.IsTrue(connections.Count > 0);
Condition.IsTrue(connections.Keys.Contains(serverId));
Condition.IsTrue(connections[serverId].FolderContainer.Count > 0);
if (requirementContainer.ContainsKey(90205002) && requirementContainer[90205002])
{
Condition.IsTrue(((ImportDeleteFlags)importDeleteFlag & ImportDeleteFlags.delete) == ImportDeleteFlags.delete);
}
// Initialize return value.
RopResult result = RopResult.InvalidParameter;
// When the ImportDeleteFlags flag is set HardDelete by Exchange 2007 then server return 0x80070057.
if (importDeleteFlag == (byte)ImportDeleteFlags.HardDelete)
{
if (requirementContainer.ContainsKey(2593) && requirementContainer[2593])
{
result = RopResult.NotSupported;
ModelHelper.CaptureRequirement(2593, "[In Appendix A: Product Behavior] <16> Section 2.2.3.2.4.5.1: The HardDelete flag is not supported by Exchange 2003 or Exchange 2007.");
return result;
}
}
// When the ImportDeleteFlags flag is an invalid value (0x10) then server returns 0x80070057.
if (importDeleteFlag == 0x10)
{
if (requirementContainer.ContainsKey(2254001) && requirementContainer[2254001])
{
result = RopResult.NotSupported;
}
else
{
result = RopResult.InvalidParameter;
}
return result;
}
// Get ConnectionData value.
ConnectionData changeConnection = connections[serverId];
// Create uploadInfo variable.
AbstractUploadInfo uploadInfo = new AbstractUploadInfo();
// Identify whether the Current Upload information is existent or not.
bool isCurrentUploadinfoExist = false;
// Record the current uploadInfo index.
int currentUploadIndex = 0;
foreach (AbstractUploadInfo tempUploadInfo in changeConnection.UploadContextContainer)
{
if (tempUploadInfo.UploadHandleIndex == uploadContextHandleIndex)
{
// Set the value to the variable when the current upload context is existent.
isCurrentUploadinfoExist = true;
uploadInfo = tempUploadInfo;
currentUploadIndex = changeConnection.UploadContextContainer.IndexOf(tempUploadInfo);
}
}
if (isCurrentUploadinfoExist)
{
// Set the upload information.
uploadInfo.ImportDeleteflags = importDeleteFlag;
AbstractFolder currentFolder = new AbstractFolder();
// Record the current Folder Index
int currentFolderIndex = 0;
foreach (AbstractFolder tempFolder in changeConnection.FolderContainer)
{
if (tempFolder.FolderHandleIndex == uploadInfo.RelatedObjectHandleIndex)
{
// Set the value to the variable when the current Folder is existent.
currentFolder = tempFolder;
currentFolderIndex = changeConnection.FolderContainer.IndexOf(tempFolder);
}
}
foreach (AbstractFolder tempFolder in changeConnection.FolderContainer)
{
if ((tempFolder.ParentFolderIdIndex == currentFolder.FolderIdIndex) && objIdIndexes.Contains(tempFolder.FolderIdIndex))
{
// Remove current folder from FolderContainer and parent folder when the parent Folder is existent.
changeConnection.FolderContainer = changeConnection.FolderContainer.Remove(tempFolder);
currentFolder.SubFolderIds = currentFolder.SubFolderIds.Remove(tempFolder.FolderIdIndex);
}
if (importDeleteFlag == (byte)ImportDeleteFlags.Hierarchy)
{
softDeleteFolderCount += 1;
}
}
foreach (AbstractMessage tempMessage in changeConnection.MessageContainer)
{
if ((tempMessage.FolderIdIndex == currentFolder.FolderIdIndex) && objIdIndexes.Contains(tempMessage.MessageIdIndex))
{
// Remove current Message from MessageContainer and current folder when current Message is existent.
//.........这里部分代码省略.........