示例#1
0
 private void ReadComplete()
 {
     for (int i = 0; i < Length; i++)
     {
         if (!ReadHandles[i].IsValid())
         {
             continue;
         }
         ReadHandles[i].JobHandle.Complete();
         ReadHandles[i].Dispose();
         if (IsUtf16)
         {
             FilesPtr[0][i]             = TextFile.FromRawTextFileUtf16(RawFiles[i], allocator);
             DeleteCommentJobHandles[i] = DeleteCommentJob.Schedule(FilesPtr[0] + i, IsDebug);
         }
         else
         {
             FilesPtr[0][i]             = TextFile.FromRawTextFileCp932(RawFiles[i], allocator);
             DeleteCommentJobHandles[i] = DeleteCommentJob.Schedule(FilesPtr[0] + i, IsDebug);
         }
     }
     _currentStage = Stage.DeleteCommentAsync;
 }
示例#2
0
            private void ReadAsyncUpdate()
            {
                bool isAnyRunning = false;

                for (int i = 0; i < Length; i++)
                {
                    if (!ReadHandles[i].IsValid())
                    {
                        continue;
                    }
                    switch (ReadHandles[i].Status)
                    {
                    case ReadStatus.Complete:
                        ReadHandles[i].Dispose();
                        if (IsUtf16)
                        {
                            FilesPtr[0][i]             = TextFile.FromRawTextFileUtf16(RawFiles[i], allocator);
                            DeleteCommentJobHandles[i] = DeleteCommentJob.Schedule(FilesPtr[0] + i, IsDebug);
                        }
                        else
                        {
                            FilesPtr[0][i]             = TextFile.FromRawTextFileCp932(RawFiles[i], allocator);
                            DeleteCommentJobHandles[i] = DeleteCommentJob.Schedule(FilesPtr[0] + i, IsDebug);
                        }
                        break;

                    case ReadStatus.Failed:
                        ReadHandles[i].Dispose();
                        break;

                    case ReadStatus.InProgress:
                        isAnyRunning = true;
                        break;
                    }
                }
                if (isAnyRunning)
                {
                    return;
                }
                _currentStage = Stage.DeleteCommentAsync;
                if (RawFiles != null)
                {
                    if (IsUtf16)
                    {
                        UnsafeUtility.Free(RawFiles, allocator);
                    }
                    else
                    {
                        for (int i = 0; i < Length; i++)
                        {
                            RawFiles[i].Dispose();
                        }
                        UnsafeUtility.Free(RawFiles, allocator);
                    }
                    RawFiles = null;
                }
                if (ReadHandles != null)
                {
                    UnsafeUtility.Free(ReadHandles, allocator);
                    ReadHandles = null;
                }
                if (ReadCommands != null)
                {
                    UnsafeUtility.Free(ReadCommands, allocator);
                    ReadCommands = null;
                }
            }