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, }); }