protected IList <IList <string> > GetDteStrings(IDictionary <string, byte> dteTable) { IList <IList <string> > secs = GetCopyOfSections(); TextUtilities.DoDTEEncoding(secs, DteAllowed, dteTable); return(secs.AsReadOnly()); }
internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint origin) { // http://redis.io/commands/cluster-nodes this.configuration = configuration; this.raw = raw; var parts = raw.Split(StringSplits.Space); var flags = parts[2].Split(StringSplits.Comma); endpoint = Format.TryParseEndPoint(parts[1]); nodeId = parts[0]; isSlave = flags.Contains("slave"); isNoAddr = flags.Contains("noaddr"); parentNodeId = string.IsNullOrWhiteSpace(parts[3]) ? null : parts[3]; List <SlotRange> slots = null; for (int i = 8; i < parts.Length; i++) { SlotRange range; if (SlotRange.TryParse(parts[i], out range)) { if (slots == null) { slots = new List <SlotRange>(parts.Length - i); } slots.Add(range); } } this.slots = slots == null ? NoSlots : slots.AsReadOnly(); this.isConnected = parts[7] == "connected"; // Can be "connected" or "disconnected" }
private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, IList <IndexReaderContext> children, IList <AtomicReaderContext> leaves) : base(parent, ordInParent, docbaseInParent) { this.children = children.AsReadOnly(); this.leaves = leaves; this.reader = reader; }
public TransformationStepRecorder() { var steps = new List <ITransformationStep>(16); this.steps = steps; this.readonlySteps = steps.AsReadOnly(); }
public TransformationStepRecorder() { var steps = new List<ITransformationStep>(16); this.steps = steps; this.readonlySteps = steps.AsReadOnly(); }
public GroupableSet(string group, IList <int> indices, int originalCost) { Group = group; Indices = indices.AsReadOnly(); OriginalCost = originalCost; hashCode = group.GetHashCode(); }
/// <include file='../../_Doc/mscorlib.xml' path='doc/members/member[@name="M:System.Collections.Generic.List`1.AsReadOnly"]/*' /> public static ReadOnlyCollection <T> AsReadOnly <T>(this IList <T> list) { #if DOTNET || WINDOWS_PHONE || WINDOWS_PHONE_APP return(list.AsReadOnly()); #else return(new ReadOnlyCollection <T>(list)); #endif }
internal SubscriberTopicState(string topic, string type, IList <string> topicIds, IList <SubscriberReceiverState> receivers) { Topic = topic; Type = type; SubscriberIds = topicIds.AsReadOnly(); Receivers = receivers.AsReadOnly(); }
public AstMissingMethod(string name, IList<IAstTypeReference> parameterTypes) { Argument.RequireNotNullAndNotEmpty("name", name); Argument.RequireNotNullNotEmptyAndNotContainsNull("parameterTypes", parameterTypes); this.Name = name; this.ParameterTypes = parameterTypes.AsReadOnly(); }
public BlameResult(Uri webRootUrl, ReadOnlyCollection<Block> blocks, IList<Line> lines, Dictionary<string, Commit> commits) { m_webRootUrl = webRootUrl; m_blocks = blocks; m_lines = lines; m_linesReadOnly = m_lines.AsReadOnly(); m_commits = commits; m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly(); }
public TermExpression(IList<TermExpression> terms) { if (terms == null || terms.Count == 0) throw new CqlLinqException("Empty lists are not allowed"); _type = typeof(IList<>).MakeGenericType(terms[0].Type); _terms = terms.AsReadOnly(); _termType = CqlExpressionType.List; }
public void AsReadOnly_Throws_If_List_IsNull() { IList <int> list = null; // ReSharper disable once ReturnValueOfPureMethodIsNotUsed // ReSharper disable once AssignNullToNotNullAttribute var ex = Assert.Throws <ArgumentNullException>(() => list.AsReadOnly()); ex.ParamName.Should().Be("list"); }
public BlameResult(Uri?webRootUrl, IReadOnlyList <Block> blocks, IList <Line> lines, Dictionary <string, Commit> commits) { WebRootUrl = webRootUrl; Blocks = blocks; m_lines = lines; m_linesReadOnly = m_lines.AsReadOnly(); m_commits = commits; m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly(); }
/// <summary> /// API类初始化 /// </summary> /// <param name="type">API类型对应的<see cref="Type"/></param> /// <param name="apis">API描述集合</param> /// <param name="properties">属性描述集合</param> public ApiClassDescriptor(Type type, IList <ApiDescriptor> apis, IList <ApiPropertyDescriptor> properties) { Type = type ?? throw new ArgumentNullException(nameof(type)); CheckType(type.GetTypeInfo(), true); Apis = apis.AsReadOnly(); Properties = properties.AsReadOnly(); Name = type.Name; FullName = GetFullName(type); }
internal void SetData(IList<Block> blocks, IList<Line> lines, Dictionary<string, Commit> commits) { m_blocks = blocks.AsReadOnly(); m_lines = lines; m_linesReadOnly = lines.AsReadOnly(); m_commits = commits; m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly(); RaisePropertyChanged(null); }
/// <summary> /// Initializes a new instance of <see cref="SignOutHttpResult"/> with the /// specified authentication schemes and <paramref name="properties"/>. /// </summary> /// <param name="authenticationSchemes">The authentication scheme to use when signing out the user.</param> /// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the sign-out operation.</param> internal SignOutHttpResult(IList <string> authenticationSchemes, AuthenticationProperties?properties) { if (authenticationSchemes is null) { throw new ArgumentNullException(nameof(authenticationSchemes)); } AuthenticationSchemes = authenticationSchemes.AsReadOnly(); Properties = properties; }
internal void SetData(IList <Block> blocks, IList <Line> lines, Dictionary <string, Commit> commits) { Blocks = blocks.AsReadOnly(); m_lines = lines; m_linesReadOnly = lines.AsReadOnly(); m_commits = commits; m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly(); RaisePropertyChanged(null); }
public GrantViewModel( string albumID, HashSet<IUserGroup> grantedUserGroups, IList<UserGroupViewModel> allUserGroups ) { this.AlbumID = albumID; this.grantedUserGroups = grantedUserGroups; this.AllUserGroups = allUserGroups.AsReadOnly(); }
/// <summary> /// Construct a route option from the given values. /// </summary> protected IpV4OptionRoute(IpV4OptionType optionType, IList <IpV4Address> route, byte pointedAddressIndex) : base(optionType) { if (pointedAddressIndex > PointedAddressIndexMaxValue) { throw new ArgumentOutOfRangeException("pointedAddressIndex", pointedAddressIndex, "Maximum value is " + PointedAddressIndexMaxValue); } _route = route.AsReadOnly(); _pointedAddressIndex = pointedAddressIndex; }
/// <summary> /// Create the option by giving it all the data. /// </summary> /// <param name="timestampType">The timestamp option type.</param> /// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param> /// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param> /// <param name="timedRoute">The pairs of addresses and timestamps where each timestamp time passed since midnight UT.</param> public IpV4OptionTimestampAndAddress(IpV4OptionTimestampType timestampType, byte overflow, byte pointedIndex, IList<IpV4OptionTimedAddress> timedRoute) : base(timestampType, overflow, pointedIndex) { if (timestampType != IpV4OptionTimestampType.AddressAndTimestamp && timestampType != IpV4OptionTimestampType.AddressPrespecified) { throw new ArgumentException("Illegal timestamp type " + timestampType, "timestampType"); } _addressesAndTimestamps = timedRoute.AsReadOnly(); }
private void SetTransferCodings(IList <string> transferCodings) { if (transferCodings.Any(coding => coding.Any(c => c.IsUppercaseAlpha()))) { _transferCodings = transferCodings.Select(coding => coding.ToLowerInvariant()).ToArray().AsReadOnly(); } else { _transferCodings = transferCodings.AsReadOnly(); } }
/// <summary> /// Create the option by giving it all the data. /// </summary> /// <param name="timestampType">The timestamp option type.</param> /// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param> /// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param> /// <param name="timedRoute">The pairs of addresses and timestamps where each timestamp time passed since midnight UT.</param> public IpV4OptionTimestampAndAddress(IpV4OptionTimestampType timestampType, byte overflow, byte pointedIndex, IList <IpV4OptionTimedAddress> timedRoute) : base(timestampType, overflow, pointedIndex) { if (timestampType != IpV4OptionTimestampType.AddressAndTimestamp && timestampType != IpV4OptionTimestampType.AddressPrespecified) { throw new ArgumentException("Illegal timestamp type " + timestampType, "timestampType"); } _addressesAndTimestamps = timedRoute.AsReadOnly(); }
public GalleryViewModel( AlbumViewModel currentUserAlbum, IList<AlbumViewModel> otherPeopleAlbums, AlbumListViewModel standardAlbums, AlbumViewModel selected ) { this.CurrentUserAlbum = currentUserAlbum; this.OtherPeopleAlbums = otherPeopleAlbums.AsReadOnly(); this.StandardAlbums = standardAlbums; this.Selected = selected; }
public Population(IList <Chromosome <T> > chromosomes) { chromosomes.CheckParameterForNull("chromosomes"); if (chromosomes.Count < 2) { throw new ArgumentException("At least two chromosomes must exist in the list.", "chromosomes"); } this.SetFitnessValues(chromosomes); this.Chromosomes = chromosomes.AsReadOnly(); }
public AstGenericMethodWithTypeArguments(IAstMethodReference actual, IList<IAstTypeReference> typeArguments, GenericTypeHelper genericHelper) { Argument.RequireNotNull("actual", actual); Argument.RequireNotNull("typeArguments", typeArguments); this.Actual = actual; this.GenericArgumentTypes = typeArguments.AsReadOnly(); var genericParameterTypes = actual.GetGenericParameterTypes().ToArray(); this.ParameterTypes = actual.ParameterTypes.Select(t => ApplyArgumentTypes(genericHelper, t, genericParameterTypes)).ToArray().AsReadOnly(); this.ReturnType = ApplyArgumentTypes(genericHelper, actual.ReturnType, genericParameterTypes); }
public AstGenericMethodWithTypeArguments(IAstMethodReference actual, IList <IAstTypeReference> typeArguments, GenericTypeHelper genericHelper) { Argument.RequireNotNull("actual", actual); Argument.RequireNotNull("typeArguments", typeArguments); this.Actual = actual; this.GenericArgumentTypes = typeArguments.AsReadOnly(); var genericParameterTypes = actual.GetGenericParameterTypes().ToArray(); this.ParameterTypes = actual.ParameterTypes.Select(t => ApplyArgumentTypes(genericHelper, t, genericParameterTypes)).ToArray().AsReadOnly(); this.ReturnType = ApplyArgumentTypes(genericHelper, actual.ReturnType, genericParameterTypes); }
private static void GetDisallowedEntries(XmlNode node, int numSections, out IList <IList <int> > disallowed, out IList <IDictionary <int, string> > staticEntries) { IList <IList <int> > result = new IList <int> [numSections]; IList <IDictionary <int, string> > ourStatic = new IDictionary <int, string> [numSections]; XmlNode disallowedNode = node.SelectSingleNode("DisallowedEntries"); if (disallowedNode != null) { foreach (XmlNode node2 in disallowedNode.SelectNodes("Section")) { int sec = Int32.Parse(node2.Attributes["value"].InnerText); List <int> ourResult = new List <int>(); Dictionary <int, string> ourDict = new Dictionary <int, string>(); foreach (XmlNode ent in node2.SelectNodes("entry")) { int idx = Int32.Parse(ent.InnerText); ourResult.Add(idx); XmlAttribute stat = ent.Attributes["staticValue"]; if (stat != null) { ourDict[idx] = stat.InnerText; } else { ourDict[idx] = string.Empty; } } result[sec] = ourResult.AsReadOnly(); ourStatic[sec] = new ReadOnlyDictionary <int, string>(ourDict); } } for (int i = 0; i < result.Count; i++) { if (result[i] == null) { result[i] = new int[0].AsReadOnly(); } if (ourStatic[i] == null) { ourStatic[i] = new ReadOnlyDictionary <int, string>(new Dictionary <int, string>(0)); } } disallowed = result.AsReadOnly(); staticEntries = ourStatic.AsReadOnly(); }
internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint origin) { // http://redis.io/commands/cluster-nodes this.configuration = configuration; this.raw = raw; var parts = raw.Split(StringSplits.Space); var flags = parts[2].Split(StringSplits.Comma); endpoint = Format.TryParseEndPoint(parts[1]); if (flags.Contains("myself")) { isMyself = true; if (endpoint == null) { // Unconfigured cluster nodes might report themselves as endpoint ":{port}", // hence the origin fallback value to make sure that we can address them endpoint = origin; } } nodeId = parts[0]; isSlave = flags.Contains("slave"); isNoAddr = flags.Contains("noaddr"); parentNodeId = string.IsNullOrWhiteSpace(parts[3]) ? null : parts[3]; List <SlotRange> slots = null; for (int i = 8; i < parts.Length; i++) { SlotRange range; if (SlotRange.TryParse(parts[i], out range)) { if (slots == null) { slots = new List <SlotRange>(parts.Length - i); } slots.Add(range); } } this.slots = slots == null ? NoSlots : slots.AsReadOnly(); this.isConnected = parts[7] == "connected"; // Can be "connected" or "disconnected" }
internal CustomAttributeData(ConstructorInfo constructor, object[] args, List <CustomAttributeNamedArgument> namedArguments) { this.constructor = constructor; MethodSignature sig = constructor.MethodSignature; List <CustomAttributeTypedArgument> list = new List <CustomAttributeTypedArgument>(); for (int i = 0; i < args.Length; i++) { list.Add(new CustomAttributeTypedArgument(sig.GetParameterType(i), args[i])); } constructorArguments = list.AsReadOnly(); if (namedArguments == null) { this.namedArguments = Empty <CustomAttributeNamedArgument> .Array; } else { this.namedArguments = namedArguments.AsReadOnly(); } }
internal Options(IList <T> options, bool isValid, int?length) { _options = options.AsReadOnly(); IsValid = isValid; if (length.HasValue) { BytesLength = length.Value; } else { BytesLength = SumBytesLength(OptionsCollection); if (BytesLength % 4 != 0) { BytesLength = (BytesLength / 4 + 1) * 4; } } }
private static IList <IList <string> > GetEntryNames(XmlNode sectionsNode, XmlNode templatesNode) { int sectionCount = Int32.Parse(sectionsNode.Attributes["count"].InnerText); IList <IList <string> > result = new IList <string> [sectionCount]; for (int i = 0; i < sectionCount; i++) { XmlNode currentNode = sectionsNode.SelectSingleNode(string.Format("Section[@value='{0}']", i)); int currentCount = Int32.Parse(currentNode.Attributes["entries"].InnerText); XmlNode emptyNode = currentNode.Attributes["empty"]; bool empty = emptyNode != null && Boolean.Parse(emptyNode.InnerText); if (empty) { result[i] = new string[currentCount].AsReadOnly(); } else { string[] currentSection = new string[currentCount]; foreach (XmlNode entryNode in currentNode.SelectNodes("entry")) { int index = Int32.Parse(entryNode.Attributes["value"].InnerText); currentSection[index] = entryNode.Attributes["name"].InnerText; } foreach (XmlNode includeNode in currentNode.SelectNodes("include")) { XmlNode included = templatesNode.SelectSingleNode(includeNode.Attributes["name"].InnerText); int start = Int32.Parse(includeNode.Attributes["start"].InnerText); int end = Int32.Parse(includeNode.Attributes["end"].InnerText); int offset = Int32.Parse(includeNode.Attributes["offset"].InnerText); for (int j = start; j <= end; j++) { currentSection[j + offset] = included.SelectSingleNode(string.Format("entry[@value='{0}']", j)).Attributes["name"].InnerText; } } result[i] = currentSection.AsReadOnly(); } } return(result.AsReadOnly()); }
public SelectStatementExpression(Type type, SelectClauseExpression selectClause, string tableName, IList<RelationExpression> whereClause, IList<OrderingExpression> orderBy, int? limit, bool allowFiltering) { if (type == null) throw new ArgumentNullException("type"); if (selectClause == null) throw new ArgumentNullException("selectClause"); if (tableName == null) throw new ArgumentNullException("tableName"); _type = type; _selectClause = selectClause; _tableName = tableName; _whereClause = whereClause.AsReadOnly(); _orderBy = orderBy.AsReadOnly(); _limit = limit; _allowFiltering = allowFiltering; }
internal ClusterNode(ClusterConfiguration configuration, string raw, EndPoint origin) { this.configuration = configuration; this.raw = raw; var parts = raw.Split(StringSplits.Space); var flags = parts[2].Split(StringSplits.Comma); if (flags.Contains("myself")) { endpoint = origin; } else { endpoint = Format.TryParseEndPoint(parts[1]); } nodeId = parts[0]; isSlave = flags.Contains("slave"); parentNodeId = string.IsNullOrWhiteSpace(parts[3]) ? null : parts[3]; List <SlotRange> slots = null; for (int i = 8; i < parts.Length; i++) { SlotRange range; if (SlotRange.TryParse(parts[i], out range)) { if (slots == null) { slots = new List <SlotRange>(parts.Length - i); } slots.Add(range); } } this.slots = slots == null ? NoSlots : slots.AsReadOnly(); }
public Slice(IList <TValue> source, int start = 0, int?count = null) : this(source.AsReadOnly(), start, count) { }
/// <summary> /// Creates an instance from a list of flow identifiers. /// </summary> /// <param name="flowIdentifiers"> /// Indicating a registered FID. /// One or more FID fields can be included in this option. /// </param> public IpV6MobilityOptionFlowSummary(IList<ushort> flowIdentifiers) : this(flowIdentifiers.AsReadOnly()) { }
private static IList<IList<string>> GetEntryNames( XmlNode sectionsNode, XmlNode templatesNode ) { int sectionCount = Int32.Parse( sectionsNode.Attributes["count"].InnerText ); IList<IList<string>> result = new IList<string>[sectionCount]; for ( int i = 0; i < sectionCount; i++ ) { XmlNode currentNode = sectionsNode.SelectSingleNode( string.Format( "Section[@value='{0}']", i ) ); int currentCount = Int32.Parse( currentNode.Attributes["entries"].InnerText ); XmlNode emptyNode = currentNode.Attributes["empty"]; bool empty = emptyNode != null && Boolean.Parse( emptyNode.InnerText ); if ( empty ) { result[i] = new string[currentCount].AsReadOnly(); } else { string[] currentSection = new string[currentCount]; foreach ( XmlNode entryNode in currentNode.SelectNodes( "entry" ) ) { int index = Int32.Parse( entryNode.Attributes["value"].InnerText ); currentSection[index] = entryNode.Attributes["name"].InnerText; } foreach ( XmlNode includeNode in currentNode.SelectNodes( "includeResource" ) ) { int start = Int32.Parse( includeNode.Attributes["start"].InnerText ); int end = Int32.Parse( includeNode.Attributes["end"].InnerText ); int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText ); string fullName = includeNode.Attributes["name"].InnerText; XmlAttribute formatNode = includeNode.Attributes["format"]; string format = formatNode != null ? formatNode.InnerText.Replace( "\\n", Environment.NewLine ) : "{0}"; if ( !cachedResources.ContainsKey( fullName ) ) { cachedResources[fullName] = PatcherLib.ResourcesClass.GetResourceByName( fullName ); } IList<string> resourceList = cachedResources[fullName]; for ( int j = start; j <= end; j++ ) { if ( string.IsNullOrEmpty( resourceList[j] ) ) { currentSection[j + offset] = string.Empty; } else { currentSection[j + offset] = string.Format( format, resourceList[j] ); } } } foreach ( XmlNode includeNode in currentNode.SelectNodes( "include" ) ) { XmlNode included = templatesNode.SelectSingleNode( includeNode.Attributes["name"].InnerText ); int start = Int32.Parse( includeNode.Attributes["start"].InnerText ); int end = Int32.Parse( includeNode.Attributes["end"].InnerText ); int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText ); for ( int j = start; j <= end; j++ ) { currentSection[j + offset] = included.SelectSingleNode( string.Format( "entry[@value='{0}']", j ) ).Attributes["name"].InnerText; } } result[i] = currentSection.AsReadOnly(); } } return result.AsReadOnly(); }
public GroupableSet( string group, IList<int> indices, int originalCost ) { Group = group; Indices = indices.AsReadOnly(); OriginalCost = originalCost; hashCode = group.GetHashCode(); }
/// <summary> /// Creates an instance from a list of flow identifiers. /// </summary> /// <param name="flowIdentifiers"> /// Indicating a registered FID. /// One or more FID fields can be included in this option. /// </param> public IpV6MobilityOptionFlowSummary(IList <ushort> flowIdentifiers) : this(flowIdentifiers.AsReadOnly()) { }
/// <summary> /// Create the option by giving it all the data. /// </summary> /// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param> /// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param> /// <param name="timestamps">The timestamps as time passed since midnight UT.</param> public IpV4OptionTimestampOnly(byte overflow, byte pointedIndex, IList<IpV4TimeOfDay> timestamps) : base(IpV4OptionTimestampType.TimestampOnly, overflow, pointedIndex) { _timestamps = timestamps.AsReadOnly(); }
/// <summary> /// Creates an instance from a list of requests. /// </summary> /// <param name="requests">The requests types and options.</param> public IpV6MobilityOptionContextRequest(IList<IpV6MobilityOptionContextRequestEntry> requests) : this(requests.AsReadOnly()) { }
/// <summary> /// Initializes a new instance of <see cref="ChallengeHttpResult"/> with the /// specified authentication schemes and <paramref name="properties"/>. /// </summary> /// <param name="authenticationSchemes">The authentication scheme to challenge.</param> /// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication /// challenge.</param> internal ChallengeHttpResult(IList <string> authenticationSchemes, AuthenticationProperties?properties) { AuthenticationSchemes = authenticationSchemes.AsReadOnly(); Properties = properties; }
private static void GetDisallowedEntries( XmlNode node, int numSections, out IList<IList<int>> disallowed, out IList<IDictionary<int,string>> staticEntries ) { IList<IList<int>> result = new IList<int>[numSections]; IList<IDictionary<int, string>> ourStatic = new IDictionary<int, string>[numSections]; XmlNode disallowedNode = node.SelectSingleNode( "DisallowedEntries" ); if ( disallowedNode != null ) { foreach ( XmlNode node2 in disallowedNode.SelectNodes( "Section" ) ) { int sec = Int32.Parse( node2.Attributes["value"].InnerText ); List<int> ourResult = new List<int>(); Dictionary<int, string> ourDict = new Dictionary<int, string>(); foreach ( XmlNode ent in node2.SelectNodes( "entry" ) ) { int idx = Int32.Parse(ent.InnerText); ourResult.Add( idx); XmlAttribute stat = ent.Attributes["staticValue"]; if ( stat != null ) { ourDict[idx] = stat.InnerText; } else { ourDict[idx] = string.Empty; } } result[sec] = ourResult.AsReadOnly(); ourStatic[sec] = new ReadOnlyDictionary<int, string>( ourDict ); } } for ( int i = 0; i < result.Count; i++ ) { if ( result[i] == null ) { result[i] = new int[0].AsReadOnly(); } if ( ourStatic[i] == null ) { ourStatic[i] = new ReadOnlyDictionary<int, string>( new Dictionary<int, string>( 0 ) ); } } disallowed = result.AsReadOnly(); staticEntries = ourStatic.AsReadOnly(); }
/// <summary> /// Creates an instance from a list of binding ids. /// </summary> /// <param name="bindingIds"> /// Indicates the BIDs that the mobile node wants to associate with the flow identification option. /// One or more BID fields can be included in this sub-option. /// </param> public IpV6FlowIdentificationSubOptionBindingReference(IList<ushort> bindingIds) : this((ReadOnlyCollection<ushort>)bindingIds.AsReadOnly()) { }
private static IList<IList<string>> GetEntryNames( XmlNode sectionsNode, XmlNode templatesNode ) { int sectionCount = Int32.Parse( sectionsNode.Attributes["count"].InnerText ); IList<IList<string>> result = new IList<string>[sectionCount]; for ( int i = 0; i < sectionCount; i++ ) { XmlNode currentNode = sectionsNode.SelectSingleNode( string.Format( "Section[@value='{0}']", i ) ); int currentCount = Int32.Parse( currentNode.Attributes["entries"].InnerText ); XmlNode emptyNode = currentNode.Attributes["empty"]; bool empty = emptyNode != null && Boolean.Parse( emptyNode.InnerText ); if ( empty ) { result[i] = new string[currentCount].AsReadOnly(); } else { string[] currentSection = new string[currentCount]; foreach ( XmlNode entryNode in currentNode.SelectNodes( "entry" ) ) { int index = Int32.Parse( entryNode.Attributes["value"].InnerText ); currentSection[index] = entryNode.Attributes["name"].InnerText; } foreach ( XmlNode includeNode in currentNode.SelectNodes( "include" ) ) { XmlNode included = templatesNode.SelectSingleNode( includeNode.Attributes["name"].InnerText ); int start = Int32.Parse( includeNode.Attributes["start"].InnerText ); int end = Int32.Parse( includeNode.Attributes["end"].InnerText ); int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText ); for ( int j = start; j <= end; j++ ) { currentSection[j + offset] = included.SelectSingleNode( string.Format( "entry[@value='{0}']", j ) ).Attributes["name"].InnerText; } } result[i] = currentSection.AsReadOnly(); } } return result.AsReadOnly(); }
private static FileInfo GetFileInfo(Context context, XmlNode node) { string displayName = node.SelectSingleNode("DisplayName").InnerText; Guid guid = new Guid(node.SelectSingleNode("Guid").InnerText); int size = Int32.Parse(node.SelectSingleNode("Size").InnerText); FileType filetype = (FileType)Enum.Parse(typeof(FileType), node.Name); int sectionCount = Int32.Parse(node.SelectSingleNode("Sections/@count").InnerText); int[] sectionLengths = new int[sectionCount]; bool[] dteAllowed = new bool[sectionCount]; bool[] compressionAllowed = new bool[sectionCount]; for (int i = 0; i < sectionCount; i++) { XmlNode sectionNode = node.SelectSingleNode(string.Format("Sections/Section[@value='{0}']", i)); sectionLengths[i] = Int32.Parse(sectionNode.Attributes["entries"].InnerText); dteAllowed[i] = Boolean.Parse(sectionNode.Attributes["dte"].InnerText); if (filetype == FileType.CompressedFile) { compressionAllowed[i] = Boolean.Parse(sectionNode.Attributes["compressible"].InnerText); } } XmlNodeList sectors = node.SelectNodes("Sectors/*"); Dictionary <SectorType, IList <KeyValuePair <Enum, int> > > dict = new Dictionary <SectorType, IList <KeyValuePair <Enum, int> > >(3); bool first = true; IList <byte> bytes = null; KeyValuePair <Enum, int> primaryFile = new KeyValuePair <Enum, int>(); foreach (XmlNode sectorNode in sectors) { SectorType sectorType = (SectorType)Enum.Parse(typeof(SectorType), sectorNode.Name); if (!dict.ContainsKey(sectorType)) { dict.Add(sectorType, new List <KeyValuePair <Enum, int> >()); } int offset = Int32.Parse(sectorNode.Attributes["offset"].InnerText); Enum fileEnum = null; switch (sectorType) { case SectorType.BootBin: dict[sectorType].Add(new KeyValuePair <Enum, int>(PatcherLib.Iso.PspIso.Sectors.PSP_GAME_SYSDIR_BOOT_BIN, offset)); dict[sectorType].Add(new KeyValuePair <Enum, int>(PatcherLib.Iso.PspIso.Sectors.PSP_GAME_SYSDIR_EBOOT_BIN, offset)); fileEnum = PatcherLib.Iso.PspIso.Sectors.PSP_GAME_SYSDIR_BOOT_BIN; break; case SectorType.FFTPack: FFTPack.Files fftPackFile = (FFTPack.Files)Enum.Parse(typeof(FFTPack.Files), sectorNode.SelectSingleNode("@index").InnerText); dict[sectorType].Add(new KeyValuePair <Enum, int>(fftPackFile, offset)); fileEnum = fftPackFile; break; case SectorType.Sector: PatcherLib.Iso.PsxIso.Sectors file = (PatcherLib.Iso.PsxIso.Sectors)Enum.Parse(typeof(PatcherLib.Iso.PsxIso.Sectors), sectorNode.SelectSingleNode("@filename").InnerText); dict[sectorType].Add(new KeyValuePair <Enum, int>(file, offset)); fileEnum = file; break; } if (first) { //bytes = reader( iso, fileEnum, offset, size ); primaryFile = new KeyValuePair <Enum, int>(fileEnum, offset); first = false; } } IList <IList <string> > entryNames = GetEntryNames(node.SelectSingleNode("Sections"), node.SelectSingleNode("//Templates")); IList <string> sectionNames = GetSectionNames(node.SelectSingleNode("Sections")); IList <IList <int> > disallowedEntries; IList <IDictionary <int, string> > staticEntries; GetDisallowedEntries(node, sectionLengths.Length, out disallowedEntries, out staticEntries); FileInfo fi = new FileInfo { Context = context, DisplayName = displayName, DisallowedEntries = disallowedEntries.AsReadOnly(), StaticEntries = staticEntries.AsReadOnly(), EntryNames = entryNames.AsReadOnly(), FileType = filetype, Guid = guid, SectionLengths = sectionLengths.AsReadOnly(), Sectors = new ReadOnlyDictionary <SectorType, IList <KeyValuePair <Enum, int> > >(dict), SectionNames = sectionNames, Size = size, PrimaryFile = primaryFile, CompressionAllowed = compressionAllowed, DteAllowed = dteAllowed }; return(fi); }
private static IList <IList <string> > GetEntryNames(XmlNode sectionsNode, XmlNode templatesNode) { int sectionCount = Int32.Parse(sectionsNode.Attributes["count"].InnerText); IList <IList <string> > result = new IList <string> [sectionCount]; for (int i = 0; i < sectionCount; i++) { XmlNode currentNode = sectionsNode.SelectSingleNode(string.Format("Section[@value='{0}']", i)); int currentCount = Int32.Parse(currentNode.Attributes["entries"].InnerText); XmlNode emptyNode = currentNode.Attributes["empty"]; bool empty = emptyNode != null && Boolean.Parse(emptyNode.InnerText); if (empty) { result[i] = new string[currentCount].AsReadOnly(); } else { string[] currentSection = new string[currentCount]; foreach (XmlNode entryNode in currentNode.SelectNodes("entry")) { int index = Int32.Parse(entryNode.Attributes["value"].InnerText); currentSection[index] = entryNode.Attributes["name"].InnerText; } foreach (XmlNode includeNode in currentNode.SelectNodes("includeResource")) { int start = Int32.Parse(includeNode.Attributes["start"].InnerText); int end = Int32.Parse(includeNode.Attributes["end"].InnerText); int offset = Int32.Parse(includeNode.Attributes["offset"].InnerText); string fullName = includeNode.Attributes["name"].InnerText; XmlAttribute formatNode = includeNode.Attributes["format"]; string format = formatNode != null?formatNode.InnerText.Replace("\\n", Environment.NewLine) : "{0}"; if (!cachedResources.ContainsKey(fullName)) { cachedResources[fullName] = PatcherLib.ResourcesClass.GetResourceByName(fullName); } IList <string> resourceList = cachedResources[fullName]; for (int j = start; j <= end; j++) { if (string.IsNullOrEmpty(resourceList[j])) { currentSection[j + offset] = string.Empty; } else { currentSection[j + offset] = string.Format(format, resourceList[j]); } } } foreach (XmlNode includeNode in currentNode.SelectNodes("include")) { XmlNode included = templatesNode.SelectSingleNode(includeNode.Attributes["name"].InnerText); int start = Int32.Parse(includeNode.Attributes["start"].InnerText); int end = Int32.Parse(includeNode.Attributes["end"].InnerText); int offset = Int32.Parse(includeNode.Attributes["offset"].InnerText); for (int j = start; j <= end; j++) { currentSection[j + offset] = included.SelectSingleNode(string.Format("entry[@value='{0}']", j)).Attributes["name"].InnerText; } } result[i] = currentSection.AsReadOnly(); } } return(result.AsReadOnly()); }
public DbExpressionSet(IList<Expression> expressions) : base(DbExpressionType.Block, expressions[expressions.Count - 1].Type) { _expressions = expressions.AsReadOnly(); }
/// <summary> /// Creates an instance from next header, checksum, home agent addresses and options. /// </summary> /// <param name="nextHeader">Identifies the type of header immediately following this extension header.</param> /// <param name="checksum"> /// Contains the checksum of the Mobility Header. /// The checksum is calculated from the octet string consisting of a "pseudo-header" /// followed by the entire Mobility Header starting with the Payload Proto field. /// The checksum is the 16-bit one's complement of the one's complement sum of this string. /// </param> /// <param name="homeAgentAddresses">A list of alternate home agent addresses for the mobile node.</param> /// <param name="options">Zero or more TLV-encoded mobility options.</param> public IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage(IpV4Protocol? nextHeader, ushort checksum, IList<IpV6Address> homeAgentAddresses, IpV6MobilityOptions options) : this(nextHeader, checksum, (ReadOnlyCollection<IpV6Address>)homeAgentAddresses.AsReadOnly(), options) { }
/// <summary> /// Constructs options from the given list of options. /// The given otpions list should be modified after the call to this constructor. /// </summary> public DnsOptions(IList <DnsOption> options) { Options = options.AsReadOnly(); BytesLength = options.Sum(option => option.Length); }
private Lang(IList <LangRule> rules, Languages languages) { this.rules = rules.AsReadOnly(); this.languages = languages; }