public override Task Load() { return(Task.Run ( () => { string path = UOFileManager.GetUOFilePath("hues.mul"); FileSystemHelper.EnsureFileExists(path); UOFileMul file = new UOFileMul(path); int groupSize = Marshal.SizeOf <HuesGroup>(); int entrycount = (int)file.Length / groupSize; HuesCount = entrycount * 8; HuesRange = new HuesGroup[entrycount]; ulong addr = (ulong)file.StartAddress; for (int i = 0; i < entrycount; i++) { HuesRange[i] = Marshal.PtrToStructure <HuesGroup>((IntPtr)(addr + (ulong)(i * groupSize))); } path = UOFileManager.GetUOFilePath("radarcol.mul"); FileSystemHelper.EnsureFileExists(path); UOFileMul radarcol = new UOFileMul(path); RadarCol = radarcol.ReadArray <ushort>((int)radarcol.Length >> 1); file.Dispose(); radarcol.Dispose(); } )); }
public override void Load() { string path = Path.Combine(FileManager.UoFolderPath, "hues.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul file = new UOFileMul(path, false); int groupSize = Marshal.SizeOf <HuesGroup>(); int entrycount = (int)file.Length / groupSize; HuesCount = entrycount * 8; HuesRange = new HuesGroup[entrycount]; ulong addr = (ulong)file.StartAddress; for (int i = 0; i < entrycount; i++) { HuesRange[i] = Marshal.PtrToStructure <HuesGroup>((IntPtr)(addr + (ulong)(i * groupSize))); } path = Path.Combine(FileManager.UoFolderPath, "radarcol.mul"); if (!File.Exists(path)) { throw new FileNotFoundException(); } UOFileMul radarcol = new UOFileMul(path, false); RadarCol = radarcol.ReadArray <ushort>((int)radarcol.Length >> 1); file.Dispose(); radarcol.Dispose(); }