private RemoteConfigDataStore InitDataStore()
        {
            RemoteConfigDataStore asset = ScriptableObject.CreateInstance <RemoteConfigDataStore>();

            asset.rsKeyList            = new List <RsKvtData>();
            asset.currentEnvironmentId = null;
            asset.environments         = new List <Environment>();
            asset.rulesList            = new List <RuleWithSettingsMetadata>();
            asset.addedRulesIDs        = new List <string>();
            asset.updatedRulesIDs      = new List <string>();
            asset.deletedRulesIDs      = new List <string>();

            return(asset);
        }
        private RemoteConfigDataStore InitDataStore()
        {
            RemoteConfigDataStore asset = ScriptableObject.CreateInstance <RemoteConfigDataStore>();

            asset.rsKeyList            = new JArray();
            asset.currentEnvironment   = "Please create an environment.";
            asset.currentEnvironmentId = null;
            asset.environments         = new JArray();
            asset.rulesList            = new JArray();
            asset.lastCachedRulesList  = new JArray();
            asset.addedRulesIDs        = new List <string>();
            asset.updatedRulesIDs      = new List <string>();
            asset.deletedRulesIDs      = new List <string>();

            return(asset);
        }
        /// <summary>
        /// Checks for the existence of the Remote Config data store. Creates a new data store if one doesn't already exist
        /// and saves it to the AssetDatabase.
        /// </summary>
        /// <returns>Remote Config data store object</returns>
        public RemoteConfigDataStore CheckAndCreateDataStore()
        {
            string formattedPath = Path.Combine(k_PathToDataStore, string.Format(k_DataStoreAssetFileName, k_DataStoreName));

            if (AssetDatabase.FindAssets(k_DataStoreName).Length > 0)
            {
                if (AssetDatabase.LoadAssetAtPath(formattedPath, typeof(RemoteConfigDataStore)) == null)
                {
                    AssetDatabase.DeleteAsset(formattedPath);
                }
            }
            if (AssetDatabase.FindAssets(k_DataStoreName).Length == 0)
            {
                RemoteConfigDataStore asset = InitDataStore();
                CheckAndCreateAssetFolder(k_PathToDataStore);
                AssetDatabase.CreateAsset(asset, formattedPath);
                AssetDatabase.SaveAssets();
            }
            return(AssetDatabase.LoadAssetAtPath(formattedPath, typeof(RemoteConfigDataStore)) as RemoteConfigDataStore);
        }
 /// <summary>
 /// Constructor: creates amd initalizes the Remote Config data store and restores the last selected environment.
 /// </summary>
 public RemoteConfigDataManager()
 {
     m_DataStore = CheckAndCreateDataStore();
     RestoreLastSelectedEnvironment(m_DataStore.currentEnvironment);
     dataStoreStatus = m_DataStoreStatus.Init;
 }