Decompiled source of Mod the Gungeon API v1.9.1
monomod/UnityEngine.CoreModule.MTGAPIPatcher.mm.dll
Decompiled 2 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using MonoMod; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MTGAPIPatcher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MTGAPIPatcher")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d59c59db-e716-4050-860e-762f0a0d8524")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] namespace MTGAPIPatcher; [MonoModPatch("UnityEngine.Object")] internal class patch_Object : Object { public static T Instantiate<T>(T original) where T : Object { return (T)(object)Instantiate((Object)(object)original); } public static Object Instantiate(Object original) { return orig_Instantiate(original); } public static extern Object orig_Instantiate(Object original); }
plugins/MtGAPI/Ionic.Zip.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Ionic.BZip2; using Ionic.Crc; using Ionic.Zip; using Ionic.Zlib; using Microsoft.CSharp; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Guid("dfd2b1f6-e3be-43d1-9b43-11aae1e901d8")] [assembly: CLSCompliant(true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: ComVisible(true)] [assembly: AssemblyCopyright("Copyright © Dino Chiesa 2006 - 2011")] [assembly: AssemblyDescription("a library for handling zip archives. http://www.codeplex.com/DotNetZip (Flavor=Retail)")] [assembly: AssemblyCompany("Dino Chiesa")] [assembly: AssemblyProduct("DotNetZip Library")] [assembly: AssemblyTrademark("")] [assembly: AssemblyFileVersion("1.9.1.8")] [assembly: AllowPartiallyTrustedCallers] [assembly: AssemblyTitle("Ionic's Zip Library")] [assembly: AssemblyConfiguration("Retail")] [assembly: AssemblyVersion("1.9.1.8")] namespace Ionic.Zip { public enum ZipEntrySource { None, FileSystem, Stream, ZipFile, WriteDelegate, JitStream, ZipOutputStream } public class ZipOutputStream : Stream { private EncryptionAlgorithm _encryption; private ZipEntryTimestamp _timestamp; internal string _password; private string _comment; private Stream _outputStream; private ZipEntry _currentEntry; internal Zip64Option _zip64; private Dictionary<string, ZipEntry> _entriesWritten; private int _entryCount; private ZipOption _alternateEncodingUsage; private Encoding _alternateEncoding = Encoding.GetEncoding("IBM437"); private bool _leaveUnderlyingStreamOpen; private bool _disposed; private bool _exceptionPending; private bool _anyEntriesUsedZip64; private bool _directoryNeededZip64; private CountingStream _outputCounter; private Stream _encryptor; private Stream _deflater; private CrcCalculatorStream _entryOutputStream; private bool _needToWriteEntryHeader; private string _name; private bool _DontIgnoreCase; internal ParallelDeflateOutputStream ParallelDeflater; private long _ParallelDeflateThreshold; private int _maxBufferPairs = 16; public string Password { set { if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } _password = value; if (_password == null) { _encryption = EncryptionAlgorithm.None; } else if (_encryption == EncryptionAlgorithm.None) { _encryption = EncryptionAlgorithm.PkzipWeak; } } } public EncryptionAlgorithm Encryption { get { return _encryption; } set { if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } if (value == EncryptionAlgorithm.Unsupported) { _exceptionPending = true; throw new InvalidOperationException("You may not set Encryption to that value."); } _encryption = value; } } public int CodecBufferSize { get; set; } public CompressionStrategy Strategy { get; set; } public ZipEntryTimestamp Timestamp { get { return _timestamp; } set { if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } _timestamp = value; } } public CompressionLevel CompressionLevel { get; set; } public CompressionMethod CompressionMethod { get; set; } public string Comment { get { return _comment; } set { if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } _comment = value; } } public Zip64Option EnableZip64 { get { return _zip64; } set { if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } _zip64 = value; } } public bool OutputUsedZip64 { get { if (!_anyEntriesUsedZip64) { return _directoryNeededZip64; } return true; } } public bool IgnoreCase { get { return !_DontIgnoreCase; } set { _DontIgnoreCase = !value; } } [Obsolete("Beginning with v1.9.1.6 of DotNetZip, this property is obsolete. It will be removed in a future version of the library. Use AlternateEncoding and AlternateEncodingUsage instead.")] public bool UseUnicodeAsNecessary { get { if (_alternateEncoding == Encoding.UTF8) { return AlternateEncodingUsage == ZipOption.AsNecessary; } return false; } set { if (value) { _alternateEncoding = Encoding.UTF8; _alternateEncodingUsage = ZipOption.AsNecessary; } else { _alternateEncoding = DefaultEncoding; _alternateEncodingUsage = ZipOption.Default; } } } [Obsolete("use AlternateEncoding and AlternateEncodingUsage instead.")] public Encoding ProvisionalAlternateEncoding { get { if (_alternateEncodingUsage == ZipOption.AsNecessary) { return _alternateEncoding; } return null; } set { _alternateEncoding = value; _alternateEncodingUsage = ZipOption.AsNecessary; } } public Encoding AlternateEncoding { get { return _alternateEncoding; } set { _alternateEncoding = value; } } public ZipOption AlternateEncodingUsage { get { return _alternateEncodingUsage; } set { _alternateEncodingUsage = value; } } public static Encoding DefaultEncoding => Encoding.GetEncoding("IBM437"); public long ParallelDeflateThreshold { get { return _ParallelDeflateThreshold; } set { if (value != 0 && value != -1 && value < 65536) { throw new ArgumentOutOfRangeException("value must be greater than 64k, or 0, or -1"); } _ParallelDeflateThreshold = value; } } public int ParallelDeflateMaxBufferPairs { get { return _maxBufferPairs; } set { if (value < 4) { throw new ArgumentOutOfRangeException("ParallelDeflateMaxBufferPairs", "Value must be 4 or greater."); } _maxBufferPairs = value; } } internal Stream OutputStream => _outputStream; internal string Name => _name; public override bool CanRead => false; public override bool CanSeek => false; public override bool CanWrite => true; public override long Length { get { throw new NotSupportedException(); } } public override long Position { get { return _outputStream.Position; } set { throw new NotSupportedException(); } } public ZipOutputStream(Stream stream) : this(stream, leaveOpen: false) { } public ZipOutputStream(string fileName) { Stream stream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None); _Init(stream, leaveOpen: false, fileName); } public ZipOutputStream(Stream stream, bool leaveOpen) { _Init(stream, leaveOpen, null); } private void _Init(Stream stream, bool leaveOpen, string name) { _outputStream = (stream.CanRead ? stream : new CountingStream(stream)); CompressionLevel = CompressionLevel.Default; CompressionMethod = CompressionMethod.Deflate; _encryption = EncryptionAlgorithm.None; _entriesWritten = new Dictionary<string, ZipEntry>(StringComparer.Ordinal); _zip64 = Zip64Option.Default; _leaveUnderlyingStreamOpen = leaveOpen; Strategy = CompressionStrategy.Default; _name = name ?? "(stream)"; ParallelDeflateThreshold = -1L; } public override string ToString() { return $"ZipOutputStream::{_name}(leaveOpen({_leaveUnderlyingStreamOpen})))"; } private void InsureUniqueEntry(ZipEntry ze1) { if (_entriesWritten.ContainsKey(ze1.FileName)) { _exceptionPending = true; throw new ArgumentException($"The entry '{ze1.FileName}' already exists in the zip archive."); } } public bool ContainsEntry(string name) { return _entriesWritten.ContainsKey(SharedUtilities.NormalizePathForUseInZipFile(name)); } public override void Write(byte[] buffer, int offset, int count) { if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } if (buffer == null) { _exceptionPending = true; throw new ArgumentNullException("buffer"); } if (_currentEntry == null) { _exceptionPending = true; throw new InvalidOperationException("You must call PutNextEntry() before calling Write()."); } if (_currentEntry.IsDirectory) { _exceptionPending = true; throw new InvalidOperationException("You cannot Write() data for an entry that is a directory."); } if (_needToWriteEntryHeader) { _InitiateCurrentEntry(finishing: false); } if (count != 0) { _entryOutputStream.Write(buffer, offset, count); } } public ZipEntry PutNextEntry(string entryName) { if (string.IsNullOrEmpty(entryName)) { throw new ArgumentNullException("entryName"); } if (_disposed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } _FinishCurrentEntry(); _currentEntry = ZipEntry.CreateForZipOutputStream(entryName); _currentEntry._container = new ZipContainer(this); _currentEntry._BitField |= 8; _currentEntry.SetEntryTimes(DateTime.Now, DateTime.Now, DateTime.Now); _currentEntry.CompressionLevel = CompressionLevel; _currentEntry.CompressionMethod = CompressionMethod; _currentEntry.Password = _password; _currentEntry.Encryption = Encryption; _currentEntry.AlternateEncoding = AlternateEncoding; _currentEntry.AlternateEncodingUsage = AlternateEncodingUsage; if (entryName.EndsWith("/")) { _currentEntry.MarkAsDirectory(); } _currentEntry.EmitTimesInWindowsFormatWhenSaving = (_timestamp & ZipEntryTimestamp.Windows) != 0; _currentEntry.EmitTimesInUnixFormatWhenSaving = (_timestamp & ZipEntryTimestamp.Unix) != 0; InsureUniqueEntry(_currentEntry); _needToWriteEntryHeader = true; return _currentEntry; } private void _InitiateCurrentEntry(bool finishing) { _entriesWritten.Add(_currentEntry.FileName, _currentEntry); _entryCount++; if (_entryCount > 65534 && _zip64 == Zip64Option.Default) { _exceptionPending = true; throw new InvalidOperationException("Too many entries. Consider setting ZipOutputStream.EnableZip64."); } _currentEntry.WriteHeader(_outputStream, finishing ? 99 : 0); _currentEntry.StoreRelativeOffset(); if (!_currentEntry.IsDirectory) { _currentEntry.WriteSecurityMetadata(_outputStream); _currentEntry.PrepOutputStream(_outputStream, (!finishing) ? (-1) : 0, out _outputCounter, out _encryptor, out _deflater, out _entryOutputStream); } _needToWriteEntryHeader = false; } private void _FinishCurrentEntry() { if (_currentEntry != null) { if (_needToWriteEntryHeader) { _InitiateCurrentEntry(finishing: true); } _currentEntry.FinishOutputStream(_outputStream, _outputCounter, _encryptor, _deflater, _entryOutputStream); _currentEntry.PostProcessOutput(_outputStream); if (_currentEntry.OutputUsedZip64.HasValue) { _anyEntriesUsedZip64 |= _currentEntry.OutputUsedZip64.Value; } _outputCounter = null; _encryptor = (_deflater = null); _entryOutputStream = null; } } protected override void Dispose(bool disposing) { if (_disposed) { return; } if (disposing && !_exceptionPending) { _FinishCurrentEntry(); _directoryNeededZip64 = ZipOutput.WriteCentralDirectoryStructure(_outputStream, _entriesWritten.Values, 1u, _zip64, Comment, new ZipContainer(this)); Stream stream = null; if (_outputStream is CountingStream countingStream) { stream = countingStream.WrappedStream; countingStream.Dispose(); } else { stream = _outputStream; } if (!_leaveUnderlyingStreamOpen) { stream.Dispose(); } _outputStream = null; } _disposed = true; } public override void Flush() { } public override int Read(byte[] buffer, int offset, int count) { throw new NotSupportedException("Read"); } public override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException("Seek"); } public override void SetLength(long value) { throw new NotSupportedException(); } } internal class ZipContainer { private ZipFile _zf; private ZipOutputStream _zos; private ZipInputStream _zis; public ZipFile ZipFile => _zf; public ZipOutputStream ZipOutputStream => _zos; public string Name { get { if (_zf != null) { return _zf.Name; } if (_zis != null) { throw new NotSupportedException(); } return _zos.Name; } } public string Password { get { if (_zf != null) { return _zf._Password; } if (_zis != null) { return _zis._Password; } return _zos._password; } } public Zip64Option Zip64 { get { if (_zf != null) { return _zf._zip64; } if (_zis != null) { throw new NotSupportedException(); } return _zos._zip64; } } public int BufferSize { get { if (_zf != null) { return _zf.BufferSize; } if (_zis != null) { throw new NotSupportedException(); } return 0; } } public ParallelDeflateOutputStream ParallelDeflater { get { if (_zf != null) { return _zf.ParallelDeflater; } if (_zis != null) { return null; } return _zos.ParallelDeflater; } set { if (_zf != null) { _zf.ParallelDeflater = value; } else if (_zos != null) { _zos.ParallelDeflater = value; } } } public long ParallelDeflateThreshold { get { if (_zf != null) { return _zf.ParallelDeflateThreshold; } return _zos.ParallelDeflateThreshold; } } public int ParallelDeflateMaxBufferPairs { get { if (_zf != null) { return _zf.ParallelDeflateMaxBufferPairs; } return _zos.ParallelDeflateMaxBufferPairs; } } public int CodecBufferSize { get { if (_zf != null) { return _zf.CodecBufferSize; } if (_zis != null) { return _zis.CodecBufferSize; } return _zos.CodecBufferSize; } } public CompressionStrategy Strategy { get { if (_zf != null) { return _zf.Strategy; } return _zos.Strategy; } } public Zip64Option UseZip64WhenSaving { get { if (_zf != null) { return _zf.UseZip64WhenSaving; } return _zos.EnableZip64; } } public Encoding AlternateEncoding { get { if (_zf != null) { return _zf.AlternateEncoding; } if (_zos != null) { return _zos.AlternateEncoding; } return null; } } public Encoding DefaultEncoding { get { if (_zf != null) { return ZipFile.DefaultEncoding; } if (_zos != null) { return ZipOutputStream.DefaultEncoding; } return null; } } public ZipOption AlternateEncodingUsage { get { if (_zf != null) { return _zf.AlternateEncodingUsage; } if (_zos != null) { return _zos.AlternateEncodingUsage; } return ZipOption.Default; } } public Stream ReadStream { get { if (_zf != null) { return _zf.ReadStream; } return _zis.ReadStream; } } public ZipContainer(object o) { _zf = o as ZipFile; _zos = o as ZipOutputStream; _zis = o as ZipInputStream; } } public class ZipInputStream : Stream { private Stream _inputStream; private Encoding _provisionalAlternateEncoding; private ZipEntry _currentEntry; private bool _firstEntry; private bool _needSetup; private ZipContainer _container; private CrcCalculatorStream _crcStream; private long _LeftToRead; internal string _Password; private long _endOfEntry; private string _name; private bool _leaveUnderlyingStreamOpen; private bool _closed; private bool _findRequired; private bool _exceptionPending; public Encoding ProvisionalAlternateEncoding { get { return _provisionalAlternateEncoding; } set { _provisionalAlternateEncoding = value; } } public int CodecBufferSize { get; set; } public string Password { set { if (_closed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } _Password = value; } } internal Stream ReadStream => _inputStream; public override bool CanRead => true; public override bool CanSeek => _inputStream.CanSeek; public override bool CanWrite => false; public override long Length => _inputStream.Length; public override long Position { get { return _inputStream.Position; } set { Seek(value, SeekOrigin.Begin); } } public ZipInputStream(Stream stream) : this(stream, leaveOpen: false) { } public ZipInputStream(string fileName) { Stream stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); _Init(stream, leaveOpen: false, fileName); } public ZipInputStream(Stream stream, bool leaveOpen) { _Init(stream, leaveOpen, null); } private void _Init(Stream stream, bool leaveOpen, string name) { _inputStream = stream; if (!_inputStream.CanRead) { throw new ZipException("The stream must be readable."); } _container = new ZipContainer(this); _provisionalAlternateEncoding = Encoding.GetEncoding("IBM437"); _leaveUnderlyingStreamOpen = leaveOpen; _findRequired = true; _name = name ?? "(stream)"; } public override string ToString() { return $"ZipInputStream::{_name}(leaveOpen({_leaveUnderlyingStreamOpen})))"; } private void SetupStream() { _crcStream = _currentEntry.InternalOpenReader(_Password); _LeftToRead = _crcStream.Length; _needSetup = false; } public override int Read(byte[] buffer, int offset, int count) { if (_closed) { _exceptionPending = true; throw new InvalidOperationException("The stream has been closed."); } if (_needSetup) { SetupStream(); } if (_LeftToRead == 0) { return 0; } int count2 = (int)((_LeftToRead > count) ? count : _LeftToRead); int num = _crcStream.Read(buffer, offset, count2); _LeftToRead -= num; if (_LeftToRead == 0) { int crc = _crcStream.Crc; _currentEntry.VerifyCrcAfterExtract(crc); _inputStream.Seek(_endOfEntry, SeekOrigin.Begin); } return num; } public ZipEntry GetNextEntry() { if (_findRequired) { long num = SharedUtilities.FindSignature(_inputStream, 67324752); if (num == -1) { return null; } _inputStream.Seek(-4L, SeekOrigin.Current); } else if (_firstEntry) { _inputStream.Seek(_endOfEntry, SeekOrigin.Begin); } _currentEntry = ZipEntry.ReadEntry(_container, !_firstEntry); _endOfEntry = _inputStream.Position; _firstEntry = true; _needSetup = true; _findRequired = false; return _currentEntry; } protected override void Dispose(bool disposing) { if (_closed) { return; } if (disposing) { if (_exceptionPending) { return; } if (!_leaveUnderlyingStreamOpen) { _inputStream.Dispose(); } } _closed = true; } public override void Flush() { throw new NotSupportedException("Flush"); } public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException("Write"); } public override long Seek(long offset, SeekOrigin origin) { _findRequired = true; return _inputStream.Seek(offset, origin); } public override void SetLength(long value) { throw new NotSupportedException(); } } internal class ZipSegmentedStream : Stream { private enum RwMode { None, ReadOnly, Write } private RwMode rwMode; private bool _exceptionPending; private string _baseName; private string _baseDir; private string _currentName; private string _currentTempName; private uint _currentDiskNumber; private uint _maxDiskNumber; private int _maxSegmentSize; private Stream _innerStream; public bool ContiguousWrite { get; set; } public uint CurrentSegment { get { return _currentDiskNumber; } private set { _currentDiskNumber = value; _currentName = null; } } public string CurrentName { get { if (_currentName == null) { _currentName = _NameForSegment(CurrentSegment); } return _currentName; } } public string CurrentTempName => _currentTempName; public override bool CanRead { get { if (rwMode == RwMode.ReadOnly && _innerStream != null) { return _innerStream.CanRead; } return false; } } public override bool CanSeek { get { if (_innerStream != null) { return _innerStream.CanSeek; } return false; } } public override bool CanWrite { get { if (rwMode == RwMode.Write && _innerStream != null) { return _innerStream.CanWrite; } return false; } } public override long Length => _innerStream.Length; public override long Position { get { return _innerStream.Position; } set { _innerStream.Position = value; } } private ZipSegmentedStream() { _exceptionPending = false; } public static ZipSegmentedStream ForReading(string name, uint initialDiskNumber, uint maxDiskNumber) { ZipSegmentedStream zipSegmentedStream = new ZipSegmentedStream(); zipSegmentedStream.rwMode = RwMode.ReadOnly; zipSegmentedStream.CurrentSegment = initialDiskNumber; zipSegmentedStream._maxDiskNumber = maxDiskNumber; zipSegmentedStream._baseName = name; ZipSegmentedStream zipSegmentedStream2 = zipSegmentedStream; zipSegmentedStream2._SetReadStream(); return zipSegmentedStream2; } public static ZipSegmentedStream ForWriting(string name, int maxSegmentSize) { ZipSegmentedStream zipSegmentedStream = new ZipSegmentedStream(); zipSegmentedStream.rwMode = RwMode.Write; zipSegmentedStream.CurrentSegment = 0u; zipSegmentedStream._baseName = name; zipSegmentedStream._maxSegmentSize = maxSegmentSize; zipSegmentedStream._baseDir = Path.GetDirectoryName(name); ZipSegmentedStream zipSegmentedStream2 = zipSegmentedStream; if (zipSegmentedStream2._baseDir == "") { zipSegmentedStream2._baseDir = "."; } zipSegmentedStream2._SetWriteStream(0u); return zipSegmentedStream2; } public static Stream ForUpdate(string name, uint diskNumber) { if (diskNumber >= 99) { throw new ArgumentOutOfRangeException("diskNumber"); } string path = $"{Path.Combine(Path.GetDirectoryName(name), Path.GetFileNameWithoutExtension(name))}.z{diskNumber + 1:D2}"; return File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None); } private string _NameForSegment(uint diskNumber) { if (diskNumber >= 99) { _exceptionPending = true; throw new OverflowException("The number of zip segments would exceed 99."); } return $"{Path.Combine(Path.GetDirectoryName(_baseName), Path.GetFileNameWithoutExtension(_baseName))}.z{diskNumber + 1:D2}"; } public uint ComputeSegment(int length) { if (_innerStream.Position + length > _maxSegmentSize) { return CurrentSegment + 1; } return CurrentSegment; } public override string ToString() { return string.Format("{0}[{1}][{2}], pos=0x{3:X})", "ZipSegmentedStream", CurrentName, rwMode.ToString(), Position); } private void _SetReadStream() { if (_innerStream != null) { _innerStream.Dispose(); } if (CurrentSegment + 1 == _maxDiskNumber) { _currentName = _baseName; } _innerStream = File.OpenRead(CurrentName); } public override int Read(byte[] buffer, int offset, int count) { if (rwMode != RwMode.ReadOnly) { _exceptionPending = true; throw new InvalidOperationException("Stream Error: Cannot Read."); } int num = _innerStream.Read(buffer, offset, count); int num2 = num; while (num2 != count) { if (_innerStream.Position != _innerStream.Length) { _exceptionPending = true; throw new ZipException($"Read error in file {CurrentName}"); } if (CurrentSegment + 1 == _maxDiskNumber) { return num; } CurrentSegment++; _SetReadStream(); offset += num2; count -= num2; num2 = _innerStream.Read(buffer, offset, count); num += num2; } return num; } private void _SetWriteStream(uint increment) { if (_innerStream != null) { _innerStream.Dispose(); if (File.Exists(CurrentName)) { File.Delete(CurrentName); } File.Move(_currentTempName, CurrentName); } if (increment != 0) { CurrentSegment += increment; } SharedUtilities.CreateAndOpenUniqueTempFile(_baseDir, out _innerStream, out _currentTempName); if (CurrentSegment == 0) { _innerStream.Write(BitConverter.GetBytes(134695760), 0, 4); } } public override void Write(byte[] buffer, int offset, int count) { if (rwMode != RwMode.Write) { _exceptionPending = true; throw new InvalidOperationException("Stream Error: Cannot Write."); } if (ContiguousWrite) { if (_innerStream.Position + count > _maxSegmentSize) { _SetWriteStream(1u); } } else { while (_innerStream.Position + count > _maxSegmentSize) { int num = _maxSegmentSize - (int)_innerStream.Position; _innerStream.Write(buffer, offset, num); _SetWriteStream(1u); count -= num; offset += num; } } _innerStream.Write(buffer, offset, count); } public long TruncateBackward(uint diskNumber, long offset) { if (diskNumber >= 99) { throw new ArgumentOutOfRangeException("diskNumber"); } if (rwMode != RwMode.Write) { _exceptionPending = true; throw new ZipException("bad state."); } if (diskNumber == CurrentSegment) { return _innerStream.Seek(offset, SeekOrigin.Begin); } if (_innerStream != null) { _innerStream.Dispose(); if (File.Exists(_currentTempName)) { File.Delete(_currentTempName); } } for (uint num = CurrentSegment - 1; num > diskNumber; num--) { string path = _NameForSegment(num); if (File.Exists(path)) { File.Delete(path); } } CurrentSegment = diskNumber; for (int i = 0; i < 3; i++) { try { _currentTempName = SharedUtilities.InternalGetTempFileName(); File.Move(CurrentName, _currentTempName); } catch (IOException) { if (i == 2) { throw; } continue; } break; } _innerStream = new FileStream(_currentTempName, FileMode.Open); return _innerStream.Seek(offset, SeekOrigin.Begin); } public override void Flush() { _innerStream.Flush(); } public override long Seek(long offset, SeekOrigin origin) { return _innerStream.Seek(offset, origin); } public override void SetLength(long value) { if (rwMode != RwMode.Write) { _exceptionPending = true; throw new InvalidOperationException(); } _innerStream.SetLength(value); } protected override void Dispose(bool disposing) { try { if (_innerStream != null) { _innerStream.Dispose(); if (rwMode == RwMode.Write) { _ = _exceptionPending; } } } finally { base.Dispose(disposing); } } } [ComVisible(true)] [Guid("ebc25cf6-9120-4283-b972-0e5520d0000F")] [ClassInterface(ClassInterfaceType.AutoDispatch)] public class ComHelper { public bool IsZipFile(string filename) { return ZipFile.IsZipFile(filename); } public bool IsZipFileWithExtract(string filename) { return ZipFile.IsZipFile(filename, testExtract: true); } public bool CheckZip(string filename) { return ZipFile.CheckZip(filename); } public bool CheckZipPassword(string filename, string password) { return ZipFile.CheckZipPassword(filename, password); } public void FixZipDirectory(string filename) { ZipFile.FixZipDirectory(filename); } public string GetZipLibraryVersion() { return ZipFile.LibraryVersion.ToString(); } } internal class OffsetStream : Stream, IDisposable { private long _originalPosition; private Stream _innerStream; public override bool CanRead => _innerStream.CanRead; public override bool CanSeek => _innerStream.CanSeek; public override bool CanWrite => false; public override long Length => _innerStream.Length; public override long Position { get { return _innerStream.Position - _originalPosition; } set { _innerStream.Position = _originalPosition + value; } } public OffsetStream(Stream s) { _originalPosition = s.Position; _innerStream = s; } public override int Read(byte[] buffer, int offset, int count) { return _innerStream.Read(buffer, offset, count); } public override void Write(byte[] buffer, int offset, int count) { throw new NotImplementedException(); } public override void Flush() { _innerStream.Flush(); } public override long Seek(long offset, SeekOrigin origin) { return _innerStream.Seek(_originalPosition + offset, origin) - _originalPosition; } public override void SetLength(long value) { throw new NotImplementedException(); } void IDisposable.Dispose() { Close(); } public override void Close() { base.Close(); } } public enum ZipErrorAction { Throw, Skip, Retry, InvokeErrorEvent } public enum EncryptionAlgorithm { None, PkzipWeak, WinZipAes128, WinZipAes256, Unsupported } public enum ExtractExistingFileAction { Throw, OverwriteSilently, DoNotOverwrite, InvokeExtractProgressEvent } } namespace Ionic { internal enum LogicalConjunction { NONE, AND, OR, XOR } internal enum WhichTime { atime, mtime, ctime } internal enum ComparisonOperator { [Description(">")] GreaterThan, [Description(">=")] GreaterThanOrEqualTo, [Description("<")] LesserThan, [Description("<=")] LesserThanOrEqualTo, [Description("=")] EqualTo, [Description("!=")] NotEqualTo } internal abstract class SelectionCriterion { internal virtual bool Verbose { get; set; } internal abstract bool Evaluate(string filename); [Conditional("SelectorTrace")] protected static void CriterionTrace(string format, params object[] args) { } internal abstract bool Evaluate(ZipEntry entry); } internal class SizeCriterion : SelectionCriterion { internal ComparisonOperator Operator; internal long Size; public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("size ").Append(EnumUtil.GetDescription(Operator)).Append(" ") .Append(Size.ToString()); return stringBuilder.ToString(); } internal override bool Evaluate(string filename) { FileInfo fileInfo = new FileInfo(filename); return _Evaluate(fileInfo.Length); } private bool _Evaluate(long Length) { bool flag = false; return Operator switch { ComparisonOperator.GreaterThanOrEqualTo => Length >= Size, ComparisonOperator.GreaterThan => Length > Size, ComparisonOperator.LesserThanOrEqualTo => Length <= Size, ComparisonOperator.LesserThan => Length < Size, ComparisonOperator.EqualTo => Length == Size, ComparisonOperator.NotEqualTo => Length != Size, _ => throw new ArgumentException("Operator"), }; } internal override bool Evaluate(ZipEntry entry) { return _Evaluate(entry.UncompressedSize); } } internal class TimeCriterion : SelectionCriterion { internal ComparisonOperator Operator; internal WhichTime Which; internal DateTime Time; public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(Which.ToString()).Append(" ").Append(EnumUtil.GetDescription(Operator)) .Append(" ") .Append(Time.ToString("yyyy-MM-dd-HH:mm:ss")); return stringBuilder.ToString(); } internal override bool Evaluate(string filename) { return _Evaluate(Which switch { WhichTime.atime => File.GetLastAccessTime(filename).ToUniversalTime(), WhichTime.mtime => File.GetLastWriteTime(filename).ToUniversalTime(), WhichTime.ctime => File.GetCreationTime(filename).ToUniversalTime(), _ => throw new ArgumentException("Operator"), }); } private bool _Evaluate(DateTime x) { bool flag = false; return Operator switch { ComparisonOperator.GreaterThanOrEqualTo => x >= Time, ComparisonOperator.GreaterThan => x > Time, ComparisonOperator.LesserThanOrEqualTo => x <= Time, ComparisonOperator.LesserThan => x < Time, ComparisonOperator.EqualTo => x == Time, ComparisonOperator.NotEqualTo => x != Time, _ => throw new ArgumentException("Operator"), }; } internal override bool Evaluate(ZipEntry entry) { return _Evaluate(Which switch { WhichTime.atime => entry.AccessedTime, WhichTime.mtime => entry.ModifiedTime, WhichTime.ctime => entry.CreationTime, _ => throw new ArgumentException("??time"), }); } } internal class NameCriterion : SelectionCriterion { private Regex _re; private string _regexString; internal ComparisonOperator Operator; private string _MatchingFileSpec; internal virtual string MatchingFileSpec { set { if (Directory.Exists(value)) { _MatchingFileSpec = ".\\" + value + "\\*.*"; } else { _MatchingFileSpec = value; } _regexString = "^" + Regex.Escape(_MatchingFileSpec).Replace("\\\\\\*\\.\\*", "\\\\([^\\.]+|.*\\.[^\\\\\\.]*)").Replace("\\.\\*", "\\.[^\\\\\\.]*") .Replace("\\*", ".*") .Replace("\\?", "[^\\\\\\.]") + "$"; _re = new Regex(_regexString, RegexOptions.IgnoreCase); } } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("name ").Append(EnumUtil.GetDescription(Operator)).Append(" '") .Append(_MatchingFileSpec) .Append("'"); return stringBuilder.ToString(); } internal override bool Evaluate(string filename) { return _Evaluate(filename); } private bool _Evaluate(string fullpath) { string input = ((_MatchingFileSpec.IndexOf('\\') == -1) ? Path.GetFileName(fullpath) : fullpath); bool flag = _re.IsMatch(input); if (Operator != ComparisonOperator.EqualTo) { flag = !flag; } return flag; } internal override bool Evaluate(ZipEntry entry) { string fullpath = entry.FileName.Replace("/", "\\"); return _Evaluate(fullpath); } } internal class TypeCriterion : SelectionCriterion { private char ObjectType; internal ComparisonOperator Operator; internal string AttributeString { get { return ObjectType.ToString(); } set { if (value.Length != 1 || (value[0] != 'D' && value[0] != 'F')) { throw new ArgumentException("Specify a single character: either D or F"); } ObjectType = value[0]; } } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("type ").Append(EnumUtil.GetDescription(Operator)).Append(" ") .Append(AttributeString); return stringBuilder.ToString(); } internal override bool Evaluate(string filename) { bool flag = ((ObjectType == 'D') ? Directory.Exists(filename) : File.Exists(filename)); if (Operator != ComparisonOperator.EqualTo) { flag = !flag; } return flag; } internal override bool Evaluate(ZipEntry entry) { bool flag = ((ObjectType == 'D') ? entry.IsDirectory : (!entry.IsDirectory)); if (Operator != ComparisonOperator.EqualTo) { flag = !flag; } return flag; } } internal class AttributesCriterion : SelectionCriterion { private FileAttributes _Attributes; internal ComparisonOperator Operator; internal string AttributeString { get { string text = ""; if ((_Attributes & FileAttributes.Hidden) != 0) { text += "H"; } if ((_Attributes & FileAttributes.System) != 0) { text += "S"; } if ((_Attributes & FileAttributes.ReadOnly) != 0) { text += "R"; } if ((_Attributes & FileAttributes.Archive) != 0) { text += "A"; } if ((_Attributes & FileAttributes.ReparsePoint) != 0) { text += "L"; } if ((_Attributes & FileAttributes.NotContentIndexed) != 0) { text += "I"; } return text; } set { _Attributes = FileAttributes.Normal; string text = value.ToUpper(); foreach (char c in text) { switch (c) { case 'H': if ((_Attributes & FileAttributes.Hidden) != 0) { throw new ArgumentException($"Repeated flag. ({c})", "value"); } _Attributes |= FileAttributes.Hidden; break; case 'R': if ((_Attributes & FileAttributes.ReadOnly) != 0) { throw new ArgumentException($"Repeated flag. ({c})", "value"); } _Attributes |= FileAttributes.ReadOnly; break; case 'S': if ((_Attributes & FileAttributes.System) != 0) { throw new ArgumentException($"Repeated flag. ({c})", "value"); } _Attributes |= FileAttributes.System; break; case 'A': if ((_Attributes & FileAttributes.Archive) != 0) { throw new ArgumentException($"Repeated flag. ({c})", "value"); } _Attributes |= FileAttributes.Archive; break; case 'I': if ((_Attributes & FileAttributes.NotContentIndexed) != 0) { throw new ArgumentException($"Repeated flag. ({c})", "value"); } _Attributes |= FileAttributes.NotContentIndexed; break; case 'L': if ((_Attributes & FileAttributes.ReparsePoint) != 0) { throw new ArgumentException($"Repeated flag. ({c})", "value"); } _Attributes |= FileAttributes.ReparsePoint; break; default: throw new ArgumentException(value); } } } } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("attributes ").Append(EnumUtil.GetDescription(Operator)).Append(" ") .Append(AttributeString); return stringBuilder.ToString(); } private bool _EvaluateOne(FileAttributes fileAttrs, FileAttributes criterionAttrs) { bool flag = false; if ((_Attributes & criterionAttrs) == criterionAttrs) { return (fileAttrs & criterionAttrs) == criterionAttrs; } return true; } internal override bool Evaluate(string filename) { if (Directory.Exists(filename)) { return Operator != ComparisonOperator.EqualTo; } FileAttributes attributes = File.GetAttributes(filename); return _Evaluate(attributes); } private bool _Evaluate(FileAttributes fileAttrs) { bool flag = _EvaluateOne(fileAttrs, FileAttributes.Hidden); if (flag) { flag = _EvaluateOne(fileAttrs, FileAttributes.System); } if (flag) { flag = _EvaluateOne(fileAttrs, FileAttributes.ReadOnly); } if (flag) { flag = _EvaluateOne(fileAttrs, FileAttributes.Archive); } if (flag) { flag = _EvaluateOne(fileAttrs, FileAttributes.NotContentIndexed); } if (flag) { flag = _EvaluateOne(fileAttrs, FileAttributes.ReparsePoint); } if (Operator != ComparisonOperator.EqualTo) { flag = !flag; } return flag; } internal override bool Evaluate(ZipEntry entry) { FileAttributes attributes = entry.Attributes; return _Evaluate(attributes); } } internal class CompoundCriterion : SelectionCriterion { internal LogicalConjunction Conjunction; internal SelectionCriterion Left; private SelectionCriterion _Right; internal SelectionCriterion Right { get { return _Right; } set { _Right = value; if (value == null) { Conjunction = LogicalConjunction.NONE; } else if (Conjunction == LogicalConjunction.NONE) { Conjunction = LogicalConjunction.AND; } } } internal override bool Evaluate(string filename) { bool flag = Left.Evaluate(filename); switch (Conjunction) { case LogicalConjunction.AND: if (flag) { flag = Right.Evaluate(filename); } break; case LogicalConjunction.OR: if (!flag) { flag = Right.Evaluate(filename); } break; case LogicalConjunction.XOR: flag ^= Right.Evaluate(filename); break; default: throw new ArgumentException("Conjunction"); } return flag; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("(").Append((Left != null) ? Left.ToString() : "null").Append(" ") .Append(Conjunction.ToString()) .Append(" ") .Append((Right != null) ? Right.ToString() : "null") .Append(")"); return stringBuilder.ToString(); } internal override bool Evaluate(ZipEntry entry) { bool flag = Left.Evaluate(entry); switch (Conjunction) { case LogicalConjunction.AND: if (flag) { flag = Right.Evaluate(entry); } break; case LogicalConjunction.OR: if (!flag) { flag = Right.Evaluate(entry); } break; case LogicalConjunction.XOR: flag ^= Right.Evaluate(entry); break; } return flag; } } public class FileSelector { private enum ParseState { Start, OpenParen, CriterionDone, ConjunctionPending, Whitespace } private static class RegexAssertions { public static readonly string PrecededByOddNumberOfSingleQuotes = "(?<=(?:[^']*'[^']*')*'[^']*)"; public static readonly string FollowedByOddNumberOfSingleQuotesAndLineEnd = "(?=[^']*'(?:[^']*'[^']*')*[^']*$)"; public static readonly string PrecededByEvenNumberOfSingleQuotes = "(?<=(?:[^']*'[^']*')*[^']*)"; public static readonly string FollowedByEvenNumberOfSingleQuotesAndLineEnd = "(?=(?:[^']*'[^']*')*[^']*$)"; } internal SelectionCriterion _Criterion; public string SelectionCriteria { get { if (_Criterion == null) { return null; } return _Criterion.ToString(); } set { if (value == null) { _Criterion = null; } else if (value.Trim() == "") { _Criterion = null; } else { _Criterion = _ParseCriterion(value); } } } public bool TraverseReparsePoints { get; set; } public FileSelector(string selectionCriteria) : this(selectionCriteria, traverseDirectoryReparsePoints: true) { } public FileSelector(string selectionCriteria, bool traverseDirectoryReparsePoints) { if (!string.IsNullOrEmpty(selectionCriteria)) { _Criterion = _ParseCriterion(selectionCriteria); } TraverseReparsePoints = traverseDirectoryReparsePoints; } private static string NormalizeCriteriaExpression(string source) { string[][] array = new string[11][] { new string[2] { "([^']*)\\(\\(([^']+)", "$1( ($2" }, new string[2] { "(.)\\)\\)", "$1) )" }, new string[2] { "\\((\\S)", "( $1" }, new string[2] { "(\\S)\\)", "$1 )" }, new string[2] { "^\\)", " )" }, new string[2] { "(\\S)\\(", "$1 (" }, new string[2] { "\\)(\\S)", ") $1" }, new string[2] { "(=)('[^']*')", "$1 $2" }, new string[2] { "([^ !><])(>|<|!=|=)", "$1 $2" }, new string[2] { "(>|<|!=|=)([^ =])", "$1 $2" }, new string[2] { "/", "\\" } }; string input = source; for (int i = 0; i < array.Length; i++) { string pattern = RegexAssertions.PrecededByEvenNumberOfSingleQuotes + array[i][0] + RegexAssertions.FollowedByEvenNumberOfSingleQuotesAndLineEnd; input = Regex.Replace(input, pattern, array[i][1]); } string pattern2 = "/" + RegexAssertions.FollowedByOddNumberOfSingleQuotesAndLineEnd; input = Regex.Replace(input, pattern2, "\\"); pattern2 = " " + RegexAssertions.FollowedByOddNumberOfSingleQuotesAndLineEnd; return Regex.Replace(input, pattern2, "\u0006"); } private static SelectionCriterion _ParseCriterion(string s) { if (s == null) { return null; } s = NormalizeCriteriaExpression(s); if (s.IndexOf(" ") == -1) { s = "name = " + s; } string[] array = s.Trim().Split(' ', '\t'); if (array.Length < 3) { throw new ArgumentException(s); } SelectionCriterion selectionCriterion = null; LogicalConjunction logicalConjunction = LogicalConjunction.NONE; Stack<ParseState> stack = new Stack<ParseState>(); Stack<SelectionCriterion> stack2 = new Stack<SelectionCriterion>(); stack.Push(ParseState.Start); for (int i = 0; i < array.Length; i++) { string text = array[i].ToLower(); ParseState parseState; switch (text) { case "and": case "xor": case "or": { parseState = stack.Peek(); if (parseState != ParseState.CriterionDone) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } if (array.Length <= i + 3) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } logicalConjunction = (LogicalConjunction)Enum.Parse(typeof(LogicalConjunction), array[i].ToUpper(), ignoreCase: true); CompoundCriterion compoundCriterion = new CompoundCriterion(); compoundCriterion.Left = selectionCriterion; compoundCriterion.Right = null; compoundCriterion.Conjunction = logicalConjunction; selectionCriterion = compoundCriterion; stack.Push(parseState); stack.Push(ParseState.ConjunctionPending); stack2.Push(selectionCriterion); break; } case "(": parseState = stack.Peek(); if (parseState != 0 && parseState != ParseState.ConjunctionPending && parseState != ParseState.OpenParen) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } if (array.Length <= i + 4) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } stack.Push(ParseState.OpenParen); break; case ")": parseState = stack.Pop(); if (stack.Peek() != ParseState.OpenParen) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } stack.Pop(); stack.Push(ParseState.CriterionDone); break; case "atime": case "ctime": case "mtime": { if (array.Length <= i + 2) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } DateTime value; try { value = DateTime.ParseExact(array[i + 2], "yyyy-MM-dd-HH:mm:ss", null); } catch (FormatException) { try { value = DateTime.ParseExact(array[i + 2], "yyyy/MM/dd-HH:mm:ss", null); } catch (FormatException) { try { value = DateTime.ParseExact(array[i + 2], "yyyy/MM/dd", null); goto end_IL_035d; } catch (FormatException) { try { value = DateTime.ParseExact(array[i + 2], "MM/dd/yyyy", null); goto end_IL_035d; } catch (FormatException) { value = DateTime.ParseExact(array[i + 2], "yyyy-MM-dd", null); goto end_IL_035d; } } end_IL_035d:; } } value = DateTime.SpecifyKind(value, DateTimeKind.Local).ToUniversalTime(); TimeCriterion timeCriterion = new TimeCriterion(); timeCriterion.Which = (WhichTime)Enum.Parse(typeof(WhichTime), array[i], ignoreCase: true); timeCriterion.Operator = (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), array[i + 1]); timeCriterion.Time = value; selectionCriterion = timeCriterion; i += 2; stack.Push(ParseState.CriterionDone); break; } case "length": case "size": { if (array.Length <= i + 2) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } long num = 0L; string text2 = array[i + 2]; num = (text2.ToUpper().EndsWith("K") ? (long.Parse(text2.Substring(0, text2.Length - 1)) * 1024) : (text2.ToUpper().EndsWith("KB") ? (long.Parse(text2.Substring(0, text2.Length - 2)) * 1024) : (text2.ToUpper().EndsWith("M") ? (long.Parse(text2.Substring(0, text2.Length - 1)) * 1024 * 1024) : (text2.ToUpper().EndsWith("MB") ? (long.Parse(text2.Substring(0, text2.Length - 2)) * 1024 * 1024) : (text2.ToUpper().EndsWith("G") ? (long.Parse(text2.Substring(0, text2.Length - 1)) * 1024 * 1024 * 1024) : ((!text2.ToUpper().EndsWith("GB")) ? long.Parse(array[i + 2]) : (long.Parse(text2.Substring(0, text2.Length - 2)) * 1024 * 1024 * 1024))))))); SizeCriterion sizeCriterion = new SizeCriterion(); sizeCriterion.Size = num; sizeCriterion.Operator = (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), array[i + 1]); selectionCriterion = sizeCriterion; i += 2; stack.Push(ParseState.CriterionDone); break; } case "filename": case "name": { if (array.Length <= i + 2) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } ComparisonOperator comparisonOperator2 = (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), array[i + 1]); if (comparisonOperator2 != ComparisonOperator.NotEqualTo && comparisonOperator2 != ComparisonOperator.EqualTo) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } string text3 = array[i + 2]; if (text3.StartsWith("'") && text3.EndsWith("'")) { text3 = text3.Substring(1, text3.Length - 2).Replace("\u0006", " "); } NameCriterion nameCriterion = new NameCriterion(); nameCriterion.MatchingFileSpec = text3; nameCriterion.Operator = comparisonOperator2; selectionCriterion = nameCriterion; i += 2; stack.Push(ParseState.CriterionDone); break; } case "attrs": case "attributes": case "type": { if (array.Length <= i + 2) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } ComparisonOperator comparisonOperator = (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), array[i + 1]); if (comparisonOperator != ComparisonOperator.NotEqualTo && comparisonOperator != ComparisonOperator.EqualTo) { throw new ArgumentException(string.Join(" ", array, i, array.Length - i)); } object obj; if (!(text == "type")) { AttributesCriterion attributesCriterion = new AttributesCriterion(); attributesCriterion.AttributeString = array[i + 2]; attributesCriterion.Operator = comparisonOperator; obj = attributesCriterion; } else { TypeCriterion typeCriterion = new TypeCriterion(); typeCriterion.AttributeString = array[i + 2]; typeCriterion.Operator = comparisonOperator; obj = typeCriterion; } selectionCriterion = (SelectionCriterion)obj; i += 2; stack.Push(ParseState.CriterionDone); break; } case "": stack.Push(ParseState.Whitespace); break; default: throw new ArgumentException("'" + array[i] + "'"); } parseState = stack.Peek(); if (parseState == ParseState.CriterionDone) { stack.Pop(); if (stack.Peek() == ParseState.ConjunctionPending) { while (stack.Peek() == ParseState.ConjunctionPending) { CompoundCriterion compoundCriterion2 = stack2.Pop() as CompoundCriterion; compoundCriterion2.Right = selectionCriterion; selectionCriterion = compoundCriterion2; stack.Pop(); parseState = stack.Pop(); if (parseState != ParseState.CriterionDone) { throw new ArgumentException("??"); } } } else { stack.Push(ParseState.CriterionDone); } } if (parseState == ParseState.Whitespace) { stack.Pop(); } } return selectionCriterion; } public override string ToString() { return "FileSelector(" + _Criterion.ToString() + ")"; } private bool Evaluate(string filename) { return _Criterion.Evaluate(filename); } [Conditional("SelectorTrace")] private void SelectorTrace(string format, params object[] args) { if (_Criterion != null && _Criterion.Verbose) { Console.WriteLine(format, args); } } public ICollection<string> SelectFiles(string directory) { return SelectFiles(directory, recurseDirectories: false); } public ReadOnlyCollection<string> SelectFiles(string directory, bool recurseDirectories) { if (_Criterion == null) { throw new ArgumentException("SelectionCriteria has not been set"); } List<string> list = new List<string>(); try { if (Directory.Exists(directory)) { string[] files = Directory.GetFiles(directory); string[] array = files; foreach (string text in array) { if (Evaluate(text)) { list.Add(text); } } if (recurseDirectories) { string[] directories = Directory.GetDirectories(directory); string[] array2 = directories; foreach (string text2 in array2) { if (TraverseReparsePoints || (File.GetAttributes(text2) & FileAttributes.ReparsePoint) == 0) { if (Evaluate(text2)) { list.Add(text2); } list.AddRange(SelectFiles(text2, recurseDirectories)); } } } } } catch (UnauthorizedAccessException) { } catch (IOException) { } return list.AsReadOnly(); } private bool Evaluate(ZipEntry entry) { return _Criterion.Evaluate(entry); } public ICollection<ZipEntry> SelectEntries(ZipFile zip) { if (zip == null) { throw new ArgumentNullException("zip"); } List<ZipEntry> list = new List<ZipEntry>(); foreach (ZipEntry item in zip) { if (Evaluate(item)) { list.Add(item); } } return list; } public ICollection<ZipEntry> SelectEntries(ZipFile zip, string directoryPathInArchive) { if (zip == null) { throw new ArgumentNullException("zip"); } List<ZipEntry> list = new List<ZipEntry>(); string text = directoryPathInArchive?.Replace("/", "\\"); if (text != null) { while (text.EndsWith("\\")) { text = text.Substring(0, text.Length - 1); } } foreach (ZipEntry item in zip) { if ((directoryPathInArchive == null || Path.GetDirectoryName(item.FileName) == directoryPathInArchive || Path.GetDirectoryName(item.FileName) == text) && Evaluate(item)) { list.Add(item); } } return list; } } internal sealed class EnumUtil { private EnumUtil() { } internal static string GetDescription(Enum value) { FieldInfo field = value.GetType().GetField(value.ToString()); DescriptionAttribute[] array = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), inherit: false); if (array.Length > 0) { return array[0].Description; } return value.ToString(); } internal static object Parse(Type enumType, string stringRepresentation) { return Parse(enumType, stringRepresentation, ignoreCase: false); } internal static object Parse(Type enumType, string stringRepresentation, bool ignoreCase) { if (ignoreCase) { stringRepresentation = stringRepresentation.ToLower(); } foreach (Enum value in Enum.GetValues(enumType)) { string text = GetDescription(value); if (ignoreCase) { text = text.ToLower(); } if (text == stringRepresentation) { return value; } } return Enum.Parse(enumType, stringRepresentation, ignoreCase); } } } namespace Ionic.Zip { internal class WinZipAesCrypto { internal byte[] _Salt; internal byte[] _providedPv; internal byte[] _generatedPv; internal int _KeyStrengthInBits; private byte[] _MacInitializationVector; private byte[] _StoredMac; private byte[] _keyBytes; private short PasswordVerificationStored; private short PasswordVerificationGenerated; private int Rfc2898KeygenIterations = 1000; private string _Password; private bool _cryptoGenerated; public byte[] CalculatedMac; public byte[] GeneratedPV { get { if (!_cryptoGenerated) { _GenerateCryptoBytes(); } return _generatedPv; } } public byte[] Salt => _Salt; private int _KeyStrengthInBytes => _KeyStrengthInBits / 8; public int SizeOfEncryptionMetadata => _KeyStrengthInBytes / 2 + 10 + 2; public string Password { private get { return _Password; } set { _Password = value; if (_Password != null) { PasswordVerificationGenerated = (short)(GeneratedPV[0] + GeneratedPV[1] * 256); if (PasswordVerificationGenerated != PasswordVerificationStored) { throw new BadPasswordException(); } } } } public byte[] KeyBytes { get { if (!_cryptoGenerated) { _GenerateCryptoBytes(); } return _keyBytes; } } public byte[] MacIv { get { if (!_cryptoGenerated) { _GenerateCryptoBytes(); } return _MacInitializationVector; } } private WinZipAesCrypto(string password, int KeyStrengthInBits) { _Password = password; _KeyStrengthInBits = KeyStrengthInBits; } public static WinZipAesCrypto Generate(string password, int KeyStrengthInBits) { WinZipAesCrypto winZipAesCrypto = new WinZipAesCrypto(password, KeyStrengthInBits); int num = winZipAesCrypto._KeyStrengthInBytes / 2; winZipAesCrypto._Salt = new byte[num]; Random random = new Random(); random.NextBytes(winZipAesCrypto._Salt); return winZipAesCrypto; } public static WinZipAesCrypto ReadFromStream(string password, int KeyStrengthInBits, Stream s) { WinZipAesCrypto winZipAesCrypto = new WinZipAesCrypto(password, KeyStrengthInBits); int num = winZipAesCrypto._KeyStrengthInBytes / 2; winZipAesCrypto._Salt = new byte[num]; winZipAesCrypto._providedPv = new byte[2]; s.Read(winZipAesCrypto._Salt, 0, winZipAesCrypto._Salt.Length); s.Read(winZipAesCrypto._providedPv, 0, winZipAesCrypto._providedPv.Length); winZipAesCrypto.PasswordVerificationStored = (short)(winZipAesCrypto._providedPv[0] + winZipAesCrypto._providedPv[1] * 256); if (password != null) { winZipAesCrypto.PasswordVerificationGenerated = (short)(winZipAesCrypto.GeneratedPV[0] + winZipAesCrypto.GeneratedPV[1] * 256); if (winZipAesCrypto.PasswordVerificationGenerated != winZipAesCrypto.PasswordVerificationStored) { throw new BadPasswordException("bad password"); } } return winZipAesCrypto; } private void _GenerateCryptoBytes() { Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(_Password, Salt, Rfc2898KeygenIterations); _keyBytes = rfc2898DeriveBytes.GetBytes(_KeyStrengthInBytes); _MacInitializationVector = rfc2898DeriveBytes.GetBytes(_KeyStrengthInBytes); _generatedPv = rfc2898DeriveBytes.GetBytes(2); _cryptoGenerated = true; } public void ReadAndVerifyMac(Stream s) { bool flag = false; _StoredMac = new byte[10]; s.Read(_StoredMac, 0, _StoredMac.Length); if (_StoredMac.Length != CalculatedMac.Length) { flag = true; } if (!flag) { for (int i = 0; i < _StoredMac.Length; i++) { if (_StoredMac[i] != CalculatedMac[i]) { flag = true; } } } if (flag) { throw new BadStateException("The MAC does not match."); } } } internal class WinZipAesCipherStream : Stream { private const int BLOCK_SIZE_IN_BYTES = 16; private WinZipAesCrypto _params; private Stream _s; private CryptoMode _mode; private int _nonce; private bool _finalBlock; internal HMACSHA1 _mac; internal RijndaelManaged _aesCipher; internal ICryptoTransform _xform; private byte[] counter = new byte[16]; private byte[] counterOut = new byte[16]; private long _length; private long _totalBytesXferred; private byte[] _PendingWriteBlock; private int _pendingCount; private byte[] _iobuf; private object _outputLock = new object(); public byte[] FinalAuthentication { get { if (!_finalBlock) { if (_totalBytesXferred != 0) { throw new BadStateException("The final hash has not been computed."); } byte[] buffer = new byte[0]; _mac.ComputeHash(buffer); } byte[] array = new byte[10]; Array.Copy(_mac.Hash, 0, array, 0, 10); return array; } } public override bool CanRead { get { if (_mode != CryptoMode.Decrypt) { return false; } return true; } } public override bool CanSeek => false; public override bool CanWrite => _mode == CryptoMode.Encrypt; public override long Length { get { throw new NotImplementedException(); } } public override long Position { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } internal WinZipAesCipherStream(Stream s, WinZipAesCrypto cryptoParams, long length, CryptoMode mode) : this(s, cryptoParams, mode) { _length = length; } internal WinZipAesCipherStream(Stream s, WinZipAesCrypto cryptoParams, CryptoMode mode) { _params = cryptoParams; _s = s; _mode = mode; _nonce = 1; if (_params == null) { throw new BadPasswordException("Supply a password to use AES encryption."); } int num = _params.KeyBytes.Length * 8; if (num != 256 && num != 128 && num != 192) { throw new ArgumentOutOfRangeException("keysize", "size of key must be 128, 192, or 256"); } _mac = new HMACSHA1(_params.MacIv); _aesCipher = new RijndaelManaged(); _aesCipher.BlockSize = 128; _aesCipher.KeySize = num; _aesCipher.Mode = CipherMode.ECB; _aesCipher.Padding = PaddingMode.None; byte[] rgbIV = new byte[16]; _xform = _aesCipher.CreateEncryptor(_params.KeyBytes, rgbIV); if (_mode == CryptoMode.Encrypt) { _iobuf = new byte[2048]; _PendingWriteBlock = new byte[16]; } } private void XorInPlace(byte[] buffer, int offset, int count) { for (int i = 0; i < count; i++) { buffer[offset + i] = (byte)(counterOut[i] ^ buffer[offset + i]); } } private void WriteTransformOneBlock(byte[] buffer, int offset) { Array.Copy(BitConverter.GetBytes(_nonce++), 0, counter, 0, 4); _xform.TransformBlock(counter, 0, 16, counterOut, 0); XorInPlace(buffer, offset, 16); _mac.TransformBlock(buffer, offset, 16, null, 0); } private void WriteTransformBlocks(byte[] buffer, int offset, int count) { int i = offset; for (int num = count + offset; i < buffer.Length && i < num; i += 16) { WriteTransformOneBlock(buffer, i); } } private void WriteTransformFinalBlock() { if (_pendingCount == 0) { throw new InvalidOperationException("No bytes available."); } if (_finalBlock) { throw new InvalidOperationException("The final block has already been transformed."); } Array.Copy(BitConverter.GetBytes(_nonce++), 0, counter, 0, 4); counterOut = _xform.TransformFinalBlock(counter, 0, 16); XorInPlace(_PendingWriteBlock, 0, _pendingCount); _mac.TransformFinalBlock(_PendingWriteBlock, 0, _pendingCount); _finalBlock = true; } private int ReadTransformOneBlock(byte[] buffer, int offset, int last) { if (_finalBlock) { throw new NotSupportedException(); } int num = last - offset; int num2 = ((num > 16) ? 16 : num); Array.Copy(BitConverter.GetBytes(_nonce++), 0, counter, 0, 4); if (num2 == num && _length > 0 && _totalBytesXferred + last == _length) { _mac.TransformFinalBlock(buffer, offset, num2); counterOut = _xform.TransformFinalBlock(counter, 0, 16); _finalBlock = true; } else { _mac.TransformBlock(buffer, offset, num2, null, 0); _xform.TransformBlock(counter, 0, 16, counterOut, 0); } XorInPlace(buffer, offset, num2); return num2; } private void ReadTransformBlocks(byte[] buffer, int offset, int count) { int i = offset; int num2; for (int num = count + offset; i < buffer.Length && i < num; i += num2) { num2 = ReadTransformOneBlock(buffer, i, num); } } public override int Read(byte[] buffer, int offset, int count) { if (_mode == CryptoMode.Encrypt) { throw new NotSupportedException(); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Must not be less than zero."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Must not be less than zero."); } if (buffer.Length < offset + count) { throw new ArgumentException("The buffer is too small"); } int count2 = count; if (_totalBytesXferred >= _length) { return 0; } long num = _length - _totalBytesXferred; if (num < count) { count2 = (int)num; } int num2 = _s.Read(buffer, offset, count2); ReadTransformBlocks(buffer, offset, count2); _totalBytesXferred += num2; return num2; } public override void Write(byte[] buffer, int offset, int count) { if (_finalBlock) { throw new InvalidOperationException("The final block has already been transformed."); } if (_mode == CryptoMode.Decrypt) { throw new NotSupportedException(); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Must not be less than zero."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Must not be less than zero."); } if (buffer.Length < offset + count) { throw new ArgumentException("The offset and count are too large"); } if (count == 0) { return; } if (count + _pendingCount <= 16) { Buffer.BlockCopy(buffer, offset, _PendingWriteBlock, _pendingCount, count); _pendingCount += count; return; } int num = count; int num2 = offset; if (_pendingCount != 0) { int num3 = 16 - _pendingCount; if (num3 > 0) { Buffer.BlockCopy(buffer, offset, _PendingWriteBlock, _pendingCount, num3); num -= num3; num2 += num3; } WriteTransformOneBlock(_PendingWriteBlock, 0); _s.Write(_PendingWriteBlock, 0, 16); _totalBytesXferred += 16L; _pendingCount = 0; } int num4 = (num - 1) / 16; _pendingCount = num - num4 * 16; Buffer.BlockCopy(buffer, num2 + num - _pendingCount, _PendingWriteBlock, 0, _pendingCount); num -= _pendingCount; _totalBytesXferred += num; if (num4 <= 0) { return; } do { int num5 = _iobuf.Length; if (num5 > num) { num5 = num; } Buffer.BlockCopy(buffer, num2, _iobuf, 0, num5); WriteTransformBlocks(_iobuf, 0, num5); _s.Write(_iobuf, 0, num5); num -= num5; num2 += num5; } while (num > 0); } public override void Close() { if (_pendingCount > 0) { WriteTransformFinalBlock(); _s.Write(_PendingWriteBlock, 0, _pendingCount); _totalBytesXferred += _pendingCount; _pendingCount = 0; } _s.Close(); } public override void Flush() { _s.Flush(); } public override long Seek(long offset, SeekOrigin origin) { throw new NotImplementedException(); } public override void SetLength(long value) { throw new NotImplementedException(); } [Conditional("Trace")] private void TraceOutput(string format, params object[] varParams) { lock (_outputLock) { int hashCode = Thread.CurrentThread.GetHashCode(); Console.ForegroundColor = (ConsoleColor)(hashCode % 8 + 8); Console.Write("{0:000} WZACS ", hashCode); Console.WriteLine(format, varParams); Console.ResetColor(); } } } internal static class ZipConstants { public const uint PackedToRemovableMedia = 808471376u; public const uint Zip64EndOfCentralDirectoryRecordSignature = 101075792u; public const uint Zip64EndOfCentralDirectoryLocatorSignature = 117853008u; public const uint EndOfCentralDirectorySignature = 101010256u; public const int ZipEntrySignature = 67324752; public const int ZipEntryDataDescriptorSignature = 134695760; public const int SplitArchiveSignature = 134695760; public const int ZipDirEntrySignature = 33639248; public const int AesKeySize = 192; public const int AesBlockSize = 128; public const ushort AesAlgId128 = 26126; public const ushort AesAlgId192 = 26127; public const ushort AesAlgId256 = 26128; } [Serializable] [Guid("ebc25cf6-9120-4283-b972-0e5520d00006")] public class ZipException : Exception { public ZipException() { } public ZipException(string message) : base(message) { } public ZipException(string message, Exception innerException) : base(message, innerException) { } protected ZipException(SerializationInfo info, StreamingContext context) : base(info, context) { } } [Serializable] [Guid("ebc25cf6-9120-4283-b972-0e5520d0000B")] public class BadPasswordException : ZipException { public BadPasswordException() { } public BadPasswordException(string message) : base(message) { } public BadPasswordException(string message, Exception innerException) : base(message, innerException) { } protected BadPasswordException(SerializationInfo info, StreamingContext context) : base(info, context) { } } [Serializable] [Guid("ebc25cf6-9120-4283-b972-0e5520d0000A")] public class BadReadException : ZipException { public BadReadException() { } public BadReadException(string message) : base(message) { } public BadReadException(string message, Exception innerException) : base(message, innerException) { } protected BadReadException(SerializationInfo info, StreamingContext context) : base(info, context) { } } [Serializable] [Guid("ebc25cf6-9120-4283-b972-0e5520d00009")] public class BadCrcException : ZipException { public BadCrcException() { } public BadCrcException(string message) : base(message) { } protected BadCrcException(SerializationInfo info, StreamingContext context) : base(info, context) { } } [Serializable] [Guid("ebc25cf6-9120-4283-b972-0e5520d00008")] public class SfxGenerationException : ZipException { public SfxGenerationException() { } public SfxGenerationException(string message) : base(message) { } protected SfxGenerationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } [Serializable] [Guid("ebc25cf6-9120-4283-b972-0e5520d00007")] public class BadStateException : ZipException { public BadStateException() { } public BadStateException(string message) : base(message) { } public BadStateException(string message, Exception innerException) : base(message, innerException) { } protected BadStateException(SerializationInfo info, StreamingContext context) : base(info, context) { } } internal static class SharedUtilities { private static Regex doubleDotRegex1 = new Regex("^(.*/)?([^/\\\\.]+/\\\\.\\\\./)(.+)$"); private static Encoding ibm437 = Encoding.GetEncoding("IBM437"); private static Encoding utf8 = Encoding.GetEncoding("UTF-8"); public static long GetFileLength(string fileName) { if (!File.Exists(fileName)) { throw new FileNotFoundException(fileName); } long num = 0L; FileShare fileShare = FileShare.ReadWrite; fileShare |= FileShare.Delete; using FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, fileShare); return fileStream.Length; } [Conditional("NETCF")] public static void Workaround_Ladybug318918(Stream s) { s.Flush(); } private static string SimplifyFwdSlashPath(string path) { if (path.StartsWith("./")) { path = path.Substring(2); } path = path.Replace("/./", "/"); path = doubleDotRegex1.Replace(path, "$1$3"); return path; } public static string NormalizePathForUseInZipFile(string pathName) { if (string.IsNullOrEmpty(pathName)) { return pathName; } if (pathName.Length >= 2 && pathName[1] == ':' && pathName[2] == '\\') { pathName = pathName.Substring(3); } pathName = pathName.Replace('\\', '/'); while (pathName.StartsWith("/")) { pathName = pathName.Substring(1); } return SimplifyFwdSlashPath(pathName); } internal static byte[] StringToByteArray(string value, Encoding encoding) { return encoding.GetBytes(value); } internal static byte[] StringToByteArray(string value) { return StringToByteArray(value, ibm437); } internal static string Utf8StringFromBuffer(byte[] buf) { return StringFromBuffer(buf, utf8); } internal static string StringFromBuffer(byte[] buf, Encoding encoding) { return encoding.GetString(buf, 0, buf.Length); } internal static int ReadSignature(Stream s) { int result = 0; try { result = _ReadFourBytes(s, "n/a"); } catch (BadReadException) { } return result; } internal static int ReadEntrySignature(Stream s) { int num = 0; try { num = _ReadFourBytes(s, "n/a"); if (num == 134695760) { s.Seek(12L, SeekOrigin.Current); num = _ReadFourBytes(s, "n/a"); if (num != 67324752) { s.Seek(8L, SeekOrigin.Current); num = _ReadFourBytes(s, "n/a"); if (num != 67324752) { s.Seek(-24L, SeekOrigin.Current); num = _ReadFourBytes(s, "n/a"); } } } } catch (BadReadException) { } return num; } internal static int ReadInt(Stream s) { return _ReadFourBytes(s, "Could not read block - no data! (position 0x{0:X8})"); } private static int _ReadFourBytes(Stream s, string message) { int num = 0; byte[] array = new byte[4]; num = s.Read(array, 0, array.Length); if (num != array.Length) { throw new BadReadException(string.Format(message, s.Position)); } return ((array[3] * 256 + array[2]) * 256 + array[1]) * 256 + array[0]; } internal static long FindSignature(Stream stream, int SignatureToFind) { long position = stream.Position; int num = 65536; byte[] array = new byte[4] { (byte)(SignatureToFind >> 24), (byte)((SignatureToFind & 0xFF0000) >> 16), (byte)((SignatureToFind & 0xFF00) >> 8), (byte)((uint)SignatureToFind & 0xFFu) }; byte[] array2 = new byte[num]; int num2 = 0; bool flag = false; do { num2 = stream.Read(array2, 0, array2.Length); if (num2 == 0) { break; } for (int i = 0; i < num2; i++) { if (array2[i] == array[3]) { long position2 = stream.Position; stream.Seek(i - num2, SeekOrigin.Current); int num3 = ReadSignature(stream); flag = num3 == SignatureToFind; if (flag) { break; } stream.Seek(position2, SeekOrigin.Begin); } } } while (!flag); if (!flag) { stream.Seek(position, SeekOrigin.Begin); return -1L; } return stream.Position - position - 4; } internal static DateTime AdjustTime_Reverse(DateTime time) { if (time.Kind == DateTimeKind.Utc) { return time; } DateTime result = time; if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime()) { result = time - new TimeSpan(1, 0, 0); } else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime()) { result = time + new TimeSpan(1, 0, 0); } return result; } internal static DateTime PackedToDateTime(int packedDateTime) { if (packedDateTime == 65535 || packedDateTime == 0) { return new DateTime(1995, 1, 1, 0, 0, 0, 0); } short num = (short)(packedDateTime & 0xFFFF); short num2 = (short)((packedDateTime & 0xFFFF0000u) >> 16); int i = 1980 + ((num2 & 0xFE00) >> 9); int j = (num2 & 0x1E0) >> 5; int k = num2 & 0x1F; int num3 = (num & 0xF800) >> 11; int l = (num & 0x7E0) >> 5; int m = (num & 0x1F) * 2; if (m >= 60) { l++; m = 0; } if (l >= 60) { num3++; l = 0; } if (num3 >= 24) { k++; num3 = 0; } DateTime value = DateTime.Now; bool flag = false; try { value = new DateTime(i, j, k, num3, l, m, 0); flag = true; } catch (ArgumentOutOfRangeException) { if (i == 1980 && (j == 0 || k == 0)) { try { value = new DateTime(1980, 1, 1, num3, l, m, 0); flag = true; } catch (ArgumentOutOfRangeException) { try { value = new DateTime(1980, 1, 1, 0, 0, 0, 0); flag = true; goto end_IL_00f1; } catch (ArgumentOutOfRangeException) { goto end_IL_00f1; } end_IL_00f1:; } } else { try { for (; i < 1980; i++) { } while (i > 2030) { i--; } for (; j < 1; j++) { } while (j > 12) { j--; } for (; k < 1; k++) { } while (k > 28) { k--; } for (; l < 0; l++) { } while (l > 59) { l--; } for (; m < 0; m++) { } while (m > 59) { m--; } value = new DateTime(i, j, k, num3, l, m, 0); flag = true; } catch (ArgumentOutOfRangeException) { } } } if (!flag) { string arg = $"y({i}) m({j}) d({k}) h({num3}) m({l}) s({m})"; throw new ZipException($"Bad date/time format in the zip file. ({arg})"); } return DateTime.SpecifyKind(value, DateTimeKind.Local); } internal static int DateTimeToPacked(DateTime time) { time = time.ToLocalTime(); ushort num = (ushort)(((uint)time.Day & 0x1Fu) | ((uint)(time.Month << 5) & 0x1E0u) | ((uint)(time.Year - 1980 << 9) & 0xFE00u)); ushort num2 = (ushort)(((uint)(time.Second / 2) & 0x1Fu) | ((uint)(time.Minute << 5) & 0x7E0u) | ((uint)(time.Hour << 11) & 0xF800u)); return (num << 16) | num2; } public static void CreateAndOpenUniqueTempFile(string dir, out Stream fs, out string filename) { for (int i = 0; i < 3; i++) { try { filename = Path.Combine(dir, InternalGetTempFileName()); fs = new FileStream(filename, FileMode.CreateNew); return; } catch (IOException) { if (i == 2) { throw; } } } throw new IOException(); } public static string InternalGetTempFileName() { return "DotNetZip-" + Path.GetRandomFileName().Substring(0, 8) + ".tmp"; } internal static int ReadWithRetry(Stream s, byte[] buffer, int offset, int count, string FileName) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown int result = 0; bool flag = false; int num = 0; do { try { result = s.Read(buffer, offset, count); flag = true; } catch (IOException ex) { SecurityPermission val = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode); if (val.IsUnrestricted()) { uint num2 = _HRForException(ex); if (num2 != 2147942433u) { throw new IOException($"Cannot read file {FileName}", ex); } num++; if (num > 10) { throw new IOException($"Cannot read file {FileName}, at offset 0x{offset:X8} after 10 retries", ex); } Thread.Sleep(250 + num * 550); continue; } throw; } } while (!flag); return result; } private static uint _HRForException(Exception ex1) { return (uint)Marshal.GetHRForException(ex1); } } public class CountingStream : Stream { private Stream _s; private long _bytesWritten; private long _bytesRead; private long _initialOffset; public Stream WrappedStream => _s; public long BytesWritten => _bytesWritten; public long BytesRead => _bytesRead; public override bool CanRead => _s.CanRead; public override bool CanSeek => _s.CanSeek; public override bool CanWrite => _s.CanWrite; public override long Length => _s.Length; public long ComputedPosition => _initialOffset + _bytesWritten; public override long Position { get { return _s.Position; } set { _s.Seek(value, SeekOrigin.Begin); } } public CountingStream(Stream stream) { _s = stream; try { _initialOffset = _s.Position; } catch { _initialOffset = 0L; } } public void Adjust(long delta) { _bytesWritten -= delta; if (_bytesWritten < 0) { throw new InvalidOperationException(); } if (_s is CountingStream) { ((CountingStream)_s).Adjust(delta); } } public override int Read(byte[] buffer, int offset, int count) { int num = _s.Read(buffer, offset, count); _bytesRead += num; return num; } public override void Write(byte[] buffer, int offset, int count) { if (count != 0) { _s.Write(buffer, offset, count); _bytesWritten += count; } } public override void Flush() { _s.Flush(); } public override long Seek(long offset, SeekOrigin origin) { return _s.Seek(offset, origin); } public override void SetLength(long value) { _s.SetLength(value); } } internal class ZipCrypto { private uint[] _Keys = new uint[3] { 305419896u, 591751049u, 878082192u }; private CRC32 crc32 = new CRC32(); private byte MagicByte { get { ushort num = (ushort)((ushort)(_Keys[2] & 0xFFFFu) | 2u); return (byte)(num * (num ^ 1) >> 8); } } private ZipCrypto() { } public static ZipCrypto ForWrite(string password) { ZipCrypto zipCrypto = new ZipCrypto(); if (password == null) { throw new BadPasswordException("This entry requires a password."); } zipCrypto.InitCipher(password); return zipCrypto; } public static ZipCrypto ForRead(string password, ZipEntry e) { Stream archiveStream = e._archiveStream; e._WeakEncryptionHeader = new byte[12]; byte[] weakEncryptionHeader = e._WeakEncryptionHeader; ZipCrypto zipCrypto = new ZipCrypto(); if (password == null) { throw new BadPasswordException("This entry requires a password."); } zipCrypto.InitCipher(password); ZipEntry.ReadWeakEncryptionHeader(archiveStream, weakEncryptionHeader); byte[] array = zipCrypto.DecryptMessage(weakEncryptionHeader, weakEncryptionHeader.Length); if (array[11] != (byte)((e._Crc32 >> 24) & 0xFF)) { if ((e._BitField & 8) != 8) { throw new BadPasswordException("The password did not match."); } if (array[11] != (byte)((e._TimeBlob >> 8) & 0xFF)) { throw new BadPasswordException("The password did not match."); } } return zipCrypto; } public byte[] DecryptMessage(byte[] cipherText, int length) { if (cipherText == null) { throw new ArgumentNullException("cipherText"); } if (length > cipherText.Length) { throw new ArgumentOutOfRangeException("length", "Bad length during Decryption: the length parameter must be smaller than or equal to the size of the destination array."); } byte[] array = new byte[length]; for (int i = 0; i < length; i++) { byte b = (byte)(cipherText[i] ^ MagicByte); UpdateKeys(b); array[i] = b; } return array; } public byte[] EncryptMessage(byte[] plainText, int length) { if (plainText == null) { throw new ArgumentNullException("plaintext"); } if (length > plainText.Length) { throw new ArgumentOutOfRangeException("length", "Bad length during Encryption: The length parameter must be smaller than or equal to the size of the destination array."); } byte[] array = new byte[length]; for (int i = 0; i < length; i++) { byte byteValue = plainText[i]; array[i] = (byte)(plainText[i] ^ MagicByte); UpdateKeys(byteValue); } return array; } public void InitCipher(string passphrase) { byte[] array = SharedUtilities.StringToByteArray(passphrase); for (int i = 0; i < passphrase.Length; i++) { UpdateKeys(array[i]); } } private void UpdateKeys(byte byteValue) { _Keys[0] = (uint)crc32.ComputeCrc32((int)_Keys[0], byteValue); _Keys[1] = _Keys[1] + (byte)_Keys[0]; _Keys[1] = _Keys[1] * 134775813 + 1; _Keys[2] = (uint)crc32.ComputeCrc32((int)_Keys[2], (byte)(_Keys[1] >> 24)); } } internal enum CryptoMode { Encrypt, Decrypt } internal class ZipCipherStream : Stream { private ZipCrypto _cipher; private Stream _s; private CryptoMode _mode; public override bool CanRead => _mode == CryptoMode.Decrypt; public override bool CanSeek => false; public override bool CanWrite => _mode == CryptoMode.Encrypt; public override long Length { get { throw new NotSupportedException(); } } public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } } public ZipCipherStream(Stream s, ZipCrypto cipher, CryptoMode mode) { _cipher = cipher; _s = s; _mode = mode; } public override int Read(byte[] buffer, int offset, int count) { if (_mode == CryptoMode.Encrypt) { throw new NotSupportedException("This stream does not encrypt via Read()"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } byte[] array = new byte[count]; int num = _s.Read(array, 0, count); byte[] array2 = _cipher.DecryptMessage(array, num); for (int i = 0; i < num; i++) { buffer[offset + i] = array2[i]; } return num; } public override void Write(byte[] buffer, int offset, int count) { if (_mode == CryptoMode.Decrypt) { throw new NotSupportedException("This stream does not Decrypt via Write()"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (count == 0) { return; } byte[] array = null; if (offset != 0) { array = new byte[count]; for (int i = 0; i < count; i++) { array[i] = buffer[offset + i]; } } else { array = buffer; } byte[] array2 = _cipher.EncryptMessage(array, count); _s.Write(array2, 0, array2.Length); } public override void Flush() { } public override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(); } public override void SetLength(long value) { throw new NotSupportedException(); } } public delegate void WriteDelegate(string entryName, Stream stream); public delegate Stream OpenDelegate(string entryName); public delegate void CloseDelegate(string entryName, Stream stream); public delegate CompressionLevel SetCompressionCallback(string localFileName, string fileNameInArchive); public enum ZipProgressEventType { Adding_Started, Adding_AfterAddEntry, Adding_Completed, Reading_Started, Reading_BeforeReadEntry, Reading_AfterReadEntry, Reading_Completed, Reading_ArchiveBytesRead, Saving_Started, Saving_BeforeWriteEntry, Saving_AfterWriteEntry, Saving_Completed, Saving_AfterSaveTempArchive, Saving_BeforeRenameTempArchive, Saving_AfterRenameTempArchive, Saving_AfterCompileSelfExtractor, Saving_EntryBytesRead, Extracting_BeforeExtractEntry, Extracting_AfterExtractEntry, Extracting_ExtractEntryWouldOverwrite, Extracting_EntryBytesWritten, Extracting_BeforeExtractAll, Extracting_AfterExtractAll, Error_Saving } public class ZipProgressEventArgs : EventArgs { private int _entriesTotal; private bool _cancel; private ZipEntry _latestEntry; private ZipProgressEventType _flavor; private string _archiveName; private long _bytesTransferred; private long _totalBytesToTransfer; public int EntriesTotal { get { return _entriesTotal; } set { _entriesTotal = value; } } public ZipEntry CurrentEntry { get { return _latestEntry; } set { _latestEntry = value; } } public bool Cancel { get { return _cancel; } set { _cancel = _cancel || value; } } public ZipProgressEventType EventType { get { return _flavor; } set { _flavor = value; } } public string ArchiveName { get { return _archiveName; } set { _archiveName = value; } } public long BytesTransferred { get { return _bytesTransferred; } set { _bytesTransferred = value; } } public long TotalBytesToTransfer { get { return _totalBytesToTransfer; } set { _totalBytesToTransfer = value; } } internal ZipProgressEventArgs() { } internal ZipProgressEventArgs(string archiveName, ZipProgressEventType flavor) { _archiveName = archiveName; _flavor = flavor; } } public class ReadProgressEventArgs : ZipProgressEventArgs { internal ReadProgressEventArgs() { } private ReadProgressEventArgs(string archiveName, ZipProgressEventType flavor) : base(archiveName, flavor) { } internal static ReadProgressEventArgs Before(string archiveName, int entriesTotal) { ReadProgressEventArgs readProgressEventArgs = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_BeforeReadEntry); readProgressEventArgs.EntriesTotal = entriesTotal; return readProgressEventArgs; } internal static ReadProgressEventArgs After(string archiveName, ZipEntry entry, int entriesTotal) { ReadProgressEventArgs readProgressEventArgs = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_AfterReadEntry); readProgressEventArgs.EntriesTotal = entriesTotal; readProgressEventArgs.CurrentEntry = entry; return readProgressEventArgs; } internal static ReadProgressEventArgs Started(string archiveName) { return new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_Started); } internal static ReadProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, long bytesXferred, long totalBytes) { ReadProgressEventArgs readProgressEventArgs = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_ArchiveBytesRead); readProgressEventArgs.CurrentEntry = entry; readProgressEventArgs.BytesTransferred = bytesXferred; readProgressEventArgs.TotalBytesToTransfer = totalBytes; return readProgressEventArgs; } internal static ReadProgressEventArgs Completed(string archiveName) { return new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_Completed); } } public class AddProgressEventArgs : ZipProgressEventArgs { internal AddProgressEventArgs() { } private AddProgressEventArgs(string archiveName, ZipProgressEventType flavor) : base(archiveName, flavor) { } internal static AddProgressEventArgs AfterEntry(string archiveName, ZipEntry entry, int entriesTotal) { AddProgressEventArgs addProgressEventArgs = new AddProgressEventArgs(archiveName, ZipProgressEventType.Adding_AfterAddEntry); addProgressEventArgs.EntriesTotal = entriesTotal; addProgressEventArgs.CurrentEntry = entry; return addProgressEventArgs; } internal static AddProgressEventArgs Started(string archiveName) { return new AddProgressEventArgs(archiveName, ZipProgressEventType.Adding_Started); } internal static AddProgressEventArgs Completed(string archiveName) { return new AddProgressEventArgs(archiveName, ZipProgressEventType.Adding_Completed); } } public class SaveProgressEventArgs : ZipProgressEventArgs { private int _entriesSaved; public int EntriesSaved => _entriesSaved; internal SaveProgressEventArgs(string archiveName, bool before, int entriesTotal, int entriesSaved, ZipEntry entry) : base(archiveName, before ? ZipProgressEventType.Saving_BeforeWriteEntry : ZipProgressEventType.Saving_AfterWriteEntry) { base.EntriesTotal = entriesTotal; base.CurrentEntry = entry; _entriesSaved = entriesSaved; } internal SaveProgressEventArgs() { } internal SaveProgressEventArgs(string archiveName, ZipProgressEventType flavor) : base(archiveName, flavor) { } internal static SaveProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, long bytesXferred, long totalBytes) { SaveProgressEventArgs saveProgressEventArgs = new SaveProgressEventArgs(archiveName, ZipProgressEventType.Saving_EntryBytesRead); saveProgressEventArgs.ArchiveName = archiveName; saveProgressEventArgs.CurrentEntry = entry; saveProgressEventArgs.BytesTransferred = bytesXferred; saveProgressEventArgs.TotalBytesToTransfer = totalBytes; return saveProgressEventArgs; } internal static SaveProgressEventArgs Started(string archiveName) { return new SaveProgressEventArgs(archiveName, ZipProgressEventType.Saving_Started); } internal static SaveProgressEventArgs Completed(string archiveName) { return new SaveProgressEventArgs(archiveName, ZipProgressEventType.Saving_Completed); } } public class ExtractProgressEventArgs : ZipProgressEventArgs { private int _entriesExtracted; private string _target; public int EntriesExtracted => _entriesExtracted; public string ExtractLocation => _target; internal ExtractProgressEventArgs(string archiveName, bool before, int entriesTotal, int entriesExtracted, ZipEntry entry, string extractLocation) : base(archiveName, before ? ZipProgressEventType.Extracting_BeforeExtractEntry : ZipProgressEventType.Extracting_AfterExtractEntry) { base.EntriesTotal = entriesTotal; base.CurrentEntry = entry; _entriesExtracted = entriesExtracted; _target = extractLocation; } internal ExtractProgressEventArgs(string archiveName, ZipProgressEventType flavor) : base(archiveName, flavor) { } internal ExtractProgressEventArgs() { } internal static ExtractProgressEventArgs BeforeExtractEntry(string archiveName, ZipEntry entry, string extractLocation) { ExtractProgressEventArgs extractProgressEventArgs = new ExtractProgressEventArgs(); extractProgressEventArgs.ArchiveName = archiveName; extractProgressEventArgs.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry; extractProgressEventArgs.CurrentEntry = entry; extractProgressEventArgs._target = extractLocation; return extractProgressEventArgs; } internal static ExtractProgressEventArgs ExtractExisting(string archiveName, ZipEntry entry, string extractLocation) { ExtractProgressEventArgs extractProgressEventArgs = new ExtractProgressEventArgs(); extractProgressEventArgs.ArchiveName = archiveName; extractProgressEventArgs.EventType = ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite; extractProgressEventArgs.CurrentEntry = entry; extractProgressEventArgs._target = extractLocation; return extractProgressEventArgs; } internal static ExtractProgressEventArgs AfterExtractEntry(string archiveName, ZipEntry entry, string extractLocation) { ExtractProgressEventArgs extractProgressEventArgs = new ExtractProgressEventArgs(); extractProgressEventArgs.ArchiveName = archiveName; extractProgressEventArgs.EventType = ZipProgressEventType.Extracting_AfterExtractEntry; extractProgressEventArgs.CurrentEntry = entry; extractProgressEventArgs._target = extractLocation; return extractProgressEventArgs; } internal static ExtractProgressEventArgs ExtractAllStarted(string archiveName, string extractLocation) { ExtractProgressEventArgs extractProgressEventArgs = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_BeforeExtractAll); extractProgressEventArgs._target = extractLocation; return extractProgressEventArgs; } internal static ExtractProgressEventArgs ExtractAllCompleted(string archiveName, string extractLocation) { ExtractProgressEventArgs extractProgressEventArgs = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_AfterExtractAll); extractProgressEventArgs._target = extractLocation; return extractProgressEventArgs; } internal static ExtractProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, long bytesWritten, long totalBytes) { ExtractProgressEventArgs extractProgressEventArgs = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_EntryBytesWritten); extractProgressEventArgs.ArchiveName = archiveName; extractProgressEventArgs.CurrentEntry = entry; extractProgressEventArgs.BytesTransferred = bytesWritten; extractProgressEventArgs.TotalBytesToTransfer = totalBytes; return extractProgressEventArgs; } } public class ZipErrorEventArgs : ZipProgressEventArgs { private Exception _exc; public Exception Exception => _exc; public string FileName => base.CurrentEntry.LocalFileName; private ZipErrorEventArgs() { } internal static ZipErrorEventArgs Saving(string archiveName, ZipEntry entry, Exception exception) { ZipErrorEventArgs zipErrorEventArgs = new ZipErrorEventArgs(); zipErrorEventArgs.EventType = ZipProgressEventType.Error_Saving; zipErrorEventArgs.ArchiveName = archiveName; zipErrorEventArgs.CurrentEntry = entry; zipErrorEventArgs._exc = exception; return zipErrorEventArgs; } } [ComVisible(true)] [Guid("ebc25cf6-9120-4283-b972-0e5520d00004")] [ClassInterface(ClassInterfaceType.AutoDispatch)] public class ZipEntry { private class CopyHelper { private static Regex re = new Regex(" \\(copy (\\d+)\\)$"); private static int callCount = 0; internal static string AppendCopyToFileName(string f) { callCount++; if (callCount > 25) { throw new OverflowException("overflow while creating filename"); } int num = 1; int num2 = f.LastIndexOf("."); if (num2 == -1) { Match match = re.Match(f); if (match.Success) { num = int.Parse(match.Groups[1].Value) + 1; string text = $" (copy {num})"; f = f.Substring(0, match.Index) + text; } else { string text2 = $" (copy {num})"; f += text2; } } else { Match match2 = re.Match(f.Substring(0, num2)); if (match2.Success) { num = int.Parse(match2.Groups[1].Value) + 1; string text3 = $" (copy {num})"; f = f.Substring(0, match2.Index) + text3 + f.Substring(num2); } else { string text4 = $" (copy {num})"; f = f.Substring(0, num2) + text4 + f.Substring(num2); } } return f; } } private delegate T Func<T>(); private short _VersionMadeBy; private short _InternalFileAttrs; private int _ExternalFileAttrs; private short _filenameLength; private short _extraFieldLength; private short _commentLength; private ZipCrypto _zipCrypto_forExtract; private ZipCrypto _zipCrypto_forWrite; private WinZipAesCrypto _aesCrypto_forExtract; private WinZipAesCrypto _aesCrypto_forWrite; private short _WinZipAesMethod; internal DateTime _LastModified; private DateTime _Mtime; private DateTime _Atime; private DateTime _Ctime; private bool _ntfsTimesAreSet; private bool _emitNtfsTimes = true; private bool _emitUnixTimes; private bool _TrimVolumeFromFullyQualifiedPaths = true; internal string _LocalFileName; private string _FileNameInArchive; internal short _VersionNeeded; internal short _BitField; internal short _CompressionMethod; private short _CompressionMethod_FromZipFile; private CompressionLevel _CompressionLevel; internal string _Comment; private bool _IsDirectory; private byte[] _CommentBytes; internal long _CompressedSize; internal long _CompressedFileDataSize; internal long _UncompressedSize; internal int _TimeBlob; private bool _crcCalculated; internal int _Crc32; internal byte[] _Extra; private bool _metadataChanged; private bool _restreamRequiredOnSave; private bool _sourceIsEncrypted; private bool _skippedDuringSave; private uint _diskNumber; private static Encoding ibm437 = Encoding.GetEncoding("IBM437"); private Encoding _actualEncoding; internal ZipContainer _container; private long __FileDataPosition = -1L; private byte[] _EntryHeader; internal long _RelativeOffsetOfLocalHeader; private long _future_ROLH; private long _TotalEntrySize; private int _LengthOfHeader; private int _LengthOfTrailer; internal bool _InputUsesZip64; private uint _UnsupportedAlgorithmId; internal string _Password; internal ZipEntrySource _Source; internal EncryptionAlgorithm _Encryption; internal EncryptionAlgorithm _Encryption_FromZipFile; internal byte[] _WeakEncryptionHeader; internal Stream _archiveStream; private Stream _sourceStream; private long? _sourceStreamOriginalPosition; private bool _sourceWasJitProvided; private bool _ioOperationCanceled; private bool _presumeZip64; private bool? _entryRequiresZip64; private bool? _OutputUsesZip64; private bool _IsText; private ZipEntryTimestamp _timestamp; private static DateTime _unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); private
plugins/MtGAPI/ModTheGungeonAPI.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using Dungeonator; using ETGGUI; using FullSerializer; using FullSerializer.Internal; using Gungeon; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pathfinding; using SGUI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("EtG.ModTheGungeonAPI")] [assembly: AssemblyDescription("An API for Enter the Gungeon that brings the good parts of MtG (Mod the Gungeon) to BepInEx as a plugin.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ModTheGungeonAPI")] [assembly: AssemblyProduct("ModTheGungeonAPI")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("74614e13-b452-410a-838d-f0e1fefc0d85")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal class BeamBehaviourTracker : MonoBehaviour { public GunBehaviour gunBehaviour; } public static class ETGMod { public static class Assets { public const string DEFINITION_METADATA_EXTENSION = "jtk2d"; public const string FULL_DEFINITION_METADATA_EXTENSION = ".jtk2d"; private static List<tk2dSpriteCollectionData> _spriteCollections; private static readonly List<string> processedFolders = new List<string>(); internal static readonly Dictionary<string, Texture2D> unprocessedSingleTextureReplacements = new Dictionary<string, Texture2D>(); internal static readonly Dictionary<string, Dictionary<string, Texture2D>> unprocessedReplacements = new Dictionary<string, Dictionary<string, Texture2D>>(); internal static readonly Dictionary<string, Dictionary<string, AssetSpriteData>> unprocessedJsons = new Dictionary<string, Dictionary<string, AssetSpriteData>>(); public static Dictionary<string, Texture2D> TextureMap = new Dictionary<string, Texture2D>(); public static RuntimeAtlasPacker Packer = new RuntimeAtlasPacker(0, 0, (TextureFormat)4); public static List<tk2dSpriteCollectionData> Collections => _spriteCollections ?? (_spriteCollections = (from x in Resources.FindObjectsOfTypeAll<tk2dSpriteCollectionData>() where (Object)(object)((x != null) ? ((Component)x).gameObject : null) != (Object)null select x).ToList()); public static Vector2[] GenerateUVs(Texture2D texture, int x, int y, int width, int height) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) return (Vector2[])(object)new Vector2[4] { new Vector2((float)x / (float)((Texture)texture).width, (float)y / (float)((Texture)texture).height), new Vector2((float)(x + width) / (float)((Texture)texture).width, (float)y / (float)((Texture)texture).height), new Vector2((float)x / (float)((Texture)texture).width, (float)(y + height) / (float)((Texture)texture).height), new Vector2((float)(x + width) / (float)((Texture)texture).width, (float)(y + height) / (float)((Texture)texture).height) }; } public static void SetupSprites(Dictionary<string, Texture2D> sheetReplacements, Dictionary<string, Dictionary<string, Texture2D>> definitionReplacements, Dictionary<string, Dictionary<string, AssetSpriteData>> spriteData) { if (sheetReplacements != null) { foreach (KeyValuePair<string, Texture2D> sheetReplacement in sheetReplacements) { tk2dSpriteCollectionData val = FindCollectionOfName(sheetReplacement.Key); if ((Object)(object)val == (Object)null || val.materials == null || val.materials.Length == 0) { if (!((Object)(object)val != (Object)null)) { string key = sheetReplacement.Key.Replace("_", " "); unprocessedSingleTextureReplacements[key] = sheetReplacement.Value; } } else { HandleCollectionSheetReplacement(val, sheetReplacement.Value); } } } if (definitionReplacements != null) { foreach (KeyValuePair<string, Dictionary<string, Texture2D>> definitionReplacement in definitionReplacements) { tk2dSpriteCollectionData val2 = FindCollectionOfName(definitionReplacement.Key); if ((Object)(object)val2 == (Object)null || val2.materials == null || val2.materials.Length == 0) { if (!((Object)(object)val2 != (Object)null)) { string key2 = definitionReplacement.Key.Replace("_", " "); if (!unprocessedReplacements.TryGetValue(key2, out var value) || value == null) { value = (unprocessedReplacements[key2] = new Dictionary<string, Texture2D>()); } value.SetRange(definitionReplacement.Value); } } else { HandleCollectionDefinitionReplacements(val2, definitionReplacement.Value); } } } if (spriteData == null) { return; } foreach (KeyValuePair<string, Dictionary<string, AssetSpriteData>> spriteDatum in spriteData) { tk2dSpriteCollectionData val3 = FindCollectionOfName(spriteDatum.Key); if ((Object)(object)val3 == (Object)null || val3.materials == null || val3.materials.Length == 0) { if (!((Object)(object)val3 != (Object)null)) { string key3 = spriteDatum.Key.Replace("_", " "); if (!unprocessedJsons.TryGetValue(key3, out var value2) || value2 == null) { value2 = (unprocessedJsons[key3] = new Dictionary<string, AssetSpriteData>()); } value2.SetRange(spriteDatum.Value); } } else { HandleCollectionAttachPoints(val3, spriteDatum.Value); } } } public static tk2dSpriteCollectionData FindCollectionOfName(string name) { if (Collections == null) { return null; } return Collections.Find((tk2dSpriteCollectionData x) => (Object)(object)x != (Object)null && !string.IsNullOrEmpty(x.spriteCollectionName) && x.spriteCollectionName.Replace("_", " ").ToLowerInvariant() == name.Replace("_", " ").ToLowerInvariant()); } public static void HandleCollectionSheetReplacement(tk2dSpriteCollectionData coll, Texture2D sheetTex) { //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown if ((Object)(object)coll == (Object)null || (Object)(object)sheetTex == (Object)null) { return; } Material val = coll.materials[0]; if (!Object.op_Implicit((Object)(object)val)) { return; } Texture mainTexture = val.mainTexture; if (!Object.op_Implicit((Object)(object)mainTexture)) { return; } string name = ((Object)mainTexture).name; if (string.IsNullOrEmpty(name) || name.StartsWith("~")) { return; } Dictionary<int, Texture> dictionary = new Dictionary<int, Texture>(); if (coll.spriteDefinitions != null) { for (int i = 0; i < coll.spriteDefinitions.Length; i++) { tk2dSpriteDefinition val2 = coll.spriteDefinitions[i]; bool flag = (Object)(object)val2.materialInst != (Object)null; Material[] materials = coll.materials; foreach (Material val3 in materials) { if ((Object)(object)val2.materialInst == (Object)null || (Object)(object)val2.materialInst.mainTexture == (Object)(object)val3.mainTexture) { flag = false; } } if (flag) { dictionary[i] = val2.materialInst.mainTexture; } } } ((Object)sheetTex).name = "~" + name; for (int k = 0; k < coll.materials.Length; k++) { if (!((Object)(object)coll.materials[k] == (Object)null) && !((Object)(object)coll.materials[k].mainTexture == (Object)null)) { coll.materials[k].mainTexture = (Texture)(object)sheetTex; } } if ((Object)(object)coll.inst == (Object)null) { return; } coll.inst.materialInsts = null; coll.inst.Init(); foreach (KeyValuePair<int, Texture> item in dictionary) { if (item.Key < coll.Count) { tk2dSpriteDefinition val4 = coll.spriteDefinitions[item.Key]; if (val4 != null && !((Object)(object)val4.materialInst == (Object)null)) { val4.materialInst = new Material(val4.material) { mainTexture = item.Value }; } } } if (!Object.op_Implicit((Object)(object)coll.inst) != Object.op_Implicit((Object)(object)coll)) { return; } if (coll.inst.materials != null) { for (int l = 0; l < coll.inst.materials.Length; l++) { Material obj = coll.inst.materials[l]; if (!((Object)(object)((obj != null) ? obj.mainTexture : null) == (Object)null)) { coll.inst.materials[l].mainTexture = (Texture)(object)sheetTex; } } } foreach (KeyValuePair<int, Texture> item2 in dictionary) { if (item2.Key < coll.inst.Count) { tk2dSpriteDefinition val5 = coll.inst.spriteDefinitions[item2.Key]; if (val5 != null && (Object)(object)val5.materialInst != (Object)null) { val5.materialInst.mainTexture = item2.Value; } } } } public static void HandleCollectionDefinitionReplacements(tk2dSpriteCollectionData coll, Dictionary<string, Texture2D> sprites) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)coll == (Object)null || sprites == null || sprites.Count <= 0 || coll.Count <= 0) { return; } List<tk2dSpriteDefinition> list = new List<tk2dSpriteDefinition>((IEnumerable<tk2dSpriteDefinition>)(((object)coll.spriteDefinitions) ?? ((object)new tk2dSpriteDefinition[0]))); List<tk2dSpriteDefinition> list2 = (((Object)(object)coll.inst != (Object)null) ? new List<tk2dSpriteDefinition>((IEnumerable<tk2dSpriteDefinition>)(((object)coll.inst.spriteDefinitions) ?? ((object)new tk2dSpriteDefinition[0]))) : new List<tk2dSpriteDefinition>()); bool flag = (Object)(object)coll.inst != (Object)null && (Object)(object)coll.inst != (Object)(object)coll; foreach (KeyValuePair<string, Texture2D> sprite in sprites) { string key = sprite.Key; Texture2D value = sprite.Value; int spriteIdByName = coll.GetSpriteIdByName(key, -1); TextureMap["sprites/" + coll.spriteCollectionName + "/" + key] = value; if (spriteIdByName >= 0) { coll.spriteDefinitions[spriteIdByName].ReplaceTexture(value, pack: true); if (flag) { coll.inst.spriteDefinitions[spriteIdByName].ReplaceTexture(value, pack: true); } continue; } tk2dSpriteDefinition val = new tk2dSpriteDefinition { name = key, material = coll.materials[0] }; val.ReplaceTexture(value, pack: true); val.normals = (Vector3[])(object)new Vector3[0]; val.tangents = (Vector4[])(object)new Vector4[0]; val.indices = new int[6] { 0, 3, 1, 2, 3, 0 }; float num = 0.0625f; float num2 = (float)((Texture)value).width * num; float num3 = (float)((Texture)value).height * num; val.position0 = new Vector3(0f, 0f, 0f); val.position1 = new Vector3(num2, 0f, 0f); val.position2 = new Vector3(0f, num3, 0f); val.position3 = new Vector3(num2, num3, 0f); val.boundsDataCenter = (val.untrimmedBoundsDataCenter = new Vector3(num2 / 2f, num3 / 2f, 0f)); val.boundsDataExtents = (val.untrimmedBoundsDataExtents = new Vector3(num2, num3, 0f)); list.Add(val); list2.Add(val); } coll.spriteDefinitions = list.ToArray(); coll.spriteNameLookupDict = null; if (flag) { coll.inst.spriteDefinitions = list2.ToArray(); coll.inst.spriteNameLookupDict = null; } } public static void HandleCollectionAttachPoints(tk2dSpriteCollectionData coll, Dictionary<string, AssetSpriteData> attachPoint) { if ((Object)(object)coll == (Object)null || attachPoint == null || attachPoint.Count <= 0 || coll.Count <= 0) { return; } bool flag = (Object)(object)coll.inst != (Object)null && (Object)(object)coll.inst != (Object)(object)coll; foreach (KeyValuePair<string, AssetSpriteData> item in attachPoint) { int spriteIdByName = coll.GetSpriteIdByName(item.Key, -1); if (spriteIdByName >= 0) { coll.SetAttachPoints(spriteIdByName, item.Value.attachPoints); if (flag) { coll.inst.SetAttachPoints(spriteIdByName, item.Value.attachPoints); } } } } public static void SetupSpritesFromFolder(string folder) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown if (processedFolders.Contains(folder)) { return; } if (!Directory.Exists(folder)) { ETGModConsole.Log("Part of the path to " + folder + " is missing!"); return; } Dictionary<string, Texture2D> dictionary = new Dictionary<string, Texture2D>(); Dictionary<string, Dictionary<string, Texture2D>> dictionary2 = new Dictionary<string, Dictionary<string, Texture2D>>(); Dictionary<string, Dictionary<string, AssetSpriteData>> dictionary3 = new Dictionary<string, Dictionary<string, AssetSpriteData>>(); string[] files = Directory.GetFiles(folder, "*.png"); foreach (string path in files) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); try { ImageConversion.LoadImage(val, File.ReadAllBytes(path)); } catch { } ((Texture)val).filterMode = (FilterMode)0; dictionary[fileNameWithoutExtension] = val; } files = Directory.GetDirectories(folder); foreach (string path2 in files) { string fileName = Path.GetFileName(path2); string[] files2 = Directory.GetFiles(path2, "*.png"); IEnumerable<string> enumerable = Directory.GetFiles(path2, "*.json").Concat(Directory.GetFiles(path2, "*.jtk2d")); string[] array = files2; foreach (string path3 in array) { if (!dictionary2.TryGetValue(fileName, out var value)) { value = (dictionary2[fileName] = new Dictionary<string, Texture2D>()); } string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(path3); Texture2D val2 = new Texture2D(1, 1, (TextureFormat)4, false); try { ImageConversion.LoadImage(val2, File.ReadAllBytes(path3)); } catch { } value[fileNameWithoutExtension2] = val2; } foreach (string item in enumerable) { if (!dictionary3.TryGetValue(fileName, out var value2)) { value2 = (dictionary3[fileName] = new Dictionary<string, AssetSpriteData>()); } using FileStream stream = File.OpenRead(item); string fileNameWithoutExtension3 = Path.GetFileNameWithoutExtension(item); try { value2[fileNameWithoutExtension3] = JSONHelper.ReadJSON<AssetSpriteData>(stream); } catch { ETGModConsole.Log("Error: invalid json at path " + item); } } } SetupSprites(dictionary, dictionary2, dictionary3); processedFolders.Add(folder); } public static void SetupSpritesFromAssembly(Assembly asmb, string path) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown if ((object)asmb == null) { return; } path = path.Replace("/", ".").Replace("\\", "."); if (!path.EndsWith(".")) { path += "."; } Dictionary<string, Texture2D> dictionary = new Dictionary<string, Texture2D>(); Dictionary<string, Dictionary<string, Texture2D>> dictionary2 = new Dictionary<string, Dictionary<string, Texture2D>>(); Dictionary<string, Dictionary<string, AssetSpriteData>> dictionary3 = new Dictionary<string, Dictionary<string, AssetSpriteData>>(); string[] manifestResourceNames = asmb.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.StartsWith(path) || text.Length <= path.Length) { continue; } string[] array = text.Substring(path.Length).Split(new char[1] { '.' }); if (array.Length == 3) { string key = array[0]; string key2 = array[1]; string text2 = array[2]; if (text2.ToLowerInvariant() == "png") { using Stream stream = asmb.GetManifestResourceStream(text); Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); try { byte[] array2 = new byte[stream.Length]; stream.Read(array2, 0, array2.Length); ImageConversion.LoadImage(val, array2); } catch { } ((Texture)val).filterMode = (FilterMode)0; if (!dictionary2.TryGetValue(key, out var value) || value == null) { value = (dictionary2[key] = new Dictionary<string, Texture2D>()); } value[key2] = val; } else { if (!(text2.ToLowerInvariant() == "json") && !(text2.ToLowerInvariant() == "jtk2d")) { continue; } using Stream stream2 = asmb.GetManifestResourceStream(text); if (!dictionary3.TryGetValue(key, out var value2) || value2 == null) { value2 = (dictionary3[key] = new Dictionary<string, AssetSpriteData>()); } try { value2[key2] = JSONHelper.ReadJSON<AssetSpriteData>(stream2); } catch { ETGModConsole.Log("Error: invalid json at project path " + text); } } } else { if (array.Length != 2) { continue; } string key3 = array[0]; if (array[1].ToLowerInvariant() != "png") { continue; } using Stream stream3 = asmb.GetManifestResourceStream(text); Texture2D val2 = new Texture2D(1, 1, (TextureFormat)4, false); try { byte[] array3 = new byte[stream3.Length]; stream3.Read(array3, 0, array3.Length); ImageConversion.LoadImage(val2, array3); } catch { } ((Texture)val2).filterMode = (FilterMode)0; dictionary[key3] = val2; } } SetupSprites(dictionary, dictionary2, dictionary3); } public static void ReplaceTexture(tk2dSpriteDefinition frame, Texture2D replacement, bool pack = true) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) RuntimeAtlasSegment runtimeAtlasSegment = Packer.Pack(replacement); if (runtimeAtlasSegment != null) { frame.flipped = (FlipMode)0; frame.materialInst = new Material(frame.material); frame.texelSize = ((Texture)replacement).texelSize; frame.extractRegion = true; frame.materialInst.mainTexture = (Texture)(object)runtimeAtlasSegment.texture; frame.uvs = runtimeAtlasSegment.uvs; } } } internal class GlobalCRRunner : MonoBehaviour { } public static class Databases { public static readonly ItemDB Items = new ItemDB(); public static readonly StringDB Strings = new StringDB(); } public static class AIActor { public static Action<AIActor> OnPreStart; public static Action<AIActor> OnPostStart; public static Action<AIActor> OnBlackPhantomnessCheck; } public static class Chest { public delegate bool DOnPreOpen(bool shouldOpen, Chest chest, PlayerController player); public static Action<Chest> OnPostSpawn; public static DOnPreOpen OnPreOpen; public static Action<Chest, PlayerController> OnPostOpen; } public static readonly Action<Coroutine> StopGlobalCoroutine = delegate(Coroutine x) { ((MonoBehaviour)GameObjectExtensions.GetOrAddComponent<GlobalCRRunner>(Chainloader.ManagerObject)).StopCoroutine(x); }; public static readonly Func<IEnumerator, Coroutine> StartGlobalCoroutine = (IEnumerator x) => ((MonoBehaviour)GameObjectExtensions.GetOrAddComponent<GlobalCRRunner>(Chainloader.ManagerObject)).StartCoroutine(x); private static readonly long _DoubleNegativeZero = BitConverter.DoubleToInt64Bits(-0.0); public static string ResourcesDirectory { get { string text = Path.Combine(Paths.GameRootPath, "Resources"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } return text; } } public static string SpriteReplacementDirectory { get { string text = Path.Combine(ResourcesDirectory, "SpriteReplacement"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } return text; } } public static string FolderPath(this BaseUnityPlugin plug) { if ((Object)(object)plug == (Object)null || plug.Info == null || plug.Info.Location == null) { return ""; } return Path.GetDirectoryName(plug.Info.Location); } public static void ReplaceTexture(this tk2dSpriteDefinition frame, Texture2D replacement, bool pack = true) { Assets.ReplaceTexture(frame, replacement); } public static T RunHook<T>(this MulticastDelegate md, T val, params object[] args) { if ((object)md == null) { return val; } object[] array = new object[args.Length + 1]; array[0] = val; Array.Copy(args, 0, array, 1, args.Length); Delegate[] invocationList = md.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { array[0] = invocationList[i].DynamicInvoke(array); } return (T)array[0]; } public static string ToStringSafe(this object o) { if (o != null) { if (!(o is string result)) { return o.ToString(); } return result; } return string.Empty; } public static string RemoveUnacceptableCharactersForEnum(this string str) { return str?.Replace("\"", "").Replace("\\", "").Replace(" ", "") .Replace("-", "_") .Replace("\n", ""); } public static string RemoveUnacceptableCharactersForGUID(this string str) { return str?.Replace("\"", "").Replace("\\", "").Replace("\n", ""); } public static string ToID(this string str) { return str.ToLowerInvariant().Replace("\n", "").Replace("\\", "") .Replace("\"", "") .Replace(" ", "_") .Replace(".", "") .Replace("-", ""); } public static bool IsNegativeZero(this double d) { return BitConverter.DoubleToInt64Bits(d) == _DoubleNegativeZero; } public static bool IsNegativeZero(this float f) { return BitConverter.DoubleToInt64Bits(f) == _DoubleNegativeZero; } public static int Count(this string @in, char c) { int num = 0; for (int i = 0; i < @in.Length; i++) { if (@in[i] == c) { num++; } } return num; } internal static bool ContainsWhitespace(this string s) { if (string.IsNullOrEmpty(s)) { return false; } for (int i = 0; i < s.Length; i++) { if (char.IsWhiteSpace(s[i])) { return true; } } return false; } public static T GetFirst<T>(this IEnumerable<T> e) { using (IEnumerator<T> enumerator = e.GetEnumerator()) { if (enumerator.MoveNext()) { return enumerator.Current; } } return default(T); } public static string ToTitleCaseInvariant(this string s) { return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(s); } public static string ToStringInvariant(this float o) { return o.ToString(CultureInfo.InvariantCulture); } public static string RemovePrefix(this string str, string prefix) { if (!str.StartsWithInvariant(prefix)) { return str; } return str.Substring(prefix.Length); } public static string RemoveSuffix(this string str, string suffix) { if (!str.StartsWithInvariant(suffix)) { return str; } return str.Substring(0, suffix.Length - suffix.Length); } public static int IndexOfInvariant(this string s, string a) { return s.IndexOf(a, StringComparison.InvariantCulture); } public static int IndexOfInvariant(this string s, string a, int i) { return s.IndexOf(a, i, StringComparison.InvariantCulture); } public static int LastIndexOfInvariant(this string s, string a) { return s.LastIndexOf(a, StringComparison.InvariantCulture); } public static int LastIndexOfInvariant(this string s, string a, int i) { return s.LastIndexOf(a, i, StringComparison.InvariantCulture); } public static bool StartsWithInvariant(this string s, string a) { return s.StartsWith(a, StringComparison.InvariantCulture); } public static bool EndsWithInvariant(this string s, string a) { return s.EndsWith(a, StringComparison.InvariantCulture); } public static string Combine(this IList<string> sa, string c) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < sa.Count; i++) { stringBuilder.Append(sa[i]); if (i < sa.Count - 1) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } public static string CombineReversed(this IList<string> sa, string c) { StringBuilder stringBuilder = new StringBuilder(); int num = sa.Count - 1; while (0 <= num) { stringBuilder.Append(sa[num]); if (0 < num) { stringBuilder.Append(c); } num--; } return stringBuilder.ToString(); } public static Type GetValueType(this MemberInfo info) { if (info is FieldInfo) { return ((FieldInfo)info).FieldType; } if (info is PropertyInfo) { return ((PropertyInfo)info).PropertyType; } if (info is MethodInfo) { return ((MethodInfo)info).ReturnType; } return null; } public static T AtOr<T>(this T[] a, int i, T or) { if (i < 0 || a.Length <= i) { return or; } return a[i]; } public static void AddRange(this IDictionary to, IDictionary from) { foreach (DictionaryEntry item in from) { to.Add(item.Key, item.Value); } } public static void SetRange(this IDictionary to, IDictionary from) { foreach (DictionaryEntry item in from) { to[item.Key] = item.Value; } } public static void ForEach<T>(this BindingList<T> list, Action<T> a) { for (int i = 0; i < list.Count; i++) { a(list[i]); } } public static void AddRange<T>(this BindingList<T> list, BindingList<T> other) { for (int i = 0; i < other.Count; i++) { list.Add(other[i]); } } public static int IndexOf(this object[] array, object elem) { for (int i = 0; i < array.Length; i++) { if (array[i] == elem) { return i; } } return -1; } public static Texture2D Copy(this Texture2D texture, TextureFormat? format = 5) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown if ((Object)(object)texture == (Object)null) { return null; } RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)0); Graphics.Blit((Texture)(object)texture, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Texture2D val = new Texture2D(((Texture)texture).width, ((Texture)texture).height, format.HasValue ? format.Value : texture.format, 1 < texture.mipmapCount) { name = ((Object)texture).name }; val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0); val.Apply(true, false); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); return val; } public static Texture2D GetRW(this Texture2D texture) { if ((Object)(object)texture == (Object)null) { return null; } if (texture.IsReadable()) { return texture; } return texture.Copy((TextureFormat)5); } public static bool IsReadable(this Texture2D texture) { try { texture.GetPixels(); return true; } catch { return false; } } public static Type GetListType(this Type list) { if (list.IsArray) { return list.GetElementType(); } Type[] interfaces = list.GetInterfaces(); foreach (Type type in interfaces) { if (type.IsGenericType && (object)type.GetGenericTypeDefinition() == typeof(IList<>)) { return list.GetGenericArguments()[0]; } } return null; } public static string GetPath(this Transform t) { List<string> list = new List<string>(); do { list.Add(((Object)t).name); } while ((Object)(object)(t = t.parent) != (Object)null); return list.CombineReversed("/"); } public static GameObject AddChild(this GameObject go, string name, params Type[] components) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GameObject val = new GameObject(name, components); val.transform.SetParent(go.transform); val.transform.SetAsLastSibling(); return val; } public static tk2dBaseSprite GetAnySprite(this BraveBehaviour b) { return ((Component)b).GetComponent<tk2dBaseSprite>() ?? ((Component)b.transform).GetComponentInChildren<tk2dBaseSprite>() ?? ((Component)b.transform).GetComponentInParent<tk2dBaseSprite>(); } public static Coroutine StartGlobal(this IEnumerator c) { if (c == null) { return null; } return StartGlobalCoroutine(c); } public static void StopGlobal(this Coroutine c) { if (c != null) { StopGlobalCoroutine(c); } } } public class AssetDirectory { private AssetDirectory() { } } public struct AssetSpriteData { public string name; public int x; public int y; public int width; public int height; public int flip; public AttachPoint[] attachPoints; public static void ToTK2D(List<AssetSpriteData> list, out string[] names, out Rect[] regions, out Vector2[] anchors, out AttachPoint[][] attachPoints) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) names = new string[list.Count]; regions = (Rect[])(object)new Rect[list.Count]; anchors = (Vector2[])(object)new Vector2[list.Count]; attachPoints = new AttachPoint[list.Count][]; for (int i = 0; i < list.Count; i++) { AssetSpriteData assetSpriteData = list[i]; names[i] = assetSpriteData.name; regions[i] = new Rect((float)assetSpriteData.x, (float)assetSpriteData.y, (float)assetSpriteData.width, (float)assetSpriteData.height); anchors[i] = new Vector2((float)assetSpriteData.width / 2f, (float)assetSpriteData.height / 2f); attachPoints[i] = assetSpriteData.attachPoints; } } public static List<AssetSpriteData> FromTK2D(tk2dSpriteCollectionData sprites) { List<AssetSpriteData> list = new List<AssetSpriteData>(sprites.spriteDefinitions.Length); for (int i = 0; i < sprites.spriteDefinitions.Length; i++) { tk2dSpriteDefinition frame = sprites.spriteDefinitions[i]; list.Add(FromTK2D(sprites, frame)); } return list; } public static AssetSpriteData FromTK2D(tk2dSpriteCollectionData sprites, tk2dSpriteDefinition frame, bool separate = false) { Material obj = sprites.materials[0]; AssetSpriteData result; if ((Object)(object)((obj != null) ? obj.mainTexture : null) == (Object)null) { result = default(AssetSpriteData); result.name = (separate ? "INCOMPLETE" : (frame.name + "_INCOMPLETE")); return result; } int num = sprites.materials[0].mainTexture.width; int num2 = sprites.materials[0].mainTexture.height; result = default(AssetSpriteData); result.name = (separate ? null : frame.name); result.x = ((!separate) ? ((int)Math.Floor((float)num * frame.uvs[0].x)) : 0); result.y = ((!separate) ? ((int)Math.Floor((float)num2 * frame.uvs[0].y)) : 0); result.width = (int)Math.Ceiling((float)num * (frame.uvs[3].x - frame.uvs[0].x)); result.height = (int)Math.Ceiling((float)num2 * (frame.uvs[3].y - frame.uvs[0].y)); result.flip = ((frame.uvs[0].x == frame.uvs[1].x) ? 1 : 0); object[] spriteDefinitions = sprites.spriteDefinitions; result.attachPoints = (AttachPoint[])(((object)sprites.GetAttachPoints(spriteDefinitions.IndexOf(frame))) ?? ((object)new AttachPoint[0])); return result; } } public class JSONAttachPointRule : JSONValueTypeBaseRule<AttachPoint> { } public class RuntimeAtlasPacker { public List<RuntimeAtlasPage> Pages = new List<RuntimeAtlasPage>(); public int Width; public int Height; public TextureFormat Format; public int Padding; public Action<RuntimeAtlasPage> OnNewPage; public RuntimeAtlasPacker(int width = 0, int height = 0, TextureFormat format = 4, int padding = 2) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (width == 0) { width = RuntimeAtlasPage.DefaultSize; } if (height == 0) { height = RuntimeAtlasPage.DefaultSize; } Width = width; Height = height; Format = format; Padding = padding; } public RuntimeAtlasSegment Pack(Texture2D tex, bool apply = false) { int num = Padding * 2; if (((Texture)tex).width + num > RuntimeAtlasPage.DefaultSize || ((Texture)tex).height + num > RuntimeAtlasPage.DefaultSize) { int num2 = NextPowerOfTwo(Mathf.Max(((Texture)tex).width, ((Texture)tex).height) + num); if (num2 <= 0) { return null; } return CustomNewPage(num2, num2).Pack(tex, apply); } for (int i = 0; i < Pages.Count; i++) { RuntimeAtlasSegment result; if ((result = Pages[i].Pack(tex, apply)) != null) { return result; } } return NewPage().Pack(tex, apply); } private static int NextPowerOfTwo(int i) { if (i > 65535) { return 0; } int num; for (num = RuntimeAtlasPage.DefaultSize * 2; num < i; num *= 2) { } return num; } public RuntimeAtlasPage NewPage() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) RuntimeAtlasPage runtimeAtlasPage = new RuntimeAtlasPage(Width, Height, Format, Padding); Pages.Add(runtimeAtlasPage); OnNewPage?.Invoke(runtimeAtlasPage); return runtimeAtlasPage; } public RuntimeAtlasPage CustomNewPage(int width, int height) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) RuntimeAtlasPage runtimeAtlasPage = new RuntimeAtlasPage(width, height, Format, Padding); Pages.Add(runtimeAtlasPage); OnNewPage?.Invoke(runtimeAtlasPage); return runtimeAtlasPage; } public void Apply() { for (int i = 0; i < Pages.Count; i++) { Pages[i].Apply(); } } public bool IsPageTexture(Texture2D tex) { return IsPageTexture((Texture)(object)tex); } internal bool IsPageTexture(Texture tex) { for (int i = 0; i < Pages.Count; i++) { if (Pages[i].Texture == tex) { return true; } } return false; } } public class RuntimeAtlasPage { public static int DefaultSize = Math.Min(SystemInfo.maxTextureSize, 1024); public List<RuntimeAtlasSegment> Segments = new List<RuntimeAtlasSegment>(); public Texture2D Texture; public int Padding; protected Rect _MainRect; protected List<Rect> _Rects = new List<Rect>(); protected int _Changes; private static readonly int BlockSize = 128; private static readonly Color32[] DefaultBlock = CreateDefaultBlock(); private static readonly Color32 Default = new Color32((byte)0, (byte)0, (byte)0, (byte)0); private float _startingX; private float _currentY; private float _nextYLine; public RuntimeAtlasPage(int width = 0, int height = 0, TextureFormat format = 4, int padding = 2) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (width == 0) { width = DefaultSize; } if (height == 0) { height = DefaultSize; } Texture = new Texture2D(width, height, format, false); ((Texture)Texture).wrapMode = (TextureWrapMode)1; ((Texture)Texture).filterMode = (FilterMode)0; ((Texture)Texture).anisoLevel = 0; for (int i = 0; i < height; i += BlockSize) { for (int j = 0; j < width; j += BlockSize) { Texture.SetPixels32(j, i, BlockSize, BlockSize, DefaultBlock); } } _MainRect = new Rect(0f, 0f, (float)width, (float)height); Padding = padding; } public RuntimeAtlasSegment Pack(Texture2D tex, bool apply = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val)).Set(_startingX + (float)Padding, _currentY + (float)Padding, (float)(((Texture)tex).width + Padding), (float)(((Texture)tex).height + Padding)); if (dfRectExtensions.Contains(_MainRect, val)) { _startingX = ((Rect)(ref val)).xMax; _nextYLine = Math.Max(((Rect)(ref val)).yMax, _nextYLine); } else { _startingX = 0f; _currentY = _nextYLine; ((Rect)(ref val)).Set(_startingX + (float)Padding, _currentY + (float)Padding, (float)(((Texture)tex).width + Padding), (float)(((Texture)tex).height + Padding)); if (!dfRectExtensions.Contains(_MainRect, val)) { return null; } _startingX = ((Rect)(ref val)).xMax; _nextYLine = Math.Max(((Rect)(ref val)).yMax, _nextYLine); } _Rects.Add(val); RuntimeAtlasSegment runtimeAtlasSegment = new RuntimeAtlasSegment { texture = Texture, x = Mathf.RoundToInt(((Rect)(ref val)).x), y = Mathf.RoundToInt(((Rect)(ref val)).y), width = ((Texture)tex).width, height = ((Texture)tex).height }; Segments.Add(runtimeAtlasSegment); Texture.SetPixels32(runtimeAtlasSegment.x, runtimeAtlasSegment.y, runtimeAtlasSegment.width, runtimeAtlasSegment.height, tex.GetPixels32()); _Changes++; if (apply) { Apply(); } return runtimeAtlasSegment; } public void Apply() { if (_Changes != 0) { _Changes = 0; Texture.Apply(false, false); } } private static Color32[] CreateDefaultBlock() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Color32[] array = (Color32[])(object)new Color32[BlockSize * BlockSize]; for (int i = 0; i < array.Length; i++) { array[i] = Default; } return array; } } public class RuntimeAtlasSegment { public Texture2D texture; public int x; public int y; public int width; public int height; public Vector2[] uvs => ETGMod.Assets.GenerateUVs(texture, x, y, width, height); } [HarmonyPatch] public static class ETGModCompatibility { private static readonly Dictionary<Type, Dictionary<GuidInfo, int>> extendedEnums = new Dictionary<Type, Dictionary<GuidInfo, int>>(); private static readonly Dictionary<string, Dictionary<string, object>> sharedData = new Dictionary<string, Dictionary<string, object>>(); public static T ExtendEnum<T>(string guid, string name) where T : Enum { return (T)ExtendEnum(guid, name, typeof(T)); } public static object ExtendEnum(string guid, string name, Type t) { if (!t.IsEnum) { return 0; } ETGModMainBehaviour.EnsureHarmonyInitialized(); if (!extendedEnums.TryGetValue(t, out var value)) { value = (extendedEnums[t] = new Dictionary<GuidInfo, int>()); } name = name.RemoveUnacceptableCharactersForEnum().Replace(".", ""); guid = guid.RemoveUnacceptableCharactersForEnum(); GuidInfo ginfo = new GuidInfo(guid, name); IEnumerable<KeyValuePair<GuidInfo, int>> source = value.Where((KeyValuePair<GuidInfo, int> x) => x.Key.guid == ginfo.guid && x.Key.info == ginfo.info); KeyValuePair<GuidInfo, int>? keyValuePair = null; if (source.Count() > 0) { keyValuePair = source.FirstOrDefault(); } if (keyValuePair.HasValue) { return keyValuePair.GetValueOrDefault().Value; } int num = 0; try { num = Enum.GetValues(t).Cast<int>().Max(); } catch { } int num2 = 0; num2 = ((!t.IsDefined(typeof(FlagsAttribute), inherit: false)) ? (num + 1) : ((num == 0) ? 1 : (num * 2))); value.Add(ginfo, num2); return num2; } [HarmonyPatch(typeof(GameStatsManager), "GetPlayerStatValue")] [HarmonyPrefix] private static bool FixCharacterCountTracked(GameStatsManager __instance, out float __result, TrackedStats stat) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) __result = 0f; if (__instance.m_sessionStats != null) { __result += __instance.m_sessionStats.GetStatValue(stat); } foreach (GameStats value in __instance.m_characterStats.Values) { __result += value.GetStatValue(stat); } return false; } [HarmonyPatch(typeof(GameStatsManager), "GetPlayerMaximum")] [HarmonyPrefix] private static bool FixCharacterCountMaximum(GameStatsManager __instance, out float __result, TrackedMaximums stat) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) __result = 0f; if (__instance.m_sessionStats != null) { __result = Mathf.Max(new float[3] { __result, __instance.m_sessionStats.GetMaximumValue(stat), __instance.m_savedSessionStats.GetMaximumValue(stat) }); } foreach (GameStats value in __instance.m_characterStats.Values) { __result = Mathf.Max(__result, value.GetMaximumValue(stat)); } return false; } [HarmonyPatch(typeof(GameStatsManager), "Save")] [HarmonyPrefix] private static void RemoveAndSaveExtendedEnums() { //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected I4, but got Unknown //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) if (extendedEnums != null && GameStatsManager.m_instance != null) { ExtendedEnumCache instance2 = ExtendedEnumCache.Instance; GameStatsManager instance = GameStatsManager.m_instance; instance2.extendedFlags.Clear(); instance2.extendedValidTilesets.Clear(); instance2.extendedPlayersTrackedStats.Clear(); instance2.extendedPlayersTrackedMaximums.Clear(); instance2.extendedPlayersCharacterFlags.Clear(); if (extendedEnums.ContainsKey(typeof(GungeonFlags)) && extendedEnums[typeof(GungeonFlags)] != null) { (instance2.extendedFlags = instance.m_flags.Where((GungeonFlags x) => extendedEnums[typeof(GungeonFlags)].ContainsValue((int)x)).ToList()).ForEach(delegate(GungeonFlags x) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) instance.m_flags.Remove(x); }); } bool num = extendedEnums.ContainsKey(typeof(PlayableCharacters)) && extendedEnums[typeof(PlayableCharacters)] != null; bool flag = extendedEnums.ContainsKey(typeof(TrackedStats)) && extendedEnums[typeof(TrackedStats)] != null; bool flag2 = extendedEnums.ContainsKey(typeof(TrackedMaximums)) && extendedEnums[typeof(TrackedMaximums)] != null; bool flag3 = extendedEnums.ContainsKey(typeof(CharacterSpecificGungeonFlags)) && extendedEnums[typeof(CharacterSpecificGungeonFlags)] != null; if (num || flag || flag2 || flag3) { List<PlayableCharacters> list = new List<PlayableCharacters>(); foreach (KeyValuePair<PlayableCharacters, GameStats> kvp in instance.m_characterStats) { if (kvp.Value != null && extendedEnums[typeof(PlayableCharacters)].ContainsValue((int)kvp.Key)) { list.Add(kvp.Key); instance2.extendedPlayersTrackedStats[kvp.Key] = new List<KeyValuePair<TrackedStats, float>>(kvp.Value.stats); instance2.extendedPlayersTrackedMaximums[kvp.Key] = new List<KeyValuePair<TrackedMaximums, float>>(kvp.Value.maxima); instance2.extendedPlayersCharacterFlags[kvp.Key] = new List<CharacterSpecificGungeonFlags>(kvp.Value.m_flags); continue; } if (flag) { List<KeyValuePair<TrackedStats, float>> list3 = (instance2.extendedPlayersTrackedStats[kvp.Key] = kvp.Value.stats.Where((KeyValuePair<TrackedStats, float> x) => extendedEnums[typeof(TrackedStats)].ContainsValue((int)x.Key)).ToList()); CollectionExtensions.Do<KeyValuePair<TrackedStats, float>>((IEnumerable<KeyValuePair<TrackedStats, float>>)list3, (Action<KeyValuePair<TrackedStats, float>>)delegate(KeyValuePair<TrackedStats, float> x) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) kvp.Value.stats.Remove(x.Key); }); } if (flag2) { List<KeyValuePair<TrackedMaximums, float>> list5 = (instance2.extendedPlayersTrackedMaximums[kvp.Key] = kvp.Value.maxima.Where((KeyValuePair<TrackedMaximums, float> x) => extendedEnums[typeof(TrackedMaximums)].ContainsValue((int)x.Key)).ToList()); CollectionExtensions.Do<KeyValuePair<TrackedMaximums, float>>((IEnumerable<KeyValuePair<TrackedMaximums, float>>)list5, (Action<KeyValuePair<TrackedMaximums, float>>)delegate(KeyValuePair<TrackedMaximums, float> x) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) kvp.Value.maxima.Remove(x.Key); }); } if (flag3) { List<CharacterSpecificGungeonFlags> list7 = (instance2.extendedPlayersCharacterFlags[kvp.Key] = kvp.Value.m_flags.Where((CharacterSpecificGungeonFlags x) => extendedEnums[typeof(CharacterSpecificGungeonFlags)].ContainsValue((int)x)).ToList()); CollectionExtensions.Do<CharacterSpecificGungeonFlags>((IEnumerable<CharacterSpecificGungeonFlags>)list7, (Action<CharacterSpecificGungeonFlags>)delegate(CharacterSpecificGungeonFlags x) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) kvp.Value.m_flags.Remove(x); }); } } CollectionExtensions.Do<PlayableCharacters>((IEnumerable<PlayableCharacters>)list, (Action<PlayableCharacters>)delegate(PlayableCharacters x) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) instance.m_characterStats.Remove(x); }); } if (extendedEnums.ContainsKey(typeof(ValidTilesets)) && extendedEnums[typeof(ValidTilesets)] != null) { (instance2.extendedValidTilesets = instance.LastBossEncounteredMap.Where((KeyValuePair<ValidTilesets, string> x) => extendedEnums[typeof(ValidTilesets)].ContainsValue((int)x.Key)).ToList()).ForEach(delegate(KeyValuePair<ValidTilesets, string> x) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) instance.LastBossEncounteredMap.Remove(x.Key); }); } ExtendedEnumCache.Save(); } SaveManager.GameSave.encrypted = false; } [HarmonyPatch(typeof(GameStatsManager), "Save")] [HarmonyPatch(typeof(GameStatsManager), "Load")] [HarmonyPostfix] private static void AddBackExtendedEnums() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) if (GameStatsManager.m_instance == null) { return; } ExtendedEnumCache instance2 = ExtendedEnumCache.Instance; GameStatsManager instance = GameStatsManager.m_instance; instance2.extendedFlags.ForEach(delegate(GungeonFlags x) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) instance.m_flags.Add(x); }); foreach (KeyValuePair<PlayableCharacters, List<KeyValuePair<TrackedStats, float>>> extendedPlayersTrackedStat in instance2.extendedPlayersTrackedStats) { if (!instance.m_characterStats.ContainsKey(extendedPlayersTrackedStat.Key) || instance.m_characterStats[extendedPlayersTrackedStat.Key] == null) { instance.m_characterStats[extendedPlayersTrackedStat.Key] = new GameStats(); } foreach (KeyValuePair<TrackedStats, float> item in extendedPlayersTrackedStat.Value) { instance.m_characterStats[extendedPlayersTrackedStat.Key].stats[item.Key] = item.Value; } } foreach (KeyValuePair<PlayableCharacters, List<KeyValuePair<TrackedMaximums, float>>> extendedPlayersTrackedMaximum in instance2.extendedPlayersTrackedMaximums) { if (!instance.m_characterStats.ContainsKey(extendedPlayersTrackedMaximum.Key) || instance.m_characterStats[extendedPlayersTrackedMaximum.Key] == null) { instance.m_characterStats[extendedPlayersTrackedMaximum.Key] = new GameStats(); } foreach (KeyValuePair<TrackedMaximums, float> item2 in extendedPlayersTrackedMaximum.Value) { instance.m_characterStats[extendedPlayersTrackedMaximum.Key].maxima[item2.Key] = item2.Value; } } foreach (KeyValuePair<PlayableCharacters, List<CharacterSpecificGungeonFlags>> extendedPlayersCharacterFlag in instance2.extendedPlayersCharacterFlags) { if (!instance.m_characterStats.ContainsKey(extendedPlayersCharacterFlag.Key) || instance.m_characterStats[extendedPlayersCharacterFlag.Key] == null) { instance.m_characterStats[extendedPlayersCharacterFlag.Key] = new GameStats(); } foreach (CharacterSpecificGungeonFlags item3 in extendedPlayersCharacterFlag.Value) { instance.m_characterStats[extendedPlayersCharacterFlag.Key].m_flags.Add(item3); } } foreach (KeyValuePair<ValidTilesets, string> extendedValidTileset in instance2.extendedValidTilesets) { instance.LastBossEncounteredMap[extendedValidTileset.Key] = extendedValidTileset.Value; } } [HarmonyPatch(typeof(fsEnumConverter), "TryDeserialize")] [HarmonyPostfix] private static void FixEnumConverter(ref fsResult __result, fsData data, ref object instance, Type storageType) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (__result._success || !data.IsString) { return; } string[] array = data.AsString.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); long num = 0L; string[] array2 = array; foreach (string text in array2) { if (!fsEnumConverter.ArrayContains<string>(Enum.GetNames(storageType), text)) { string[] source = text.Split(new char[1] { '.' }); if (source.Count() <= 3) { return; } string guid = string.Join(".", source.Take(3).ToArray()); string name = string.Join(".", source.Skip(3).ToArray()); ExtendEnum(guid, name, storageType); } long num2 = (long)Convert.ChangeType(Enum.Parse(storageType, text), typeof(long)); num |= num2; } instance = Enum.ToObject(storageType, num); __result = fsResult.Success; } [HarmonyPatch(typeof(Enum), "GetValues")] [HarmonyPostfix] private static void AddNewValues(ref Array __result, Type enumType) { if (__result == null || extendedEnums == null || !extendedEnums.ContainsKey(enumType)) { return; } List<object> list = new List<object>(); foreach (object item in __result) { list.Add(item); } list.AddRange(extendedEnums[enumType].Values.Select((int x) => Enum.ToObject(enumType, x))); __result = Array.CreateInstance(enumType, list.Count); for (int i = 0; i < __result.Length; i++) { __result.SetValue(list[i], i); } } [HarmonyPatch(typeof(Enum), "GetNames")] [HarmonyPostfix] private static void AddNewNames(ref string[] __result, Type enumType) { if (__result != null && extendedEnums != null && extendedEnums.ContainsKey(enumType)) { __result = __result.Concat(extendedEnums[enumType].Keys.Select((GuidInfo x) => x.ToString())).ToArray(); } } [HarmonyPatch(typeof(Enum), "GetName")] [HarmonyPostfix] private static void AddName(ref string __result, Type enumType, object value) { if (__result != null || extendedEnums == null || !extendedEnums.ContainsKey(enumType)) { return; } try { int val = (int)value; IEnumerable<KeyValuePair<GuidInfo, int>> source = extendedEnums[enumType].Where((KeyValuePair<GuidInfo, int> x) => x.Value == val); if (source.Count() > 0) { __result = source.FirstOrDefault().Key.ToString(); } } catch { } } [HarmonyPatch(typeof(Enum), "IsDefined")] [HarmonyPostfix] private static void AddDefined(ref bool __result, Type enumType, object value) { if (extendedEnums != null && extendedEnums.ContainsKey(enumType) && !__result) { if ((object)value.GetType() == typeof(string)) { __result = Enum.GetNames(enumType).Contains(value); return; } __result = (int)typeof(Enum).GetMethod("FindPosition", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[2] { value, Enum.GetValues(enumType) }) >= 0; } } [HarmonyPatch(typeof(Enum), "Parse", new Type[] { typeof(Type), typeof(string), typeof(bool) })] [HarmonyFinalizer] private static Exception AddParse(Exception __exception, ref object __result, Type enumType, string value, bool ignoreCase) { if (__exception != null) { if (__result != null || extendedEnums == null || !extendedEnums.ContainsKey(enumType)) { return __exception; } if (__exception is ArgumentException) { if ((object)enumType == null) { return __exception; } if (value == null) { return __exception; } if (!enumType.IsEnum) { return __exception; } value = value.Trim(); if (value.Length == 0) { return __exception; } Array values = Enum.GetValues(enumType); string[] names = Enum.GetNames(enumType); int num = FindName(names, value, ignoreCase); if (num >= 0) { __result = values.GetValue(num); return null; } TypeCode typeCode = ((Enum)values.GetValue(0)).GetTypeCode(); if (value.IndexOf(',') != -1) { string[] array = value.Split(new char[1] { ',' }); ulong num2 = 0uL; for (int i = 0; i < array.Length; i++) { num = FindName(names, array[i].Trim(), ignoreCase); if (num < 0) { throw new ArgumentException("The requested value was not found."); } num2 |= GetValue(values.GetValue(num), typeCode); } __result = Enum.ToObject(enumType, num2); return null; } } return __exception; } return null; } private static int FindName(string[] names, string name, bool ignoreCase) { if (!ignoreCase) { for (int i = 0; i < names.Length; i++) { if (name == names[i]) { return i; } } } else { for (int j = 0; j < names.Length; j++) { if (string.Compare(name, names[j], ignoreCase, CultureInfo.InvariantCulture) == 0) { return j; } } } return -1; } private static ulong GetValue(object value, TypeCode typeCode) { return typeCode switch { TypeCode.SByte => (byte)(sbyte)value, TypeCode.Byte => (byte)value, TypeCode.Int16 => (ushort)(short)value, TypeCode.UInt16 => (ushort)value, TypeCode.Int32 => (ulong)(int)value, TypeCode.UInt32 => (uint)value, TypeCode.Int64 => (ulong)(long)value, TypeCode.UInt64 => (ulong)value, _ => throw new ArgumentException("typeCode is not a valid type code for an Enum"), }; } [HarmonyPatch(typeof(Enum), "FormatFlags")] [HarmonyPostfix] private static void FixFlagFormatting(ref string __result, Type enumType, object value) { if (extendedEnums == null || !extendedEnums.ContainsKey(enumType)) { return; } string text = string.Empty; Array values = Enum.GetValues(enumType); string[] names = Enum.GetNames(enumType); string text2 = value.ToString(); if (text2 == "0") { text = Enum.GetName(enumType, value); if (text == null) { text = text2; } __result = text; return; } switch (((Enum)values.GetValue(0)).GetTypeCode()) { case TypeCode.SByte: { sbyte b = (sbyte)value; for (int num7 = values.Length - 1; num7 >= 0; num7--) { sbyte b2 = (sbyte)values.GetValue(num7); if (b2 != 0 && (b & b2) == b2) { text = names[num7] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; b -= b2; } } if (b != 0) { __result = text2; return; } break; } case TypeCode.Byte: { byte b3 = (byte)value; for (int num8 = values.Length - 1; num8 >= 0; num8--) { byte b4 = (byte)values.GetValue(num8); if (b4 != 0 && (b3 & b4) == b4) { text = names[num8] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; b3 -= b4; } } if (b3 != 0) { __result = text2; return; } break; } case TypeCode.Int16: { short num18 = (short)value; for (int num19 = values.Length - 1; num19 >= 0; num19--) { short num20 = (short)values.GetValue(num19); if (num20 != 0 && (num18 & num20) == num20) { text = names[num19] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; num18 -= num20; } } if (num18 != 0) { __result = text2; return; } break; } case TypeCode.UInt16: { ushort num12 = (ushort)value; for (int num13 = values.Length - 1; num13 >= 0; num13--) { ushort num14 = (ushort)values.GetValue(num13); if (num14 != 0 && (num12 & num14) == num14) { text = names[num13] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; num12 -= num14; } } if (num12 != 0) { __result = text2; return; } break; } case TypeCode.Int32: { int num15 = (int)value; for (int num16 = values.Length - 1; num16 >= 0; num16--) { int num17 = (int)values.GetValue(num16); if (num17 != 0 && (num15 & num17) == num17) { text = names[num16] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; num15 -= num17; } } if (num15 != 0) { __result = text2; return; } break; } case TypeCode.UInt32: { uint num4 = (uint)value; for (int num5 = values.Length - 1; num5 >= 0; num5--) { uint num6 = (uint)values.GetValue(num5); if (num6 != 0 && (num4 & num6) == num6) { text = names[num5] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; num4 -= num6; } } if (num4 != 0) { __result = text2; return; } break; } case TypeCode.Int64: { long num9 = (long)value; for (int num10 = values.Length - 1; num10 >= 0; num10--) { long num11 = (long)values.GetValue(num10); if (num11 != 0L && (num9 & num11) == num11) { text = names[num10] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; num9 -= num11; } } if (num9 != 0L) { __result = text2; return; } break; } case TypeCode.UInt64: { ulong num = (ulong)value; for (int num2 = values.Length - 1; num2 >= 0; num2--) { ulong num3 = (ulong)values.GetValue(num2); if (num3 != 0L && (num & num3) == num3) { text = names[num2] + ((!(text == string.Empty)) ? ", " : string.Empty) + text; num -= num3; } } if (num != 0L) { __result = text2; return; } break; } } if (text == string.Empty) { __result = text2; } else { __result = text; } } public static void SetSharedData(string guid, string name, object value) { if (!sharedData.TryGetValue(guid, out var value2)) { value2 = new Dictionary<string, object>(); sharedData.Add(guid, value2); } if (value2.ContainsKey(name)) { value2[name] = value; } else { value2.Add(name, value); } } public static bool TryGetSharedData<T>(string guid, string name, out T value) { if (!TryGetSharedData(guid, name, out var value2)) { value = default(T); return false; } if (value2 is T val) { value = val; return true; } value = default(T); return false; } public static bool TryGetSharedData(string guid, string name, out object value) { if (sharedData.TryGetValue(guid, out var value2) && value2.TryGetValue(name, out value)) { return true; } value = null; return false; } public static T GetSharedData<T>(string guid, string name) { TryGetSharedData(guid, name, out T value); return value; } public static object GetSharedData(string guid, string name) { TryGetSharedData(guid, name, out var value); return value; } } [fsObject] internal class ExtendedEnumCache { private static ExtendedEnumCache _instance; [fsProperty] public List<GungeonFlags> extendedFlags = new List<GungeonFlags>(); [fsProperty] public List<KeyValuePair<ValidTilesets, string>> extendedValidTilesets = new List<KeyValuePair<ValidTilesets, string>>(); [fsProperty] public Dictionary<PlayableCharacters, List<KeyValuePair<TrackedStats, float>>> extendedPlayersTrackedStats = new Dictionary<PlayableCharacters, List<KeyValuePair<TrackedStats, float>>>(); [fsProperty] public Dictionary<PlayableCharacters, List<KeyValuePair<TrackedMaximums, float>>> extendedPlayersTrackedMaximums = new Dictionary<PlayableCharacters, List<KeyValuePair<TrackedMaximums, float>>>(); [fsProperty] public Dictionary<PlayableCharacters, List<CharacterSpecificGungeonFlags>> extendedPlayersCharacterFlags = new Dictionary<PlayableCharacters, List<CharacterSpecificGungeonFlags>>(); public static SaveType EnumCacheSave = new SaveType { filePattern = "Slot{0}.enumCache", backupCount = 3, backupPattern = "Slot{0}.enumCacheBackup.{1}", backupMinTimeMin = 45 }; public static ExtendedEnumCache Instance => _instance ?? (_instance = Load()); public static ExtendedEnumCache Load() { SaveManager.Init(); if (!SaveManager.Load<ExtendedEnumCache>(EnumCacheSave, ref _instance, true, 0u, (Func<string, uint, string>)null, (SaveSlot?)null)) { _instance = new ExtendedEnumCache(); } return _instance; } public static void Save() { SaveManager.Init(); try { SaveManager.Save<ExtendedEnumCache>(Instance, EnumCacheSave, (GameStatsManager.Instance != null) ? GameStatsManager.Instance.PlaytimeMin : 0, 0u, (SaveSlot?)null); } catch (Exception ex) { Debug.LogError((object)("Failed saving enum cache: " + ex)); } } } public struct GuidInfo { public string guid; public string info; public GuidInfo(string guid, string info) { this.guid = guid; this.info = info; } public override string ToString() { return guid + "." + info; } } [HarmonyPatch] public class ItemDB { public List<PickupObject> ModItems = new List<PickupObject>(); public Dictionary<string, PickupObject> ModItemMap = new Dictionary<string, PickupObject>(); public Dictionary<string, List<WeightedGameObject>> ModLootPerFloor = new Dictionary<string, List<WeightedGameObject>>(); public tk2dSpriteCollectionData WeaponCollection = ETGMod.Assets.Collections.Find((tk2dSpriteCollectionData x) => x.spriteCollectionName == "WeaponCollection"); public tk2dSpriteCollectionData WeaponCollection02 = ETGMod.Assets.Collections.Find((tk2dSpriteCollectionData x) => x.spriteCollectionName == "WeaponCollection02"); public tk2dSpriteCollectionData ProjectileCollection = ETGMod.Assets.Collections.Find((tk2dSpriteCollectionData x) => x.spriteCollectionName == "ProjectileCollection"); public tk2dSpriteCollectionData ItemCollection = ETGMod.Assets.Collections.Find((tk2dSpriteCollectionData x) => x.spriteCollectionName == "ItemCollection"); private Gun _GunGivenPrototype; public PickupObject this[int id] => ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).InternalGetById(id); public PickupObject this[string name] => ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).InternalGetByName(name); public int Count => ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects.Count; public int AddSpecific(bool proxy, PickupObject value, bool dontDestroyOnLoad = false, string floor = "ANY") { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown int count = ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects.Count; ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects.Add(value); ModItems.Add(value); if ((Object)(object)value != (Object)null) { if (dontDestroyOnLoad) { Object.DontDestroyOnLoad((Object)(object)((Component)value).gameObject); } ModItemMap[((Object)value).name] = value; value.PickupObjectId = count; if ((Object)(object)((BraveBehaviour)value).encounterTrackable != (Object)null) { ((BraveBehaviour)value).encounterTrackable.EncounterGuid = ((BraveBehaviour)value).encounterTrackable.EncounterGuid.RemoveUnacceptableCharactersForGUID(); EncounterDatabaseEntry val = new EncounterDatabaseEntry(((BraveBehaviour)value).encounterTrackable); ((AssetBundleDatabaseEntry)val).myGuid = ((BraveBehaviour)value).encounterTrackable.EncounterGuid; if (proxy) { val.ProxyEncounterGuid = ((AssetBundleDatabaseEntry)val).myGuid; } ((AssetBundleDatabaseEntry)val).path = "Assets/Resources/ITEMDB:" + ((Object)value).name + ".prefab"; ((AssetBundleDatabase<EncounterTrackable, EncounterDatabaseEntry>)(object)EncounterDatabase.Instance).Entries.Add(val); } WeightedGameObject val2 = new WeightedGameObject { weight = 1f, additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0] }; val2.SetGameObject(((Component)value).gameObject); if (value is Gun) { GameManager.Instance.RewardManager.GunsLootTable.defaultItemDrops.Add(val2); } else { GameManager.Instance.RewardManager.ItemsLootTable.defaultItemDrops.Add(val2); } if (!ModLootPerFloor.TryGetValue(floor, out var value2)) { value2 = new List<WeightedGameObject>(); } value2.Add(val2); ModLootPerFloor[floor] = value2; } return count; } public int AddSpecific(PickupObject value, bool dontDestroyOnLoad = false, string floor = "ANY") { return AddSpecific(proxy: true, value, dontDestroyOnLoad, floor); } public int Add(PickupObject value, bool updateSpriteCollections = false, string floor = "ANY") { return AddSpecific(value, dontDestroyOnLoad: true, floor); } public int Add(Gun value, tk2dSpriteCollectionData collection = null, string floor = "ANY") { return Add((PickupObject)(object)value, updateSpriteCollections: false, floor); } [HarmonyPatch(typeof(Dungeon), "Start")] [HarmonyPrefix] private static void DungeonStart() { if (ETGMod.Databases.Items?.ModLootPerFloor == null || !GameManager.HasInstance || !((Object)(object)GameManager.Instance.Dungeon != (Object)null) || !((Object)(object)GameManager.Instance.Dungeon.baseChestContents != (Object)null) || GameManager.Instance.Dungeon.baseChestContents.defaultItemDrops == null || GameManager.Instance.Dungeon.baseChestContents.defaultItemDrops.elements == null) { return; } if (ETGMod.Databases.Items.ModLootPerFloor.TryGetValue("ANY", out var value)) { GameManager.Instance.Dungeon.baseChestContents.defaultItemDrops.elements.AddRange(value); } string dungeonFloorName = GameManager.Instance.Dungeon.DungeonFloorName; if (!string.IsNullOrEmpty(dungeonFloorName)) { string text = null; int num = 0; if (dungeonFloorName.StartsWith("#")) { num = 1; } if (dungeonFloorName.Contains("_") && dungeonFloorName.IndexOf('_') - num > 0) { text = dungeonFloorName.Substring(num, dungeonFloorName.IndexOf('_') - num); } else if (dungeonFloorName.Length - num > 0) { text = dungeonFloorName.Substring(num); } if (!string.IsNullOrEmpty(text) && ETGMod.Databases.Items.ModLootPerFloor.TryGetValue(text, out value)) { GameManager.Instance.Dungeon.baseChestContents.defaultItemDrops.elements.AddRange(value); } } } public Gun NewGun(string gunName, string gunNameShort = null) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if ((Object)(object)_GunGivenPrototype == (Object)null) { _GunGivenPrototype = (Gun)ETGMod.Databases.Items["Pea_Shooter"]; ProjectileCollection = ((Component)_GunGivenPrototype.DefaultModule.projectiles[0]).GetComponentInChildren<tk2dBaseSprite>().Collection; } return NewGun(gunName, _GunGivenPrototype, gunNameShort); } public Gun NewGun(string gunName, Gun baseGun, string gunNameShort = null) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (gunNameShort == null) { gunNameShort = gunName.Replace(' ', '_'); } GameObject obj = Object.Instantiate<GameObject>(((Component)baseGun).gameObject); ((Object)obj).name = gunNameShort; Gun component = obj.GetComponent<Gun>(); SetupItem((PickupObject)(object)component, gunName); component.gunName = gunName; component.gunSwitchGroup = gunNameShort; component.modifiedVolley = null; component.singleModule = null; component.RawSourceVolley = ScriptableObject.CreateInstance<ProjectileVolleyData>(); component.Volley.projectiles = new List<ProjectileModule>(); component.SetBaseMaxAmmo(300); component.reloadTime = 0.625f; ((Component)component.barrelOffset).transform.localScale = Vector3.one; Game.Items.Add("outdated_gun_mods:" + gunName.ToID(), (PickupObject)(object)component); return component; } public void SetupItem(PickupObject item, string name) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if ((Object)(object)((BraveBehaviour)item).encounterTrackable == (Object)null) { ((BraveBehaviour)item).encounterTrackable = ((Component)item).gameObject.AddComponent<EncounterTrackable>(); } if (((BraveBehaviour)item).encounterTrackable.journalData == null) { ((BraveBehaviour)item).encounterTrackable.journalData = new JournalEntry(); } ((BraveBehaviour)item).encounterTrackable.EncounterGuid = ((Object)item).name; ((BraveBehaviour)item).encounterTrackable.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; ((BraveBehaviour)item).encounterTrackable.journalData.SuppressKnownState = false; string text = "#" + ((Object)item).name.Replace(" ", "").ToUpperInvariant(); ((BraveBehaviour)item).encounterTrackable.journalData.PrimaryDisplayName = text + "_ENCNAME"; ((BraveBehaviour)item).encounterTrackable.journalData.NotificationPanelDescription = text + "_SHORTDESC"; ((BraveBehaviour)item).encounterTrackable.journalData.AmmonomiconFullEntry = text + "_LONGDESC"; ((BraveBehaviour)item).encounterTrackable.journalData.AmmonomiconSprite = ((Object)item).name.Replace(' ', '_') + "_idle_001"; item.SetName(name); } public PickupObject GetModItemByName(string name) { if (ModItemMap.TryGetValue(name, out var value)) { return value; } return null; } } [HarmonyPatch] public class StringDB { public readonly StringDBTable Core = new StringDBTable(() => StringTableManager.CoreTable); public readonly StringDBTable Items = new StringDBTable(() => StringTableManager.ItemTable); public readonly StringDBTable Enemies = new StringDBTable(() => StringTableManager.EnemyTable); public readonly StringDBTable Intro = new StringDBTable(() => StringTableManager.IntroTable); public readonly StringDBTable Synergy = new StringDBTable(() => SynergyTable); public readonly UIStringDBTable UI = new UIStringDBTable(); public Action<GungeonSupportedLanguages> OnLanguageChanged; public Action<dfLanguageManager, dfLanguageCode> OnUILanguageChanged; public GungeonSupportedLanguages CurrentLanguage { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return GameManager.Options.CurrentLanguage; } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) StringTableManager.SetNewLanguage(value, true); } } public static Dictionary<string, StringCollection> SynergyTable { get { if (StringTableManager.m_synergyTable == null) { StringTableManager.m_synergyTable = StringTableManager.LoadSynergyTable(StringTableManager.m_currentSubDirectory); } if (StringTableManager.m_backupSynergyTable == null) { StringTableManager.m_backupSynergyTable = StringTableManager.LoadSynergyTable("english_items"); } return StringTableManager.m_synergyTable; } } [HarmonyPatch(typeof(StringTableManager), "SetNewLanguage")] [HarmonyPostfix] private static void LanguageChanged(GungeonSupportedLanguages language, bool force) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (force || StringTableManager.CurrentLanguage != language) { ETGMod.Databases.Strings.Core.LanguageChanged(); ETGMod.Databases.Strings.Items.LanguageChanged(); ETGMod.Databases.Strings.Enemies.LanguageChanged(); ETGMod.Databases.Strings.Intro.LanguageChanged(); ETGMod.Databases.Strings.Synergy.LanguageChanged(); ETGMod.Databases.Strings.OnLanguageChanged?.Invoke(ETGMod.Databases.Strings.CurrentLanguage); } } [HarmonyPatch(typeof(dfLanguageManager), "LoadLanguage")] [HarmonyPostfix] private static void UILanguageChanged(dfLanguageManager __instance, dfLanguageCode language, bool forceReload) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) ETGMod.Databases.Strings.UI.LanguageChanged(__instance); ETGMod.Databases.Strings.OnUILanguageChanged?.Invoke(__instance, language); if (forceReload) { dfControl[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<dfControl>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Localize(); } for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].PerformLayout(); componentsInChildren[j].LanguageChanged?.Invoke(componentsInChildren[j]); } } } } public sealed class StringDBTable { private readonly Func<Dictionary<string, StringCollection>> _getTable; private readonly Dictionary<GungeonSupportedLanguages, Dictionary<string, StringCollection>> _changes; private Dictionary<string, StringCollection> _cachedTable; public Dictionary<string, StringCollection> Table => _cachedTable ?? (_cachedTable = _getTable()); public StringCollection this[string key] { get { return Table[key]; } set { this[key, (GungeonSupportedLanguages)0] = value; } } public StringCollection this[string key, GungeonSupportedLanguages lang] { set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (!_changes.TryGetValue(lang, out var value2)) { value2 = (_changes[lang] = new Dictionary<string, StringCollection>()); } value2[key] = value; if ((int)lang == 0 && StringTableManager.CurrentLanguage != lang && _changes.TryGetValue(StringTableManager.CurrentLanguage, out var value3) && value3.ContainsKey(key)) { return; } if ((int)lang != 0) { if (!_changes.TryGetValue((GungeonSupportedLanguages)0, out var value4)) { value4 = (_changes[(GungeonSupportedLanguages)0] = new Dictionary<string, StringCollection>()); } if (!value4.ContainsKey(key)) { value4[key] = value; } else if (StringTableManager.CurrentLanguage != lang && _changes.TryGetValue(StringTableManager.CurrentLanguage, out value3) && value3.ContainsKey(key)) { return; } } Table[key] = value; JournalEntry.ReloadDataSemaphore += 1; } } public StringDBTable(Func<Dictionary<string, StringCollection>> getTable) { _getTable = getTable; _changes = new Dictionary<GungeonSupportedLanguages, Dictionary<string, StringCollection>>(); } public bool ContainsKey(string key) { return Table.ContainsKey(key); } public void Set(string key, string value) { Set((GungeonSupportedLanguages)0, key, value); } public void Set(GungeonSupportedLanguages lang, string key, string value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) SimpleStringCollection val = new SimpleStringCollection(); ((StringCollection)val).AddString(value, 1f); this[key, lang] = (StringCollection)(object)val; } public void SetComplex(string key, params string[] values) { SetComplex((GungeonSupportedLanguages)0, key, values); } public void SetComplex(GungeonSupportedLanguages lang, string key, params string[] values) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) ComplexStringCollection collection = new ComplexStringCollection(); CollectionExtensions.Do<string>((IEnumerable<string>)values, (Action<string>)delegate(string x) { ((StringCollection)collection).AddString(x, 1f); }); this[key, lang] = (StringCollection)(object)collection; } public void SetComplex(string key, params Tuple<string, float>[] values) { SetComplex((GungeonSupportedLanguages)0, key, values); } public void SetComplex(GungeonSupportedLanguages lang, string key, params Tuple<string, float>[] values) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) ComplexStringCollection collection = new ComplexStringCollection(); CollectionExtensions.Do<Tuple<string, float>>((IEnumerable<Tuple<string, float>>)values, (Action<Tuple<string, float>>)delegate(Tuple<string, float> x) { ((StringCollection)collection).AddString(x.First, x.Second); }); this[key, lang] = (StringCollection)(object)collection; } public void LanguageChanged() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) _cachedTable = null; Dictionary<string, StringCollection> table = Table; if (_changes.TryGetValue((GungeonSupportedLanguages)0, out var value)) { foreach (KeyValuePair<string, StringCollection> item in value) { table[item.Key] = item.Value; } } if (!_changes.TryGetValue(StringTableManager.CurrentLanguage, out var value2)) { return; } foreach (KeyValuePair<string, StringCollection> item2 in value2) { table[item2.Key] = item2.Value; } } } public sealed class UIStringDBTable { private readonly Dictionary<dfLanguageCode, Dictionary<string, string>> _changes = new Dictionary<dfLanguageCode, Dictionary<string, string>>(); public void LanguageChanged(dfLanguageManager man) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (_changes.TryGetValue((dfLanguageCode)37, out var value)) { foreach (KeyValuePair<string, string> item in value) { man.strings[item.Key] = item.Value; } } if (!_changes.TryGetValue(man.CurrentLanguage, out var value2)) { return; } foreach (KeyValuePair<string, string> item2 in value2) { man.strings[item2.Key] = item2.Value; } } public void Set(string key, string value) { Set((dfLanguageCode)37, key, value); } public void Set(dfLanguageCode lang, string key, string value) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!_changes.TryGetValue(lang, out var value2)) { value2 = (_changes[lang] = new Dictionary<string, string>()); } value2[key] = value; if ((int)lang != 37) { if (!_changes.TryGetValue((dfLanguageCode)37, out var value3)) { value3 = (_changes[(dfLanguageCode)37] = new Dictionary<string, string>()); } if (!value3.ContainsKey(key)) { value3[key] = value; } } if (dfGUIManager.ActiveManagers == null) { return; } foreach (dfGUIManager activeManager in dfGUIManager.ActiveManagers) { if (!((Object)(object)activeManager == (Object)null)) { dfLanguageManager component = ((Component)activeManager).GetComponent<dfLanguageManager>(); if (!((Object)(object)component == (Object)null) && (component.CurrentLanguage == lang || !_changes.TryGetValue(component.CurrentLanguage, out var value4) || !value4.ContainsKey(key))) { component.strings[key] = value; } } } } } public class AutocompletionSettings { public Func<int, string, string[]> Match; public static bool MatchContains = true; public AutocompletionSettings(Func<string, string[]> match) { Match = (int index, string key) => (index != 0) ? new string[0] : match(key); } public AutocompletionSettings(Func<int, string, string[]> match) { Match = match; } } public static class StringAutocompletionExtensions { public static bool AutocompletionMatch(this string text, string match) { if (AutocompletionSettings.MatchContains) { return text.Contains(match); } return text.StartsWith(match); } } public class ConsoleCommand : ConsoleCommandUnit { private string[] _EmptyStringArray = new string[0]; public ConsoleCommand(Action<string[]> cmdref, AutocompletionSettings autocompletion) { CommandReference = cmdref; Autocompletion = autocompletion; } public ConsoleCommand(Action<string[]> cmdref) { CommandReference = cmdref; Autocompletion = new AutocompletionSettings((string input) => _EmptyStringArray); } } public class ConsoleCommandGroup : ConsoleCommandUnit { public class UnitSearchResult { public int index = -1; public ConsoleCommandUnit unit; public UnitSearchResult(int index, ConsoleCommandUnit unit) { this.index = index; this.unit = unit; } public UnitSearchResult() { } } private Dictionary<string, ConsoleCommand> _Commands = new Dictionary<string, ConsoleCommand>(); private Dictionary<string, ConsoleCommandGroup> _Groups = new Dictionary<string, ConsoleCommandGroup>(); public AutocompletionSettings additionalAutocompletion; private AutocompletionSettings _CreateDefaultAutocompletion() { return new AutocompletionSettings(delegate(string input) { string[] allUnitNames = GetAllUnitNames(); List<string> list = new List<string>(); foreach (string text in allUnitNames) { if (text.StartsWith(input)) { list.Add(text); } } return list.ToArray(); }); } public ConsoleCommandGroup(Action<string[]> cmdref) { Autocompletion = _CreateDefaultAutocompletion(); CommandReference = cmdref; } public ConsoleCommandGroup(Action<string[]> cmdref, AutocompletionSettings additionalautocompletion) { ConsoleCommandGroup consoleCommandGroup = this; Autocompletion = new AutocompletionSettings(delegate(int index, string keyword) { string[] array = additionalautocompletion.Match(index, keyword); string[] array2 = consoleCommandGroup._CreateDefaultAutocompletion().Match(index, keyword); return (array != null) ? array2.Concat(array).ToArray() : array2; }); additionalAutocompletion = additionalautocompletion; CommandReference = cmdref; } public ConsoleCommandGroup() : this(delegate { ETGModConsole.Log("Command group does not have an assigned action"); }) { } public ConsoleCommandGroup AddUnit(string name, ConsoleCommand command) { command.Name = name; _Commands[name] = command; return this; } public ConsoleCommandGroup AddUnit(string name, Action<string[]> action) { ConsoleCommand consoleCommand = new ConsoleCommand(action); consoleCommand.Name = name; _Commands[name] = consoleCommand; return this; } public ConsoleCommandGroup AddUnit(string name, Action<string[]> action, AutocompletionSettings autocompletion) { ConsoleCommand consoleCommand = new ConsoleCommand(action, autocompletion); consoleCommand.Name = name; _Commands[name] = consoleCommand; return this; } public ConsoleCommandGroup AddUnit(string name, ConsoleCommandGroup group) { group.Name = name; _Groups[name] = group; return this; } public ConsoleCommandGroup AddGroup(string name) { AddUnit(name, new ConsoleCommandGroup()); return this; } public ConsoleCommandGroup AddGroup(string name, Action<string[]> action) { AddUnit(name, new ConsoleCommandGroup(action)); return this; } public ConsoleCommandGroup AddGroup(string name, Action<string[]> action, AutocompletionSettings autocompletion) { AddUnit(name, new ConsoleCommandGroup(action, autocompletion)); return this; } public UnitSearchResult SearchUnit(string[] path) { ConsoleCommandGroup consoleCommandGroup = this; UnitSearchResult unitSearchResult = new UnitSearchResult(); for (int i = 0; i < path.Length; i++) { ConsoleCommandGroup group = consoleCommandGroup.GetGroup(path[i]); ConsoleCommand command = consoleCommandGroup.GetCommand(path[i]); if (group != null) { consoleCommandGroup = group; unitSearchResult.index++; } else if (command != null) { unitSearchResult.index++; unitSearchResult.unit = command; return unitSearchResult; } } UnitSearchResult unitSearchResult2 = unitSearchResult; if (unitSearchResult2.unit == null) { unitSearchResult2.unit = consoleCommandGroup; } return unitSearchResult; } public List<List<string>> ConstructPaths() { List<List<string>> list = new List<List<string>>(); foreach (string key in _Commands.Keys) { List<string> list2 = new List<string>(); list2.Add(key); list.Add(list2); } foreach (string key2 in _Groups.Keys) { List<string> list3 = new List<string>(); list3.Add(key2); list.Add(list3); List<List<string>> list4 = _Groups[key2].ConstructPaths(); for (int i = 0; i < list4.Count; i++) { List<string> list5 = new List<string>(); list5.Add(key2); for (int j = 0; j < list4[i].Count; j++) { list5.Add(list4[i][j]); } list.Add(list5); } } return list; } public string[] GetAllUnitNames() { List<string> list = new List<string>(); foreach (string key in _Groups.Keys) { list.Add(key); } foreach (string key2 in _Commands.Keys) { list.Add(key2); } return list.ToArray(); } public ConsoleCommandUnit GetUnit(string[] unit) { return SearchUnit(unit).unit; } public ConsoleCommandGroup GetGroup(string[] unit) { return SearchUnit(unit).unit as ConsoleCommandGroup; } public ConsoleCommandGroup GetGroup(string unit) { if (!_Groups.ContainsKey(unit)) { return null; } return _Groups[unit]; } public ConsoleCommand GetCommand(string[] unit) { return SearchUnit(unit).unit as ConsoleCommand; } public ConsoleCommand GetCommand(string name) { if (!_Commands.ContainsKey(name)) { return null; } return _Commands[name]; } public int GetFirstNonUnitIndexInPath(string[] path) { return SearchUnit(path).index + 1; } } public class ConsoleCommandUnit { public string Name; public Action<string[]> CommandReference; public AutocompletionSettings Autocompletion; public void RunCommand(string[] args) { CommandReference(args); } } public static class PlayerControllerExt { public static bool IsPlaying(this PlayerController player) { if (!((Object)(object)GameManager.Instance.PrimaryPlayer == (Object)(object)player)) { return (Object)(object)GameManager.Instance.SecondaryPlayer == (Object)(object)player; } return true; } public static bool GiveItem(this PlayerController player, string id) { if (!player.IsPlaying()) { throw new Exception("Tried to give item to inactive player controller"); } LootEngine.TryGivePrefabToPlayer(((Component)Game.Items[id]).gameObject, player, false); return true; } } public class ETGModConsole : ETGModMenu { private List<string> lastCommands = new List<string>(); private string lastVal = string.Empty; private int currentCommandIndex = -1; public static readonly Dictionary<string, Chest> ModdedChests = new Dictionary<string, Chest>(); public static readonly Dictionary<string, GameObject> ModdedShrines = new Dictionary<string, GameObject>(); public static readonly Dictionary<string, GameObject> ModdedNPCs = new Dictionary<string, GameObject>(); public static readonly string[] BaseGameChests = new string[15] { "brown", "green", "blue", "red", "black", "synergy", "glitched", "rainbow", "hidden_rainbow", "rainbow_synergy", "rat", "truth", "high_dragunfire", "random", "mirror" }; public static readonly string[] BaseGameShrines = new string[15] { "shrine_ammo", "shrine_beholster", "shrine_blank", "shrine_blood", "shrine_challenge", "shrine_cleanse", "shrine_companion", "shrine_demonface", "shrine_dice", "shrine_fallenangel", "shrine_glass", "shrine_health", "shrine_junk", "shrine_mirror", "shrine_yv" }; public static readonly Dictionary<string, string> BaseGameNPCs = new Dictionary<string, string> { { "bowler", "npc_bowler" }, { "daisuke", "npc_daisuke" }, { "sorceress", "npc_sorceress_gang" }, { "tonic", "npc_tonic" }, { "winchester", "npc_artful_dodger" }, { "frifle_and_grey_mauser", "npc_frifle_and_mauser" }, { "gunsling_king", "npc_gunslingking" }, { "manservantes", "npc_manservantes" }, { "lost_adventurer", "npc_lostadventurer" }, { "old_man", "npc_old_man" }, { "monster_manuel", "npc_monster_manuel" }, { "synergrace", "npc_synergrace" }, { "synerscope_left", "npc_synerscope_left" }, { "synerscope_right", "npc_synerscope_right" }, { "brother_albern", "npc_truth_knower" }, { "witches", "npc_witches" }, { "muncher", "npc_gunbermuncher" }, { "evil_muncher", "npc_gunbermuncher_evil" }, { "vampire", "npc_vampire" } }; public static readonly Dictionary<string, string> DungeonDictionary = new Dictionary<string, string> { { "keep", "tt_castle" }, { "leadlordkeep", "tt_castle" }, { "lead_lord_keep", "tt_castle" }, { "proper", "tt5" }, { "gungeon", "tt5" }, { "gungeonproper", "tt5" }, { "gungeon_proper", "tt5" }, { "mines", "tt_mines" }, { "mine", "tt_mines" }, { "powdermines", "tt_mines" }, { "powdermine", "tt_mines" }, { "powder_mines", "tt_mines" }, { "powder_mine", "tt_mines" }, { "hollow", "tt_catacombs" }, { "forge", "tt_forge" }, { "hell", "tt_bullethell" }, { "bullethell", "tt_bullethell" }, { "bullet_hell", "tt_bullethell" }, { "oubliette", "tt_sewer" }, { "sewer", "tt_sewer" }, { "sewers", "tt_sewer" }, { "abbey", "tt_cathedral" }, { "truegunabbbey", "tt_cathedral" }, { "true_gun_abbey", "tt_cathedral" }, { "ratlair", "ss_resourcefulrat" }, { "ratden", "ss_resourcefulrat" }, { "rat_lair", "ss_resourcefulrat" }, { "rat_den", "ss_resourcefulrat" }, { "rng", "tt_nakatomi" }, { "r&g", "tt_nakatomi" }, { "rngdept", "tt_nakatomi" }, { "r&gdept", "tt_nakatomi" }, { "rng_dept", "tt_nakatomi" }, { "r&g_dept", "tt_nakatomi" }, { "marinepast", "fs_soldier" }, { "marine_past", "fs_soldier" }, { "convictpast", "fs_convict" }, { "convict_past", "fs_convict" }, { "hunterpast", "fs_guide" }, { "hunter_past", "fs_guide" }, { "pilotpast", "fs_pilot" }, { "pilot_past", "fs_pilot" }, { "robotpast", "fs_robot" }, { "robot_past", "fs_robot" }, { "bulletpast", "fs_bullet" }, { "bullet_past", "fs_bullet" }, { "gunslingerpast", "tt_bullethell" }, { "gunslinger_past", "tt_bullethell" }, { "tutorial", "tt_tutorial" }, { "halls", "tt_tutorial" }, { "knowledgehalls", "tt_tutorial" }, { "knowledge_halls", "tt_tutorial" }, { "cultistpast", "fs_coop" }, { "cultist_past", "fs_coop" }, { "cooppast", "fs_coop" }, { "coop_past", "fs_coop" } }; public static readonly Dictionary<string, StatType> PlayerStatDictionary = new Dictionary<string, StatType> { { "move_speed", (StatType)0 }, { "firerate_mult", (StatType)1 }, { "charge_speed_mult", (StatType)25 }, { "reload_speed_mult", (StatType)10 }, { "spread_mult", (StatType)2 }, { "health", (StatType)3 }, { "damage_mult", (StatType)5 }, { "boss_damage_mult", (StatType)22 }, { "range_mult", (StatType)26 }, { "proj_speed_mult", (StatType)6 }, { "proj_scale_mult", (StatType)15 }, { "knockback_mult", (StatType)12 }, { "ammo_mult", (StatType)9 }, { "clip_size_mult", (StatType)16 }, { "additional_active_slots", (StatType)8 }, { "additional_pierces", (StatType)11 }, { "additional_bounces", (StatType)17 }, { "additional_blanks", (StatType)18 }, { "curse", (StatType)14 }, { "coolness", (StatType)4 }, { "shadow_bullet_chance", (StatType)19 }, { "yv_chance", (StatType)24 }, { "throw_damage_mult", (StatType)20 }, { "enemy_proj_speed_mult", (StatType)23 }, { "roll_damage_mult", (StatType)21 }, { "roll_distance_mult", (StatType)27 }, { "roll_speed_mult", (StatType)28 }, { "price_mult", (StatType)13 }, { "money_drop_mult", (StatType)30 } }; public static readonly Dictionary<string, string> Characters = new Dictionary<string, string> { { "pilot", "rogue" }, { "convict", "convict" }, { "hunter", "guide" }, { "marine", "marine" }, { "bullet", "bullet" }, { "robot", "robot" }, { "paradox", "eevee" }, { "gunslinger", "gunslinger" }, { "cultist", "coopcultist" }, { "lamey", "lamey" }, { "ninja", "ninja" }, { "cosmonaut", "cosmonaut" } }; public static ManualLogSource Logger; public static ConsoleCommandGroup Commands = new ConsoleCommandGroup(delegate(string[] args) { Log("Command or group " + args[0] + " doesn't exist"); }); public static readonly Dictionary<string, string> CommandDescri
plugins/MtGAPI/Newtonsoft.Json.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Xml; using Microsoft.CodeAnalysis; using Newtonsoft.Json.Bson; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq.JsonPath; using Newtonsoft.Json.Schema; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Utilities; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AllowPartiallyTrustedCallers] [assembly: InternalsVisibleTo("Newtonsoft.Json.Schema")] [assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")] [assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")] [assembly: AssemblyTrademark("")] [assembly: CLSCompliant(true)] [assembly: AssemblyCompany("Newtonsoft")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © James Newton-King 2008")] [assembly: AssemblyDescription("Json.NET is a popular high-performance JSON framework for .NET")] [assembly: AssemblyFileVersion("11.0.1")] [assembly: AssemblyInformationalVersion("11.0.1-beta2+bdfeb80d3eb277241ce8f051a360c9461b33afc5")] [assembly: AssemblyProduct("Json.NET")] [assembly: AssemblyTitle("Json.NET .NET 3.5")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: AssemblyVersion("11.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true)] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } } namespace Newtonsoft.Json { public enum ConstructorHandling { Default, AllowNonPublicDefaultConstructor } public enum DateFormatHandling { IsoDateFormat, MicrosoftDateFormat } public enum DateParseHandling { None, DateTime, DateTimeOffset } public enum DateTimeZoneHandling { Local, Utc, Unspecified, RoundtripKind } public class DefaultJsonNameTable : JsonNameTable { private class Entry { internal readonly string Value; internal readonly int HashCode; internal Entry Next; internal Entry(string value, int hashCode, Entry next) { Value = value; HashCode = hashCode; Next = next; } } private static readonly int HashCodeRandomizer; private int _count; private Entry[] _entries; private int _mask = 31; static DefaultJsonNameTable() { HashCodeRandomizer = Environment.TickCount; } public DefaultJsonNameTable() { _entries = new Entry[_mask + 1]; } public override string? Get(char[] key, int start, int length) { if (length == 0) { return string.Empty; } int num = length + HashCodeRandomizer; num += (num << 7) ^ key[start]; int num2 = start + length; for (int i = start + 1; i < num2; i++) { num += (num << 7) ^ key[i]; } num -= num >> 17; num -= num >> 11; num -= num >> 5; int num3 = num & _mask; Entry[] entries = _entries; for (Entry entry = entries[num3]; entry != null; entry = entry.Next) { if (entry.HashCode == num && TextEquals(entry.Value, key, start, length)) { return entry.Value; } } return null; } public string Add(string key) { if (key == null) { throw new ArgumentNullException("key"); } int length = key.Length; if (length == 0) { return string.Empty; } int num = length + HashCodeRandomizer; for (int i = 0; i < key.Length; i++) { num += (num << 7) ^ key[i]; } num -= num >> 17; num -= num >> 11; num -= num >> 5; for (Entry entry = _entries[num & _mask]; entry != null; entry = entry.Next) { if (entry.HashCode == num && entry.Value.Equals(key, StringComparison.Ordinal)) { return entry.Value; } } return AddEntry(key, num); } private string AddEntry(string str, int hashCode) { int num = hashCode & _mask; Entry entry = new Entry(str, hashCode, _entries[num]); _entries[num] = entry; if (_count++ == _mask) { Grow(); } return entry.Value; } private void Grow() { Entry[] entries = _entries; int num = _mask * 2 + 1; Entry[] array = new Entry[num + 1]; for (int i = 0; i < entries.Length; i++) { Entry entry = entries[i]; while (entry != null) { int num2 = entry.HashCode & num; Entry next = entry.Next; entry.Next = array[num2]; array[num2] = entry; entry = next; } } _entries = array; _mask = num; } private static bool TextEquals(string str1, char[] str2, int str2Start, int str2Length) { if (str1.Length != str2Length) { return false; } for (int i = 0; i < str1.Length; i++) { if (str1[i] != str2[str2Start + i]) { return false; } } return true; } } [Flags] public enum DefaultValueHandling { Include = 0, Ignore = 1, Populate = 2, IgnoreAndPopulate = 3 } public enum FloatFormatHandling { String, Symbol, DefaultValue } public enum FloatParseHandling { Double, Decimal } public enum Formatting { None, Indented } public interface IArrayPool<T> { T[] Rent(int minimumLength); void Return(T[]? array); } public interface IJsonLineInfo { int LineNumber { get; } int LinePosition { get; } bool HasLineInfo(); } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] public sealed class JsonArrayAttribute : JsonContainerAttribute { private bool _allowNullItems; public bool AllowNullItems { get { return _allowNullItems; } set { _allowNullItems = value; } } public JsonArrayAttribute() { } public JsonArrayAttribute(bool allowNullItems) { _allowNullItems = allowNullItems; } public JsonArrayAttribute(string id) : base(id) { } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)] public sealed class JsonConstructorAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] public abstract class JsonContainerAttribute : Attribute { internal bool? _isReference; internal bool? _itemIsReference; internal ReferenceLoopHandling? _itemReferenceLoopHandling; internal TypeNameHandling? _itemTypeNameHandling; private Type? _namingStrategyType; private object[]? _namingStrategyParameters; public string? Id { get; set; } public string? Title { get; set; } public string? Description { get; set; } public Type? ItemConverterType { get; set; } public object[]? ItemConverterParameters { get; set; } public Type? NamingStrategyType { get { return _namingStrategyType; } set { _namingStrategyType = value; NamingStrategyInstance = null; } } public object[]? NamingStrategyParameters { get { return _namingStrategyParameters; } set { _namingStrategyParameters = value; NamingStrategyInstance = null; } } internal NamingStrategy? NamingStrategyInstance { get; set; } public bool IsReference { get { return _isReference.GetValueOrDefault(); } set { _isReference = value; } } public bool ItemIsReference { get { return _itemIsReference.GetValueOrDefault(); } set { _itemIsReference = value; } } public ReferenceLoopHandling ItemReferenceLoopHandling { get { return _itemReferenceLoopHandling.GetValueOrDefault(); } set { _itemReferenceLoopHandling = value; } } public TypeNameHandling ItemTypeNameHandling { get { return _itemTypeNameHandling.GetValueOrDefault(); } set { _itemTypeNameHandling = value; } } protected JsonContainerAttribute() { } protected JsonContainerAttribute(string id) { Id = id; } } public static class JsonConvert { public static readonly string True = "true"; public static readonly string False = "false"; public static readonly string Null = "null"; public static readonly string Undefined = "undefined"; public static readonly string PositiveInfinity = "Infinity"; public static readonly string NegativeInfinity = "-Infinity"; public static readonly string NaN = "NaN"; public static Func<JsonSerializerSettings>? DefaultSettings { get; set; } public static string ToString(DateTime value) { return ToString(value, DateFormatHandling.IsoDateFormat, DateTimeZoneHandling.RoundtripKind); } public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling) { DateTime value2 = DateTimeUtils.EnsureDateTime(value, timeZoneHandling); using StringWriter stringWriter = StringUtils.CreateStringWriter(64); stringWriter.Write('"'); DateTimeUtils.WriteDateTimeString(stringWriter, value2, format, null, CultureInfo.InvariantCulture); stringWriter.Write('"'); return stringWriter.ToString(); } public static string ToString(DateTimeOffset value) { return ToString(value, DateFormatHandling.IsoDateFormat); } public static string ToString(DateTimeOffset value, DateFormatHandling format) { using StringWriter stringWriter = StringUtils.CreateStringWriter(64); stringWriter.Write('"'); DateTimeUtils.WriteDateTimeOffsetString(stringWriter, value, format, null, CultureInfo.InvariantCulture); stringWriter.Write('"'); return stringWriter.ToString(); } public static string ToString(bool value) { return value ? True : False; } public static string ToString(char value) { return ToString(char.ToString(value)); } public static string ToString(Enum value) { return value.ToString("D"); } public static string ToString(int value) { return value.ToString(null, CultureInfo.InvariantCulture); } public static string ToString(short value) { return value.ToString(null, CultureInfo.InvariantCulture); } [CLSCompliant(false)] public static string ToString(ushort value) { return value.ToString(null, CultureInfo.InvariantCulture); } [CLSCompliant(false)] public static string ToString(uint value) { return value.ToString(null, CultureInfo.InvariantCulture); } public static string ToString(long value) { return value.ToString(null, CultureInfo.InvariantCulture); } [CLSCompliant(false)] public static string ToString(ulong value) { return value.ToString(null, CultureInfo.InvariantCulture); } public static string ToString(float value) { return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)); } internal static string ToString(float value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable) { return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable); } private static string EnsureFloatFormat(double value, string text, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable) { if (floatFormatHandling == FloatFormatHandling.Symbol || (!double.IsInfinity(value) && !double.IsNaN(value))) { return text; } if (floatFormatHandling == FloatFormatHandling.DefaultValue) { return (!nullable) ? "0.0" : Null; } return quoteChar + text + quoteChar; } public static string ToString(double value) { return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)); } internal static string ToString(double value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable) { return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable); } private static string EnsureDecimalPlace(double value, string text) { if (double.IsNaN(value) || double.IsInfinity(value) || text.IndexOf('.') != -1 || text.IndexOf('E') != -1 || text.IndexOf('e') != -1) { return text; } return text + ".0"; } private static string EnsureDecimalPlace(string text) { if (text.IndexOf('.') != -1) { return text; } return text + ".0"; } public static string ToString(byte value) { return value.ToString(null, CultureInfo.InvariantCulture); } [CLSCompliant(false)] public static string ToString(sbyte value) { return value.ToString(null, CultureInfo.InvariantCulture); } public static string ToString(decimal value) { return EnsureDecimalPlace(value.ToString(null, CultureInfo.InvariantCulture)); } public static string ToString(Guid value) { return ToString(value, '"'); } internal static string ToString(Guid value, char quoteChar) { string text = value.ToString("D", CultureInfo.InvariantCulture); string text2 = quoteChar.ToString(CultureInfo.InvariantCulture); return text2 + text + text2; } public static string ToString(TimeSpan value) { return ToString(value, '"'); } internal static string ToString(TimeSpan value, char quoteChar) { return ToString(value.ToString(), quoteChar); } public static string ToString(Uri? value) { if (value == null) { return Null; } return ToString(value, '"'); } internal static string ToString(Uri value, char quoteChar) { return ToString(value.OriginalString, quoteChar); } public static string ToString(string? value) { return ToString(value, '"'); } public static string ToString(string? value, char delimiter) { return ToString(value, delimiter, StringEscapeHandling.Default); } public static string ToString(string? value, char delimiter, StringEscapeHandling stringEscapeHandling) { if (delimiter != '"' && delimiter != '\'') { throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter"); } return JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, appendDelimiters: true, stringEscapeHandling); } public static string ToString(object? value) { if (value == null) { return Null; } return ConvertUtils.GetTypeCode(value.GetType()) switch { PrimitiveTypeCode.String => ToString((string)value), PrimitiveTypeCode.Char => ToString((char)value), PrimitiveTypeCode.Boolean => ToString((bool)value), PrimitiveTypeCode.SByte => ToString((sbyte)value), PrimitiveTypeCode.Int16 => ToString((short)value), PrimitiveTypeCode.UInt16 => ToString((ushort)value), PrimitiveTypeCode.Int32 => ToString((int)value), PrimitiveTypeCode.Byte => ToString((byte)value), PrimitiveTypeCode.UInt32 => ToString((uint)value), PrimitiveTypeCode.Int64 => ToString((long)value), PrimitiveTypeCode.UInt64 => ToString((ulong)value), PrimitiveTypeCode.Single => ToString((float)value), PrimitiveTypeCode.Double => ToString((double)value), PrimitiveTypeCode.DateTime => ToString((DateTime)value), PrimitiveTypeCode.Decimal => ToString((decimal)value), PrimitiveTypeCode.DateTimeOffset => ToString((DateTimeOffset)value), PrimitiveTypeCode.Guid => ToString((Guid)value), PrimitiveTypeCode.Uri => ToString((Uri)value), PrimitiveTypeCode.TimeSpan => ToString((TimeSpan)value), _ => throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())), }; } [DebuggerStepThrough] public static string SerializeObject(object? value) { return SerializeObject(value, (Type?)null, (JsonSerializerSettings?)null); } [DebuggerStepThrough] public static string SerializeObject(object? value, Formatting formatting) { return SerializeObject(value, formatting, (JsonSerializerSettings?)null); } [DebuggerStepThrough] public static string SerializeObject(object? value, params JsonConverter[] converters) { JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings { Converters = converters } : null); return SerializeObject(value, null, settings); } [DebuggerStepThrough] public static string SerializeObject(object? value, Formatting formatting, params JsonConverter[] converters) { JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings { Converters = converters } : null); return SerializeObject(value, null, formatting, settings); } [DebuggerStepThrough] public static string SerializeObject(object? value, JsonSerializerSettings? settings) { return SerializeObject(value, null, settings); } [DebuggerStepThrough] public static string SerializeObject(object? value, Type? type, JsonSerializerSettings? settings) { JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings); return SerializeObjectInternal(value, type, jsonSerializer); } [DebuggerStepThrough] public static string SerializeObject(object? value, Formatting formatting, JsonSerializerSettings? settings) { return SerializeObject(value, null, formatting, settings); } [DebuggerStepThrough] public static string SerializeObject(object? value, Type? type, Formatting formatting, JsonSerializerSettings? settings) { JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings); jsonSerializer.Formatting = formatting; return SerializeObjectInternal(value, type, jsonSerializer); } private static string SerializeObjectInternal(object? value, Type? type, JsonSerializer jsonSerializer) { StringBuilder sb = new StringBuilder(256); StringWriter stringWriter = new StringWriter(sb, CultureInfo.InvariantCulture); using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter)) { jsonTextWriter.Formatting = jsonSerializer.Formatting; jsonSerializer.Serialize(jsonTextWriter, value, type); } return stringWriter.ToString(); } [DebuggerStepThrough] public static object? DeserializeObject(string value) { return DeserializeObject(value, (Type?)null, (JsonSerializerSettings?)null); } [DebuggerStepThrough] public static object? DeserializeObject(string value, JsonSerializerSettings settings) { return DeserializeObject(value, null, settings); } [DebuggerStepThrough] public static object? DeserializeObject(string value, Type type) { return DeserializeObject(value, type, (JsonSerializerSettings?)null); } [DebuggerStepThrough] public static T? DeserializeObject<T>(string value) { return JsonConvert.DeserializeObject<T>(value, (JsonSerializerSettings?)null); } [DebuggerStepThrough] public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject) { return DeserializeObject<T>(value); } [DebuggerStepThrough] public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings) { return DeserializeObject<T>(value, settings); } [DebuggerStepThrough] public static T? DeserializeObject<T>(string value, params JsonConverter[] converters) { return (T)DeserializeObject(value, typeof(T), converters); } [DebuggerStepThrough] public static T? DeserializeObject<T>(string value, JsonSerializerSettings? settings) { return (T)DeserializeObject(value, typeof(T), settings); } [DebuggerStepThrough] public static object? DeserializeObject(string value, Type type, params JsonConverter[] converters) { JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings { Converters = converters } : null); return DeserializeObject(value, type, settings); } public static object? DeserializeObject(string value, Type? type, JsonSerializerSettings? settings) { ValidationUtils.ArgumentNotNull(value, "value"); JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings); if (!jsonSerializer.IsCheckAdditionalContentSet()) { jsonSerializer.CheckAdditionalContent = true; } using JsonTextReader reader = new JsonTextReader(new StringReader(value)); return jsonSerializer.Deserialize(reader, type); } [DebuggerStepThrough] public static void PopulateObject(string value, object target) { PopulateObject(value, target, null); } public static void PopulateObject(string value, object target, JsonSerializerSettings? settings) { JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings); using JsonReader jsonReader = new JsonTextReader(new StringReader(value)); jsonSerializer.Populate(jsonReader, target); if (settings == null || !settings.CheckAdditionalContent) { return; } while (jsonReader.Read()) { if (jsonReader.TokenType != JsonToken.Comment) { throw JsonSerializationException.Create(jsonReader, "Additional text found in JSON string after finishing deserializing object."); } } } } public abstract class JsonConverter { public virtual bool CanRead => true; public virtual bool CanWrite => true; public abstract void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer); public abstract object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer); public abstract bool CanConvert(Type objectType); } public abstract class JsonConverter<T> : JsonConverter { public sealed override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { if (!((value != null) ? (value is T) : ReflectionUtils.IsNullable(typeof(T)))) { throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T))); } WriteJson(writer, (T)value, serializer); } public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer); public sealed override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) { bool flag = existingValue == null; if (!flag && !(existingValue is T)) { throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T))); } return ReadJson(reader, objectType, flag ? default(T) : ((T)existingValue), !flag, serializer); } public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer); public sealed override bool CanConvert(Type objectType) { return typeof(T).IsAssignableFrom(objectType); } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter, AllowMultiple = false)] public sealed class JsonConverterAttribute : Attribute { private readonly Type _converterType; public Type ConverterType => _converterType; public object[]? ConverterParameters { get; } public JsonConverterAttribute(Type converterType) { if ((object)converterType == null) { throw new ArgumentNullException("converterType"); } _converterType = converterType; } public JsonConverterAttribute(Type converterType, params object[] converterParameters) : this(converterType) { ConverterParameters = converterParameters; } } public class JsonConverterCollection : Collection<JsonConverter> { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] public sealed class JsonDictionaryAttribute : JsonContainerAttribute { public JsonDictionaryAttribute() { } public JsonDictionaryAttribute(string id) : base(id) { } } [Serializable] public class JsonException : Exception { public JsonException() { } public JsonException(string message) : base(message) { } public JsonException(string message, Exception? innerException) : base(message, innerException) { } public JsonException(SerializationInfo info, StreamingContext context) : base(info, context) { } internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message) { message = JsonPosition.FormatMessage(lineInfo, path, message); return new JsonException(message); } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public class JsonExtensionDataAttribute : Attribute { public bool WriteData { get; set; } public bool ReadData { get; set; } public JsonExtensionDataAttribute() { WriteData = true; ReadData = true; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public sealed class JsonIgnoreAttribute : Attribute { } public abstract class JsonNameTable { public abstract string? Get(char[] key, int start, int length); } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)] public sealed class JsonObjectAttribute : JsonContainerAttribute { private MemberSerialization _memberSerialization = MemberSerialization.OptOut; internal MissingMemberHandling? _missingMemberHandling; internal Required? _itemRequired; internal NullValueHandling? _itemNullValueHandling; public MemberSerialization MemberSerialization { get { return _memberSerialization; } set { _memberSerialization = value; } } public MissingMemberHandling MissingMemberHandling { get { return _missingMemberHandling.GetValueOrDefault(); } set { _missingMemberHandling = value; } } public NullValueHandling ItemNullValueHandling { get { return _itemNullValueHandling.GetValueOrDefault(); } set { _itemNullValueHandling = value; } } public Required ItemRequired { get { return _itemRequired.GetValueOrDefault(); } set { _itemRequired = value; } } public JsonObjectAttribute() { } public JsonObjectAttribute(MemberSerialization memberSerialization) { MemberSerialization = memberSerialization; } public JsonObjectAttribute(string id) : base(id) { } } internal enum JsonContainerType { None, Object, Array, Constructor } internal struct JsonPosition { private static readonly char[] SpecialCharacters = new char[18] { '.', ' ', '\'', '/', '"', '[', ']', '(', ')', '\t', '\n', '\r', '\f', '\b', '\\', '\u0085', '\u2028', '\u2029' }; internal JsonContainerType Type; internal int Position; internal string? PropertyName; internal bool HasIndex; public JsonPosition(JsonContainerType type) { Type = type; HasIndex = TypeHasIndex(type); Position = -1; PropertyName = null; } internal int CalculateLength() { switch (Type) { case JsonContainerType.Object: return PropertyName.Length + 5; case JsonContainerType.Array: case JsonContainerType.Constructor: return MathUtils.IntLength((ulong)Position) + 2; default: throw new ArgumentOutOfRangeException("Type"); } } internal void WriteTo(StringBuilder sb, ref StringWriter? writer, ref char[]? buffer) { switch (Type) { case JsonContainerType.Object: { string propertyName = PropertyName; if (propertyName.IndexOfAny(SpecialCharacters) != -1) { sb.Append("['"); if (writer == null) { writer = new StringWriter(sb); } JavaScriptUtils.WriteEscapedJavaScriptString(writer, propertyName, '\'', appendDelimiters: false, JavaScriptUtils.SingleQuoteCharEscapeFlags, StringEscapeHandling.Default, null, ref buffer); sb.Append("']"); } else { if (sb.Length > 0) { sb.Append('.'); } sb.Append(propertyName); } break; } case JsonContainerType.Array: case JsonContainerType.Constructor: sb.Append('['); sb.Append(Position); sb.Append(']'); break; } } internal static bool TypeHasIndex(JsonContainerType type) { return type == JsonContainerType.Array || type == JsonContainerType.Constructor; } internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition) { int num = 0; if (positions != null) { for (int i = 0; i < positions.Count; i++) { num += positions[i].CalculateLength(); } } if (currentPosition.HasValue) { num += currentPosition.GetValueOrDefault().CalculateLength(); } StringBuilder stringBuilder = new StringBuilder(num); StringWriter writer = null; char[] buffer = null; if (positions != null) { foreach (JsonPosition position in positions) { position.WriteTo(stringBuilder, ref writer, ref buffer); } } currentPosition?.WriteTo(stringBuilder, ref writer, ref buffer); return stringBuilder.ToString(); } internal static string FormatMessage(IJsonLineInfo? lineInfo, string path, string message) { if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal)) { message = message.Trim(); if (!StringUtils.EndsWith(message, '.')) { message += "."; } message += " "; } message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path); if (lineInfo != null && lineInfo.HasLineInfo()) { message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition); } message += "."; return message; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] public sealed class JsonPropertyAttribute : Attribute { internal NullValueHandling? _nullValueHandling; internal DefaultValueHandling? _defaultValueHandling; internal ReferenceLoopHandling? _referenceLoopHandling; internal ObjectCreationHandling? _objectCreationHandling; internal TypeNameHandling? _typeNameHandling; internal bool? _isReference; internal int? _order; internal Required? _required; internal bool? _itemIsReference; internal ReferenceLoopHandling? _itemReferenceLoopHandling; internal TypeNameHandling? _itemTypeNameHandling; public Type? ItemConverterType { get; set; } public object[]? ItemConverterParameters { get; set; } public Type? NamingStrategyType { get; set; } public object[]? NamingStrategyParameters { get; set; } public NullValueHandling NullValueHandling { get { return _nullValueHandling.GetValueOrDefault(); } set { _nullValueHandling = value; } } public DefaultValueHandling DefaultValueHandling { get { return _defaultValueHandling.GetValueOrDefault(); } set { _defaultValueHandling = value; } } public ReferenceLoopHandling ReferenceLoopHandling { get { return _referenceLoopHandling.GetValueOrDefault(); } set { _referenceLoopHandling = value; } } public ObjectCreationHandling ObjectCreationHandling { get { return _objectCreationHandling.GetValueOrDefault(); } set { _objectCreationHandling = value; } } public TypeNameHandling TypeNameHandling { get { return _typeNameHandling.GetValueOrDefault(); } set { _typeNameHandling = value; } } public bool IsReference { get { return _isReference.GetValueOrDefault(); } set { _isReference = value; } } public int Order { get { return _order.GetValueOrDefault(); } set { _order = value; } } public Required Required { get { return _required.GetValueOrDefault(); } set { _required = value; } } public string? PropertyName { get; set; } public ReferenceLoopHandling ItemReferenceLoopHandling { get { return _itemReferenceLoopHandling.GetValueOrDefault(); } set { _itemReferenceLoopHandling = value; } } public TypeNameHandling ItemTypeNameHandling { get { return _itemTypeNameHandling.GetValueOrDefault(); } set { _itemTypeNameHandling = value; } } public bool ItemIsReference { get { return _itemIsReference.GetValueOrDefault(); } set { _itemIsReference = value; } } public JsonPropertyAttribute() { } public JsonPropertyAttribute(string propertyName) { PropertyName = propertyName; } } public abstract class JsonReader : IDisposable { protected internal enum State { Start, Complete, Property, ObjectStart, Object, ArrayStart, Array, Closed, PostValue, ConstructorStart, Constructor, Error, Finished } private JsonToken _tokenType; private object? _value; internal char _quoteChar; internal State _currentState; private JsonPosition _currentPosition; private CultureInfo? _culture; private DateTimeZoneHandling _dateTimeZoneHandling; private int? _maxDepth; private bool _hasExceededMaxDepth; internal DateParseHandling _dateParseHandling; internal FloatParseHandling _floatParseHandling; private string? _dateFormatString; private List<JsonPosition>? _stack; protected State CurrentState => _currentState; public bool CloseInput { get; set; } public bool SupportMultipleContent { get; set; } public virtual char QuoteChar { get { return _quoteChar; } protected internal set { _quoteChar = value; } } public DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling; } set { if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind) { throw new ArgumentOutOfRangeException("value"); } _dateTimeZoneHandling = value; } } public DateParseHandling DateParseHandling { get { return _dateParseHandling; } set { if (value < DateParseHandling.None || value > DateParseHandling.DateTimeOffset) { throw new ArgumentOutOfRangeException("value"); } _dateParseHandling = value; } } public FloatParseHandling FloatParseHandling { get { return _floatParseHandling; } set { if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal) { throw new ArgumentOutOfRangeException("value"); } _floatParseHandling = value; } } public string? DateFormatString { get { return _dateFormatString; } set { _dateFormatString = value; } } public int? MaxDepth { get { return _maxDepth; } set { if (value <= 0) { throw new ArgumentException("Value must be positive.", "value"); } _maxDepth = value; } } public virtual JsonToken TokenType => _tokenType; public virtual object? Value => _value; public virtual Type? ValueType => _value?.GetType(); public virtual int Depth { get { int num = _stack?.Count ?? 0; if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None) { return num; } return num + 1; } } public virtual string Path { get { if (_currentPosition.Type == JsonContainerType.None) { return string.Empty; } JsonPosition? currentPosition = ((_currentState != State.ArrayStart && _currentState != State.ConstructorStart && _currentState != State.ObjectStart) ? new JsonPosition?(_currentPosition) : null); return JsonPosition.BuildPath(_stack, currentPosition); } } public CultureInfo Culture { get { return _culture ?? CultureInfo.InvariantCulture; } set { _culture = value; } } internal JsonPosition GetPosition(int depth) { if (_stack != null && depth < _stack.Count) { return _stack[depth]; } return _currentPosition; } protected JsonReader() { _currentState = State.Start; _dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; _dateParseHandling = DateParseHandling.DateTime; _floatParseHandling = FloatParseHandling.Double; _maxDepth = 64; CloseInput = true; } private void Push(JsonContainerType value) { UpdateScopeWithFinishedValue(); if (_currentPosition.Type == JsonContainerType.None) { _currentPosition = new JsonPosition(value); return; } if (_stack == null) { _stack = new List<JsonPosition>(); } _stack.Add(_currentPosition); _currentPosition = new JsonPosition(value); if (!_maxDepth.HasValue || !(Depth + 1 > _maxDepth) || _hasExceededMaxDepth) { return; } _hasExceededMaxDepth = true; throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth)); } private JsonContainerType Pop() { JsonPosition currentPosition; if (_stack != null && _stack.Count > 0) { currentPosition = _currentPosition; _currentPosition = _stack[_stack.Count - 1]; _stack.RemoveAt(_stack.Count - 1); } else { currentPosition = _currentPosition; _currentPosition = default(JsonPosition); } if (_maxDepth.HasValue && Depth <= _maxDepth) { _hasExceededMaxDepth = false; } return currentPosition.Type; } private JsonContainerType Peek() { return _currentPosition.Type; } public abstract bool Read(); public virtual int? ReadAsInt32() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Integer: case JsonToken.Float: { object value = Value; if (value is int value2) { return value2; } int num; try { num = Convert.ToInt32(value, CultureInfo.InvariantCulture); } catch (Exception ex) { throw JsonReaderException.Create(this, "Could not convert to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex); } SetToken(JsonToken.Integer, num, updateIndex: false); return num; } case JsonToken.String: { string s = (string)Value; return ReadInt32String(s); } default: throw JsonReaderException.Create(this, "Error reading integer. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } internal int? ReadInt32String(string? s) { if (StringUtils.IsNullOrEmpty(s)) { SetToken(JsonToken.Null, null, updateIndex: false); return null; } if (int.TryParse(s, NumberStyles.Integer, Culture, out var result)) { SetToken(JsonToken.Integer, result, updateIndex: false); return result; } SetToken(JsonToken.String, s, updateIndex: false); throw JsonReaderException.Create(this, "Could not convert string to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, s)); } public virtual string? ReadAsString() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.String: return (string)Value; default: if (JsonTokenUtils.IsPrimitiveToken(contentToken)) { object value = Value; if (value != null) { string text = ((!(value is IFormattable formattable)) ? ((value is Uri uri) ? uri.OriginalString : value.ToString()) : formattable.ToString(null, Culture)); SetToken(JsonToken.String, text, updateIndex: false); return text; } } throw JsonReaderException.Create(this, "Error reading string. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } public virtual byte[]? ReadAsBytes() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.StartObject: { ReadIntoWrappedTypeObject(); byte[] array3 = ReadAsBytes(); ReaderReadAndAssert(); if (TokenType != JsonToken.EndObject) { throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); } SetToken(JsonToken.Bytes, array3, updateIndex: false); return array3; } case JsonToken.String: { string text = (string)Value; Guid g; byte[] array2 = ((text.Length == 0) ? CollectionUtils.ArrayEmpty<byte>() : ((!ConvertUtils.TryConvertGuid(text, out g)) ? Convert.FromBase64String(text) : g.ToByteArray())); SetToken(JsonToken.Bytes, array2, updateIndex: false); return array2; } case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Bytes: if (Value is Guid guid) { byte[] array = guid.ToByteArray(); SetToken(JsonToken.Bytes, array, updateIndex: false); return array; } return (byte[])Value; case JsonToken.StartArray: return ReadArrayIntoByteArray(); default: throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } internal byte[] ReadArrayIntoByteArray() { List<byte> list = new List<byte>(); do { if (!Read()) { SetToken(JsonToken.None); } } while (!ReadArrayElementIntoByteArrayReportDone(list)); byte[] array = list.ToArray(); SetToken(JsonToken.Bytes, array, updateIndex: false); return array; } private bool ReadArrayElementIntoByteArrayReportDone(List<byte> buffer) { switch (TokenType) { case JsonToken.None: throw JsonReaderException.Create(this, "Unexpected end when reading bytes."); case JsonToken.Integer: buffer.Add(Convert.ToByte(Value, CultureInfo.InvariantCulture)); return false; case JsonToken.EndArray: return true; case JsonToken.Comment: return false; default: throw JsonReaderException.Create(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); } } public virtual double? ReadAsDouble() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Integer: case JsonToken.Float: { object value = Value; if (value is double value2) { return value2; } double num = Convert.ToDouble(value, CultureInfo.InvariantCulture); SetToken(JsonToken.Float, num, updateIndex: false); return num; } case JsonToken.String: return ReadDoubleString((string)Value); default: throw JsonReaderException.Create(this, "Error reading double. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } internal double? ReadDoubleString(string? s) { if (StringUtils.IsNullOrEmpty(s)) { SetToken(JsonToken.Null, null, updateIndex: false); return null; } if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, Culture, out var result)) { SetToken(JsonToken.Float, result, updateIndex: false); return result; } SetToken(JsonToken.String, s, updateIndex: false); throw JsonReaderException.Create(this, "Could not convert string to double: {0}.".FormatWith(CultureInfo.InvariantCulture, s)); } public virtual bool? ReadAsBoolean() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Integer: case JsonToken.Float: { bool flag = Convert.ToBoolean(Value, CultureInfo.InvariantCulture); SetToken(JsonToken.Boolean, flag, updateIndex: false); return flag; } case JsonToken.String: return ReadBooleanString((string)Value); case JsonToken.Boolean: return (bool)Value; default: throw JsonReaderException.Create(this, "Error reading boolean. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } internal bool? ReadBooleanString(string? s) { if (StringUtils.IsNullOrEmpty(s)) { SetToken(JsonToken.Null, null, updateIndex: false); return null; } if (bool.TryParse(s, out var result)) { SetToken(JsonToken.Boolean, result, updateIndex: false); return result; } SetToken(JsonToken.String, s, updateIndex: false); throw JsonReaderException.Create(this, "Could not convert string to boolean: {0}.".FormatWith(CultureInfo.InvariantCulture, s)); } public virtual decimal? ReadAsDecimal() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Integer: case JsonToken.Float: { object value = Value; if (value is decimal value2) { return value2; } decimal num; try { num = Convert.ToDecimal(value, CultureInfo.InvariantCulture); } catch (Exception ex) { throw JsonReaderException.Create(this, "Could not convert to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex); } SetToken(JsonToken.Float, num, updateIndex: false); return num; } case JsonToken.String: return ReadDecimalString((string)Value); default: throw JsonReaderException.Create(this, "Error reading decimal. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } internal decimal? ReadDecimalString(string? s) { if (StringUtils.IsNullOrEmpty(s)) { SetToken(JsonToken.Null, null, updateIndex: false); return null; } if (decimal.TryParse(s, NumberStyles.Number, Culture, out var result)) { SetToken(JsonToken.Float, result, updateIndex: false); return result; } if (ConvertUtils.DecimalTryParse(s.ToCharArray(), 0, s.Length, out result) == ParseResult.Success) { SetToken(JsonToken.Float, result, updateIndex: false); return result; } SetToken(JsonToken.String, s, updateIndex: false); throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s)); } public virtual DateTime? ReadAsDateTime() { switch (GetContentToken()) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Date: if (Value is DateTimeOffset dateTimeOffset) { SetToken(JsonToken.Date, dateTimeOffset.DateTime, updateIndex: false); } return (DateTime)Value; case JsonToken.String: return ReadDateTimeString((string)Value); default: throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType)); } } internal DateTime? ReadDateTimeString(string? s) { if (StringUtils.IsNullOrEmpty(s)) { SetToken(JsonToken.Null, null, updateIndex: false); return null; } if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out var dt)) { dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling); SetToken(JsonToken.Date, dt, updateIndex: false); return dt; } if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt)) { dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling); SetToken(JsonToken.Date, dt, updateIndex: false); return dt; } throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s)); } public virtual DateTimeOffset? ReadAsDateTimeOffset() { JsonToken contentToken = GetContentToken(); switch (contentToken) { case JsonToken.None: case JsonToken.Null: case JsonToken.EndArray: return null; case JsonToken.Date: if (Value is DateTime dateTime) { SetToken(JsonToken.Date, new DateTimeOffset(dateTime), updateIndex: false); } return (DateTimeOffset)Value; case JsonToken.String: { string s = (string)Value; return ReadDateTimeOffsetString(s); } default: throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken)); } } internal DateTimeOffset? ReadDateTimeOffsetString(string? s) { if (StringUtils.IsNullOrEmpty(s)) { SetToken(JsonToken.Null, null, updateIndex: false); return null; } if (DateTimeUtils.TryParseDateTimeOffset(s, _dateFormatString, Culture, out var dt)) { SetToken(JsonToken.Date, dt, updateIndex: false); return dt; } if (DateTimeOffset.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt)) { SetToken(JsonToken.Date, dt, updateIndex: false); return dt; } SetToken(JsonToken.String, s, updateIndex: false); throw JsonReaderException.Create(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, s)); } internal void ReaderReadAndAssert() { if (!Read()) { throw CreateUnexpectedEndException(); } } internal JsonReaderException CreateUnexpectedEndException() { return JsonReaderException.Create(this, "Unexpected end when reading JSON."); } internal void ReadIntoWrappedTypeObject() { ReaderReadAndAssert(); if (Value != null && Value.ToString() == "$type") { ReaderReadAndAssert(); if (Value != null && Value.ToString().StartsWith("System.Byte[]", StringComparison.Ordinal)) { ReaderReadAndAssert(); if (Value.ToString() == "$value") { return; } } } throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, JsonToken.StartObject)); } public void Skip() { if (TokenType == JsonToken.PropertyName) { Read(); } if (JsonTokenUtils.IsStartToken(TokenType)) { int depth = Depth; while (Read() && depth < Depth) { } } } protected void SetToken(JsonToken newToken) { SetToken(newToken, null, updateIndex: true); } protected void SetToken(JsonToken newToken, object? value) { SetToken(newToken, value, updateIndex: true); } protected void SetToken(JsonToken newToken, object? value, bool updateIndex) { _tokenType = newToken; _value = value; switch (newToken) { case JsonToken.StartObject: _currentState = State.ObjectStart; Push(JsonContainerType.Object); break; case JsonToken.StartArray: _currentState = State.ArrayStart; Push(JsonContainerType.Array); break; case JsonToken.StartConstructor: _currentState = State.ConstructorStart; Push(JsonContainerType.Constructor); break; case JsonToken.EndObject: ValidateEnd(JsonToken.EndObject); break; case JsonToken.EndArray: ValidateEnd(JsonToken.EndArray); break; case JsonToken.EndConstructor: ValidateEnd(JsonToken.EndConstructor); break; case JsonToken.PropertyName: _currentState = State.Property; _currentPosition.PropertyName = (string)value; break; case JsonToken.Raw: case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Null: case JsonToken.Undefined: case JsonToken.Date: case JsonToken.Bytes: SetPostValueState(updateIndex); break; case JsonToken.Comment: break; } } internal void SetPostValueState(bool updateIndex) { if (Peek() != 0 || SupportMultipleContent) { _currentState = State.PostValue; } else { SetFinished(); } if (updateIndex) { UpdateScopeWithFinishedValue(); } } private void UpdateScopeWithFinishedValue() { if (_currentPosition.HasIndex) { _currentPosition.Position++; } } private void ValidateEnd(JsonToken endToken) { JsonContainerType jsonContainerType = Pop(); if (GetTypeForCloseToken(endToken) != jsonContainerType) { throw JsonReaderException.Create(this, "JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, jsonContainerType)); } if (Peek() != 0 || SupportMultipleContent) { _currentState = State.PostValue; } else { SetFinished(); } } protected void SetStateBasedOnCurrent() { JsonContainerType jsonContainerType = Peek(); switch (jsonContainerType) { case JsonContainerType.Object: _currentState = State.Object; break; case JsonContainerType.Array: _currentState = State.Array; break; case JsonContainerType.Constructor: _currentState = State.Constructor; break; case JsonContainerType.None: SetFinished(); break; default: throw JsonReaderException.Create(this, "While setting the reader state back to current object an unexpected JsonType was encountered: {0}".FormatWith(CultureInfo.InvariantCulture, jsonContainerType)); } } private void SetFinished() { _currentState = ((!SupportMultipleContent) ? State.Finished : State.Start); } private JsonContainerType GetTypeForCloseToken(JsonToken token) { return token switch { JsonToken.EndObject => JsonContainerType.Object, JsonToken.EndArray => JsonContainerType.Array, JsonToken.EndConstructor => JsonContainerType.Constructor, _ => throw JsonReaderException.Create(this, "Not a valid close JsonToken: {0}".FormatWith(CultureInfo.InvariantCulture, token)), }; } void IDisposable.Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (_currentState != State.Closed && disposing) { Close(); } } public virtual void Close() { _currentState = State.Closed; _tokenType = JsonToken.None; _value = null; } internal void ReadAndAssert() { if (!Read()) { throw JsonSerializationException.Create(this, "Unexpected end when reading JSON."); } } internal void ReadForTypeAndAssert(JsonContract? contract, bool hasConverter) { if (!ReadForType(contract, hasConverter)) { throw JsonSerializationException.Create(this, "Unexpected end when reading JSON."); } } internal bool ReadForType(JsonContract? contract, bool hasConverter) { if (hasConverter) { return Read(); } switch (contract?.InternalReadType ?? ReadType.Read) { case ReadType.Read: return ReadAndMoveToContent(); case ReadType.ReadAsInt32: ReadAsInt32(); break; case ReadType.ReadAsInt64: { bool result = ReadAndMoveToContent(); if (TokenType == JsonToken.Undefined) { throw JsonReaderException.Create(this, "An undefined token is not a valid {0}.".FormatWith(CultureInfo.InvariantCulture, contract?.UnderlyingType ?? typeof(long))); } return result; } case ReadType.ReadAsDecimal: ReadAsDecimal(); break; case ReadType.ReadAsDouble: ReadAsDouble(); break; case ReadType.ReadAsBytes: ReadAsBytes(); break; case ReadType.ReadAsBoolean: ReadAsBoolean(); break; case ReadType.ReadAsString: ReadAsString(); break; case ReadType.ReadAsDateTime: ReadAsDateTime(); break; case ReadType.ReadAsDateTimeOffset: ReadAsDateTimeOffset(); break; default: throw new ArgumentOutOfRangeException(); } return TokenType != JsonToken.None; } internal bool ReadAndMoveToContent() { return Read() && MoveToContent(); } internal bool MoveToContent() { JsonToken tokenType = TokenType; while (tokenType == JsonToken.None || tokenType == JsonToken.Comment) { if (!Read()) { return false; } tokenType = TokenType; } return true; } private JsonToken GetContentToken() { JsonToken tokenType; do { if (!Read()) { SetToken(JsonToken.None); return JsonToken.None; } tokenType = TokenType; } while (tokenType == JsonToken.Comment); return tokenType; } } [Serializable] public class JsonReaderException : JsonException { public int LineNumber { get; } public int LinePosition { get; } public string? Path { get; } public JsonReaderException() { } public JsonReaderException(string message) : base(message) { } public JsonReaderException(string message, Exception innerException) : base(message, innerException) { } public JsonReaderException(SerializationInfo info, StreamingContext context) : base(info, context) { } public JsonReaderException(string message, string path, int lineNumber, int linePosition, Exception? innerException) : base(message, innerException) { Path = path; LineNumber = lineNumber; LinePosition = linePosition; } internal static JsonReaderException Create(JsonReader reader, string message) { return Create(reader, message, null); } internal static JsonReaderException Create(JsonReader reader, string message, Exception? ex) { return Create(reader as IJsonLineInfo, reader.Path, message, ex); } internal static JsonReaderException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex) { message = JsonPosition.FormatMessage(lineInfo, path, message); int lineNumber; int linePosition; if (lineInfo != null && lineInfo.HasLineInfo()) { lineNumber = lineInfo.LineNumber; linePosition = lineInfo.LinePosition; } else { lineNumber = 0; linePosition = 0; } return new JsonReaderException(message, path, lineNumber, linePosition, ex); } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public sealed class JsonRequiredAttribute : Attribute { } [Serializable] public class JsonSerializationException : JsonException { public int LineNumber { get; } public int LinePosition { get; } public string? Path { get; } public JsonSerializationException() { } public JsonSerializationException(string message) : base(message) { } public JsonSerializationException(string message, Exception innerException) : base(message, innerException) { } public JsonSerializationException(SerializationInfo info, StreamingContext context) : base(info, context) { } public JsonSerializationException(string message, string path, int lineNumber, int linePosition, Exception? innerException) : base(message, innerException) { Path = path; LineNumber = lineNumber; LinePosition = linePosition; } internal static JsonSerializationException Create(JsonReader reader, string message) { return Create(reader, message, null); } internal static JsonSerializationException Create(JsonReader reader, string message, Exception? ex) { return Create(reader as IJsonLineInfo, reader.Path, message, ex); } internal static JsonSerializationException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex) { message = JsonPosition.FormatMessage(lineInfo, path, message); int lineNumber; int linePosition; if (lineInfo != null && lineInfo.HasLineInfo()) { lineNumber = lineInfo.LineNumber; linePosition = lineInfo.LinePosition; } else { lineNumber = 0; linePosition = 0; } return new JsonSerializationException(message, path, lineNumber, linePosition, ex); } } public class JsonSerializer { internal TypeNameHandling _typeNameHandling; internal TypeNameAssemblyFormatHandling _typeNameAssemblyFormatHandling; internal PreserveReferencesHandling _preserveReferencesHandling; internal ReferenceLoopHandling _referenceLoopHandling; internal MissingMemberHandling _missingMemberHandling; internal ObjectCreationHandling _objectCreationHandling; internal NullValueHandling _nullValueHandling; internal DefaultValueHandling _defaultValueHandling; internal ConstructorHandling _constructorHandling; internal MetadataPropertyHandling _metadataPropertyHandling; internal JsonConverterCollection? _converters; internal IContractResolver _contractResolver; internal ITraceWriter? _traceWriter; internal IEqualityComparer? _equalityComparer; internal ISerializationBinder _serializationBinder; internal StreamingContext _context; private IReferenceResolver? _referenceResolver; private Formatting? _formatting; private DateFormatHandling? _dateFormatHandling; private DateTimeZoneHandling? _dateTimeZoneHandling; private DateParseHandling? _dateParseHandling; private FloatFormatHandling? _floatFormatHandling; private FloatParseHandling? _floatParseHandling; private StringEscapeHandling? _stringEscapeHandling; private CultureInfo _culture; private int? _maxDepth; private bool _maxDepthSet; private bool? _checkAdditionalContent; private string? _dateFormatString; private bool _dateFormatStringSet; public virtual IReferenceResolver? ReferenceResolver { get { return GetReferenceResolver(); } set { if (value == null) { throw new ArgumentNullException("value", "Reference resolver cannot be null."); } _referenceResolver = value; } } [Obsolete("Binder is obsolete. Use SerializationBinder instead.")] public virtual SerializationBinder Binder { get { if (_serializationBinder is SerializationBinder result) { return result; } if (_serializationBinder is SerializationBinderAdapter serializationBinderAdapter) { return serializationBinderAdapter.SerializationBinder; } throw new InvalidOperationException("Cannot get SerializationBinder because an ISerializationBinder was previously set."); } set { if (value == null) { throw new ArgumentNullException("value", "Serialization binder cannot be null."); } _serializationBinder = (value as ISerializationBinder) ?? new SerializationBinderAdapter(value); } } public virtual ISerializationBinder SerializationBinder { get { return _serializationBinder; } set { if (value == null) { throw new ArgumentNullException("value", "Serialization binder cannot be null."); } _serializationBinder = value; } } public virtual ITraceWriter? TraceWriter { get { return _traceWriter; } set { _traceWriter = value; } } public virtual IEqualityComparer? EqualityComparer { get { return _equalityComparer; } set { _equalityComparer = value; } } public virtual TypeNameHandling TypeNameHandling { get { return _typeNameHandling; } set { if (value < TypeNameHandling.None || value > TypeNameHandling.Auto) { throw new ArgumentOutOfRangeException("value"); } _typeNameHandling = value; } } [Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")] public virtual FormatterAssemblyStyle TypeNameAssemblyFormat { get { return (FormatterAssemblyStyle)_typeNameAssemblyFormatHandling; } set { if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full) { throw new ArgumentOutOfRangeException("value"); } _typeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value; } } public virtual TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling { get { return _typeNameAssemblyFormatHandling; } set { if (value < TypeNameAssemblyFormatHandling.Simple || value > TypeNameAssemblyFormatHandling.Full) { throw new ArgumentOutOfRangeException("value"); } _typeNameAssemblyFormatHandling = value; } } public virtual PreserveReferencesHandling PreserveReferencesHandling { get { return _preserveReferencesHandling; } set { if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All) { throw new ArgumentOutOfRangeException("value"); } _preserveReferencesHandling = value; } } public virtual ReferenceLoopHandling ReferenceLoopHandling { get { return _referenceLoopHandling; } set { if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize) { throw new ArgumentOutOfRangeException("value"); } _referenceLoopHandling = value; } } public virtual MissingMemberHandling MissingMemberHandling { get { return _missingMemberHandling; } set { if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error) { throw new ArgumentOutOfRangeException("value"); } _missingMemberHandling = value; } } public virtual NullValueHandling NullValueHandling { get { return _nullValueHandling; } set { if (value < NullValueHandling.Include || value > NullValueHandling.Ignore) { throw new ArgumentOutOfRangeException("value"); } _nullValueHandling = value; } } public virtual DefaultValueHandling DefaultValueHandling { get { return _defaultValueHandling; } set { if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate) { throw new ArgumentOutOfRangeException("value"); } _defaultValueHandling = value; } } public virtual ObjectCreationHandling ObjectCreationHandling { get { return _objectCreationHandling; } set { if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace) { throw new ArgumentOutOfRangeException("value"); } _objectCreationHandling = value; } } public virtual ConstructorHandling ConstructorHandling { get { return _constructorHandling; } set { if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor) { throw new ArgumentOutOfRangeException("value"); } _constructorHandling = value; } } public virtual MetadataPropertyHandling MetadataPropertyHandling { get { return _metadataPropertyHandling; } set { if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.Ignore) { throw new ArgumentOutOfRangeException("value"); } _metadataPropertyHandling = value; } } public virtual JsonConverterCollection Converters { get { if (_converters == null) { _converters = new JsonConverterCollection(); } return _converters; } } public virtual IContractResolver ContractResolver { get { return _contractResolver; } set { _contractResolver = value ?? DefaultContractResolver.Instance; } } public virtual StreamingContext Context { get { return _context; } set { _context = value; } } public virtual Formatting Formatting { get { return _formatting.GetValueOrDefault(); } set { _formatting = value; } } public virtual DateFormatHandling DateFormatHandling { get { return _dateFormatHandling.GetValueOrDefault(); } set { _dateFormatHandling = value; } } public virtual DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind; } set { _dateTimeZoneHandling = value; } } public virtual DateParseHandling DateParseHandling { get { return _dateParseHandling ?? DateParseHandling.DateTime; } set { _dateParseHandling = value; } } public virtual FloatParseHandling FloatParseHandling { get { return _floatParseHandling.GetValueOrDefault(); } set { _floatParseHandling = value; } } public virtual FloatFormatHandling FloatFormatHandling { get { return _floatFormatHandling.GetValueOrDefault(); } set { _floatFormatHandling = value; } } public virtual StringEscapeHandling StringEscapeHandling { get { return _stringEscapeHandling.GetValueOrDefault(); } set { _stringEscapeHandling = value; } } public virtual string DateFormatString { get { return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; } set { _dateFormatString = value; _dateFormatStringSet = true; } } public virtual CultureInfo Culture { get { return _culture ?? JsonSerializerSettings.DefaultCulture; } set { _culture = value; } } public virtual int? MaxDepth { get { return _maxDepth; } set { if (value <= 0) { throw new ArgumentException("Value must be positive.", "value"); } _maxDepth = value; _maxDepthSet = true; } } public virtual bool CheckAdditionalContent { get { return _checkAdditionalContent.GetValueOrDefault(); } set { _checkAdditionalContent = value; } } public virtual event EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>? Error; internal bool IsCheckAdditionalContentSet() { return _checkAdditionalContent.HasValue; } public JsonSerializer() { _referenceLoopHandling = ReferenceLoopHandling.Error; _missingMemberHandling = MissingMemberHandling.Ignore; _nullValueHandling = NullValueHandling.Include; _defaultValueHandling = DefaultValueHandling.Include; _objectCreationHandling = ObjectCreationHandling.Auto; _preserveReferencesHandling = PreserveReferencesHandling.None; _constructorHandling = ConstructorHandling.Default; _typeNameHandling = TypeNameHandling.None; _metadataPropertyHandling = MetadataPropertyHandling.Default; _context = JsonSerializerSettings.DefaultContext; _serializationBinder = DefaultSerializationBinder.Instance; _culture = JsonSerializerSettings.DefaultCulture; _contractResolver = DefaultContractResolver.Instance; } public static JsonSerializer Create() { return new JsonSerializer(); } public static JsonSerializer Create(JsonSerializerSettings? settings) { JsonSerializer jsonSerializer = Create(); if (settings != null) { ApplySerializerSettings(jsonSerializer, settings); } return jsonSerializer; } public static JsonSerializer CreateDefault() { JsonSerializerSettings settings = JsonConvert.DefaultSettings?.Invoke(); return Create(settings); } public static JsonSerializer CreateDefault(JsonSerializerSettings? settings) { JsonSerializer jsonSerializer = CreateDefault(); if (settings != null) { ApplySerializerSettings(jsonSerializer, settings); } return jsonSerializer; } private static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings) { if (!CollectionUtils.IsNullOrEmpty(settings.Converters)) { for (int i = 0; i < settings.Converters.Count; i++) { serializer.Converters.Insert(i, settings.Converters[i]); } } if (settings._typeNameHandling.HasValue) { serializer.TypeNameHandling = settings.TypeNameHandling; } if (settings._metadataPropertyHandling.HasValue) { serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling; } if (settings._typeNameAssemblyFormatHandling.HasValue) { serializer.TypeNameAssemblyFormatHandling = settings.TypeNameAssemblyFormatHandling; } if (settings._preserveReferencesHandling.HasValue) { serializer.PreserveReferencesHandling = settings.PreserveReferencesHandling; } if (settings._referenceLoopHandling.HasValue) { serializer.ReferenceLoopHandling = settings.ReferenceLoopHandling; } if (settings._missingMemberHandling.HasValue) { serializer.MissingMemberHandling = settings.MissingMemberHandling; } if (settings._objectCreationHandling.HasValue) { serializer.ObjectCreationHandling = settings.ObjectCreationHandling; } if (settings._nullValueHandling.HasValue) { serializer.NullValueHandling = settings.NullValueHandling; } if (settings._defaultValueHandling.HasValue) { serializer.DefaultValueHandling = settings.DefaultValueHandling; } if (settings._constructorHandling.HasValue) { serializer.ConstructorHandling = settings.ConstructorHandling; } if (settings._context.HasValue) { serializer.Context = settings.Context; } if (settings._checkAdditionalContent.HasValue) { serializer._checkAdditionalContent = settings._checkAdditionalContent; } if (settings.Error != null) { serializer.Error += settings.Error; } if (settings.ContractResolver != null) { serializer.ContractResolver = settings.ContractResolver; } if (settings.ReferenceResolverProvider != null) { serializer.ReferenceResolver = settings.ReferenceResolverProvider(); } if (settings.TraceWriter != null) { serializer.TraceWriter = settings.TraceWriter; } if (settings.EqualityComparer != null) { serializer.EqualityComparer = settings.EqualityComparer; } if (settings.SerializationBinder != null) { serializer.SerializationBinder = settings.SerializationBinder; } if (settings._formatting.HasValue) { serializer._formatting = settings._formatting; } if (settings._dateFormatHandling.HasValue) { serializer._dateFormatHandling = settings._dateFormatHandling; } if (settings._dateTimeZoneHandling.HasValue) { serializer._dateTimeZoneHandling = settings._dateTimeZoneHandling; } if (settings._dateParseHandling.HasValue) { serializer._dateParseHandling = settings._dateParseHandling; } if (settings._dateFormatStringSet) { serializer._dateFormatString = settings._dateFormatString; serializer._dateFormatStringSet = settings._dateFormatStringSet; } if (settings._floatFormatHandling.HasValue) { serializer._floatFormatHandling = settings._floatFormatHandling; } if (settings._floatParseHandling.HasValue) { serializer._floatParseHandling = settings._floatParseHandling; } if (settings._stringEscapeHandling.HasValue) { serializer._stringEscapeHandling = settings._stringEscapeHandling; } if (settings._culture != null) { serializer._culture = settings._culture; } if (settings._maxDepthSet) { serializer._maxDepth = settings._maxDepth; serializer._maxDepthSet = settings._maxDepthSet; } } [DebuggerStepThrough] public void Populate(TextReader reader, object target) { Populate(new JsonTextReader(reader), target); } [DebuggerStepThrough] public void Populate(JsonReader reader, object target) { PopulateInternal(reader, target); } internal virtual void PopulateInternal(JsonReader reader, object target) { ValidationUtils.ArgumentNotNull(reader, "reader"); ValidationUtils.ArgumentNotNull(target, "target"); SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString); TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null); JsonSerializerInternalReader jsonSerializerInternalReader = new JsonSerializerInternalReader(this); jsonSerializerInternalReader.Populate(traceJsonReader ?? reader, target); if (traceJsonReader != null) { TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null); } ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString); } [DebuggerStepThrough] public object? Deserialize(JsonReader reader) { return Deserialize(reader, null); } [DebuggerStepThrough] public object? Deserialize(TextReader reader, Type objectType) { return Deserialize(new JsonTextReader(reader), objectType); } [DebuggerStepThrough] public T? Deserialize<T>(JsonReader reader) { return (T)Deserialize(reader, typeof(T)); } [DebuggerStepThrough] public object? Deserialize(JsonReader reader, Type? objectType) { return DeserializeInternal(reader, objectType); } internal virtual object? DeserializeInternal(JsonReader reader, Type? objectType) { ValidationUtils.ArgumentNotNull(reader, "reader"); SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString); TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null); JsonSerializerInternalReader jsonSerializerInternalReader = new JsonSerializerInternalReader(this); object result = jsonSerializerInternalReader.Deserialize(traceJsonReader ?? reader, objectType, CheckAdditionalContent); if (traceJsonReader != null) { TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null); } ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString); return result; } internal void SetupReader(JsonReader reader, out CultureInfo? previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string? previousDateFormatString) { if (_culture != null && !_culture.Equals(reader.Culture)) { previousCulture = reader.Culture; reader.Culture = _culture; } else { previousCulture = null; } if (_dateTimeZoneHandling.HasValue && reader.DateTimeZoneHandling != _dateTimeZoneHandling) { previousDateTimeZoneHandling = reader.DateTimeZoneHandling; reader.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault(); } else { previousDateTimeZoneHandling = null; } if (_dateParseHandling.HasValue && reader.DateParseHandling != _dateParseHandling) { previousDateParseHandling = reader.DateParseHandling; reader.DateParseHandling = _dateParseHandling.GetValueOrDefault(); } else { previousDateParseHandling = null; } if (_floatParseHandling.HasValue && reader.FloatParseHandling != _floatParseHandling) { previousFloatParseHandling = reader.FloatParseHandling; reader.FloatParseHandling = _floatParseHandling.GetValueOrDefault(); } else { previousFloatParseHandling = null; } if (_maxDepthSet && reader.MaxDepth != _maxDepth) { previousMaxDepth = reader.MaxDepth; reader.MaxDepth = _maxDepth; } else { previousMaxDepth = null; } if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString) { previousDateFormatString = reader.DateFormatString; reader.DateFormatString = _dateFormatString; } else { previousDateFormatString = null; } if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable == null && _contractResolver is DefaultContractResolver defaultContractResolver) { jsonTextReader.PropertyNameTable = defaultContractResolver.GetNameTable(); } } private void ResetReader(JsonReader reader, CultureInfo? previousCulture, DateTimeZoneHandling? previousDateTimeZoneHandling, DateParseHandling? previousDateParseHandling, FloatParseHandling? previousFloatParseHandling, int? previousMaxDepth, string? previousDateFormatString) { if (previousCulture != null) { reader.Culture = previousCulture; } if (previousDateTimeZoneHandling.HasValue) { reader.DateTimeZoneHandling = previousDateTimeZoneHandling.GetValueOrDefault(); } if (previousDateParseHandling.HasValue) { reader.DateParseHandling = previousDateParseHandling.GetValueOrDefault(); } if (previousFloatParseHandling.HasValue) { reader.FloatParseHandling = previousFloatParseHandling.GetValueOrDefault(); } if (_maxDepthSet) { reader.MaxDepth = previousMaxDepth; } if (_dateFormatStringSet) { reader.DateFormatString = previousDateFormatString; } if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable != null && _contractResolver is DefaultContractResolver defaultContractResolver && jsonTextReader.PropertyNameTable == defaultContractResolver.GetNameTable()) { jsonTextReader.PropertyNameTable = null; } } public void Serialize(TextWriter textWriter, object? value) { Serialize(new JsonTextWriter(textWriter), value); } public void Serialize(JsonWriter jsonWriter, object? value, Type? objectType) { SerializeInternal(jsonWriter, value, objectType); } public void Serialize(TextWriter textWriter, object? value, Type objectType) { Serialize(new JsonTextWriter(textWriter), value, objectType); } public void Serialize(JsonWriter jsonWriter, object? value) { SerializeInternal(jsonWriter, value, null); } private TraceJsonReader CreateTraceJsonReader(JsonReader reader) { TraceJsonReader traceJsonReader = new TraceJsonReader(reader); if (reader.TokenType != 0) { traceJsonReader.WriteCurrentToken(); } return traceJsonReader; } internal virtual void SerializeInternal(JsonWriter jsonWriter, object? value, Type? objectType) { ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter"); Formatting? formatting = null; if (_formatting.HasValue && jsonWriter.Formatting != _formatting) { formatting = jsonWriter.Formatting; jsonWriter.Formatting = _formatting.GetValueOrDefault(); } DateFormatHandling? dateFormatHandling = null; if (_dateFormatHandling.HasValue && jsonWriter.DateFormatHandling != _dateFormatHandling) { dateFormatHandling = jsonWriter.DateFormatHandling; jsonWriter.DateFormatHandling = _dateFormatHandling.GetValueOrDefault(); } DateTimeZoneHandling? dateTimeZoneHandling = null; if (_dateTimeZoneHandling.HasValue && jsonWriter.DateTimeZoneHandling != _dateTimeZoneHandling) { dateTimeZoneHandling = jsonWriter.DateTimeZoneHandling; jsonWriter.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault(); } FloatFormatHandling? floatFormatHandling = null; if (_floatFormatHandling.HasValue && jsonWriter.FloatFormatHandling != _floatFormatHandling) { floatFormatHandling = jsonWriter.FloatFormatHandling; jsonWriter.FloatFormatHandling = _floatFormatHandling.GetValueOrDefault(); } StringEscapeHandling? stringEscapeHandling = null; if (_stringEscapeHandling.HasValue && jsonWriter.StringEscapeHandling != _stringEscapeHandling) { stringEscapeHandling = jsonWriter.StringEscapeHandling; jsonWriter.StringEscapeHandling = _stringEscapeHandling.GetValueOrDefault(); } CultureInfo cultureInfo = null; if (_culture != null && !_culture.Equals(jsonWriter.Culture)) { cultureInfo = jsonWriter.Culture; jsonWriter.Culture = _culture; } string dateFormatString = null; if (_dateFormatStringSet && jsonWriter.DateFormatString != _dateFormatString) { dateFormatString = jsonWriter.DateFormatString; jsonWriter.DateFormatString = _dateFormatString; } TraceJsonWriter traceJsonWriter = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonWriter(jsonWriter) : null); JsonSerializerInternalWriter jsonSerializerInternalWriter = new JsonSerializerInternalWriter(this); jsonSerializerInternalWriter.Serialize(traceJsonWriter ?? jsonWriter, value, objectType); if (traceJsonWriter != null) { TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null); } if (formatting.HasValue) { jsonWriter.Formatting = formatting.GetValueOrDefault(); } if (dateFormatHandling.HasValue) { jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault(); } if (dateTimeZoneHandling.HasValue) { jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault(); } if (floatFormatHandling.HasValue) { jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault(); } if (stringEscapeHandling.HasValue) { jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault(); } if (_dateFormatStringSet) { jsonWriter.DateFormatString = dateFormatString; } if (cultureInfo != null) { jsonWriter.Culture = cultureInfo; } } internal IReferenceResolver GetReferenceResolver() { if (_referenceResolver == null) { _referenceResolver = new DefaultReferenceResolver(); } return _referenceResolver; } internal JsonConverter? GetMatchingConverter(Type type) { return GetMatchingConverter(_converters, type); } internal static JsonConverter? GetMatchingConverter(IList<JsonConverter>? converters, Type objectType) { ValidationUtils.ArgumentNotNull(objectType, "objectType"); if (converters != null) { for (int i = 0; i < converters.Count; i++) { JsonConverter jsonConverter = converters[i]; if (jsonConverter.CanConvert(objectType)) { return jsonConverter; } } } return null; } internal void OnError(Newtonsoft.Json.Serialization.ErrorEventArgs e) { this.Error?.Invoke(this, e); } } public class JsonSerializerSettings { internal const ReferenceLoopHandling DefaultReferenceLoopHandling = ReferenceLoopHandling.Error; internal const MissingMemberHandling DefaultMissingMemberHandling = MissingMemberHandling.Ignore; internal const NullValueHandling DefaultNullValueHandling = NullValueHandling.Include; internal const DefaultValueHandling DefaultDefaultValueHandling = DefaultValueHandling.Include; internal const ObjectCreationHandling DefaultObjectCreationHandling = ObjectCreationHandling.Auto; internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None; internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default; internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None; internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default; internal static readonly StreamingContext DefaultContext; internal const Formatting DefaultFormatting = Formatting.None; internal const DateFormatHandling DefaultDateFormatHandling = DateFormatHandling.IsoDateFormat; internal const DateTimeZoneHandling DefaultDateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; internal const DateParseHandling DefaultDateParseHandling = DateParseHandling.DateTime; internal const FloatParseHandling DefaultFloatParseHandling = FloatParseHandling.Double; internal const FloatFormatHandling DefaultFloatFormatHandling = FloatFormatHandling.String; internal const StringEscapeHandling DefaultStringEscapeHandling = StringEscapeHandling.Default; internal const TypeNameAssemblyFormatHandling DefaultTypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple; internal static readonly CultureInfo DefaultCulture; internal const bool DefaultCheckAdditionalContent = false; internal const string DefaultDateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; internal const int DefaultMaxDepth = 64; internal Formatting? _formatting; internal DateFormatHandling? _dateFormatHandling; internal DateTimeZoneHandling? _dateTimeZoneHandling; internal DateParseHandling? _dateParseHandling; internal FloatFormatHandling? _floatFormatHandling; internal FloatParseHandling? _floatParseHandling; internal StringEscapeHandling? _stringEscapeHandling; internal CultureInfo? _culture; internal bool? _checkAdditionalContent; internal int? _maxDepth; internal bool _maxDepthSet; internal string? _dateFormatString; internal bool _dateFormatStringSet; internal TypeNameAssemblyFormatHandling? _typeNameAssemblyFormatHandling; internal DefaultValueHandling? _defaultValueHandling; internal PreserveReferencesHandling? _preserveReferencesHandling; internal NullValueHandling? _nullValueHandling; internal ObjectCreationHandling? _objectCreationHandling; internal MissingMemberHandling? _missingMemberHandling; internal ReferenceLoopHandling? _referenceLoopHandling; internal StreamingContext? _context; internal ConstructorHandling? _constructorHandling; internal TypeNameHandling? _typeNameHandling; internal MetadataPropertyHandling? _metadataPropertyHandling; public ReferenceLoopHandling ReferenceLoopHandling { get { return _referenceLoopHandling.GetValueOrDefault(); } set { _referenceLoopHandling = value; } } public MissingMemberHandling MissingMemberHandling { get { return _missingMemberHandling.GetValueOrDefault(); } set { _missingMemberHandling = value; } } public ObjectCreationHandling ObjectCreationHandling { get { return _objectCreationHandling.GetValueOrDefault(); } set { _objectCreationHandling = value; } } public NullValueHandling NullValueHandling { get { return _nullValueHandling.GetValueOrDefault(); } set { _nullValueHandling = value; } } public DefaultValueHandling DefaultValueHandling { get { return _defaultValueHandling.GetValueOrDefault(); } set { _defaultValueHandling = value; } } public IList<JsonConverter> Converters { get; set; } public PreserveReferencesHandling PreserveReferencesHandling { get { return _preserveReferencesHandling.GetValueOrDefault(); } set { _preserveReferencesHandling = value; } } public TypeNameHandling TypeNameHandling { get { return _typeNameHandling.GetValueOrDefault(); } set { _typeNameHandling = value; } } public MetadataPropertyHandling MetadataPropertyHandling { get { return _metadataPropertyHandling.GetValueOrDefault(); } set { _metadataPropertyHandling = value; } } [Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")] public FormatterAssemblyStyle TypeNameAssemblyFormat { get { return (FormatterAssemblyStyle)TypeNameAssemblyFormatHandling; } set { TypeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value; } } public TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling { get { return _typeNameAssemblyFormatHandling.GetValueOrDefault(); } set { _typeNameAssemblyFormatHandling = value; } } public ConstructorHandling ConstructorHandling { get { return _constructorHandling.GetValueOrDefault(); } set { _constructorHandling = value; } } public IContractResolver? ContractResolver { get; set; } public IEqualityComparer? EqualityComparer { get; set; } [Obsolete("ReferenceResolver property is obsolete. Use the ReferenceResolverProvider property to set the IReferenceResolver: settings.ReferenceResolverProvider = () => resolver")] public IReferenceResolver? ReferenceResolver { get { return ReferenceResolverProvider?.Invoke(); } set { IReferenceResolver value2 = value; ReferenceResolverProvider = ((value2 != null) ? ((Func<IReferenceResolver>)(() => value2)) : null); } } public Func<IReferenceResolver?>? ReferenceResolverProvider { get; set; } public ITraceWriter? TraceWriter { get; set; } [Obsolete("Binder is obsolete. Use SerializationBinder instead.")] public SerializationBinder? Binder { get { if (SerializationBinder == null) { return null; } if (SerializationBinder is SerializationBinderAdapter serializationBinderAdapter) { return serializationBinderAdapter.SerializationBinder; } throw new InvalidOperationException("Cannot get SerializationBinder because an ISerializationBinder was previously set."); } set { SerializationBinder = ((value == null) ? null : new SerializationBinderAdapter(value)); } } public ISerializationBinder? SerializationBinder { get; set; } public EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>? Error { get; set; } public StreamingContext Context { get { return _context ?? DefaultContext; } set { _context = value; } } public string DateFormatString { get { return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; } set { _dateFormatString = value; _dateFormatStringSet = true; } } public int? MaxDepth { get { return _maxDepthSet ? _maxDepth : new int?(64); } set { if (value <= 0) { throw new ArgumentException("Value must be positive.", "value"); } _maxDepth = value; _maxDepthSet = true; } } public Formatting Formatting { get { return _formatting.GetValueOrDefault(); } set { _formatting = value; } } public DateFormatHandling DateFormatHandling { get { return _dateFormatHandling.GetValueOrDefault(); } set { _dateFormatHandling = value; } } public DateTimeZoneHandling DateTimeZoneHandling { get { return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind; } set { _dateTimeZoneHandling = value; } } public DateParseHandling DateParseHandling { get { return _dateParseHandling ?? DateParseHandling.DateTime; } set { _dateParseHandling = value; } } public FloatFormatHandling FloatFormatHandling { get { return _floatFormatHandling.GetValueOrDefault(); } set { _floatFormatHandling = value; } } public FloatParseHandling FloatParseHandling { get { return _floatParseHandling.GetValueOrDefault(); } set { _floatParseHandling = value; } } public StringEscapeHandling StringEscapeHandling { get { return _stringEscapeHandling.GetValueOrDefault(); } set { _stringEscapeHandling = value; } } public CultureInfo Culture { get { return _culture ?? DefaultCulture; } set { _culture = value; } } public bool CheckAdditionalContent { get { return _checkAdditionalContent.GetValueOrDefault(); } set { _checkAdditionalContent = value; } } static JsonSerializerSettings() { DefaultContext = default(StreamingContext); DefaultCulture = CultureInfo.InvariantCulture; } [DebuggerStepThrough] public JsonSerializerSettings() { Converters = new List<JsonConverter>(); } } internal enum ReadType { Read, ReadAsInt32, ReadAsInt64, ReadAsBytes, ReadAsString, ReadAsDecimal, ReadAsDateTime, ReadAsDateTimeOffset, ReadAsDouble, ReadAsBoolean } public class JsonTextReader : JsonReader, IJsonLineInfo { private const char UnicodeReplacementChar = '\ufffd'; private readonly TextReader _reader; private char[]? _chars; private int _charsUsed; private int _charPos; private int _lineStartPos; private int _lineNumber; private bool _isEndOfFile; private StringBuffer _stringBuffer; private StringReference _stringReference; private IArrayPool<char>? _arrayPool; internal int LargeBufferLength { get; set; } = 1073741823; internal char[]? CharBuffer { get { return _chars; } set { _chars = value; } } internal int CharPos => _charPos; public JsonNameTable? PropertyNameTable { get; set; } public IArrayPool<char>? ArrayPool { get { return _arrayPool; } set { if (value == null) { throw new ArgumentNullException("value"); } _arrayPool = value; } } public int LineNumber { get { if (base.CurrentState == State.Start && LinePosition == 0 && TokenType != JsonToken.Comment) { return 0; } return _lineNumber; } } public int LinePosition => _charPos - _lineStartPos; public JsonTextReader(TextReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } _reader = reader; _lineNumber = 1; } private void EnsureBufferNotEmpty() { if (_stringBuffer.IsEmpty) { _stringBuffer = new StringBuffer(_arrayPool, 1024); } } private void SetNewLine(bool hasNextChar) { MiscellaneousUtils.Assert(_chars != null); if (hasNextChar && _chars[_charPos] == '\n') { _charPos++; } OnNewLine(_charPos); } private void OnNewLine(int pos) { _lineNumber++; _lineStartPos = pos; } private void ParseString(char quote, ReadType readType) { _charPos++; ShiftBufferIfNeeded(); ReadStringIntoBuffer(quote); ParseReadString(quote, readType); } private void ParseReadString(char quote, ReadType readType) { SetPostValueState(updateIndex: true); switch (readType) { case ReadType.ReadAsBytes: { Guid g; byte[] value2 = ((_stringReference.Length == 0) ? CollectionUtils.ArrayEmpty<byte>() : ((_stringReference.Length != 36 || !ConvertUtils.TryConvertGuid(_stringReference.ToString(), out g)) ? Convert.FromBase64CharArray(_stringReference.Chars, _stringReference.StartIndex, _stringReference.Length) : g.ToByteArray())); SetToken(JsonToken.Bytes, value2, updateIndex: false); return; } case ReadType.ReadAsString: { string value = _stringReference.ToString(); SetToken(JsonToken.String, value, updateIndex: false); _quoteChar = quote; return; } case ReadType.ReadAsInt32: case ReadType.ReadAsDecimal: case ReadType.ReadAsBoolean: return; } if (_dateParseHandling != 0) { DateTimeOffset dt2; if (readType switch { ReadType.ReadAsDateTime => 1, ReadType.ReadAsDateTimeOffset => 2, _ => (int)_dateParseHandling, } == 1) { if (DateTimeUtils.TryParseDateTime(_stringReference, base.DateTimeZoneHandling, base.DateFormatString, base.Culture, out var dt)) { SetToken(JsonToken.Date, dt, updateIndex: false); return; } } else if (DateTimeUtils.TryParseDateTimeOffset(_stringReference, base.DateFormatString, base.Culture, out dt2)) { SetToken(JsonToken.Date, dt2, updateIndex: false); return; } } SetToken(JsonToken.String, _stringReference.ToString(), updateIndex: false); _quoteChar = quote; } private static void BlockCopyChars(char[] src, int srcOffset, char[] dst, int dstOffset, int count) { Buffer.BlockCopy(src, srcOffset * 2, dst, dstOffset *
plugins/MtGAPI/System.Xml.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Configuration; using System.Diagnostics; using System.Globalization; using System.IO; using System.Net; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Security.Policy; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Xml.Serialization.Advanced; using System.Xml.XPath; using System.Xml.Xsl; using Microsoft.CSharp; using Microsoft.VisualBasic; using Mono.Xml; using Mono.Xml.Schema; using Mono.Xml.XPath; using Mono.Xml.XPath.yyParser; using Mono.Xml.XPath.yydebug; using Mono.Xml.Xsl; using Mono.Xml.Xsl.Operations; using Mono.Xml.Xsl.yyParser; using Mono.Xml.Xsl.yydebug; using Mono.Xml2; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyDescription("System.Xml.dll")] [assembly: AssemblyDefaultAlias("System.Xml.dll")] [assembly: AssemblyCompany("MONO development team")] [assembly: AssemblyProduct("MONO Common language infrastructure")] [assembly: AssemblyCopyright("(c) various MONO Authors")] [assembly: SatelliteContractVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.50727.1433")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: AssemblyDelaySign(true)] [assembly: AssemblyKeyFile("../ecma.pub")] [assembly: AllowPartiallyTrustedCallers] [assembly: AssemblyFileVersion("2.0.50727.1433")] [assembly: CompilationRelaxations(CompilationRelaxations.NoStringInterning)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("System.Xml.dll")] [assembly: AssemblyVersion("2.0.0.0")] namespace Mono.Xml.XPath { internal class XPathParser { private class YYRules : MarshalByRefObject { public static string[] yyRule = new string[104] { "$accept : Expr", "Pattern : LocationPathPattern", "Pattern : Pattern BAR LocationPathPattern", "LocationPathPattern : SLASH", "LocationPathPattern : SLASH RelativePathPattern", "LocationPathPattern : IdKeyPattern", "LocationPathPattern : IdKeyPattern SLASH RelativePathPattern", "LocationPathPattern : IdKeyPattern SLASH2 RelativePathPattern", "LocationPathPattern : SLASH2 RelativePathPattern", "LocationPathPattern : RelativePathPattern", "IdKeyPattern : FUNCTION_NAME PAREN_OPEN LITERAL PAREN_CLOSE", "IdKeyPattern : FUNCTION_NAME PAREN_OPEN LITERAL COMMA LITERAL PAREN_CLOSE", "RelativePathPattern : StepPattern", "RelativePathPattern : RelativePathPattern SLASH StepPattern", "RelativePathPattern : RelativePathPattern SLASH2 StepPattern", "StepPattern : ChildOrAttributeAxisSpecifier NodeTest Predicates", "ChildOrAttributeAxisSpecifier : AbbreviatedAxisSpecifier", "ChildOrAttributeAxisSpecifier : CHILD COLON2", "ChildOrAttributeAxisSpecifier : ATTRIBUTE COLON2", "Predicates :", "Predicates : Predicates Predicate", "Expr : OrExpr", "OrExpr : AndExpr", "OrExpr : OrExpr OR AndExpr", "AndExpr : EqualityExpr", "AndExpr : AndExpr AND EqualityExpr", "EqualityExpr : RelationalExpr", "EqualityExpr : EqualityExpr EQ RelationalExpr", "EqualityExpr : EqualityExpr NE RelationalExpr", "RelationalExpr : AdditiveExpr", "RelationalExpr : RelationalExpr LT AdditiveExpr", "RelationalExpr : RelationalExpr GT AdditiveExpr", "RelationalExpr : RelationalExpr LE AdditiveExpr", "RelationalExpr : RelationalExpr GE AdditiveExpr", "AdditiveExpr : MultiplicativeExpr", "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr", "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr", "MultiplicativeExpr : UnaryExpr", "MultiplicativeExpr : MultiplicativeExpr MULTIPLY UnaryExpr", "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr", "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr", "UnaryExpr : UnionExpr", "UnaryExpr : MINUS UnaryExpr", "UnionExpr : PathExpr", "UnionExpr : UnionExpr BAR PathExpr", "PathExpr : LocationPath", "PathExpr : FilterExpr", "PathExpr : FilterExpr SLASH RelativeLocationPath", "PathExpr : FilterExpr SLASH2 RelativeLocationPath", "LocationPath : RelativeLocationPath", "LocationPath : AbsoluteLocationPath", "AbsoluteLocationPath : SLASH", "AbsoluteLocationPath : SLASH RelativeLocationPath", "AbsoluteLocationPath : SLASH2 RelativeLocationPath", "RelativeLocationPath : Step", "RelativeLocationPath : RelativeLocationPath SLASH Step", "RelativeLocationPath : RelativeLocationPath SLASH2 Step", "Step : AxisSpecifier NodeTest Predicates", "Step : AbbreviatedStep", "NodeTest : NameTest", "NodeTest : NodeType PAREN_OPEN PAREN_CLOSE", "NodeTest : PROCESSING_INSTRUCTION PAREN_OPEN OptionalLiteral PAREN_CLOSE", "NameTest : ASTERISK", "NameTest : QName", "AbbreviatedStep : DOT", "AbbreviatedStep : DOT2", "Predicates :", "Predicates : Predicates Predicate", "AxisSpecifier : AxisName COLON2", "AxisSpecifier : AbbreviatedAxisSpecifier", "AbbreviatedAxisSpecifier :", "AbbreviatedAxisSpecifier : AT", "NodeType : COMMENT", "NodeType : TEXT", "NodeType : PROCESSING_INSTRUCTION", "NodeType : NODE", "FilterExpr : PrimaryExpr", "FilterExpr : FilterExpr Predicate", "PrimaryExpr : DOLLAR QName", "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE", "PrimaryExpr : LITERAL", "PrimaryExpr : NUMBER", "PrimaryExpr : FunctionCall", "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE", "OptionalArgumentList :", "OptionalArgumentList : Expr OptionalArgumentListTail", "OptionalArgumentListTail :", "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail", "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE", "AxisName : ANCESTOR", "AxisName : ANCESTOR_OR_SELF", "AxisName : ATTRIBUTE", "AxisName : CHILD", "AxisName : DESCENDANT", "AxisName : DESCENDANT_OR_SELF", "AxisName : FOLLOWING", "AxisName : FOLLOWING_SIBLING", "AxisName : NAMESPACE", "AxisName : PARENT", "AxisName : PRECEDING", "AxisName : PRECEDING_SIBLING", "AxisName : SELF", "OptionalLiteral :", "OptionalLiteral : LITERAL" }; public static string getRule(int index) { return yyRule[index]; } } internal IStaticXsltContext Context; private static int yacc_verbose_flag; public TextWriter ErrorOutput = Console.Out; public int eof_token; internal Mono.Xml.XPath.yydebug.yyDebug debug; protected static int yyFinal = 25; protected static string[] yyNames; private int yyExpectingState; protected int yyMax; private static short[] yyLhs; private static short[] yyLen; private static short[] yyDefRed; protected static short[] yyDgoto; protected static short[] yySindex; protected static short[] yyRindex; protected static short[] yyGindex; protected static short[] yyTable; protected static short[] yyCheck; public XPathParser() : this(null) { } internal XPathParser(IStaticXsltContext context) { Context = context; ErrorOutput = TextWriter.Null; } static XPathParser() { string[] array = new string[334]; array[0] = "end-of-file"; array[36] = "'$'"; array[40] = "'('"; array[41] = "')'"; array[42] = "'*'"; array[43] = "'+'"; array[44] = "','"; array[45] = "'-'"; array[46] = "'.'"; array[47] = "'/'"; array[60] = "'<'"; array[61] = "'='"; array[62] = "'>'"; array[64] = "'@'"; array[91] = "'['"; array[93] = "']'"; array[124] = "'|'"; array[257] = "ERROR"; array[258] = "EOF"; array[259] = "SLASH"; array[260] = "SLASH2"; array[261] = "\"//\""; array[262] = "DOT"; array[263] = "DOT2"; array[264] = "\"..\""; array[265] = "COLON2"; array[266] = "\"::\""; array[267] = "COMMA"; array[268] = "AT"; array[269] = "FUNCTION_NAME"; array[270] = "BRACKET_OPEN"; array[271] = "BRACKET_CLOSE"; array[272] = "PAREN_OPEN"; array[273] = "PAREN_CLOSE"; array[274] = "AND"; array[275] = "\"and\""; array[276] = "OR"; array[277] = "\"or\""; array[278] = "DIV"; array[279] = "\"div\""; array[280] = "MOD"; array[281] = "\"mod\""; array[282] = "PLUS"; array[283] = "MINUS"; array[284] = "ASTERISK"; array[285] = "DOLLAR"; array[286] = "BAR"; array[287] = "EQ"; array[288] = "NE"; array[289] = "\"!=\""; array[290] = "LE"; array[291] = "\"<=\""; array[292] = "GE"; array[293] = "\">=\""; array[294] = "LT"; array[295] = "GT"; array[296] = "ANCESTOR"; array[297] = "\"ancestor\""; array[298] = "ANCESTOR_OR_SELF"; array[299] = "\"ancstor-or-self\""; array[300] = "ATTRIBUTE"; array[301] = "\"attribute\""; array[302] = "CHILD"; array[303] = "\"child\""; array[304] = "DESCENDANT"; array[305] = "\"descendant\""; array[306] = "DESCENDANT_OR_SELF"; array[307] = "\"descendant-or-self\""; array[308] = "FOLLOWING"; array[309] = "\"following\""; array[310] = "FOLLOWING_SIBLING"; array[311] = "\"sibling\""; array[312] = "NAMESPACE"; array[313] = "\"NameSpace\""; array[314] = "PARENT"; array[315] = "\"parent\""; array[316] = "PRECEDING"; array[317] = "\"preceding\""; array[318] = "PRECEDING_SIBLING"; array[319] = "\"preceding-sibling\""; array[320] = "SELF"; array[321] = "\"self\""; array[322] = "COMMENT"; array[323] = "\"comment\""; array[324] = "TEXT"; array[325] = "\"text\""; array[326] = "PROCESSING_INSTRUCTION"; array[327] = "\"processing-instruction\""; array[328] = "NODE"; array[329] = "\"node\""; array[330] = "MULTIPLY"; array[331] = "NUMBER"; array[332] = "LITERAL"; array[333] = "QName"; yyNames = array; yyLhs = new short[104] { -1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 4, 3, 3, 3, 5, 6, 6, 6, 8, 8, 0, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 19, 20, 20, 23, 23, 23, 22, 22, 22, 24, 24, 7, 7, 7, 27, 27, 26, 26, 8, 8, 25, 25, 9, 9, 28, 28, 28, 28, 21, 21, 31, 31, 31, 31, 31, 32, 33, 33, 34, 34, 10, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29 }; yyLen = new short[104] { 2, 1, 3, 1, 2, 1, 3, 3, 2, 1, 4, 6, 1, 3, 3, 3, 1, 2, 2, 0, 2, 1, 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, 2, 1, 3, 1, 1, 3, 3, 1, 1, 1, 2, 2, 1, 3, 3, 3, 1, 1, 3, 4, 1, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 4, 0, 2, 0, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 }; yyDefRed = new short[118] { 0, 0, 0, 64, 65, 71, 0, 0, 0, 0, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 81, 80, 0, 69, 0, 0, 0, 0, 0, 0, 37, 0, 43, 45, 0, 0, 50, 54, 0, 58, 0, 76, 82, 0, 0, 0, 0, 42, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 62, 72, 73, 0, 75, 63, 19, 59, 0, 68, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 38, 44, 0, 0, 0, 55, 56, 0, 0, 0, 0, 85, 83, 88, 103, 0, 20, 60, 0, 61, 87 }; yyDgoto = new short[35] { 25, 0, 0, 0, 0, 0, 0, 78, 105, 26, 69, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 79, 80, 112, 43, 44, 45, 83, 108 }; yySindex = new short[118] { -254, -130, -130, 0, 0, 0, -270, -254, -254, -326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -266, -262, -271, -256, -201, -267, 0, -258, 0, 0, -238, -169, 0, 0, -227, 0, -245, 0, 0, -169, -169, -254, -243, 0, 0, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -189, -130, -130, -254, 0, -130, -130, 0, 0, 0, -237, 0, 0, 0, 0, -232, 0, -224, -228, 0, -262, -271, -256, -256, -201, -201, -201, -201, -267, -267, 0, 0, 0, 0, -169, -169, -222, 0, 0, -285, -219, -220, -254, 0, 0, 0, 0, -218, 0, 0, -224, 0, 0 }; yyRindex = new short[118] { -176, 1, -176, 0, 0, 0, 0, -176, -176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 93, 37, 27, 357, 276, 0, 250, 0, 0, 85, 114, 0, 0, 0, 0, 0, 0, 0, 140, 169, -198, 0, 0, 0, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, 0, -176, -176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -208, 0, 0, 336, 484, 458, 476, 383, 393, 419, 429, 302, 328, 0, 0, 0, 0, 195, 224, 0, 0, 0, -206, 59, 0, -176, 0, 0, 0, 0, 0, 0, 0, -208, 0, 0 }; yyGindex = new short[35] { -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, -29, 0, 20, 31, 48, -33, 44, 25, 0, 29, 0, 0, 2, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, -23 }; yyTable = new short[765] { 49, 51, 48, 46, 47, 1, 2, 51, 3, 4, 52, 62, 53, 63, 5, 6, 54, 55, 7, 21, 81, 66, 67, 89, 90, 91, 92, 26, 65, 8, 84, 9, 68, 50, 56, 104, 57, 24, 58, 59, 106, 82, 10, 107, 11, 109, 12, 111, 13, 110, 14, 68, 15, 114, 16, 116, 17, 72, 18, 57, 19, 101, 20, 64, 21, 86, 22, 102, 99, 100, 1, 2, 85, 3, 4, 84, 113, 23, 24, 5, 6, 60, 61, 7, 86, 46, 70, 95, 96, 97, 70, 71, 117, 22, 98, 73, 9, 74, 0, 75, 115, 76, 87, 88, 93, 94, 77, 10, 70, 11, 0, 12, 0, 13, 49, 14, 0, 15, 0, 16, 0, 17, 0, 18, 70, 19, 70, 20, 70, 21, 70, 22, 3, 4, 0, 70, 102, 103, 5, 0, 52, 0, 23, 24, 0, 0, 70, 0, 70, 0, 70, 0, 70, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 11, 53, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 51, 0, 51, 51, 34, 51, 0, 51, 0, 51, 0, 51, 51, 70, 21, 51, 51, 51, 21, 51, 21, 51, 26, 51, 51, 0, 26, 0, 26, 26, 35, 26, 24, 0, 0, 0, 24, 0, 24, 24, 0, 24, 26, 26, 0, 0, 57, 57, 0, 0, 0, 70, 0, 70, 57, 70, 36, 70, 57, 51, 57, 57, 70, 57, 23, 57, 0, 57, 0, 57, 57, 0, 0, 57, 57, 57, 0, 57, 0, 57, 46, 57, 57, 0, 46, 29, 46, 46, 22, 46, 0, 46, 22, 46, 22, 46, 46, 22, 0, 46, 46, 46, 0, 46, 0, 46, 0, 46, 46, 49, 0, 32, 0, 49, 0, 49, 49, 57, 49, 0, 49, 33, 49, 0, 49, 49, 0, 0, 49, 49, 49, 0, 49, 0, 49, 52, 49, 49, 0, 52, 0, 52, 52, 46, 52, 0, 52, 30, 52, 0, 52, 52, 0, 0, 52, 52, 52, 31, 52, 0, 52, 0, 52, 52, 53, 0, 0, 0, 53, 0, 53, 53, 49, 53, 0, 53, 0, 53, 0, 53, 53, 0, 0, 53, 53, 53, 27, 53, 0, 53, 47, 53, 53, 0, 47, 0, 47, 47, 52, 47, 0, 47, 0, 47, 28, 47, 47, 0, 0, 47, 47, 47, 25, 47, 0, 47, 0, 47, 47, 48, 0, 0, 0, 48, 0, 48, 48, 53, 48, 0, 48, 0, 48, 0, 48, 48, 0, 0, 48, 48, 48, 0, 48, 0, 48, 41, 48, 48, 0, 41, 0, 41, 41, 47, 41, 0, 41, 0, 41, 0, 41, 41, 0, 0, 0, 41, 41, 0, 41, 0, 41, 34, 41, 41, 0, 34, 0, 34, 34, 0, 34, 0, 48, 0, 0, 0, 34, 34, 0, 0, 0, 34, 34, 0, 34, 0, 34, 35, 34, 34, 0, 35, 0, 35, 35, 0, 35, 0, 41, 0, 0, 0, 35, 35, 0, 0, 0, 35, 35, 0, 35, 0, 35, 36, 35, 35, 0, 36, 0, 36, 36, 23, 36, 0, 0, 23, 0, 23, 36, 36, 23, 0, 0, 36, 36, 0, 36, 0, 36, 0, 36, 36, 29, 0, 0, 0, 29, 0, 29, 29, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 29, 0, 29, 0, 29, 32, 29, 29, 0, 32, 0, 32, 32, 0, 32, 33, 0, 0, 0, 33, 0, 33, 33, 0, 33, 32, 32, 0, 32, 0, 32, 0, 32, 32, 0, 33, 33, 0, 33, 0, 33, 30, 33, 33, 0, 30, 0, 30, 30, 0, 30, 31, 0, 0, 0, 31, 0, 31, 31, 0, 31, 30, 30, 0, 30, 0, 30, 0, 30, 30, 0, 31, 31, 0, 31, 0, 31, 0, 31, 31, 27, 0, 0, 0, 27, 0, 27, 27, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 27, 27, 28, 0, 28, 28, 25, 28, 0, 0, 25, 0, 25, 25, 0, 25, 0, 0, 28, 28 }; yyCheck = new short[765] { 7, 0, 272, 1, 2, 259, 260, 333, 262, 263, 276, 278, 274, 280, 268, 269, 287, 288, 272, 0, 265, 259, 260, 56, 57, 58, 59, 0, 286, 283, 273, 285, 270, 8, 290, 272, 292, 0, 294, 295, 272, 48, 296, 267, 298, 273, 300, 332, 302, 271, 304, 270, 306, 273, 308, 273, 310, 284, 312, 0, 314, 68, 316, 330, 318, 273, 320, 273, 66, 67, 259, 260, 52, 262, 263, 273, 105, 331, 332, 268, 269, 282, 283, 272, 53, 0, 284, 62, 63, 64, 259, 260, 115, 0, 65, 322, 285, 324, -1, 326, 107, 328, 54, 55, 60, 61, 333, 296, 284, 298, -1, 300, -1, 302, 0, 304, -1, 306, -1, 308, -1, 310, -1, 312, 322, 314, 324, 316, 326, 318, 328, 320, 262, 263, -1, 333, 70, 71, 268, -1, 0, -1, 331, 332, -1, -1, 322, -1, 324, -1, 326, -1, 328, -1, -1, -1, -1, 333, -1, -1, -1, -1, -1, -1, -1, -1, 296, -1, 298, 0, 300, -1, 302, -1, 304, -1, 306, -1, 308, -1, 310, -1, 312, -1, 314, -1, 316, -1, 318, -1, 320, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 267, -1, -1, -1, 271, -1, 273, 274, 0, 276, -1, 278, -1, 280, -1, 282, 283, 284, 267, 286, 287, 288, 271, 290, 273, 292, 267, 294, 295, -1, 271, -1, 273, 274, 0, 276, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, 287, 288, -1, -1, 259, 260, -1, -1, -1, 322, -1, 324, 267, 326, 0, 328, 271, 330, 273, 274, 333, 276, 0, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, 0, 273, 274, 267, 276, -1, 278, 271, 280, 273, 282, 283, 276, -1, 286, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, -1, 0, -1, 271, -1, 273, 274, 330, 276, -1, 278, 0, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 330, 276, -1, 278, 0, 280, -1, 282, 283, -1, -1, 286, 287, 288, 0, 290, -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, 0, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, 0, 282, 283, -1, -1, 286, 287, 288, 0, 290, -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, -1, 330, -1, -1, -1, 282, 283, -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, -1, 330, -1, -1, -1, 282, 283, -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 267, 276, -1, -1, 271, -1, 273, 282, 283, 276, -1, -1, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, 287, 288, -1, 290, -1, 292, -1, 294, 295, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, 287, 288, -1, 290, -1, 292, -1, 294, 295, -1, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, 267, -1, 287, 288, 271, -1, 273, 274, 267, 276, -1, -1, 271, -1, 273, 274, -1, 276, -1, -1, 287, 288 }; } internal Expression Compile(string xpath) { try { Tokenizer yyLex = new Tokenizer(xpath); return (Expression)yyparse(yyLex); } catch (XPathException) { throw; } catch (Exception innerException) { throw new XPathException("Error during parse of " + xpath, innerException); } } private NodeSet CreateNodeTest(Axes axis, object nodeTest, ArrayList plist) { NodeSet nodeSet = CreateNodeTest(axis, nodeTest); if (plist != null) { for (int i = 0; i < plist.Count; i++) { nodeSet = new ExprFilter(nodeSet, (Expression)plist[i]); } } return nodeSet; } private NodeTest CreateNodeTest(Axes axis, object test) { if (test is XPathNodeType) { return new NodeTypeTest(axis, (XPathNodeType)(int)test, null); } if (test is string || test == null) { return new NodeTypeTest(axis, XPathNodeType.ProcessingInstruction, (string)test); } XmlQualifiedName xmlQualifiedName = (XmlQualifiedName)test; if (xmlQualifiedName == XmlQualifiedName.Empty) { return new NodeTypeTest(axis); } return new NodeNameTest(axis, xmlQualifiedName, Context); } public void yyerror(string message) { yyerror(message, null); } public void yyerror(string message, string[] expected) { if (yacc_verbose_flag > 0 && expected != null && expected.Length > 0) { ErrorOutput.Write(message + ", expecting"); for (int i = 0; i < expected.Length; i++) { ErrorOutput.Write(" " + expected[i]); } ErrorOutput.WriteLine(); } else { ErrorOutput.WriteLine(message); } } public static string yyname(int token) { if (token < 0 || token > yyNames.Length) { return "[illegal]"; } string result; if ((result = yyNames[token]) != null) { return result; } return "[unknown]"; } protected int[] yyExpectingTokens(int state) { int num = 0; bool[] array = new bool[yyNames.Length]; int num2; int i; if ((num2 = yySindex[state]) != 0) { for (i = ((num2 < 0) ? (-num2) : 0); i < yyNames.Length && num2 + i < yyTable.Length; i++) { if (yyCheck[num2 + i] == i && !array[i] && yyNames[i] != null) { num++; array[i] = true; } } } if ((num2 = yyRindex[state]) != 0) { for (i = ((num2 < 0) ? (-num2) : 0); i < yyNames.Length && num2 + i < yyTable.Length; i++) { if (yyCheck[num2 + i] == i && !array[i] && yyNames[i] != null) { num++; array[i] = true; } } } int[] array2 = new int[num]; num2 = (i = 0); while (num2 < num) { if (array[i]) { array2[num2++] = i; } i++; } return array2; } protected string[] yyExpecting(int state) { int[] array = yyExpectingTokens(state); string[] array2 = new string[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i++] = yyNames[array[i]]; } return array2; } internal object yyparse(Mono.Xml.XPath.yyParser.yyInput yyLex, object yyd) { debug = (Mono.Xml.XPath.yydebug.yyDebug)yyd; return yyparse(yyLex); } protected object yyDefault(object first) { return first; } internal object yyparse(Mono.Xml.XPath.yyParser.yyInput yyLex) { if (yyMax <= 0) { yyMax = 256; } int num = 0; int[] array = new int[yyMax]; object obj = null; object[] array2 = new object[yyMax]; int num2 = -1; int num3 = 0; int num4 = 0; while (true) { if (num4 >= array.Length) { int[] array3 = new int[array.Length + yyMax]; array.CopyTo(array3, 0); array = array3; object[] array4 = new object[array2.Length + yyMax]; array2.CopyTo(array4, 0); array2 = array4; } array[num4] = num; array2[num4] = obj; if (debug != null) { debug.push(num, obj); } while (true) { int num5; if ((num5 = yyDefRed[num]) == 0) { if (num2 < 0) { num2 = (yyLex.advance() ? yyLex.token() : 0); if (debug != null) { debug.lex(num, num2, yyname(num2), yyLex.value()); } } if ((num5 = yySindex[num]) != 0 && (num5 += num2) >= 0 && num5 < yyTable.Length && yyCheck[num5] == num2) { if (debug != null) { debug.shift(num, yyTable[num5], num3 - 1); } num = yyTable[num5]; obj = yyLex.value(); num2 = -1; if (num3 > 0) { num3--; } break; } if ((num5 = yyRindex[num]) == 0 || (num5 += num2) < 0 || num5 >= yyTable.Length || yyCheck[num5] != num2) { switch (num3) { case 0: yyExpectingState = num; if (debug != null) { debug.error("syntax error"); } if (num2 == 0 || num2 == eof_token) { throw new Mono.Xml.XPath.yyParser.yyUnexpectedEof(); } break; case 1: case 2: break; case 3: goto IL_02f5; default: goto IL_034b; } num3 = 3; while ((num5 = yySindex[array[num4]]) == 0 || (num5 += 256) < 0 || num5 >= yyTable.Length || yyCheck[num5] != 256) { if (debug != null) { debug.pop(array[num4]); } if (--num4 < 0) { if (debug != null) { debug.reject(); } throw new Mono.Xml.XPath.yyParser.yyException("irrecoverable syntax error"); } } if (debug != null) { debug.shift(array[num4], yyTable[num5], 3); } num = yyTable[num5]; obj = yyLex.value(); break; } num5 = yyTable[num5]; } goto IL_034b; IL_02f5: if (num2 == 0) { if (debug != null) { debug.reject(); } throw new Mono.Xml.XPath.yyParser.yyException("irrecoverable syntax error at end-of-file"); } if (debug != null) { debug.discard(num, num2, yyname(num2), yyLex.value()); } num2 = -1; continue; IL_034b: int num6 = num4 + 1 - yyLen[num5]; if (debug != null) { debug.reduce(num, array[num6 - 1], num5, YYRules.getRule(num5), yyLen[num5]); } obj = yyDefault((num6 <= num4) ? array2[num6] : null); switch (num5) { case 2: obj = new ExprUNION((NodeSet)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 3: obj = new ExprRoot(); break; case 4: obj = new ExprSLASH(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 6: obj = new ExprSLASH((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 7: obj = new ExprSLASH2((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 8: obj = new ExprSLASH2(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 10: { XmlQualifiedName xmlQualifiedName2 = (XmlQualifiedName)array2[-3 + num4]; if (xmlQualifiedName2.Name != "id" || xmlQualifiedName2.Namespace != string.Empty) { throw new XPathException($"Expected 'id' but got '{xmlQualifiedName2}'"); } obj = ExprFunctionCall.Factory(xmlQualifiedName2, new FunctionArguments(new ExprLiteral((string)array2[-1 + num4]), null), Context); break; } case 11: { XmlQualifiedName xmlQualifiedName = (XmlQualifiedName)array2[-5 + num4]; if (xmlQualifiedName.Name != "key" || xmlQualifiedName.Namespace != string.Empty) { throw new XPathException($"Expected 'key' but got '{xmlQualifiedName}'"); } obj = Context.TryGetFunction(xmlQualifiedName, new FunctionArguments(new ExprLiteral((string)array2[-3 + num4]), new FunctionArguments(new ExprLiteral((string)array2[-1 + num4]), null))); break; } case 13: obj = new ExprSLASH((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 14: obj = new ExprSLASH2((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 15: obj = CreateNodeTest((Axes)(int)array2[-2 + num4], array2[-1 + num4], (ArrayList)array2[0 + num4]); break; case 17: obj = Axes.Child; break; case 18: obj = Axes.Attribute; break; case 19: obj = null; break; case 20: { ArrayList arrayList2 = (ArrayList)array2[-1 + num4]; if (arrayList2 == null) { arrayList2 = new ArrayList(); } arrayList2.Add((Expression)array2[0 + num4]); obj = arrayList2; break; } case 23: obj = new ExprOR((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 25: obj = new ExprAND((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 27: obj = new ExprEQ((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 28: obj = new ExprNE((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 30: obj = new ExprLT((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 31: obj = new ExprGT((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 32: obj = new ExprLE((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 33: obj = new ExprGE((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 35: obj = new ExprPLUS((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 36: obj = new ExprMINUS((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 38: obj = new ExprMULT((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 39: obj = new ExprDIV((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 40: obj = new ExprMOD((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 42: obj = new ExprNEG((Expression)array2[0 + num4]); break; case 44: obj = new ExprUNION((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 47: obj = new ExprSLASH((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 48: obj = new ExprSLASH2((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 51: obj = new ExprRoot(); break; case 52: obj = new ExprSLASH(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 53: obj = new ExprSLASH2(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 55: obj = new ExprSLASH((NodeSet)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 56: obj = new ExprSLASH2((NodeSet)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 57: obj = CreateNodeTest((Axes)(int)array2[-2 + num4], array2[-1 + num4], (ArrayList)array2[0 + num4]); break; case 60: obj = (XPathNodeType)(int)array2[-2 + num4]; break; case 61: obj = (string)array2[-1 + num4]; break; case 62: obj = XmlQualifiedName.Empty; break; case 64: obj = new NodeTypeTest(Axes.Self, XPathNodeType.All); break; case 65: obj = new NodeTypeTest(Axes.Parent, XPathNodeType.All); break; case 66: obj = null; break; case 67: { ArrayList arrayList = (ArrayList)array2[-1 + num4]; if (arrayList == null) { arrayList = new ArrayList(); } arrayList.Add(array2[0 + num4]); obj = arrayList; break; } case 68: obj = array2[-1 + num4]; break; case 70: obj = Axes.Child; break; case 71: obj = Axes.Attribute; break; case 72: obj = XPathNodeType.Comment; break; case 73: obj = XPathNodeType.Text; break; case 74: obj = XPathNodeType.ProcessingInstruction; break; case 75: obj = XPathNodeType.All; break; case 77: obj = new ExprFilter((Expression)array2[-1 + num4], (Expression)array2[0 + num4]); break; case 78: { Expression expression2 = null; if (Context != null) { expression2 = Context.TryGetVariable(((XmlQualifiedName)array2[0 + num4]).ToString()); } if (expression2 == null) { expression2 = new ExprVariable((XmlQualifiedName)array2[0 + num4], Context); } obj = expression2; break; } case 79: obj = new ExprParens((Expression)array2[-1 + num4]); break; case 80: obj = new ExprLiteral((string)array2[0 + num4]); break; case 81: obj = new ExprNumber((double)array2[0 + num4]); break; case 83: { Expression expression = null; if (Context != null) { expression = Context.TryGetFunction((XmlQualifiedName)array2[-3 + num4], (FunctionArguments)array2[-1 + num4]); } if (expression == null) { expression = ExprFunctionCall.Factory((XmlQualifiedName)array2[-3 + num4], (FunctionArguments)array2[-1 + num4], Context); } obj = expression; break; } case 85: obj = new FunctionArguments((Expression)array2[-1 + num4], (FunctionArguments)array2[0 + num4]); break; case 87: obj = new FunctionArguments((Expression)array2[-1 + num4], (FunctionArguments)array2[0 + num4]); break; case 88: obj = array2[-1 + num4]; break; case 89: obj = Axes.Ancestor; break; case 90: obj = Axes.AncestorOrSelf; break; case 91: obj = Axes.Attribute; break; case 92: obj = Axes.Child; break; case 93: obj = Axes.Descendant; break; case 94: obj = Axes.DescendantOrSelf; break; case 95: obj = Axes.Following; break; case 96: obj = Axes.FollowingSibling; break; case 97: obj = Axes.Namespace; break; case 98: obj = Axes.Parent; break; case 99: obj = Axes.Preceding; break; case 100: obj = Axes.PrecedingSibling; break; case 101: obj = Axes.Self; break; } num4 -= yyLen[num5]; num = array[num4]; int num7 = yyLhs[num5]; if (num == 0 && num7 == 0) { if (debug != null) { debug.shift(0, yyFinal); } num = yyFinal; if (num2 < 0) { num2 = (yyLex.advance() ? yyLex.token() : 0); if (debug != null) { debug.lex(num, num2, yyname(num2), yyLex.value()); } } if (num2 == 0) { if (debug != null) { debug.accept(obj); } return obj; } break; } num = (((num5 = yyGindex[num7]) == 0 || (num5 += num) < 0 || num5 >= yyTable.Length || yyCheck[num5] != num) ? yyDgoto[num7] : yyTable[num5]); if (debug != null) { debug.shift(array[num4], num); } break; } num4++; } } } } namespace Mono.Xml.XPath.yydebug { internal interface yyDebug { void push(int state, object value); void lex(int state, int token, string name, object value); void shift(int from, int to, int errorFlag); void pop(int state); void discard(int state, int token, string name, object value); void reduce(int from, int to, int rule, string text, int len); void shift(int from, int to); void accept(object value); void error(string message); void reject(); } internal class yyDebugSimple : yyDebug { private void println(string s) { Console.Error.WriteLine(s); } public void push(int state, object value) { println("push\tstate " + state + "\tvalue " + value); } public void lex(int state, int token, string name, object value) { println("lex\tstate " + state + "\treading " + name + "\tvalue " + value); } public void shift(int from, int to, int errorFlag) { switch (errorFlag) { default: println("shift\tfrom state " + from + " to " + to); break; case 0: case 1: case 2: println("shift\tfrom state " + from + " to " + to + "\t" + errorFlag + " left to recover"); break; case 3: println("shift\tfrom state " + from + " to " + to + "\ton error"); break; } } public void pop(int state) { println("pop\tstate " + state + "\ton error"); } public void discard(int state, int token, string name, object value) { println("discard\tstate " + state + "\ttoken " + name + "\tvalue " + value); } public void reduce(int from, int to, int rule, string text, int len) { println("reduce\tstate " + from + "\tuncover " + to + "\trule (" + rule + ") " + text); } public void shift(int from, int to) { println("goto\tfrom state " + from + " to " + to); } public void accept(object value) { println("accept\tvalue " + value); } public void error(string message) { println("error\t" + message); } public void reject() { println("reject"); } } } namespace Mono.Xml.XPath { internal class Token { public const int ERROR = 257; public const int EOF = 258; public const int SLASH = 259; public const int SLASH2 = 260; public const int DOT = 262; public const int DOT2 = 263; public const int COLON2 = 265; public const int COMMA = 267; public const int AT = 268; public const int FUNCTION_NAME = 269; public const int BRACKET_OPEN = 270; public const int BRACKET_CLOSE = 271; public const int PAREN_OPEN = 272; public const int PAREN_CLOSE = 273; public const int AND = 274; public const int and = 275; public const int OR = 276; public const int or = 277; public const int DIV = 278; public const int div = 279; public const int MOD = 280; public const int mod = 281; public const int PLUS = 282; public const int MINUS = 283; public const int ASTERISK = 284; public const int DOLLAR = 285; public const int BAR = 286; public const int EQ = 287; public const int NE = 288; public const int LE = 290; public const int GE = 292; public const int LT = 294; public const int GT = 295; public const int ANCESTOR = 296; public const int ancestor = 297; public const int ANCESTOR_OR_SELF = 298; public const int ATTRIBUTE = 300; public const int attribute = 301; public const int CHILD = 302; public const int child = 303; public const int DESCENDANT = 304; public const int descendant = 305; public const int DESCENDANT_OR_SELF = 306; public const int FOLLOWING = 308; public const int following = 309; public const int FOLLOWING_SIBLING = 310; public const int sibling = 311; public const int NAMESPACE = 312; public const int NameSpace = 313; public const int PARENT = 314; public const int parent = 315; public const int PRECEDING = 316; public const int preceding = 317; public const int PRECEDING_SIBLING = 318; public const int SELF = 320; public const int self = 321; public const int COMMENT = 322; public const int comment = 323; public const int TEXT = 324; public const int text = 325; public const int PROCESSING_INSTRUCTION = 326; public const int NODE = 328; public const int node = 329; public const int MULTIPLY = 330; public const int NUMBER = 331; public const int LITERAL = 332; public const int QName = 333; public const int yyErrorCode = 256; } } namespace Mono.Xml.XPath.yyParser { internal class yyException : Exception { public yyException(string message) : base(message) { } } internal class yyUnexpectedEof : yyException { public yyUnexpectedEof(string message) : base(message) { } public yyUnexpectedEof() : base(string.Empty) { } } internal interface yyInput { bool advance(); int token(); object value(); } } namespace Mono.Xml.Xsl { internal class XsltPatternParser { private class YYRules : MarshalByRefObject { public static string[] yyRule = new string[104] { "$accept : Pattern", "Pattern : LocationPathPattern", "Pattern : Pattern BAR LocationPathPattern", "LocationPathPattern : SLASH", "LocationPathPattern : SLASH RelativePathPattern", "LocationPathPattern : IdKeyPattern", "LocationPathPattern : IdKeyPattern SLASH RelativePathPattern", "LocationPathPattern : IdKeyPattern SLASH2 RelativePathPattern", "LocationPathPattern : SLASH2 RelativePathPattern", "LocationPathPattern : RelativePathPattern", "IdKeyPattern : FUNCTION_NAME PAREN_OPEN LITERAL PAREN_CLOSE", "IdKeyPattern : FUNCTION_NAME PAREN_OPEN LITERAL COMMA LITERAL PAREN_CLOSE", "RelativePathPattern : StepPattern", "RelativePathPattern : RelativePathPattern SLASH StepPattern", "RelativePathPattern : RelativePathPattern SLASH2 StepPattern", "StepPattern : ChildOrAttributeAxisSpecifier NodeTest Predicates", "ChildOrAttributeAxisSpecifier : AbbreviatedAxisSpecifier", "ChildOrAttributeAxisSpecifier : CHILD COLON2", "ChildOrAttributeAxisSpecifier : ATTRIBUTE COLON2", "Predicates :", "Predicates : Predicates Predicate", "Expr : OrExpr", "OrExpr : AndExpr", "OrExpr : OrExpr OR AndExpr", "AndExpr : EqualityExpr", "AndExpr : AndExpr AND EqualityExpr", "EqualityExpr : RelationalExpr", "EqualityExpr : EqualityExpr EQ RelationalExpr", "EqualityExpr : EqualityExpr NE RelationalExpr", "RelationalExpr : AdditiveExpr", "RelationalExpr : RelationalExpr LT AdditiveExpr", "RelationalExpr : RelationalExpr GT AdditiveExpr", "RelationalExpr : RelationalExpr LE AdditiveExpr", "RelationalExpr : RelationalExpr GE AdditiveExpr", "AdditiveExpr : MultiplicativeExpr", "AdditiveExpr : AdditiveExpr PLUS MultiplicativeExpr", "AdditiveExpr : AdditiveExpr MINUS MultiplicativeExpr", "MultiplicativeExpr : UnaryExpr", "MultiplicativeExpr : MultiplicativeExpr MULTIPLY UnaryExpr", "MultiplicativeExpr : MultiplicativeExpr DIV UnaryExpr", "MultiplicativeExpr : MultiplicativeExpr MOD UnaryExpr", "UnaryExpr : UnionExpr", "UnaryExpr : MINUS UnaryExpr", "UnionExpr : PathExpr", "UnionExpr : UnionExpr BAR PathExpr", "PathExpr : LocationPath", "PathExpr : FilterExpr", "PathExpr : FilterExpr SLASH RelativeLocationPath", "PathExpr : FilterExpr SLASH2 RelativeLocationPath", "LocationPath : RelativeLocationPath", "LocationPath : AbsoluteLocationPath", "AbsoluteLocationPath : SLASH", "AbsoluteLocationPath : SLASH RelativeLocationPath", "AbsoluteLocationPath : SLASH2 RelativeLocationPath", "RelativeLocationPath : Step", "RelativeLocationPath : RelativeLocationPath SLASH Step", "RelativeLocationPath : RelativeLocationPath SLASH2 Step", "Step : AxisSpecifier NodeTest Predicates", "Step : AbbreviatedStep", "NodeTest : NameTest", "NodeTest : NodeType PAREN_OPEN PAREN_CLOSE", "NodeTest : PROCESSING_INSTRUCTION PAREN_OPEN OptionalLiteral PAREN_CLOSE", "NameTest : ASTERISK", "NameTest : QName", "AbbreviatedStep : DOT", "AbbreviatedStep : DOT2", "Predicates :", "Predicates : Predicates Predicate", "AxisSpecifier : AxisName COLON2", "AxisSpecifier : AbbreviatedAxisSpecifier", "AbbreviatedAxisSpecifier :", "AbbreviatedAxisSpecifier : AT", "NodeType : COMMENT", "NodeType : TEXT", "NodeType : PROCESSING_INSTRUCTION", "NodeType : NODE", "FilterExpr : PrimaryExpr", "FilterExpr : FilterExpr Predicate", "PrimaryExpr : DOLLAR QName", "PrimaryExpr : PAREN_OPEN Expr PAREN_CLOSE", "PrimaryExpr : LITERAL", "PrimaryExpr : NUMBER", "PrimaryExpr : FunctionCall", "FunctionCall : FUNCTION_NAME PAREN_OPEN OptionalArgumentList PAREN_CLOSE", "OptionalArgumentList :", "OptionalArgumentList : Expr OptionalArgumentListTail", "OptionalArgumentListTail :", "OptionalArgumentListTail : COMMA Expr OptionalArgumentListTail", "Predicate : BRACKET_OPEN Expr BRACKET_CLOSE", "AxisName : ANCESTOR", "AxisName : ANCESTOR_OR_SELF", "AxisName : ATTRIBUTE", "AxisName : CHILD", "AxisName : DESCENDANT", "AxisName : DESCENDANT_OR_SELF", "AxisName : FOLLOWING", "AxisName : FOLLOWING_SIBLING", "AxisName : NAMESPACE", "AxisName : PARENT", "AxisName : PRECEDING", "AxisName : PRECEDING_SIBLING", "AxisName : SELF", "OptionalLiteral :", "OptionalLiteral : LITERAL" }; public static string getRule(int index) { return yyRule[index]; } } internal IStaticXsltContext Context; private static int yacc_verbose_flag; public TextWriter ErrorOutput = Console.Out; public int eof_token; internal Mono.Xml.Xsl.yydebug.yyDebug debug; protected static int yyFinal = 7; protected static string[] yyNames; private int yyExpectingState; protected int yyMax; private static short[] yyLhs; private static short[] yyLen; private static short[] yyDefRed; protected static short[] yyDgoto; protected static short[] yySindex; protected static short[] yyRindex; protected static short[] yyGindex; protected static short[] yyTable; protected static short[] yyCheck; public XsltPatternParser() : this(null) { } internal XsltPatternParser(IStaticXsltContext context) { Context = context; ErrorOutput = TextWriter.Null; } static XsltPatternParser() { string[] array = new string[334]; array[0] = "end-of-file"; array[36] = "'$'"; array[40] = "'('"; array[41] = "')'"; array[42] = "'*'"; array[43] = "'+'"; array[44] = "','"; array[45] = "'-'"; array[46] = "'.'"; array[47] = "'/'"; array[60] = "'<'"; array[61] = "'='"; array[62] = "'>'"; array[64] = "'@'"; array[91] = "'['"; array[93] = "']'"; array[124] = "'|'"; array[257] = "ERROR"; array[258] = "EOF"; array[259] = "SLASH"; array[260] = "SLASH2"; array[261] = "\"//\""; array[262] = "DOT"; array[263] = "DOT2"; array[264] = "\"..\""; array[265] = "COLON2"; array[266] = "\"::\""; array[267] = "COMMA"; array[268] = "AT"; array[269] = "FUNCTION_NAME"; array[270] = "BRACKET_OPEN"; array[271] = "BRACKET_CLOSE"; array[272] = "PAREN_OPEN"; array[273] = "PAREN_CLOSE"; array[274] = "AND"; array[275] = "\"and\""; array[276] = "OR"; array[277] = "\"or\""; array[278] = "DIV"; array[279] = "\"div\""; array[280] = "MOD"; array[281] = "\"mod\""; array[282] = "PLUS"; array[283] = "MINUS"; array[284] = "ASTERISK"; array[285] = "DOLLAR"; array[286] = "BAR"; array[287] = "EQ"; array[288] = "NE"; array[289] = "\"!=\""; array[290] = "LE"; array[291] = "\"<=\""; array[292] = "GE"; array[293] = "\">=\""; array[294] = "LT"; array[295] = "GT"; array[296] = "ANCESTOR"; array[297] = "\"ancestor\""; array[298] = "ANCESTOR_OR_SELF"; array[299] = "\"ancstor-or-self\""; array[300] = "ATTRIBUTE"; array[301] = "\"attribute\""; array[302] = "CHILD"; array[303] = "\"child\""; array[304] = "DESCENDANT"; array[305] = "\"descendant\""; array[306] = "DESCENDANT_OR_SELF"; array[307] = "\"descendant-or-self\""; array[308] = "FOLLOWING"; array[309] = "\"following\""; array[310] = "FOLLOWING_SIBLING"; array[311] = "\"sibling\""; array[312] = "NAMESPACE"; array[313] = "\"NameSpace\""; array[314] = "PARENT"; array[315] = "\"parent\""; array[316] = "PRECEDING"; array[317] = "\"preceding\""; array[318] = "PRECEDING_SIBLING"; array[319] = "\"preceding-sibling\""; array[320] = "SELF"; array[321] = "\"self\""; array[322] = "COMMENT"; array[323] = "\"comment\""; array[324] = "TEXT"; array[325] = "\"text\""; array[326] = "PROCESSING_INSTRUCTION"; array[327] = "\"processing-instruction\""; array[328] = "NODE"; array[329] = "\"node\""; array[330] = "MULTIPLY"; array[331] = "NUMBER"; array[332] = "LITERAL"; array[333] = "QName"; yyNames = array; yyLhs = new short[104] { -1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, 2, 4, 5, 5, 5, 7, 7, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 19, 20, 20, 23, 23, 23, 22, 22, 22, 24, 24, 6, 6, 6, 27, 27, 26, 26, 7, 7, 25, 25, 8, 8, 28, 28, 28, 28, 21, 21, 31, 31, 31, 31, 31, 32, 33, 33, 34, 34, 9, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29 }; yyLen = new short[104] { 2, 1, 3, 1, 2, 1, 3, 3, 2, 1, 4, 6, 1, 3, 3, 3, 1, 2, 2, 0, 2, 1, 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, 2, 1, 3, 1, 1, 3, 3, 1, 1, 1, 2, 2, 1, 3, 3, 3, 1, 1, 3, 4, 1, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 4, 0, 2, 0, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 }; yyDefRed = new short[151] { 0, 0, 0, 71, 0, 0, 0, 0, 1, 0, 0, 12, 0, 16, 0, 0, 0, 18, 17, 0, 0, 0, 0, 0, 62, 72, 73, 0, 75, 63, 19, 59, 0, 0, 2, 13, 14, 0, 0, 0, 0, 0, 0, 10, 103, 0, 0, 20, 60, 0, 61, 0, 0, 64, 65, 0, 0, 0, 0, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 81, 80, 69, 0, 0, 0, 0, 0, 0, 0, 37, 0, 43, 45, 0, 0, 50, 54, 0, 58, 0, 76, 82, 11, 0, 0, 0, 0, 42, 78, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 19, 68, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 38, 44, 0, 0, 55, 56, 0, 0, 85, 83, 0, 87 }; yyDgoto = new short[35] { 7, 8, 9, 10, 11, 12, 30, 40, 74, 47, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 31, 32, 45, 92, 93, 94, 125, 147 }; yySindex = new short[151] { -245, -251, -251, 0, -261, -221, -218, -256, 0, -231, -219, 0, -225, 0, -231, -231, -279, 0, 0, -245, -251, -251, -251, -251, 0, 0, 0, -211, 0, 0, 0, 0, -209, -235, 0, 0, 0, -231, -231, -247, -174, -167, -220, 0, 0, -159, -250, 0, 0, -157, 0, 216, 216, 0, 0, -154, -250, -250, -213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -149, -152, -148, -215, -16, -203, -244, 0, -158, 0, 0, -239, -50, 0, 0, -225, 0, -135, 0, 0, 0, -50, -50, -250, -141, 0, 0, 0, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -185, 216, 216, 0, 216, 216, 0, 0, -128, -131, 0, -148, -215, -16, -16, -203, -203, -203, -203, -244, -244, 0, 0, 0, 0, -50, -50, 0, 0, -174, -250, 0, 0, -128, 0 }; yyRindex = new short[151] { -122, 1, -122, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 5, 6, 0, 0, 0, -122, -122, -122, -122, -122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, -124, 2, 0, 0, 0, 0, 0, -122, 0, 0, 0, 0, -97, -122, 0, 0, 0, -122, -122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -228, -115, -169, 219, -53, 264, 0, 193, 0, 0, -23, 57, 0, 0, 0, 0, 0, 0, 0, 0, 83, 112, -257, 0, 0, 0, 0, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 0, -122, -122, 0, 0, -119, 0, 0, -68, -133, 388, 407, 10, 342, 352, 378, 290, 316, 0, 0, 0, 0, 138, 167, 0, 0, -123, -122, 0, 0, -119, 0 }; yyGindex = new short[35] { 0, 126, 87, 0, 192, 0, 76, 46, 548, 89, -56, 0, 70, 74, 110, 201, 134, -20, 0, 64, 0, 0, -26, 0, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33 }; yyTable = new short[696] { 99, 3, 15, 9, 5, 4, 8, 6, 7, 51, 52, 16, 53, 54, 1, 2, 84, 3, 3, 55, 117, 118, 56, 3, 4, 96, 97, 70, 20, 21, 19, 46, 42, 57, 113, 58, 114, 100, 43, 21, 22, 23, 124, 21, 17, 21, 59, 18, 60, 5, 61, 6, 62, 33, 63, 5, 64, 6, 65, 24, 66, 39, 67, 41, 68, 70, 69, 70, 70, 70, 71, 70, 105, 106, 51, 52, 70, 53, 54, 111, 112, 72, 73, 3, 55, 44, 115, 56, 14, 15, 149, 141, 142, 137, 138, 139, 46, 25, 24, 26, 58, 27, 24, 28, 24, 24, 48, 24, 29, 37, 38, 59, 49, 60, 50, 61, 95, 62, 98, 63, 101, 64, 102, 65, 103, 66, 104, 67, 116, 68, 123, 69, 126, 70, 25, 71, 57, 57, 25, 146, 25, 25, 148, 25, 57, 34, 72, 73, 57, 102, 57, 57, 22, 57, 86, 57, 22, 57, 22, 57, 57, 22, 70, 57, 57, 57, 122, 57, 145, 57, 51, 57, 57, 127, 51, 119, 51, 51, 128, 51, 140, 51, 150, 51, 0, 51, 51, 70, 0, 51, 51, 51, 0, 51, 0, 51, 0, 51, 51, 23, 70, 0, 70, 23, 70, 23, 70, 57, 23, 120, 121, 70, 35, 36, 29, 129, 130, 0, 29, 0, 29, 29, 0, 29, 0, 70, 0, 70, 0, 70, 0, 70, 0, 51, 29, 29, 70, 29, 0, 29, 0, 29, 29, 0, 46, 135, 136, 0, 46, 0, 46, 46, 0, 46, 0, 46, 0, 46, 0, 46, 46, 15, 15, 46, 46, 46, 0, 46, 0, 46, 0, 46, 46, 0, 107, 0, 108, 32, 109, 110, 0, 32, 0, 32, 32, 70, 32, 3, 15, 9, 5, 4, 8, 6, 7, 143, 144, 32, 32, 0, 32, 0, 32, 0, 32, 32, 0, 46, 131, 132, 133, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 49, 70, 0, 70, 49, 70, 49, 49, 0, 49, 70, 49, 0, 49, 0, 49, 49, 0, 0, 49, 49, 49, 0, 49, 0, 49, 52, 49, 49, 0, 52, 0, 52, 52, 0, 52, 0, 52, 0, 52, 0, 52, 52, 0, 0, 52, 52, 52, 0, 52, 0, 52, 0, 52, 52, 53, 0, 0, 0, 53, 0, 53, 53, 49, 53, 0, 53, 0, 53, 0, 53, 53, 0, 0, 53, 53, 53, 0, 53, 0, 53, 47, 53, 53, 0, 47, 0, 47, 47, 52, 47, 0, 47, 0, 47, 0, 47, 47, 0, 0, 47, 47, 47, 0, 47, 0, 47, 0, 47, 47, 48, 0, 0, 0, 48, 0, 48, 48, 53, 48, 0, 48, 0, 48, 0, 48, 48, 0, 0, 48, 48, 48, 0, 48, 0, 48, 41, 48, 48, 0, 41, 0, 41, 41, 47, 41, 0, 41, 0, 41, 0, 41, 41, 0, 53, 54, 41, 41, 0, 41, 3, 41, 26, 41, 41, 0, 26, 0, 26, 26, 0, 26, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 26, 26, 0, 0, 0, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 41, 65, 0, 66, 0, 67, 0, 68, 34, 69, 0, 70, 34, 71, 34, 34, 0, 34, 0, 0, 0, 0, 0, 34, 34, 13, 13, 13, 34, 34, 0, 34, 0, 34, 35, 34, 34, 0, 35, 0, 35, 35, 0, 35, 13, 13, 13, 13, 13, 35, 35, 0, 0, 0, 35, 35, 0, 35, 0, 35, 36, 35, 35, 0, 36, 0, 36, 36, 0, 36, 0, 0, 0, 0, 0, 36, 36, 0, 0, 0, 36, 36, 0, 36, 0, 36, 33, 36, 36, 0, 33, 0, 33, 33, 0, 33, 30, 0, 0, 0, 30, 0, 30, 30, 0, 30, 33, 33, 0, 33, 0, 33, 0, 33, 33, 0, 30, 30, 0, 30, 0, 30, 31, 30, 30, 0, 31, 0, 31, 31, 0, 31, 27, 0, 0, 0, 27, 0, 27, 27, 0, 27, 31, 31, 0, 31, 0, 31, 0, 31, 31, 28, 27, 27, 0, 28, 0, 28, 28, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28 }; yyCheck = new short[696] { 56, 0, 0, 0, 0, 0, 0, 0, 0, 259, 260, 272, 262, 263, 259, 260, 273, 268, 268, 269, 259, 260, 272, 268, 269, 51, 52, 284, 259, 260, 286, 270, 267, 283, 278, 285, 280, 57, 273, 267, 259, 260, 98, 271, 265, 273, 296, 265, 298, 300, 300, 302, 302, 332, 304, 300, 306, 302, 308, 284, 310, 272, 312, 272, 314, 322, 316, 324, 318, 326, 320, 328, 287, 288, 259, 260, 333, 262, 263, 282, 283, 331, 332, 268, 269, 332, 330, 272, 1, 2, 146, 117, 118, 113, 114, 115, 270, 322, 267, 324, 285, 326, 271, 328, 273, 274, 273, 276, 333, 22, 23, 296, 332, 298, 273, 300, 273, 302, 272, 304, 333, 306, 271, 308, 276, 310, 274, 312, 286, 314, 265, 316, 273, 318, 267, 320, 259, 260, 271, 267, 273, 274, 273, 276, 267, 19, 331, 332, 271, 273, 273, 274, 267, 276, 273, 278, 271, 280, 273, 282, 283, 276, 284, 286, 287, 288, 90, 290, 122, 292, 267, 294, 295, 103, 271, 86, 273, 274, 104, 276, 116, 278, 149, 280, -1, 282, 283, 284, -1, 286, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, 322, -1, 324, 271, 326, 273, 328, 330, 276, 259, 260, 333, 20, 21, 267, 105, 106, -1, 271, -1, 273, 274, -1, 276, -1, 322, -1, 324, -1, 326, -1, 328, -1, 330, 287, 288, 333, 290, -1, 292, -1, 294, 295, -1, 267, 111, 112, -1, 271, -1, 273, 274, -1, 276, -1, 278, -1, 280, -1, 282, 283, 259, 260, 286, 287, 288, -1, 290, -1, 292, -1, 294, 295, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 284, 276, 286, 286, 286, 286, 286, 286, 286, 286, 120, 121, 287, 288, -1, 290, -1, 292, -1, 294, 295, -1, 330, 107, 108, 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 322, 267, 324, -1, 326, 271, 328, 273, 274, -1, 276, 333, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, -1, -1, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, -1, 286, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, 330, 276, -1, 278, -1, 280, -1, 282, 283, -1, 262, 263, 287, 288, -1, 290, 268, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, -1, 330, -1, -1, -1, -1, -1, -1, -1, -1, 287, 288, -1, -1, -1, -1, 296, -1, 298, -1, 300, -1, 302, -1, 304, -1, 306, 330, 308, -1, 310, -1, 312, -1, 314, 267, 316, -1, 318, 271, 320, 273, 274, -1, 276, -1, -1, -1, -1, -1, 282, 283, 0, 1, 2, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, 19, 20, 21, 22, 23, 282, 283, -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, -1, -1, -1, -1, -1, 282, 283, -1, -1, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, 287, 288, -1, 290, -1, 292, -1, 294, 295, -1, 287, 288, -1, 290, -1, 292, 267, 294, 295, -1, 271, -1, 273, 274, -1, 276, 267, -1, -1, -1, 271, -1, 273, 274, -1, 276, 287, 288, -1, 290, -1, 292, -1, 294, 295, 267, 287, 288, -1, 271, -1, 273, 274, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, 288 }; } internal Expression Compile(string xpath) { try { Tokenizer yyLex = new Tokenizer(xpath); return (Expression)yyparse(yyLex); } catch (XPathException) { throw; } catch (Exception innerException) { throw new XPathException("Error during parse of " + xpath, innerException); } } private NodeSet CreateNodeTest(Axes axis, object nodeTest, ArrayList plist) { NodeSet nodeSet = CreateNodeTest(axis, nodeTest); if (plist != null) { for (int i = 0; i < plist.Count; i++) { nodeSet = new ExprFilter(nodeSet, (Expression)plist[i]); } } return nodeSet; } private NodeTest CreateNodeTest(Axes axis, object test) { if (test is XPathNodeType) { return new NodeTypeTest(axis, (XPathNodeType)(int)test, null); } if (test is string || test == null) { return new NodeTypeTest(axis, XPathNodeType.ProcessingInstruction, (string)test); } XmlQualifiedName xmlQualifiedName = (XmlQualifiedName)test; if (xmlQualifiedName == XmlQualifiedName.Empty) { return new NodeTypeTest(axis); } return new NodeNameTest(axis, xmlQualifiedName, Context); } public void yyerror(string message) { yyerror(message, null); } public void yyerror(string message, string[] expected) { if (yacc_verbose_flag > 0 && expected != null && expected.Length > 0) { ErrorOutput.Write(message + ", expecting"); for (int i = 0; i < expected.Length; i++) { ErrorOutput.Write(" " + expected[i]); } ErrorOutput.WriteLine(); } else { ErrorOutput.WriteLine(message); } } public static string yyname(int token) { if (token < 0 || token > yyNames.Length) { return "[illegal]"; } string result; if ((result = yyNames[token]) != null) { return result; } return "[unknown]"; } protected int[] yyExpectingTokens(int state) { int num = 0; bool[] array = new bool[yyNames.Length]; int num2; int i; if ((num2 = yySindex[state]) != 0) { for (i = ((num2 < 0) ? (-num2) : 0); i < yyNames.Length && num2 + i < yyTable.Length; i++) { if (yyCheck[num2 + i] == i && !array[i] && yyNames[i] != null) { num++; array[i] = true; } } } if ((num2 = yyRindex[state]) != 0) { for (i = ((num2 < 0) ? (-num2) : 0); i < yyNames.Length && num2 + i < yyTable.Length; i++) { if (yyCheck[num2 + i] == i && !array[i] && yyNames[i] != null) { num++; array[i] = true; } } } int[] array2 = new int[num]; num2 = (i = 0); while (num2 < num) { if (array[i]) { array2[num2++] = i; } i++; } return array2; } protected string[] yyExpecting(int state) { int[] array = yyExpectingTokens(state); string[] array2 = new string[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i++] = yyNames[array[i]]; } return array2; } internal object yyparse(Mono.Xml.Xsl.yyParser.yyInput yyLex, object yyd) { debug = (Mono.Xml.Xsl.yydebug.yyDebug)yyd; return yyparse(yyLex); } protected object yyDefault(object first) { return first; } internal object yyparse(Mono.Xml.Xsl.yyParser.yyInput yyLex) { if (yyMax <= 0) { yyMax = 256; } int num = 0; int[] array = new int[yyMax]; object obj = null; object[] array2 = new object[yyMax]; int num2 = -1; int num3 = 0; int num4 = 0; while (true) { if (num4 >= array.Length) { int[] array3 = new int[array.Length + yyMax]; array.CopyTo(array3, 0); array = array3; object[] array4 = new object[array2.Length + yyMax]; array2.CopyTo(array4, 0); array2 = array4; } array[num4] = num; array2[num4] = obj; if (debug != null) { debug.push(num, obj); } while (true) { int num5; if ((num5 = yyDefRed[num]) == 0) { if (num2 < 0) { num2 = (yyLex.advance() ? yyLex.token() : 0); if (debug != null) { debug.lex(num, num2, yyname(num2), yyLex.value()); } } if ((num5 = yySindex[num]) != 0 && (num5 += num2) >= 0 && num5 < yyTable.Length && yyCheck[num5] == num2) { if (debug != null) { debug.shift(num, yyTable[num5], num3 - 1); } num = yyTable[num5]; obj = yyLex.value(); num2 = -1; if (num3 > 0) { num3--; } break; } if ((num5 = yyRindex[num]) == 0 || (num5 += num2) < 0 || num5 >= yyTable.Length || yyCheck[num5] != num2) { switch (num3) { case 0: yyExpectingState = num; if (debug != null) { debug.error("syntax error"); } if (num2 == 0 || num2 == eof_token) { throw new Mono.Xml.Xsl.yyParser.yyUnexpectedEof(); } break; case 1: case 2: break; case 3: goto IL_02f5; default: goto IL_034b; } num3 = 3; while ((num5 = yySindex[array[num4]]) == 0 || (num5 += 256) < 0 || num5 >= yyTable.Length || yyCheck[num5] != 256) { if (debug != null) { debug.pop(array[num4]); } if (--num4 < 0) { if (debug != null) { debug.reject(); } throw new Mono.Xml.Xsl.yyParser.yyException("irrecoverable syntax error"); } } if (debug != null) { debug.shift(array[num4], yyTable[num5], 3); } num = yyTable[num5]; obj = yyLex.value(); break; } num5 = yyTable[num5]; } goto IL_034b; IL_02f5: if (num2 == 0) { if (debug != null) { debug.reject(); } throw new Mono.Xml.Xsl.yyParser.yyException("irrecoverable syntax error at end-of-file"); } if (debug != null) { debug.discard(num, num2, yyname(num2), yyLex.value()); } num2 = -1; continue; IL_034b: int num6 = num4 + 1 - yyLen[num5]; if (debug != null) { debug.reduce(num, array[num6 - 1], num5, YYRules.getRule(num5), yyLen[num5]); } obj = yyDefault((num6 <= num4) ? array2[num6] : null); switch (num5) { case 2: obj = new ExprUNION((NodeSet)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 3: obj = new ExprRoot(); break; case 4: obj = new ExprSLASH(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 6: obj = new ExprSLASH((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 7: obj = new ExprSLASH2((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 8: obj = new ExprSLASH2(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 10: { XmlQualifiedName xmlQualifiedName2 = (XmlQualifiedName)array2[-3 + num4]; if (xmlQualifiedName2.Name != "id" || xmlQualifiedName2.Namespace != string.Empty) { throw new XPathException($"Expected 'id' but got '{xmlQualifiedName2}'"); } obj = ExprFunctionCall.Factory(xmlQualifiedName2, new FunctionArguments(new ExprLiteral((string)array2[-1 + num4]), null), Context); break; } case 11: { XmlQualifiedName xmlQualifiedName = (XmlQualifiedName)array2[-5 + num4]; if (xmlQualifiedName.Name != "key" || xmlQualifiedName.Namespace != string.Empty) { throw new XPathException($"Expected 'key' but got '{xmlQualifiedName}'"); } obj = Context.TryGetFunction(xmlQualifiedName, new FunctionArguments(new ExprLiteral((string)array2[-3 + num4]), new FunctionArguments(new ExprLiteral((string)array2[-1 + num4]), null))); break; } case 13: obj = new ExprSLASH((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 14: obj = new ExprSLASH2((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 15: obj = CreateNodeTest((Axes)(int)array2[-2 + num4], array2[-1 + num4], (ArrayList)array2[0 + num4]); break; case 17: obj = Axes.Child; break; case 18: obj = Axes.Attribute; break; case 19: obj = null; break; case 20: { ArrayList arrayList2 = (ArrayList)array2[-1 + num4]; if (arrayList2 == null) { arrayList2 = new ArrayList(); } arrayList2.Add((Expression)array2[0 + num4]); obj = arrayList2; break; } case 23: obj = new ExprOR((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 25: obj = new ExprAND((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 27: obj = new ExprEQ((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 28: obj = new ExprNE((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 30: obj = new ExprLT((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 31: obj = new ExprGT((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 32: obj = new ExprLE((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 33: obj = new ExprGE((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 35: obj = new ExprPLUS((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 36: obj = new ExprMINUS((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 38: obj = new ExprMULT((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 39: obj = new ExprDIV((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 40: obj = new ExprMOD((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 42: obj = new ExprNEG((Expression)array2[0 + num4]); break; case 44: obj = new ExprUNION((Expression)array2[-2 + num4], (Expression)array2[0 + num4]); break; case 47: obj = new ExprSLASH((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 48: obj = new ExprSLASH2((Expression)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 51: obj = new ExprRoot(); break; case 52: obj = new ExprSLASH(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 53: obj = new ExprSLASH2(new ExprRoot(), (NodeSet)array2[0 + num4]); break; case 55: obj = new ExprSLASH((NodeSet)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 56: obj = new ExprSLASH2((NodeSet)array2[-2 + num4], (NodeSet)array2[0 + num4]); break; case 57: obj = CreateNodeTest((Axes)(int)array2[-2 + num4], array2[-1 + num4], (ArrayList)array2[0 + num4]); break; case 60: obj = (XPathNodeType)(int)array2[-2 + num4]; break; case 61: obj = (string)array2[-1 + num4]; break; case 62: obj = XmlQualifiedName.Empty; break; case 64: obj = new NodeTypeTest(Axes.Self, XPathNodeType.All); break; case 65: obj = new NodeTypeTest(Axes.Parent, XPathNodeType.All); break; case 66: obj = null; break; case 67: { ArrayList arrayList = (ArrayList)array2[-1 + num4]; if (arrayList == null) { arrayList = new ArrayList(); } arrayList.Add(array2[0 + num4]); obj = arrayList; break; } case 68: obj = array2[-1 + num4]; break; case 70: obj = Axes.Child; break; case 71: obj = Axes.Attribute; break; case 72: obj = XPathNodeType.Comment; break; case 73: obj = XPathNodeType.Text; break; case 74: obj = XPathNodeType.ProcessingInstruction; break; case 75: obj = XPathNodeType.All; break; case 77: obj = new ExprFilter((Expression)array2[-1 + num4], (Expression)array2[0 + num4]); break; case 78: { Expression expression2 = null; if (Context != null) { expression2 = Context.TryGetVariable(((XmlQualifiedName)array2[0 + num4]).ToString()); } if (expression2 == null) { expression2 = new ExprVariable((XmlQualifiedName)array2[0 + num4], Context); } obj = expression2; break; } case 79: obj = new ExprParens((Expression)array2[-1 + num4]); break; case 80: obj = new ExprLiteral((string)array2[0 + num4]); break; case 81: obj = new ExprNumber((double)array2[0 + num4]); break; case 83: { Expression expression = null; if (Context != null) { expression = Context.TryGetFunction((XmlQualifiedName)array2[-3 + num4], (FunctionArguments)array2[-1 + num4]); } if (expression == null) { expression = ExprFunctionCall.Factory((XmlQualifiedName)array2[-3 + num4], (FunctionArguments)array2[-1 + num4], Context); } obj = expression; break; } case 85: obj = new FunctionArguments((Expression)array2[-1 + num4], (FunctionArguments)array2[0 + num4]); break; case 87: obj = new FunctionArguments((Expression)array2[-1 + num4], (FunctionArguments)array2[0 + num4]); break; case 88: obj = array2[-1 + num4]; break; case 89: obj = Axes.Ancestor; break; case 90: obj = Axes.AncestorOrSelf; break; case 91: obj = Axes.Attribute; break; case 92: obj = Axes.Child; break; case 93: obj = Axes.Descendant; break; case 94: obj = Axes.DescendantOrSelf; break; case 95: obj = Axes.Following; break; case 96: obj = Axes.FollowingSibling; break; case 97: obj = Axes.Namespace; break; case 98: obj = Axes.Parent; break; case 99: obj = Axes.Preceding; break; case 100: obj = Axes.PrecedingSibling; break; case 101: obj = Axes.Self; break; } num4 -= yyLen[num5]; num = array[num4]; int num7 = yyLhs[num5]; if (num == 0 && num7 == 0) { if (debug != null) { debug.shift(0, yyFinal); } num = yyFinal; if (num2 < 0) { num2 = (yyLex.advance() ? yyLex.token() : 0); if (debug != null) { debug.lex(num, num2, yyname(num2), yyLex.value()); } } if (num2 == 0) { if (debug != null) { debug.accept(obj); } return obj; } break; } num = (((num5 = yyGindex[num7]) == 0 || (num5 += num) < 0 || num5 >= yyTable.Length || yyCheck[num5] != num) ? yyDgoto[num7] : yyTable[num5]); if (debug != null) { debug.shift(array[num4], num); } break; } num4++; } } } } namespace Mono.Xml.Xsl.yydebug { internal interface yyDebug { void push(int state, object value); void lex(int state, int token, string name, object value); void shift(int from, int to, int errorFlag); void pop(int state); void discard(int state, int token, string name, object value); void reduce(int from, int to, int rule, string text, int len); void shift(int from, int to); void accept(object value); void error(string message); void reject(); } internal class yyDebugSimple : yyDebug { private void println(string s) { Console.Error.WriteLine(s); } public void push(int state, object value) { println("push\tstate " + state + "\tvalue " + value); } public void lex(int state, int token, string name, object value) { println("lex\tstate " + state + "\treading " + name + "\tvalue " + value); } public void shift(int from, int to, int errorFlag) { switch (errorFlag) { default: println("shift\tfrom state " + from + " to " + to); break; case 0: case 1: case 2: println("shift\tfrom state " + from + " to " + to + "\t" + errorFlag + " left to recover"); break; case 3: println("shift\tfrom state " + from + " to " + to + "\ton error"); break; } } public void pop(int state) { println("pop\tstate " + state + "\ton error"); } public void discard(int state, int token, string name, object value) { println("discard\tstate " + state + "\ttoken " + name + "\tvalue " + value); } public void reduce(int from, int to, int rule, string text, int len) { println("reduce\tstate " + from + "\tuncover " + to + "\trule (" + rule + ") " + text); } public void shift(int from, int to) { println("goto\tfrom state " + from + " to " + to); } public void accept(object value) { println("accept\tvalue " + value); } public void error(string message) { println("error\t" + message); } public void reject() { println("reject"); } } } namespace Mono.Xml.Xsl { internal class Token { public const int ERROR = 257; public const int EOF = 258; public const int SLASH = 259; public const int SLASH2 = 260; public const int DOT = 262; public const int DOT2 = 263; public const int COLON2 = 265; public const int COMMA = 267; public const int AT = 268; public const int FUNCTION_NAME = 269; public const int BRACKET_OPEN = 270; public const int BRACKET_CLOSE = 271; public const int PAREN_OPEN = 272; public const int PAREN_CLOSE = 273; public const int AND = 274; public const int and = 275; public const int OR = 276; public const int or = 277; public const int DIV = 278; public const int div = 279; public const int MOD = 280; public const int mod = 281; public const int PLUS = 282; public const int MINUS = 283; public const int ASTERISK = 284; public const int DOLLAR = 285; public const int BAR = 286; public const int EQ = 287; public const int NE = 288; public const int LE = 290; public const int GE = 292; public const int LT = 294; public const int GT = 295; public const int ANCESTOR = 296; public const int ancestor = 297; public const int ANCESTOR_OR_SELF = 298; public const int ATTRIBUTE = 300; public const int attribute = 301; public const int CHILD = 302; public const int child = 303; public const int DESCENDANT = 304; public const int descendant = 305; public const int DESCENDANT_OR_SELF = 306; public const int FOLLOWING = 308; public const int following = 309; public const int FOLLOWING_SIBLING = 310; public const int sibling = 311; public const int NAMESPACE = 312; public const int NameSpace = 313; public const int PARENT = 314; public const int parent = 315; public const int PRECEDING = 316; public const int preceding = 317; public const int PRECEDING_SIBLING = 318; public const int SELF = 320; public const int self = 321; public const int COMMENT = 322; public const int comment = 323; public const int TEXT = 324; public const int text = 325; public const int PROCESSING_INSTRUCTION = 326; public const int NODE = 328; public const int node = 329; public const int MULTIPLY = 330; public const int NUMBER = 331; public const int LITERAL = 332; public const int QName = 333; public const int yyErrorCode = 256; } } namespace Mono.Xml.Xsl.yyParser { internal class yyException : Exception { public yyException(string message) : base(message) { } } internal class yyUnexpectedEof : yyException { public yyUnexpectedEof(string message) : base(message) { } public yyUnexpectedEof() : base(string.Empty) { } } internal interface yyInput { bool advance(); int token(); object value(); } } namespace Mono.Xml.Xsl { internal class Tokenizer : Mono.Xml.Xsl.yyParser.yyInput { private const char EOL = '\0'; private string m_rgchInput; private int m_ich; private int m_cch; private int m_iToken; private int m_iTokenPrev = 258; private object m_objToken; private bool m_fPrevWasOperator; private bool m_fThisIsOperator; private static readonly Hashtable s_mapTokens; private static readonly object[] s_rgTokenMap; private bool IsFirstToken => m_iTokenPrev == 258; public Tokenizer(string strInput) { m_rgchInput = strInput; m_ich = 0; m_cch = strInput.Length; SkipWhitespace(); } static Tokenizer() { s_mapTokens = new Hashtable(); s_rgTokenMap = new object[42] { 274, "and", 276, "or", 278, "div", 280, "mod", 296, "ancestor", 298, "ancestor-or-self", 300, "attribute", 302, "child", 304, "descendant", 306, "descendant-or-self", 308, "following", 310, "following-sibling", 312, "namespace", 314, "parent", 316, "preceding", 318, "preceding-sibling", 320, "self", 322, "comment", 324, "text", 326, "processing-instruction", 328, "node" }; for (int i = 0; i < s_rgTokenMap.Length; i += 2) { s_mapTokens.Add(s_rgTokenMap[i + 1], s_rgTokenMap[i]); } } private char Peek(int iOffset) { if (m_ich + iOffset >= m_cch) { return '\0'; } return m_rgchInput[m_ich + iOffset]; } private char Peek() { return Peek(0); } private char GetChar() { if (m_ich >= m_cch) { return '\0'; } return m_rgchInput[m_ich++]; } private char PutBack() { if (m_ich == 0) { throw new XPathException("XPath parser returned an error status: invalid tokenizer state."); } return m_rgchInput[--m_ich]; } private bool SkipWhitespace() { if (!IsWhitespace(Peek())) { return false; } while (IsWhitespace(Peek())) { GetChar(); } return true; } private int ParseNumber() { StringBuilder stringBuilder = new StringBuilder(); while (IsDigit(Peek())) { stringBuilder.Append(GetChar()); } if (Peek() == '.') { stringBuilder.Append(GetChar()); while (IsDigit(Peek())) { stringBuilder.Append(GetChar()); } } m_objToken = double.Parse(stringBuilder.ToString(), NumberFormatInfo.InvariantInfo); return 331; } private int ParseLiteral() { StringBuilder stringBuilder = new StringBuilder(); char @char = GetChar(); char c; while ((c = Peek()) != @char) { if (c == '\0') { throw new XPathException("unmatched " + @char + " in expression"); } stringBuilder.Append(GetChar()); } GetChar(); m_objToken = stringBuilder.ToString(); return 332; } private string ReadIdentifier() { StringBuilder stringBuilder = new StringBuilder(); char c = Peek(); if (!char.IsLetter(c) && c != '_') { return null; } stringBuilder.Append(GetChar()); while ((c = Peek()) == '_' || c == '-' || c == '.' || char.IsLetterOrDigit(c)) { stringBuilder.Append(GetChar()); } SkipWhitespace(); return stringBuilder.ToString(); } private int ParseIdentifier() { string text = ReadIdentifier(); object obj = s_mapTokens[text]; int num = ((obj == null) ? 333 : ((int)obj)); m_objToken = text; char c = Peek(); if (c == ':') { if (Peek(1) == ':') { if (obj == null || !IsAxisName(num)) { throw new XPathException("invalid axis name: '" + text + "'"); } return num; } GetChar(); SkipWhitespace(); c = Peek(); if (c == '*') { GetChar(); m_objToken = new XmlQualifiedName(string.Empty, text); return 333; } string text2 = ReadIdentifier(); if (text2 == null) { throw new XPathException("invalid QName: " + text + ":" + c); } c = Peek(); m_objToken = new XmlQualifiedName(text2, text); if (c == '(') { return 269; } return 333; } if (!IsFirstToken && !m_fPrevWasOperator) { if (obj == null || !IsOperatorName(num)) { throw new XPathException("invalid operator name: '" + text + "'"); } return num; } if (c == '(') { if (obj == null) { m_objToken = new XmlQualifiedName(text, string.Empty); return 269; } if (IsNodeType(num)) { return num; } throw new XPathException("invalid function name: '" + text + "'"); } m_objToken = new XmlQualifiedName(text, string.Empty); return 333; } private static bool IsWhitespace(char ch) { return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'; } private static bool IsDigit(char ch) { return ch >= '0' && ch <= '9'; } private int ParseToken() { char c = Peek(); switch (c) { case '\0': return 258; case '/': m_fThisIsOperator = true; GetChar(); if (Peek() == '/') { GetChar(); return 260; } return 259; case '.': GetChar(); if (Peek() == '.') { GetChar(); return 263; } if (IsDigit(Peek())) { PutBack(); return ParseNumber(); } return 262; case ':': GetChar(); if (Peek() == ':') { m_fThisIsOperator = true; GetChar(); return 265; } return 257; case ',': m_fThisIsOperator = true; GetChar(); return 267; case '@': m_fThisIsOperator = true; GetChar(); return 268; case '[': m_fThisIsOperator = true; GetChar(); return 270; case ']': GetChar(); return 271; case '(': m_fThisIsOperator = true; GetChar(); return 272; case ')': GetChar(); return 273; case '+': m_fThisIsOperator = true; GetChar(); return 282; case '-': m_fThisIsOperator = true; GetChar(); return 283; case '*': GetChar(); if (!IsFirstToken && !m_fPrevWasOperator) { m_fThisIsOperator = true; return 330; } return 284; case '$': GetChar(); m_fThisIsOperator = true; return 285; case '|': m_fThisIsOperator = true; GetChar(); return 286; case '=': m_fThisIsOperator = true; GetChar(); return 287; case '!': GetChar(); if (Peek() == '=') { m_fThisIsOperator = true; GetChar(); return 288; } break; case '>': m_fThisIsOperator = true; GetChar(); if (Peek() == '=') { GetChar(); return 292; } return 295; case '<': m_fThisIsOperator = true; GetChar(); if (Peek() == '=') { GetChar(); return 290; } return 294; case '\'': return ParseLiteral(); case '"': return ParseLiteral(); default: if (IsDigit(c)) { return ParseNumber(); } if (char.IsLetter(c) || c == '_') { int num = ParseIdentifier(); if (IsOperatorName(num)) { m_fThisIsOperator = true; } return num; } break; } throw new XPathException("invalid token: '" + c + "'"); } public bool advance() { m_fThisIsOperator = false; m_objToken = null; m_iToken = ParseToken(); SkipWhitespace(); m_iTokenPrev = m_iToken; m_fPrevWasOperator = m_fThisIsOperator; return m_iToken != 258; } public int token() { return m_iToken; } public object value() { return m_objToken; } private bool IsNodeType(int iToken) { switch (iToken) { case 322: case 324: case 326: case 328: return true; default: return false; } } private bool IsOperatorName(int iToken) { switch (iToken) { case 274: case 276: case 278: case 280: return true; default: return false; } } private bool IsAxisName(int iToken) { switch (iToken) { case 296: case 298: case 300: case 302: case 304: case 306: case 308: case 310: case 312: case 314: case 316: case 318: case 320: return true; default: return false; } } } } internal static class Consts { public const string MonoVersion = "2.6.5.0"; public const string MonoCompany = "MONO development team"; public const string MonoProduct = "MONO Common language infrastructure"; public const string MonoCopyright = "(c) various MONO Authors"; public const string FxVersion = "2.0.0.0"; public const string VsVersion = "8.0.0.0"; public const string FxFileVersion = "2.0.50727.1433"; public const string VsFileVersion = "8.0.50727.1433"; public const string AssemblyI18N = "I18N, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMicrosoft_VisualStudio = "Microsoft.VisualStudio, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio_Web = "Microsoft.VisualStudio.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMono_Http = "Mono.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Posix = "Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Security = "Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Messaging_RabbitMQ = "Mono.Messaging.RabbitMQ, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyCorlib = "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem = "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Data = "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Design = "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_DirectoryServices = "System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing = "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Messaging = "System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Security = "System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Web = "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Core = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; } internal sealed class Locale { private Locale() { } public static string GetText(string msg) { return msg; } public static string GetText(string fmt, params object[] args) { return string.Format(fmt, args); } } namespace System { [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoTODOAttribute : Attribute { private string comment; public string Comment => comment; public MonoTODOAttribute() { } public MonoTODOAttribute(string comment) { this.comment = comment; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoDocumentationNoteAttribute : MonoTODOAttribute { public MonoDocumentationNoteAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoExtensionAttribute : MonoTODOAttribute { public MonoExtensionAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoInternalNoteAttribute : MonoTODOAttribute { public MonoInternalNoteAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoLimitationAttribute : MonoTODOAttribute { public MonoLimitationAttribute(string comment) : base(comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoNotSupportedAttribute : MonoTODOAttribute { public MonoNotSupportedAttribute(string comment) : base(comment) { } } } namespace Mono.Xml.Schema { internal class XmlSchemaValidatingReader : XmlReader, IHasXmlParserContext, IXmlLineInfo, IXmlNamespaceResolver, IXmlSchemaInfo { private static readonly XmlSchemaAttribute[] emptyAttributeArray = new XmlSchemaAttribute[0]; private XmlReader reader; private XmlSchemaValidationFlags options; private XmlSchemaValidator v; private XmlValueGetter getter; private XmlSchemaInfo xsinfo; private IXmlLineInfo readerLineInfo; private ValidationType validationType; private IXmlNamespaceResolver nsResolver; private XmlSchemaAttribute[] defaultAttributes = emptyAttributeArray; private int currentDefaultAttribute = -1; private ArrayList defaultAttributesCache = new ArrayList(); private bool defaultAttributeConsumed; private XmlSchemaType currentAttrType; private bool validationDone; private XmlSchemaElement element; int IXmlLineInfo.LineNumber => (readerLineInfo != null) ? readerLineInfo.LineNumber : 0; int IXmlLineInfo.LinePosition => (readerLineInfo != null) ? readerLineInfo.LinePosition : 0; public XmlSchemaType ElementSchemaType => (element == null) ? null : element.ElementSchemaType; public int LineNumber => (readerLineInfo != null) ? readerLineInfo.LineNumber : 0; public int LinePosition => (readerLineInfo != null) ? readerLineInfo.LinePosition : 0; public XmlSchemaType SchemaType { get { if (ReadState != ReadState.Interactive) { return null; } switch (NodeType) { case XmlNodeType.Element: if (ElementSchemaType != null) { return ElementSchemaType; } return null; case XmlNodeType.Attribute: if (currentAttrType == null && ElementSchemaType is XmlSchemaComplexType xmlSchemaComplexType) { if (xmlSchemaComplexType.AttributeUses[new XmlQualifiedName(LocalName, NamespaceURI)] is XmlSchemaAttribute xmlSchemaAttribute) { currentAttrType = xmlSchemaAttribute.AttributeSchemaType; } return currentAttrType; } return currentAttrType; default: return null; } } } public ValidationType ValidationType { get { return validationType; } set { if (ReadState != 0) { throw new InvalidOperationException("ValidationType must be set before reading."); } validationType = value; } } public override int AttributeCount => reader.AttributeCount + defaultAttributes.Length; public override string BaseURI => reader.BaseURI; public override bool CanResolveEntity => reader.CanResolveEntity; public override int Depth { get { if (currentDefaultAttribute < 0) { return reader.Depth; } if (defaultAttributeConsumed) { return reader.Depth + 2; } return reader.Depth + 1; } } public override bool EOF => reader.EOF; public override bool HasValue { get { if (currentDefaultAttribute < 0) { return reader.HasValue; } return true; } } public override bool IsDefault { get { if (currentDefaultAttribute < 0) { return reader.IsDefault; } return true; } } public override bool IsEmptyElement { get { if (currentDefaultAttribute < 0) { return reader.IsEmptyElement; } return false; } } public override string this[int i] => GetAttribute(i); public override string this[string name] => GetAttribute(name); public override string this[string localName, string ns] => GetAttribute(localName, ns); public override string LocalName { get { if (currentDefaultAttribute < 0) { return reader.LocalName; } if (defaultAttributeConsumed) { return string.Empty; } return defaultAttributes[currentDefaultAttribute].QualifiedName.Name; } } public override string Name { get { if (currentDefaultAttribute < 0) { return reader.Name; } if (defaultAttributeConsumed) { return string.Empty; } XmlQualifiedName qualifiedName = defaultAttributes[currentDefaultAttribute].QualifiedName; string prefix = Prefix; if (prefix == string.Empty) { return qualifiedName.Name; } return prefix + ":" + qualifiedName.Name; } } public override string NamespaceURI { get { if (currentDefaultAttribute < 0) { return reader.NamespaceURI; } if (defaultAttributeConsumed) { return string.Empty; } return defaultAttributes[currentDefaultAttribute].QualifiedName.Namespace; } } public override XmlNameTable NameTable => reader.NameTable; public override XmlNodeType NodeType { get { if (currentDefaultAttribute < 0) { return reader.NodeType; } if (defaultAttributeConsumed) { return XmlNodeType.Text; } return XmlNodeType.Attribute; } } public XmlParserContext ParserContext => XmlSchemaUtil.GetParserContext(reader); public override string Prefix { get { if (currentDefaultAttribute < 0) { return reader.Prefix; } if (defaultAttributeConsumed) { return string.Empty; } XmlQualifiedName qualifiedName = defaultAttributes[currentDefaultAttribute].QualifiedName; string text = nsResolver.LookupPrefix(qualifiedName.Namespace); if (text == null) { return string.Empty; } return text; } } public override char QuoteChar => reader.QuoteChar; public override ReadState ReadState => reader.ReadState; public override IXmlSchemaInfo SchemaInfo => this; public override string Value { get { if (currentDefaultAttribute < 0) { return reader.Value; } string text = defaultAttributes[currentDefaultAttribute].ValidatedDefaultValue; if (text == null) { text = defaultAttributes[currentDefaultAttribute].ValidatedFixedValue; } return text; } } public override string XmlLang { get { string xmlLang = reader.XmlLang; if (xmlLang != null) { return xmlLang; } int num = FindDefaultAttribute("lang", "http://www.w3.org/XML/1998/namespace"); if (num < 0) { return null; } xmlLang = defaultAttributes[num].ValidatedDefaultValue; if (xmlLang == null) { xmlLang = defaultAttributes[num].ValidatedFixedValue; } return xmlLang; } } public override XmlSpace XmlSpace { get { XmlSpace xmlSpace = reader.XmlSpace; if (xmlSpace != 0) { return xmlSpace; } int num = FindDefaultAttribute("space", "http://www.w3.org/XML/1998/namespace"); if (num < 0) { return XmlSpace.None; } string text = defaultAttributes[num].ValidatedDefaultValue; if (text == null) { text = defaultAttributes[num].ValidatedFixedValue; } return (XmlSpace)(int)Enum.Parse(typeof(XmlSpace), text, ignoreCase: false); } } public bool IsNil => xsinfo.IsNil; public XmlSchemaSimpleType MemberType => xsinfo.MemberType; public XmlSchemaAttribute SchemaAttribute => xsinfo.SchemaAttribute; public XmlSchemaElement SchemaElement => xsinfo.SchemaElement; public XmlSchemaValidity Validity => xsinfo.Validity; public event ValidationEventHandler ValidationEventHandler { add { v.ValidationEventHandler += value; } remove { v.ValidationEventHandler -= value; } } public XmlSchemaValidatingReader(XmlReader reader, XmlReaderSettings settings) { XmlSchemaValidatingReader xmlSchemaValidatingReader = this; IXmlNamespaceResolver xmlNamespaceResolver = reader as IXmlNamespaceResolver; if (xmlNamespaceResolver == null) { xmlNamespaceResolver = new XmlNamespaceManager(reader.NameTable); } XmlSchemaSet xmlSchemaSet = settings.Schemas; if (xmlSchemaSet == null) { xmlSchemaSet = new XmlSchemaSet(); } options = settings.ValidationFlags; this.reader = reader; v = new XmlSchemaValidator(reader.NameTable, xmlSchemaSet, xmlNamespaceResolver, options); if (reader.BaseURI != string.Empty) { v.SourceUri = new Uri(reader.BaseURI); } readerLineInfo = reader as IXmlLineInfo; getter = () => (xmlSchemaValidatingReader.v.CurrentAttributeType != null) ? xmlSchemaValidatingReader.v.CurrentAttributeType.ParseValue(xmlSchemaValidatingReader.Value, xmlSchemaValidatingReader.NameTable, xmlSchemaValidatingReader) : xmlSchemaValidatingReader.Value; xsinfo = new XmlSchemaInfo(); v.LineInfoProvider = this; v.ValidationEventSender = reader; nsResolver = xmlNamespaceResolver; ValidationEventHandler += delegate(object o, ValidationEventArgs e) { settings.OnValidationError(o, e); }; if (settings != null && settings.Schemas != null) { v.XmlResolver = settings.Schemas.XmlResolver; } else { v.XmlResolver = new XmlUrlResolver(); } v.Initialize(); } bool IXmlLineInfo.HasLineInfo() { return readerLineInfo != null && readerLineInfo.HasLineInfo(); } private void ResetStateOnRead() { currentDefaultAttribute = -1; defaultAttributeConsumed = false; currentAttrType = null; defaultAttributes = emptyAttributeArray; v.CurrentAttributeType = null; } public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope) { if (!(reader is IXmlNamespaceResolver xmlNamespaceResolver)) { throw new NotSupportedException("The input XmlReader does not implement IXmlNamespaceResolver and thus this validating reader cannot collect in-scope namespaces."); } return xmlNamespaceResolver.GetNamespacesInScope(scope); } public string LookupPrefix(string ns) { return nsResolver.LookupPrefix(ns); } public override void Close() { reader.Close(); } public override string GetAttribute(int i) { XmlNodeType nodeType = reader.NodeType; if (nodeType == XmlNodeType.DocumentType || nodeType == XmlNodeType.XmlDeclaration) { return reader.GetAttribute(i); } if (reader.AttributeCount > i) { reader.GetAttribute(i); } int num = i - reader.AttributeCount; if (i < AttributeCount) { return defaultAttributes[num].DefaultValue; } throw new ArgumentOutOfRangeException("i", i, "Specified attribute index is out of range."); } public override string GetAttribute(string name) { XmlNodeType nodeType = reader.NodeType; if (nodeType == XmlNodeType.DocumentType || nodeType == XmlNodeType.XmlDeclaration) { return reader.GetAttribute(name); } string attribute = reader.GetAttribute(name); if (attribute != null) { return attribute; } XmlQualifiedName xmlQualifiedName = SplitQName(name); return GetDefaultAttribute(xmlQualifiedName.Name, xmlQualifiedName.Namespace); } private XmlQualifiedName SplitQName(string name) { XmlConvert.VerifyName(name); Exception innerEx = null; XmlQualifiedName result = XmlSchemaUtil.ToQName(reader, name, out innerEx); if (innerEx != null) { return XmlQualifiedName.Empty; } return result; } public override string GetAttribute(string localName, string ns) { XmlNodeType nodeType = reader.NodeType; if (nodeType == XmlNodeType.DocumentType || nodeType == XmlNodeType.XmlDeclaration) { return reader.GetAttribute(localName, ns); } string attribute = reader.GetAttribute(localName, ns); if (attribute != null) { return attribute; } return GetDefaultAttribute(localName, ns); } private string GetDefaultAttribute(string localName, string ns) { int num = FindDefaultAttribute(localName, ns); if (num < 0) { return null; } string text = defaultAttributes[num].ValidatedDefaultValue; if (text == null) { text = defaultAttributes[num].ValidatedFixedValue; } return text; } private int FindDefaultAttribute(string localName, string ns) { for (int i = 0; i < defaultAttribute
plugins/MtGAPI/System.Xml.Linq.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security; using System.Text; using System.Xml.Linq; using System.Xml.Schema; using System.Xml.Serialization; using System.Xml.XPath; [assembly: AssemblyTitle("System.Xml.Linq.dll")] [assembly: AssemblyDescription("System.Xml.Linq.dll")] [assembly: AssemblyDefaultAlias("System.Xml.Linq.dll")] [assembly: AssemblyCompany("Mono development team")] [assembly: AssemblyProduct("Mono Common Language Infrastructure")] [assembly: AssemblyCopyright("(c) Various Mono authors")] [assembly: SatelliteContractVersion("3.5.0.0")] [assembly: AssemblyInformationalVersion("3.5.21022.8")] [assembly: AssemblyFileVersion("3.5.21022.8")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: CLSCompliant(true)] [assembly: AssemblyDelaySign(true)] [assembly: AssemblyKeyFile("../ecma.pub")] [assembly: AllowPartiallyTrustedCallers] [assembly: ComVisible(false)] [assembly: CompilationRelaxations(CompilationRelaxations.NoStringInterning)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("3.5.0.0")] internal static class Consts { public const string MonoVersion = "3.12.1.0"; public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; public const string FxVersion = "3.5.0.0"; public const string FxFileVersion = "3.5.21022.8"; public const string VsVersion = "0.0.0.0"; private const string PublicKeyToken = "b77a5c561934e089"; public const string AssemblyI18N = "I18N, Version=3.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMicrosoft_VisualStudio = "Microsoft.VisualStudio, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio_Web = "Microsoft.VisualStudio.Web, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMono_Http = "Mono.Http, Version=3.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Posix = "Mono.Posix, Version=3.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Security = "Mono.Security, Version=3.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Messaging_RabbitMQ = "Mono.Messaging.RabbitMQ, Version=3.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyCorlib = "mscorlib, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem = "System, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Data = "System.Data, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Design = "System.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_DirectoryServices = "System.DirectoryServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing = "System.Drawing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Messaging = "System.Messaging, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Security = "System.Security, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Web = "System.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Core = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; } internal sealed class Locale { private Locale() { } public static string GetText(string msg) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static string GetText(string fmt, params object[] args) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } namespace System { [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoTODOAttribute : Attribute { private string comment; public string Comment { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public MonoTODOAttribute() { } public MonoTODOAttribute(string comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoDocumentationNoteAttribute : MonoTODOAttribute { public MonoDocumentationNoteAttribute(string comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoExtensionAttribute : MonoTODOAttribute { public MonoExtensionAttribute(string comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoInternalNoteAttribute : MonoTODOAttribute { public MonoInternalNoteAttribute(string comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoLimitationAttribute : MonoTODOAttribute { public MonoLimitationAttribute(string comment) { } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] internal class MonoNotSupportedAttribute : MonoTODOAttribute { public MonoNotSupportedAttribute(string comment) { } } } namespace System.Xml.Linq { public static class Extensions { [DebuggerHidden] public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T> source) where T : XNode { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T> source, XName name) where T : XNode { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement> source) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement> source, XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement> source) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement> source, XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XNode> DescendantNodes<T>(this IEnumerable<T> source) where T : XContainer { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XNode> DescendantNodesAndSelf(this IEnumerable<XElement> source) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T> source) where T : XContainer { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T> source, XName name) where T : XContainer { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement> source) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement> source, XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> Elements<T>(this IEnumerable<T> source) where T : XContainer { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> Elements<T>(this IEnumerable<T> source, XName name) where T : XContainer { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<T> InDocumentOrder<T>(this IEnumerable<T> source) where T : XNode { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XNode> Nodes<T>(this IEnumerable<T> source) where T : XContainer { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static void Remove(this IEnumerable<XAttribute> source) { } public static void Remove<T>(this IEnumerable<T> source) where T : XNode { } } [Flags] public enum LoadOptions { None = 0, PreserveWhitespace = 1, SetBaseUri = 2, SetLineInfo = 4 } [Flags] public enum SaveOptions { None = 0, DisableFormatting = 1 } public class XAttribute : XObject { private static readonly XAttribute[] empty_array; private XName name; private string value; private XAttribute next; private XAttribute previous; private static readonly char[] escapeChars; public static IEnumerable<XAttribute> EmptySequence { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public bool IsNamespaceDeclaration { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XName Name { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XAttribute NextAttribute { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XAttribute PreviousAttribute { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public string Value { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XAttribute(XAttribute other) { } public XAttribute(XName name, object value) { } [CLSCompliant(false)] public static explicit operator bool(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator bool?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTime(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTime?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTimeOffset(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTimeOffset?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator decimal(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator decimal?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator double(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator double?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator float(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator float?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator Guid(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator Guid?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator int(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator int?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator long(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator long?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator uint(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator uint?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator ulong(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator ulong?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator TimeSpan(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator TimeSpan?(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator string(XAttribute attribute) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void Remove() { } public void SetValue(object value) { } public override string ToString() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public class XCData : XText { public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XCData(string value) { } public XCData(XCData other) { } public override void WriteTo(XmlWriter writer) { } } public class XComment : XNode { private string value; public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string Value { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XComment(string value) { } public XComment(XComment other) { } public override void WriteTo(XmlWriter writer) { } } public abstract class XContainer : XNode { private XNode first; private XNode last; public XNode FirstNode { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public XNode LastNode { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } internal XContainer() { } private void CheckChildType(object o, bool addFirst) { } public void Add(object content) { } private void AddNode(XNode n) { } public void Add(params object[] content) { } public void AddFirst(object content) { } public void AddFirst(params object[] content) { } internal virtual bool OnAddingObject(object o, bool rejectAttribute, XNode refNode, bool addFirst) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public XmlWriter CreateWriter() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XNode> Nodes() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XNode> DescendantNodes() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> Descendants() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> Descendants(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> Elements() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> Elements(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public XElement Element(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal void ReadContentFrom(XmlReader reader, LoadOptions options) { } public void RemoveNodes() { } public void ReplaceNodes(object content) { } public void ReplaceNodes(params object[] content) { } } public class XDeclaration { private string encoding; private string standalone; private string version; public string Encoding { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public string Standalone { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public string Version { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XDeclaration(string version, string encoding, string standalone) { } public XDeclaration(XDeclaration other) { } public override string ToString() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public class XDocument : XContainer { private XDeclaration xmldecl; public XDeclaration Declaration { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XDocumentType DocumentType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XElement Root { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XDocument() { } public XDocument(params object[] content) { } public XDocument(XDeclaration declaration, params object[] content) { } public XDocument(XDocument other) { } public static XDocument Load(string uri) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(string uri, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(Stream stream) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(Stream stream, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(TextReader textReader) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(TextReader textReader, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(XmlReader reader) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Load(XmlReader reader, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private static XDocument LoadCore(XmlReader reader, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private void ReadContent(XmlReader reader, LoadOptions options) { } private static void ValidateWhitespace(string s) { } public static XDocument Parse(string text) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XDocument Parse(string text, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void Save(string fileName) { } public void Save(string fileName, SaveOptions options) { } public void Save(TextWriter textWriter) { } public void Save(TextWriter textWriter, SaveOptions options) { } public void Save(XmlWriter writer) { } public override void WriteTo(XmlWriter writer) { } internal override bool OnAddingObject(object obj, bool rejectAttribute, XNode refNode, bool addFirst) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private void VerifyAddedNode(object node, bool addFirst) { } } public class XDocumentType : XNode { private string name; private string pubid; private string sysid; private string intSubset; public string Name { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public string PublicId { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public string SystemId { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public string InternalSubset { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XDocumentType(string name, string publicId, string systemId, string internalSubset) { } public XDocumentType(XDocumentType other) { } public override void WriteTo(XmlWriter writer) { } } [XmlSchemaProvider(null, IsAny = true)] [XmlTypeConvertor("ConvertForAssignment")] public class XElement : XContainer, IXmlSerializable { private static IEnumerable<XElement> emptySequence; private XName name; private XAttribute attr_first; private XAttribute attr_last; private bool explicit_is_empty; public static IEnumerable<XElement> EmptySequence { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XAttribute FirstAttribute { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public XAttribute LastAttribute { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public bool HasAttributes { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public bool HasElements { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public bool IsEmpty { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public XName Name { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string Value { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XElement(XName name, object content) { } public XElement(XElement other) { } public XElement(XName name) { } public XElement(XName name, params object[] content) { } public XElement(XStreamingElement other) { } private static object ConvertForAssignment(object value) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator bool(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator bool?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTime(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTime?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTimeOffset(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator DateTimeOffset?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator decimal(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator decimal?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator double(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator double?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator float(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator float?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator Guid(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator Guid?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator int(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator int?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator long(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator long?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator uint(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator uint?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator ulong(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator ulong?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator TimeSpan(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator TimeSpan?(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static explicit operator string(XElement element) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private IEnumerable<XElement> GetAncestorList(XName name, bool getMeIn) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public XAttribute Attribute(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XAttribute> Attributes() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XAttribute> Attributes(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private static void DefineDefaultSettings(XmlReaderSettings settings, LoadOptions options) { } private static XmlReaderSettings CreateDefaultSettings(LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Load(string uri) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Load(string uri, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Load(TextReader textReader) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Load(TextReader textReader, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Load(XmlReader reader) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Load(XmlReader reader, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal static XElement LoadCore(XmlReader r, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Parse(string text) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement Parse(string text, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void RemoveAll() { } public void RemoveAttributes() { } public void Save(string fileName) { } public void Save(string fileName, SaveOptions options) { } public void Save(TextWriter textWriter) { } public void Save(TextWriter textWriter, SaveOptions options) { } public void Save(XmlWriter writer) { } public IEnumerable<XElement> AncestorsAndSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public IEnumerable<XElement> AncestorsAndSelf(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public IEnumerable<XElement> DescendantsAndSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public IEnumerable<XElement> DescendantsAndSelf(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XNode> DescendantNodesAndSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void SetAttributeValue(XName name, object value) { } private void SetAttributeObject(XAttribute a) { } private string LookupPrefix(string ns, XmlWriter w) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private static string CreateDummyNamespace(ref int createdNS, IEnumerable<XAttribute> atts, bool isAttr) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override void WriteTo(XmlWriter writer) { } public XNamespace GetDefaultNamespace() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public XNamespace GetNamespaceOfPrefix(string prefix) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public string GetPrefixOfNamespace(XNamespace ns) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] private IEnumerable<string> GetPrefixOfNamespaceCore(XNamespace ns) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void ReplaceAll(object content) { } public void ReplaceAll(params object[] content) { } public void ReplaceAttributes(object content) { } public void ReplaceAttributes(params object[] content) { } public void SetElementValue(XName name, object value) { } public void SetValue(object value) { } internal override bool OnAddingObject(object o, bool rejectAttribute, XNode refNode, bool addFirst) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } void IXmlSerializable.WriteXml(XmlWriter writer) { } void IXmlSerializable.ReadXml(XmlReader reader) { } XmlSchema IXmlSerializable.GetSchema() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } internal class XChildrenIterator : IEnumerable<object>, IEnumerable { private XContainer source; private XNode n; public XChildrenIterator(XContainer source) { } [DebuggerHidden] public IEnumerator<object> GetEnumerator() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } IEnumerator IEnumerable.GetEnumerator() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } [Serializable] public sealed class XName : IEquatable<XName>, ISerializable { private string local; private XNamespace ns; public string LocalName { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XNamespace Namespace { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string NamespaceName { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } private XName(SerializationInfo info, StreamingContext context) { } internal XName(string local, XNamespace ns) { } private static Exception ErrorInvalidExpandedName() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool Equals(object obj) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } bool IEquatable<XName>.Equals(XName other) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XName Get(string expandedName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private static void ExpandName(string expandedName, out string local, out string ns) { } public static XName Get(string localName, string namespaceName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override int GetHashCode() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool operator ==(XName left, XName right) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static implicit operator XName(string expandedName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool operator !=(XName left, XName right) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override string ToString() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { } } public sealed class XNamespace { private static readonly XNamespace blank; private static readonly XNamespace xml; private static readonly XNamespace xmlns; private static Dictionary<string, XNamespace> nstable; private string uri; private Dictionary<string, XName> table; public static XNamespace None { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public static XNamespace Xml { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public static XNamespace Xmlns { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string NamespaceName { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } static XNamespace() { } private XNamespace(string namespaceName) { } public static XNamespace Get(string namespaceName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public XName GetName(string localName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool Equals(object obj) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool operator ==(XNamespace left, XNamespace right) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool operator !=(XNamespace left, XNamespace right) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XName operator +(XNamespace ns, string localName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [CLSCompliant(false)] public static implicit operator XNamespace(string namespaceName) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override int GetHashCode() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override string ToString() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public abstract class XNode : XObject { private static XNodeEqualityComparer eq_comparer; private static XNodeDocumentOrderComparer order_comparer; private XNode previous; private XNode next; public static XNodeDocumentOrderComparer DocumentOrderComparer { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public static XNodeEqualityComparer EqualityComparer { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XNode PreviousNode { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public XNode NextNode { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } internal XNode() { } public static int CompareDocumentOrder(XNode n1, XNode n2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool DeepEquals(XNode n1, XNode n2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public string ToString(SaveOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void AddAfterSelf(object content) { } public void AddAfterSelf(params object[] content) { } public void AddBeforeSelf(object content) { } public void AddBeforeSelf(params object[] content) { } public static XNode ReadFrom(XmlReader reader) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal static XNode ReadFrom(XmlReader r, LoadOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void Remove() { } public override string ToString() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public abstract void WriteTo(XmlWriter writer); [DebuggerHidden] public IEnumerable<XElement> Ancestors() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> Ancestors(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public XmlReader CreateReader() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> ElementsAfterSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> ElementsAfterSelf(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> ElementsBeforeSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XElement> ElementsBeforeSelf(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public bool IsAfter(XNode node) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public bool IsBefore(XNode node) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XNode> NodesAfterSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<XNode> NodesBeforeSelf() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void ReplaceWith(object content) { } public void ReplaceWith(params object[] content) { } } public sealed class XNodeDocumentOrderComparer : IComparer, IComparer<XNode> { private enum CompareResult { Same, Random, Parent, Child, Ancestor, Descendant, Preceding, Following } public int Compare(XNode x, XNode y) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private CompareResult CompareCore(XNode n1, XNode n2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private CompareResult CompareSibling(XNode n1, XNode n2, CompareResult forSameValue) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } int IComparer.Compare(object n1, object n2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public sealed class XNodeEqualityComparer : IEqualityComparer, IEqualityComparer<XNode> { public bool Equals(XNode x, XNode y) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private bool Equals(XAttribute a1, XAttribute a2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private bool Equals(XDeclaration d1, XDeclaration d2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } bool IEqualityComparer.Equals(object n1, object n2) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private int GetHashCode(XDeclaration d) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public int GetHashCode(XNode obj) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } int IEqualityComparer.GetHashCode(object obj) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } internal class XNodeNavigator : XPathNavigator { private static readonly XAttribute attr_ns_xml; private XNode node; private XAttribute attr; private XmlNameTable name_table; public override string BaseURI { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool CanEdit { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool HasAttributes { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool HasChildren { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool IsEmptyElement { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string LocalName { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string Name { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string NamespaceURI { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override XmlNameTable NameTable { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override XPathNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string Prefix { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override IXmlSchemaInfo SchemaInfo { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override object UnderlyingObject { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string Value { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XNodeNavigator(XNode node, XmlNameTable nameTable) { } public XNodeNavigator(XNodeNavigator other) { } private string GetInnerText(XContainer node) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private void GetInnerText(XNode n, ref StringBuilder sb) { } public override XPathNavigator Clone() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool IsSamePosition(XPathNavigator other) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveTo(XPathNavigator other) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToFirstAttribute() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToFirstChild() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToFirstNamespace(XPathNamespaceScope scope) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToId(string id) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToNext() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToNextAttribute() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToNextNamespace(XPathNamespaceScope scope) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToParent() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToPrevious() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override void MoveToRoot() { } } internal class XNodeReader : XmlReader, IXmlLineInfo { private ReadState state; private XNode node; private XNode start; private int attr; private bool attr_value; private bool end_element; private NameTable name_table; int IXmlLineInfo.LineNumber { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } int IXmlLineInfo.LinePosition { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override int AttributeCount { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string BaseURI { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override int Depth { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool EOF { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool HasAttributes { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool HasValue { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override bool IsEmptyElement { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string LocalName { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string NamespaceURI { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override XmlNameTable NameTable { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string Prefix { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override ReadState ReadState { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public override string Value { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } internal XNode CurrentNode { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XNodeReader(XNode node) { } bool IXmlLineInfo.HasLineInfo() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal XAttribute GetCurrentAttribute() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private XAttribute GetXAttribute(int idx) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private object GetCurrentName() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private object GetName(int attr) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override void Close() { } public override string LookupNamespace(string prefix) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToElement() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToFirstAttribute() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToNextAttribute() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToAttribute(string name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } private string GetPrefixedName(XName name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool MoveToAttribute(string local, string ns) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override string GetAttribute(int i) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override string GetAttribute(string name) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override string GetAttribute(string local, string ns) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool Read() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override bool ReadAttributeValue() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override void ResolveEntity() { } } internal class XNodeWriter : XmlWriter { private XContainer root; private bool is_closed; private XContainer current; private XAttribute attribute; private XmlNodeType state; public override WriteState WriteState { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XNodeWriter(XContainer fragment) { } private void CheckState() { } private void WritePossiblyTopLevelNode(XNode n, bool possiblyAttribute) { } private void FillXmlns(XElement el, string prefix, XNamespace xns) { } public override void Close() { } public override void Flush() { } public override string LookupPrefix(string ns) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public override void WriteStartDocument() { } public override void WriteStartDocument(bool standalone) { } private void WriteStartDocument(string sddecl) { } public override void WriteEndDocument() { } public override void WriteDocType(string name, string publicId, string systemId, string internalSubset) { } public override void WriteStartElement(string prefix, string name, string ns) { } public override void WriteEndElement() { } public override void WriteFullEndElement() { } private void WriteEndElementInternal(bool forceFull) { } public override void WriteStartAttribute(string prefix, string name, string ns) { } public override void WriteEndAttribute() { } public override void WriteCData(string data) { } public override void WriteComment(string comment) { } public override void WriteProcessingInstruction(string name, string value) { } public override void WriteEntityRef(string name) { } public override void WriteCharEntity(char c) { } public override void WriteWhitespace(string ws) { } public override void WriteString(string data) { } public override void WriteName(string name) { } public override void WriteNmToken(string nmtoken) { } public override void WriteQualifiedName(string name, string ns) { } public override void WriteChars(char[] chars, int start, int len) { } public override void WriteRaw(string data) { } public override void WriteRaw(char[] chars, int start, int len) { } public override void WriteBase64(byte[] data, int start, int len) { } public override void WriteBinHex(byte[] data, int start, int len) { } public override void WriteSurrogateCharEntity(char c1, char c2) { } } public abstract class XObject : IXmlLineInfo { private XContainer owner; private List<object> annotations; private string baseuri; private int line; private int column; int IXmlLineInfo.LineNumber { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } int IXmlLineInfo.LinePosition { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string BaseUri { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal set { } } public XDocument Document { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public abstract XmlNodeType NodeType { get; } public XElement Parent { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } internal XContainer Owner { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } internal int LineNumber { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } internal int LinePosition { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public event EventHandler<XObjectChangeEventArgs> Changing { add { } remove { } } public event EventHandler<XObjectChangeEventArgs> Changed { add { } remove { } } internal XObject() { } internal void SetOwner(XContainer node) { } public void AddAnnotation(object annotation) { } public T Annotation<T>() where T : class { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public object Annotation(Type type) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<T> Annotations<T>() where T : class { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public IEnumerable<object> Annotations(Type type) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void RemoveAnnotations<T>() where T : class { } public void RemoveAnnotations(Type type) { } bool IXmlLineInfo.HasLineInfo() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } internal void FillLineInfoAndBaseUri(XmlReader r, LoadOptions options) { } internal void OnAddingObject(object addedObject) { } internal void OnAddedObject(object addedObject) { } internal void OnNameChanging(object renamedObject) { } internal void OnNameChanged(object renamedObject) { } internal void OnRemovingObject(object removedObject) { } internal void OnRemovedObject(object removedObject) { } internal void OnValueChanging(object changedObject) { } internal void OnValueChanged(object changedObject) { } private void OnChanging(object sender, XObjectChangeEventArgs args) { } private void OnChanged(object sender, XObjectChangeEventArgs args) { } } public enum XObjectChange { Add, Remove, Name, Value } public class XObjectChangeEventArgs : EventArgs { public static readonly XObjectChangeEventArgs Add; public static readonly XObjectChangeEventArgs Name; public static readonly XObjectChangeEventArgs Remove; public static readonly XObjectChangeEventArgs Value; private XObjectChange type; public XObjectChange ObjectChange { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XObjectChangeEventArgs(XObjectChange objectChange) { } } public class XProcessingInstruction : XNode { private string name; private string data; public string Data { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string Target { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XProcessingInstruction(string target, string data) { } public XProcessingInstruction(XProcessingInstruction other) { } public override void WriteTo(XmlWriter writer) { } } public class XStreamingElement { private XName name; private List<object> contents; public XName Name { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } internal IEnumerable<object> Contents { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public XStreamingElement(XName name) { } public XStreamingElement(XName name, object content) { } public XStreamingElement(XName name, params object[] content) { } public void Add(object content) { } public void Add(params object[] content) { } public void Save(string fileName) { } public void Save(TextWriter textWriter) { } public void Save(XmlWriter writer) { } public void Save(string fileName, SaveOptions options) { } public void Save(TextWriter textWriter, SaveOptions options) { } public override string ToString() { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public string ToString(SaveOptions options) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public void WriteTo(XmlWriter writer) { } private void WriteContents(IEnumerable<object> items, XmlWriter w) { } private void WriteAttribute(XAttribute a, XmlWriter w) { } } public class XText : XNode { private string value; public override XmlNodeType NodeType { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } public string Value { get { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } set { } } public XText(string value) { } public XText(XText other) { } public override void WriteTo(XmlWriter writer) { } } internal static class XUtil { public const string XmlnsNamespace = "http://www.w3.org/2000/xmlns/"; public static bool ConvertToBoolean(string s) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static DateTime ToDateTime(string s) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static string ToString(object o) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool ToBoolean(object o) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static bool? ToNullableBoolean(object o) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<object> ExpandArray(object o) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XNode ToNode(object o) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static object GetDetachedObject(XObject child) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static object Clone(object o) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } } namespace System.Xml.Schema { public static class Extensions { public static IXmlSchemaInfo GetSchemaInfo(this XAttribute source) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static IXmlSchemaInfo GetSchemaInfo(this XElement source) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static void Validate(this XAttribute source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler) { } public static void Validate(this XAttribute source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler, bool addSchemaInfo) { } public static void Validate(this XDocument source, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler) { } public static void Validate(this XDocument source, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler, bool addSchemaInfo) { } [MonoTODO] public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler) { } [MonoTODO] public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler, bool addSchemaInfo) { } } } namespace System.Xml.XPath { public static class Extensions { public static XPathNavigator CreateNavigator(this XNode node) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XPathNavigator CreateNavigator(this XNode node, XmlNameTable nameTable) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static object XPathEvaluate(this XNode node, string expression) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static object XPathEvaluate(this XNode node, string expression, IXmlNamespaceResolver resolver) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] private static IEnumerable<object> GetUnderlyingXObjects(XPathNodeIterator nodeIterator) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement XPathSelectElement(this XNode node, string expression) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static XElement XPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver resolver) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } [DebuggerHidden] public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression, IXmlNamespaceResolver resolver) { /*Error: Method body consists only of 'ret', but nothing is being returned. Decompiled assembly might be a reference assembly.*/; } } }