public void TestRfcOrderBytes() { Guid guid = Guid.NewGuid(); byte[] data = guid.ToByteArray(); byte[] data2 = GuidExtensions.ToRfcBytes(guid); Guid guid2 = GuidExtensions.ToRfcGuid(data2); foreach (var b in data) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); foreach (var b in data2) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); StringBuilder sb = new StringBuilder(); foreach (var b in data2) { sb.AppendFormat("{0:X2}", b); } System.Console.WriteLine(sb.ToString()); System.Console.WriteLine(guid.ToString("N").ToUpper()); System.Console.WriteLine(guid); System.Console.WriteLine(guid2); Assert.AreEqual(guid, guid2); Assert.AreEqual(guid.ToString("N").ToUpper(), sb.ToString()); }
public void Test_SimpleEquality_BothNull() { Guid[] thisArray = null; Guid[] otherArray = null; Assert.True(GuidExtensions.GuidsEqual(thisArray, otherArray)); }
/// <summary> /// Generate unique machine identifier. Value should be with guid key in Attributes dictionary. /// Machine id is equal to mac address of first network interface. If network interface in unvailable, random long will be generated. /// </summary> /// <returns>Machine uuid</returns> private static string GenerateMachineId() { #if !UNITY_WEBGL && !UNITY_SWITCH // DeviceUniqueIdentifier will return "Switch" on Nintendo Switch // try to generate random guid instead if (SystemInfo.deviceUniqueIdentifier != SystemInfo.unsupportedIdentifier) { return(SystemInfo.deviceUniqueIdentifier); } var networkInterface = NetworkInterface.GetAllNetworkInterfaces() .FirstOrDefault(n => n.OperationalStatus == OperationalStatus.Up); PhysicalAddress physicalAddr = null; string macAddress = null; if (networkInterface == null || (physicalAddr = networkInterface.GetPhysicalAddress()) == null || string.IsNullOrEmpty(macAddress = physicalAddr.ToString())) { return(Guid.NewGuid().ToString()); } string hex = macAddress.Replace(":", string.Empty); var value = Convert.ToInt64(hex, 16); return(GuidExtensions.FromLong(value).ToString()); #else return(Guid.NewGuid().ToString()); #endif }
/// <summary> /// Generate unique machine identifier. Value should be with guid key in Attributes dictionary. /// Machine id is equal to mac address of first network interface. If network interface in unvailable, random long will be generated. /// </summary> /// <returns>Machine uuid</returns> private string GenerateMachineId() { if (SystemInfo.deviceUniqueIdentifier != SystemInfo.unsupportedIdentifier) { return(SystemInfo.deviceUniqueIdentifier); } var networkInterface = NetworkInterface.GetAllNetworkInterfaces() .FirstOrDefault(n => n.OperationalStatus == OperationalStatus.Up); PhysicalAddress physicalAddr = null; string macAddress = null; if (networkInterface == null || (physicalAddr = networkInterface.GetPhysicalAddress()) == null || string.IsNullOrEmpty(macAddress = physicalAddr.ToString())) { return(Guid.NewGuid().ToString()); } string hex = macAddress.Replace(":", string.Empty); var value = Convert.ToInt64(hex, 16); return(GuidExtensions.FromLong(value).ToString()); }
private async Task <byte[]> GenerateBattlePreviewAsync() { int centerX = 0; int centerY = 0; int previewHalfHeight = 150; int previewHalfWidth = 100; int chunkXFrom = (int)Math.Max(Math.Ceiling(((decimal)(centerX - previewHalfWidth)) / _battle.Settings.ChunkWidth), _battle.Settings.MinWidthIndex); int chunkYFrom = (int)Math.Max(Math.Ceiling(((decimal)(centerY - previewHalfHeight)) / _battle.Settings.ChunkHeight), _battle.Settings.MinHeightIndex); int chunkXTo = (int)Math.Min(Math.Floor(((decimal)(centerX + previewHalfWidth)) / _battle.Settings.ChunkWidth), _battle.Settings.MaxWidthIndex); int chunkYTo = (int)Math.Min(Math.Floor(((decimal)(centerY + previewHalfHeight)) / _battle.Settings.ChunkHeight), _battle.Settings.MaxHeightIndex); var chunks = new List <(int x, int y, byte[] image)>((chunkXTo - chunkXFrom) * (chunkYTo - chunkYFrom)); for (int i = chunkXFrom; i <= chunkXTo; i++) { for (int j = chunkYFrom; j <= chunkYTo; j++) { var chunkGrain = this.GrainFactory.GetGrain <IChunkGrain>(GuidExtensions.ToGuid(_battleId, i, j)); var chunkState = await chunkGrain.GetStateAsync(); chunks.Add((i, j, chunkState.Image)); } } return(_imageProcessor.GenerateImageFromChunks( chunks: chunks, chunkHeight: _battle.Settings.ChunkHeight, chunkWidth: _battle.Settings.ChunkWidth, previewHeight: previewHalfHeight, previewWidth: previewHalfWidth, centerX: centerX, centerY: centerY)); }
public void Profile() { PointCount = 0; BenchmarkFile(@"C:\temp\C37Test\benchmark1.sttp", @"C:\temp\C37Test\benchmark2.sttp", CtpCompressionMode.None, EncodingMethod.Normal); Console.WriteLine($"None: " + new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / 1024); Console.WriteLine(new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / (float)PointCount); //BenchmarkFile(@"C:\temp\C37Test\benchmark2.sttp", @"C:\temp\C37Test\benchmark3.sttp", CtpCompressionMode.None, EncodingMethod.Raw); using (var sha = new SHA1Managed()) { Console.WriteLine(GuidExtensions.ToRfcGuid(sha.ComputeHash(File.ReadAllBytes(@"C:\temp\C37Test\benchmark1.sttp")), 0)); Console.WriteLine(GuidExtensions.ToRfcGuid(sha.ComputeHash(File.ReadAllBytes(@"C:\temp\C37Test\benchmark2.sttp")), 0)); } string[] file1 = File.ReadAllLines(@"C:\temp\C37Test\benchmark1.txt"); string[] file2 = File.ReadAllLines(@"C:\temp\C37Test\benchmark2.txt"); int cnt = 0; int l = Math.Max(file1.Length, file2.Length); //int l = Math.Min(file1.Length, file2.Length); for (int x = 0; x < l; x++) { if (x >= file1.Length) { Console.WriteLine(x); Console.WriteLine(file2[x]); cnt++; } else if (x >= file2.Length) { Console.WriteLine(x); Console.WriteLine(file1[x]); cnt++; } else if (file1[x] != file2[x]) { Console.WriteLine(x); Console.WriteLine(file1[x]); Console.WriteLine(file2[x]); cnt++; } if (cnt == 10) { return; } } //Console.WriteLine(Names.Average(x => x.Length)); //BenchmarkFile(@"C:\temp\C37Test\benchmark1.sttp", @"C:\temp\C37Test\benchmark2.sttp", SttpCompressionMode.Deflate, EncodingMethod.Adaptive); //Console.WriteLine($"None: " + new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / 1024); //BenchmarkFile(@"C:\temp\C37Test\benchmark1.sttp", @"C:\temp\C37Test\benchmark2.sttp", SttpCompressionMode.Zlib, EncodingMethod.Adaptive); //Console.WriteLine($"None: " + new FileInfo(@"C:\temp\C37Test\benchmark2.sttp").Length / 1024); }
public void TestReorderBytes() { byte[] original = new byte[] { 14, 182, 97, 71, 156, 226, 185, 65, 191, 150, 152, 236, 122, 84, 151, 18 }, expectedResult = new byte[] { 71, 97, 182, 14, 226, 156, 65, 185, 191, 150, 152, 236, 122, 84, 151, 18 }; Assert.AreEqual(expectedResult, GuidExtensions.ReorderBytes(original), "Reversed order"); Assert.AreEqual(original, GuidExtensions.ReorderBytes(GuidExtensions.ReorderBytes(original)), "Back to original order after reordering twice"); }
/// <summary> /// Updates the specified entity to update. /// </summary> /// <param name="entity">The entity to update.</param> /// <returns></returns> public Guid SaveGuid(BaseModel entity) { var key = entity.GetType().GetProperties().FirstOrDefault(p => p.GetCustomAttributes(typeof(KeyAttribute), true).Length != 0); var objectId = key.GetValue(entity, null); if (objectId.ToGuid() == Guid.Empty) { key.SetValue(entity, GuidExtensions.GenerateComb()); objectId = Insert <Guid>(entity); } else { Update(entity); } return(objectId.ToGuid().Value); }
protected virtual void ProcessTemplateSections([NotNull] FileCodeModel fileCodeModel, [NotNull] Template template, [NotNull] CodeInterface2 codeInterface) { Debug.ArgumentNotNull(fileCodeModel, nameof(fileCodeModel)); Debug.ArgumentNotNull(template, nameof(template)); Debug.ArgumentNotNull(codeInterface, nameof(codeInterface)); var templateSection = new TemplateSection(); template.Sections.Add(templateSection); templateSection.Name = "Data"; templateSection.TemplateSectionItemId = new ItemId(GuidExtensions.Hash(template.Name + @"/" + templateSection.Name)); foreach (var property in codeInterface.Members.OfType <CodeProperty2>()) { ProcessTemplateField(fileCodeModel, template, templateSection, property); } }
public bool ReadNextMeasurement(out ushort id, out long timestamp, out uint quality, out float value) { while (true) { switch (m_reader.GetMeasurement()) { case DecompressionExitCode.NewMeasurementRegistered: if (m_reader.NewMeasurementRegisteredId != m_measurements.Count) { throw new NotSupportedException(); } ushort newID; Guid guid = GuidExtensions.ToLittleEndianGuid(m_reader.NewMeasurementRegisteredMetadata); if (!m_lookup.TryGetValue(guid, out newID)) { newID = (ushort)m_lookup.Count; m_lookup.Add(guid, newID); } m_measurements.Add(newID); break; case DecompressionExitCode.UserData: case DecompressionExitCode.UserDataWithValue: break; case DecompressionExitCode.EndOfStreamOccured: id = 0; timestamp = 0; quality = 0; value = 0; return(false); case DecompressionExitCode.MeasurementRead: id = m_measurements[m_reader.ID]; timestamp = m_reader.Timestamp; quality = m_reader.Quality; value = m_reader.Value.ValueSingle; return(true); default: throw new ArgumentOutOfRangeException(); } } }
public void TestBigEndianOrderBytes() { Guid guid = Guid.NewGuid(); byte[] data = guid.ToByteArray(); Array.Reverse(data); byte[] data2 = GuidExtensions.__ToBigEndianOrderBytes(guid); byte[] data3 = EndianOrder.BigEndian.GetBytes(guid); Guid guid2 = GuidExtensions.__ToBigEndianOrderGuid(data2); Guid guid3 = EndianOrder.BigEndian.ToGuid(data3, 0); foreach (var b in data) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); foreach (var b in data2) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); foreach (var b in data3) { System.Console.Write("{0:X2} ", b); } System.Console.WriteLine(); System.Console.WriteLine(guid); System.Console.WriteLine(guid2); System.Console.WriteLine(guid3); Assert.AreEqual(guid, guid2); Assert.AreEqual(guid, guid3); Assert.IsTrue(data.SequenceEqual(data2)); Assert.IsTrue(data2.SequenceEqual(data3)); }
protected virtual void ProcessTemplateSections([NotNull] FileCodeModel fileCodeModel, [NotNull] Template template, [NotNull] IEnumerable <string> baseFields, [NotNull] CodeClass2 codeClass, bool isGlassMapper) { Debug.ArgumentNotNull(fileCodeModel, nameof(fileCodeModel)); Debug.ArgumentNotNull(template, nameof(template)); Debug.ArgumentNotNull(baseFields, nameof(baseFields)); Debug.ArgumentNotNull(codeClass, nameof(codeClass)); var templateSection = new TemplateSection(); template.Sections.Add(templateSection); templateSection.Name = "Data"; templateSection.TemplateSectionItemId = new ItemId(GuidExtensions.Hash(template.Name + @"/" + templateSection.Name)); foreach (var property in codeClass.Members.OfType <CodeProperty2>()) { if (!baseFields.Contains(property.Name)) { ProcessTemplateField(fileCodeModel, template, templateSection, property, isGlassMapper); } } }
public Guid GetHash([NotNull] CodeElements attributes, [NotNull] string defaultName) { Assert.ArgumentNotNull(attributes, nameof(attributes)); Assert.ArgumentNotNull(defaultName, nameof(defaultName)); foreach (var attribute in attributes.OfType <CodeAttribute2>()) { if (attribute.Name == "SitecoreClass" || attribute.Name == "SitecoreClassAttribute") { var templateId = attribute.Arguments.OfType <CodeAttributeArgument>().FirstOrDefault(a => a.Name == "TemplateId"); if (templateId != null) { Guid guid; if (Guid.TryParse(templateId.Value, out guid)) { return(guid); } } } if (attribute.Name == "Guid" || attribute.Name == "GuidAttribute") { var templateId = attribute.Arguments.OfType <CodeAttributeArgument>().FirstOrDefault(); if (templateId != null) { Guid guid; if (Guid.TryParse(templateId.Value, out guid)) { return(guid); } } } } return(GuidExtensions.Hash(defaultName)); }
protected override async Task ReadStateAsync() { await base.ReadStateAsync(); _chunkKey = this.GetPrimaryKey(); (_battleId, _xChunkIndex, _yChunkIndex) = GuidExtensions.ToKeys(_chunkKey); var battle = await _apiClient.GetBattleAsync(_battleId); _chunkWidth = battle.Settings.ChunkWidth; _chunkHeight = battle.Settings.ChunkHeight; if (State.Image == null) { _pixelsCache = _imageProcessor.GetDefaultImage(_chunkHeight, _chunkWidth); State.ChangeIndex = 0; State.Image = _imageProcessor.GetBytesFromPixels(_pixelsCache, _chunkHeight, _chunkWidth); } else { _pixelsCache = _imageProcessor.GetPixelsFromBytes(State.Image, _chunkHeight, _chunkWidth); } }
public bool OnPreUpdate(PreUpdateEvent @event) { var auditable = @event.Entity as IAuditableEntity <TIdentifier>; if (auditable == null) { return(false); } string userUniqueId = string.Empty; var user = ApplicationContext.User; if (user != null) { var identity = ApplicationContext.User.Identity as ICoreIdentity; if (identity != null) { userUniqueId = identity.Id; } } DateTime updatedAt = DateTime.Now; var auditTrailFactory = ServiceLocator.TryGetInstance <IAuditTrailFactory>(); if (auditTrailFactory != null && auditTrailFactory.IsEntityRegistered(@event.Persister.EntityName)) { string tableName = @event.Persister.EntityName; int[] changedPropertiesIdx = @event.Persister.FindDirty( @event.State, @event.OldState, @event.Entity, @event.Session.GetSessionImplementation()); Guid changeSetUniqueId = GuidExtensions.NewCombGuid(); foreach (int idx in changedPropertiesIdx) { string propertyName = @event.Persister.PropertyNames[idx]; object oldValue = @event.OldState[idx]; object newValue = @event.State[idx]; IEntityAuditTrail auditTrail = auditTrailFactory.CreateAuditTrail( changeSetUniqueId, tableName, @event.Id.ToString(), propertyName, oldValue, newValue, userUniqueId, updatedAt); @event.Session.Save(auditTrail); } } this._Set(@event.Persister, @event.State, "UpdatedBy", userUniqueId); this._Set(@event.Persister, @event.State, "UpdatedAt", updatedAt); //TODO: actualizar esto con una factoria de objetos valor //auditable.AuditInfo.UpdatedBy = userUniqueId; //auditable.AuditInfo.UpdatedAt = updatedAt; return(false); }
public void Test3() { Console.WriteLine(GuidExtensions.NextGuid()); Console.WriteLine(GuidExtensions.NextGuid()); Assert.Pass(); }
/// <summary> /// Reads a Guid from the stream in Little Endian bytes. /// </summary> /// <param name="stream">the stream to read the guid from.</param> /// <returns>the guid value</returns> public static Guid ReadGuid(this Stream stream) { return(GuidExtensions.ToLittleEndianGuid(stream.ReadBytes(16))); }
/// <summary> /// Writes a guid in little endian bytes to the stream /// </summary> /// <param name="stream"></param> /// <param name="value"></param> public static void Write(this Stream stream, Guid value) { Write(stream, GuidExtensions.ToLittleEndianBytes(value)); }
/// <summary> /// This will return a byte array of data that can be written to an archive file. /// </summary> public byte[] GetBytes() { if (!IsFileAllocationTableValid()) { throw new InvalidOperationException("File Allocation Table is invalid"); } byte[] dataBytes = new byte[m_blockSize]; MemoryStream stream = new MemoryStream(dataBytes); BinaryWriter dataWriter = new BinaryWriter(stream); dataWriter.Write(FileAllocationTableHeaderBytes); if (BitConverter.IsLittleEndian) { dataWriter.Write('L'); } else { dataWriter.Write('B'); } dataWriter.Write((byte)(BitMath.CountBitsSet((uint)(m_blockSize - 1)))); dataWriter.Write(FileAllocationReadTableVersion); dataWriter.Write(FileAllocationWriteTableVersion); dataWriter.Write(FileAllocationHeaderVersion); dataWriter.Write((byte)(m_isSimplifiedFileFormat ? 2 : 1)); dataWriter.Write(m_headerBlockCount); dataWriter.Write(m_lastAllocatedBlock); dataWriter.Write(m_snapshotSequenceNumber); dataWriter.Write(m_nextFileId); dataWriter.Write(m_archiveId.ToByteArray()); dataWriter.Write(m_archiveType.ToByteArray()); dataWriter.Write((short)m_files.Count); foreach (SubFileHeader node in m_files) { node.Save(dataWriter); } //Metadata Flags if (m_flags.Count > 0) { Encoding7Bit.WriteInt15(dataWriter.Write, (short)FileHeaderAttributes.FileFlags); Encoding7Bit.WriteInt15(dataWriter.Write, (short)(m_flags.Count * 16)); foreach (var flag in m_flags) { dataWriter.Write(GuidExtensions.ToLittleEndianBytes(flag)); } } if (m_unknownAttributes != null) { foreach (var md in m_unknownAttributes) { Encoding7Bit.WriteInt15(dataWriter.Write, md.Key); Encoding7Bit.WriteInt15(dataWriter.Write, (short)md.Value.Length); dataWriter.Write(md.Value); } } if (m_userAttributes != null) { foreach (var md in m_userAttributes) { Encoding7Bit.WriteInt15(dataWriter.Write, (short)FileHeaderAttributes.UserAttributes); dataWriter.Write(GuidExtensions.ToLittleEndianBytes(md.Key)); Encoding7Bit.WriteInt15(dataWriter.Write, (short)md.Value.Length); dataWriter.Write(md.Value); } } Encoding7Bit.WriteInt15(dataWriter.Write, (short)FileHeaderAttributes.EndOfAttributes); Encoding7Bit.WriteInt15(dataWriter.Write, 0); if (stream.Position + 32 > dataBytes.Length) { throw new Exception("the file size exceedes the allowable size."); } WriteFooterData(dataBytes); return(dataBytes); }
public LoginModule() { Get["/login"] = x => { dynamic model = new ExpandoObject(); var returnUrl = (string)Request.Query.returnUrl; model.ReturnUrl = returnUrl; model.Copyright = @"© 2013 - " + DateTime.Now.ToString("yyyy") + " Anthilla S.r.l."; return(View["login", model]); }; Post["/login"] = x => { var username = (string)Request.Form.Username; var password = (string)Request.Form.Password; if (string.IsNullOrEmpty(username + password)) { return(Context.GetRedirect("/login")); } ConsoleLogger.Log($"login attempt from {username}"); var expiration = DateTime.Now.AddHours(4); var cookies = Request.Cookies; while (cookies.Any()) { cookies.Clear(); } var validationGuid = UserDatabase.ValidateUser(username, password); if (validationGuid == null) { return(Context.GetRedirect("/login")); } var sessionCookie = new NancyCookie("antd-session", GuidExtensions.ToGuid(validationGuid).ToString(), expiration); ConsoleLogger.Log($"{username} logged in successfully"); var returnUrl = (string)Request.Form.Return; return(this.LoginAndRedirect(GuidExtensions.ToGuid(validationGuid), expiration, returnUrl).WithCookie(sessionCookie)); }; Get["/logout"] = x => { var cookies = Request.Cookies; while (cookies.Any()) { cookies.Clear(); } return(this.LogoutAndRedirect("/")); }; Get["/login/auth/{username}/{password}"] = x => { dynamic model = new ExpandoObject(); model.WantsEmail = true; model.HasToken = false; model.Username = x.username; model.Password = x.password; model.Email = ""; return(View["login", model]); }; Get["/login/token/{session}"] = x => { dynamic model = new ExpandoObject(); model.Session = x.session; return(View["login-token", model]); }; Post["/login/verify"] = x => { var username = (string)Request.Form.Username; var password = (string)Request.Form.Password; var validationGuid = UserDatabase.ValidateUser(username, password); var response = validationGuid != null; return(Response.AsJson(response)); }; }
/// <summary> /// This procedure will attempt to read all of the data out of the file allocation table /// If the file allocation table is corrupt, an error will be generated. /// </summary> /// <param name="buffer">the block that contains the buffer data.</param> private void LoadFromBuffer(byte[] buffer) { ValidateBlock(buffer); m_blockSize = buffer.Length; MemoryStream stream = new MemoryStream(buffer); BinaryReader dataReader = new BinaryReader(stream); if (!dataReader.ReadBytes(26).SequenceEqual(FileAllocationTableHeaderBytes)) { throw new Exception("This file is not an archive file system, or the file is corrupt, or this file system major version is not recgonized by this version of the historian"); } char endian = (char)dataReader.ReadByte(); if (BitConverter.IsLittleEndian) { if (endian != 'L') { throw new Exception("This archive file was not writen with a little endian processor"); } } else { if (endian != 'B') { throw new Exception("This archive file was not writen with a big endian processor"); } } byte blockSizePower = dataReader.ReadByte(); if (blockSizePower > 30 || blockSizePower < 5) { throw new Exception("Block size of this file is not supported"); } int blockSize = 1 << blockSizePower; if (m_blockSize != blockSize) { throw new Exception("Block size is unexpected"); } m_minimumReadVersion = dataReader.ReadInt16(); m_minimumWriteVersion = dataReader.ReadInt16(); if (!CanRead) { throw new Exception("The version of this file system is not recgonized"); } m_headerVersion = m_minimumWriteVersion; if (m_headerVersion < 0) { throw new Exception("Header version not supported"); } if (m_headerVersion == 0 || m_headerVersion == 1) { m_isSimplifiedFileFormat = false; m_headerBlockCount = 10; LoadHeaderV0V1(dataReader); return; } m_headerVersion = dataReader.ReadInt16(); byte fileMode = dataReader.ReadByte(); if (fileMode == 1) { m_isSimplifiedFileFormat = false; } else if (fileMode == 2) { m_isSimplifiedFileFormat = true; } else { throw new Exception("Unknown File Mode"); } m_headerBlockCount = dataReader.ReadByte(); m_lastAllocatedBlock = dataReader.ReadUInt32(); m_snapshotSequenceNumber = dataReader.ReadUInt32(); m_nextFileId = dataReader.ReadUInt16(); m_archiveId = new Guid(dataReader.ReadBytes(16)); m_archiveType = new Guid(dataReader.ReadBytes(16)); int fileCount = dataReader.ReadInt16(); //ToDo: check based on block length if (fileCount > 64) { throw new Exception("Only 64 features are supported per archive"); } m_files = new ImmutableList <SubFileHeader>(fileCount); for (int x = 0; x < fileCount; x++) { m_files.Add(new SubFileHeader(dataReader, isImmutable: true, isSimplified: m_isSimplifiedFileFormat)); } m_flags = new ImmutableList <Guid>(); FileHeaderAttributes tag = (FileHeaderAttributes)Encoding7Bit.ReadInt15(dataReader.ReadByte); while (tag != FileHeaderAttributes.EndOfAttributes) { short dataLen; switch (tag) { case FileHeaderAttributes.FileFlags: dataLen = Encoding7Bit.ReadInt15(dataReader.ReadByte); while (dataLen > 0) { dataLen -= 16; m_flags.Add(GuidExtensions.ToLittleEndianGuid(dataReader.ReadBytes(16))); } break; case FileHeaderAttributes.UserAttributes: Guid flag = GuidExtensions.ToLittleEndianGuid(dataReader.ReadBytes(16)); dataLen = Encoding7Bit.ReadInt15(dataReader.ReadByte); AddUserAttribute(flag, dataReader.ReadBytes(dataLen)); break; default: dataLen = Encoding7Bit.ReadInt15(dataReader.ReadByte); AddUnknownAttribute((byte)tag, dataReader.ReadBytes(dataLen)); break; } tag = (FileHeaderAttributes)dataReader.ReadByte(); } if (!IsFileAllocationTableValid()) { throw new Exception("File System is invalid"); } IsReadOnly = true; }
public void GuidId_test() { var result = GuidExtensions.GuidId(); Assert.NotNull(result); }
public static string FileName(string ts, string version) => $"{ts}.{version}.{GuidExtensions.NewShort()}.jsonl.gz";
public string Base64EncodedGuid() => GuidExtensions.EncodeBase64String(_guid);
private Guid FormatChunkKey(ChunkKey key) { return(GuidExtensions.ToGuid(key.BattleId, key.ChunkXIndex, key.ChunkYIndex)); }