/// <summary> /// Initializes a new instance of the XmlPath. /// </summary> internal XmlPath(OpenXmlElement element) { if (element == null) { throw new ArgumentNullException(nameof(element)); } PartUri = element.GetPartUri(); XPath = TryBuildXPath(GetElements(element), out var namespaces); #pragma warning disable CS0618 // Type or member is obsolete if (namespaces == null) { Namespaces = ReadOnlyWrapper.Instance; NamespacesDefinitions = Cached.Array <string>(); } else { NamespacesDefinitions = namespaces .GetNamespacesInScope(XmlNamespaceScope.Local) .Select(ns => $"xmlns:{ns.Key}=\"{ns.Value}\"") .ToArray(); Namespaces = new ReadOnlyWrapper(namespaces); } #pragma warning restore CS0618 // Type or member is obsolete }
public Atlas(GraphicsDevice device, DirectoryInfo atlasRoot, DirectoryInfo atlasCache) { _graphicsDevice = device; _atlasRoot = atlasRoot; _atlasCacheDirectory = atlasCache; _jsonSerializer = new JsonSerializer { Converters = { new CustomComparerDictionaryCreationConverter <string>(StringComparer.Ordinal) } }; _regions = new Dictionary <string, Region>(StringComparer.Ordinal); Regions = new ReadOnlyWrapper(this); }
protected virtual void Dispose(bool disposing) { if (!_disposed) { UnloadInternal(disposing); _regions.Clear(); Regions = null; _jsonSerializer = null; _atlasRoot = null; _atlasCacheDirectory = null; _graphicsDevice = null; _textures = null; _regions = null; _disposed = true; } }
private void SetReadOnly() { if (null != _originalSelectedObjects) { _selectionChangedInternally = true; if (_readOnly) { object[] wrappedSelectedObjects = new object[SelectedObjects.Length]; for (int i = 0; i < wrappedSelectedObjects.Length; i++) { wrappedSelectedObjects[i] = new ReadOnlyWrapper(SelectedObjects[i]); } SelectedObjects = wrappedSelectedObjects; } else { SelectedObjects = _originalSelectedObjects.ToArray(); } _selectionChangedInternally = false; } }
public static ReadOnlyWrapper <IParser <TChar, TSource>, WithPositionT> Where <TChar, TSource>(this ReadOnlyWrapper <IParser <TChar, TSource>, WithPositionT> source, Func <(TSource Result, int Position), bool> predicate)