using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace SFramework.Editor
{
    public class SDataCleanHelper
    {
        [MenuItem("SFramework/Data Clean/Open PC PersistentDataPath Folder")]
        public static void OpenPersistentDataPath()
        {
            System.Diagnostics.Process.Start(Application.persistentDataPath);
        }

        [MenuItem("SFramework/Data Clean/Clear PC PersistentDataPath")]
        public static void ClearPersistentDataPath()
        {
            foreach (string dir in System.IO.Directory.GetDirectories(Application.persistentDataPath))
            {
                System.IO.Directory.Delete(dir, true);
            }
            foreach (string file in System.IO.Directory.GetFiles(Application.persistentDataPath))
            {
                System.IO.File.Delete(file);
            }
            //SAssetsBundleHelper.ShowDialog("PersistentDataPath Cleared!");
            Debug.Log("PersistentDataPath Cleared!");
        }

        [MenuItem("SFramework/Data Clean/Clear Prefs")]
        public static void ClearPlayerPrefs()
        {
            PlayerPrefs.DeleteAll();
            PlayerPrefs.Save();
            SAssetsBundleHelper.ShowDialog("Prefs Cleared!");
        }
    }
}
