public void CancelUpdateCheckTask()
 {
     if (hashTask != null && UnityHelpers.TaskManagerController.HasTask(hashTask))
     {
         UnityHelpers.TaskManagerController.CancelTask(hashTask);
         hashTask = null;
     }
 }
    public BSPMap LoadMap(string vpkLoc, string mapLoc, bool combineMeshesWithSameTextures = true, float faceLoadPercent = 1, float modelLoadPercent = 1, bool flatTextures = false, int maxTextureSize = 2048)
    {
        BSPMap.vpkLoc = vpkLoc;
        BSPMap map = new BSPMap(mapLoc);

        BSPMap.combineMeshesWithSameTexture = combineMeshesWithSameTextures;
        BSPMap.FaceLoadPercent        = faceLoadPercent;
        BSPMap.ModelLoadPercent       = modelLoadPercent;
        SourceTexture.averageTextures = flatTextures;
        SourceTexture.maxTextureSize  = maxTextureSize;

        loadingTask = UnityHelpers.TaskManagerController.RunActionAsync("Parsing Map", (cancelToken) => { map.ParseFile(cancelToken, null, () =>
            {
                if (!loadingTask.cancelled)
                {
                    UnityHelpers.TaskManagerController.RunAction(() => { map.MakeGameObject(null, (go) => { go.SetActive(true); }); });
                }
            }); });

        return(map);
    }
    private void RefreshItemInfo()
    {
        if (item != null && item is DepotDownloader.ProtoManifest.FileData)
        {
            var resourcePakData = (DepotDownloader.ProtoManifest.FileData)item;

            var fullFilePath = Path.Combine(SettingsController.gameLocation, resourcePakData.FileName);

            packNameLabel.text        = Path.GetFileNameWithoutExtension(resourcePakData.FileName);
            packSizeLabel.text        = (resourcePakData.TotalSize / 1000000) + "MB";
            deleteButton.interactable = File.Exists(fullFilePath);
            downloadToggle.isOn       = SettingsController.HasPak(resourcePakData.FileName);

            fileNeedsUpdate = false;
            if (!TaskMaker.IsBusy() && deleteButton.interactable)
            {
                if (resourcePakData.Chunks != null && resourcePakData.Chunks.Count > 0)
                {
                    hashTask = UnityHelpers.TaskManagerController.CreateTask((ct) => { CheckForUpdates(fullFilePath, resourcePakData, ct); });
                    UnityHelpers.TaskManagerController.QueueTask(hashTask);
                }
            }
        }
    }