private void Upload()
        {
            DebugUtils.Log("Upload");
            if (this.m_LocalRootPath == null)
            {
                EditorUtility.DisplayDialog("Package Assets folder not set", "You haven't set the Asset Folder yet. ", "Ok");
                return;
            }
            DebugUtils.Log(Application.dataPath + this.m_LocalRootPath);
            if (!Directory.Exists(Application.dataPath + this.m_LocalRootPath))
            {
                EditorUtility.DisplayDialog("Project not found!", "The root folder you selected does not exist in the current project.\nPlease make sure you have the correct project open or you have selected the right root folder", "Ok");
                return;
            }
            if (Directory.GetFileSystemEntries(Application.dataPath + this.m_LocalRootPath).Length == 0)
            {
                EditorUtility.DisplayDialog("Empty folder!", "The root folder you have selected is empty.\nPlease make sure you have the correct project open or you have selected the right root folder", "Ok");
                return;
            }
            this.m_DraftAssetsUploadProgress = 0f;
            this.m_LocalProjectPath          = Application.dataPath;
            this.m_LocalRootGUID             = AssetStorePackageController.GetLocalRootGUID(this.m_Package);
            string text = this.CheckContent();

            if (string.IsNullOrEmpty(text))
            {
                this.m_DraftAssetsPath = "Temp/uploadtool_" + this.m_LocalRootPath.Trim(new char[]
                {
                    '/'
                }).Replace('/', '_') + ".unitypackage";
                this.m_DraftAssetsSize          = 0L;
                this.m_DraftAssetsLastCheckTime = EditorApplication.timeSinceStartup;
                this.m_AssetsState = AssetStorePackageController.AssetsState.InitiateBuilding;
                this.m_Dirty       = true;
                EditorApplication.LockReloadAssemblies();
                return;
            }
            string text2 = AssetStorePackageController.kForbiddenExtensions[0];

            for (int i = 1; i < AssetStorePackageController.kForbiddenExtensions.Length; i++)
            {
                text2 = text2 + ", " + AssetStorePackageController.kForbiddenExtensions[i];
            }
            Debug.LogWarning(text);
            EditorUtility.DisplayDialog("Invalid files", "Your project contains file types that are not allowed in the AssetStore.\nPlease remove files with the following extensions:\n" + text2 + "\nYou can find more details in the console.", "Ok");
        }
        public void AutoSetSelected(AssetStoreManager assetStoreManager)
        {
            if (this.Dirty)
            {
                return;
            }
            this.SelectedPackage = null;
            List <Package>  list        = new List <Package>();
            IList <Package> allPackages = assetStoreManager.packageDataSource.GetAllPackages();

            foreach (Package item in allPackages)
            {
                list.Add(item);
            }
            list.RemoveAll((Package pc) => string.IsNullOrEmpty(pc.RootGUID) || pc.RootGUID != AssetStorePackageController.GetLocalRootGUID(pc));
            if (list.Count == 1)
            {
                this.SelectedPackage = list[0];
                return;
            }
            if (list.Count == 0)
            {
                foreach (Package item2 in allPackages)
                {
                    list.Add(item2);
                }
            }
            list.RemoveAll((Package pc) => pc.RootPath == null || (Application.dataPath != pc.ProjectPath && !Directory.Exists(Application.dataPath + pc.RootPath)));
            if (list.Count == 1)
            {
                this.SelectedPackage = list[0];
                return;
            }
            if (list.Count == 0)
            {
                return;
            }
            foreach (Package package in list)
            {
                if (package.RootPath != null && Directory.Exists(Application.dataPath + package.RootPath) && Application.dataPath == package.ProjectPath)
                {
                    this.SelectedPackage = package;
                    return;
                }
            }
            if (this.SelectedPackage != null)
            {
                return;
            }
            foreach (Package package2 in list)
            {
                if (package2.RootPath != null && Directory.Exists(Application.dataPath + package2.RootPath))
                {
                    this.SelectedPackage = package2;
                    return;
                }
            }
            if (this.SelectedPackage != null)
            {
                return;
            }
            foreach (Package package3 in list)
            {
                if (package3.ProjectPath != null && package3.ProjectPath == Application.dataPath)
                {
                    this.SelectedPackage = package3;
                    break;
                }
            }
        }