public ScriptAnalyzeDataManager(System.IO.FileInfo[] fileInfos, bool isUtf16, bool isDebug, Allocator allocator) #endif { if (fileInfos is null) { throw new ArgumentNullException(); } this.allocator = allocator; #if UNITY_EDITOR ShowLog = showLog; #endif FileInfos = fileInfos; FullPaths = new string[FileInfos.Length]; Names = new string[FileInfos.Length]; for (int i = 0; i < FullPaths.Length; i++) { FullPaths[i] = FileInfos[i].FullName; Names[i] = FileInfos[i].Name; } ScriptPtr = ScriptAnalyzeDataManager_Internal.CreatePtr(FullPaths.Length, allocator); Status = (InterpreterStatus *)UnsafeUtility.Malloc(sizeof(InterpreterStatus), 4, allocator); handles = new NativeList <JobHandle>(FullPaths.Length, allocator); jobs = new NativeArray <ParseJob>(FullPaths.Length, allocator); commonDatas = new NativeArray <ParseJob.CommonData>(FullPaths.Length, allocator); InitialReadTempDataPtr = InitialReadTempData.CreatePtr(FileInfos, ScriptPtr->FileLength, &ScriptPtr->Files, isUtf16, isDebug); currentStage = Stage.PreLoading; }
public static InitialReadTempData *CreatePtr(FileInfo[] infos, int fileLength, TextFile **filesPtr, bool isUtf16, bool isDebug) { var ptr = (InitialReadTempData *)UnsafeUtility.Malloc(sizeof(InitialReadTempData), 4, allocator); *ptr = new InitialReadTempData { _isDebug = isDebug ? 1 : 0, _isUtf16 = isUtf16 ? 2 : 0, _currentStage = Stage.None, Length = fileLength, RawFiles = (RawTextFile *)UnsafeUtility.Malloc(sizeof(RawTextFile) * fileLength, 4, allocator), FilesPtr = filesPtr, ReadHandles = (ReadHandle *)UnsafeUtility.Malloc(sizeof(ReadHandle) * fileLength, 4, allocator), ReadCommands = (ReadCommand *)UnsafeUtility.Malloc(sizeof(ReadCommand) * fileLength, 4, allocator), DeleteCommentJobHandles = (JobHandle *)UnsafeUtility.Malloc(sizeof(JobHandle) * fileLength, 4, allocator), }; return(ptr); }