public static TextFile FromRawTextFileUtf16(RawTextFile file, Allocator allocator) { var answer = new TextFile { Contents = (ushort *)file.Contents, Length = (int)(file.Length / 2), FilePathId = file.FilePathId, }; answer.Split(allocator); return(answer); }
public static TextFile FromRawTextFileCp932(RawTextFile file, Allocator allocator) { if (file.IsCreated) { var rawFileLength = (ulong)file.Length; var answer = new TextFile(file.FilePathId, (int)pcysl5edgo.BurstEncoding.Cp932Decoder.GetCharCount(file.Contents, rawFileLength), Allocator.Persistent); BurstEncoding.Cp932Decoder.GetChars(file.Contents, rawFileLength, answer.Contents); answer.Split(allocator); return(answer); } return(new TextFile { FilePathId = file.FilePathId, }); }
public void StartLoad(FileInfo[] infos, string[] fullPaths) { _currentStage = Stage.ReadAsync; for (int i = 0; i < Length; i++) { RawFiles[i] = new RawTextFile(i, infos[i].Length - _isUtf16); ReadCommands[i] = new ReadCommand { Size = RawFiles[i].Length, Buffer = RawFiles[i].Contents, Offset = _isUtf16, }; ReadHandles[i] = AsyncReadManager.Read(fullPaths[i], ReadCommands + i, 1); } }