Exemple #1
0
        public static SearchItemSet PopulateFromDisk(string key)
        {
            SearchItemSet sis  = null;
            string        path = GetSearchPath(key);

            //Debug.Log("[SearchItemSet] path:" + path);
            try{
                sis = (SearchItemSet)SerializationUtil.Deserialize(path);
                if (sis != null)
                {
                    sis.OnDeserialization();
                    sis.SetPath(key);
                }
            }catch (System.Exception ex)
            {
                Debug.LogException(ex);
            }
            if (sis == null)
            {
                sis = new SearchItemSet();
                sis.OnDeserialization();
                sis.SetPath(key);
                sis.AddNew(key);
                return(sis);
            }
            else
            {
                return(sis);
            }
        }
        public static SavedSearches PopulateFromDisk()
        {
            SavedSearches ss = null;

            initSearchPath();
            try{
                ss = (SavedSearches)SerializationUtil.Deserialize(path);
                if (ss != null)
                {
                    ss.OnDeserialization();
                }
            }catch (System.Exception ex)
            {
                Debug.LogError("An error occurred deserializing saved searches. If this issue persists please report the problem to [email protected]. Error: " + ex);
            }
            if (ss == null)
            {
                ss = new SavedSearches();
                ss.OnDeserialization();
                return(ss);
            }
            else
            {
                return(ss);
            }
        }
        public static SearchOptions PopulateFromDisk()
        {
            string        path = Application.persistentDataPath + "/searchreplace/currentSearchOptions";
            SearchOptions sis  = (SearchOptions)SerializationUtil.Deserialize(path);

            if (sis == null)
            {
                return(new SearchOptions());
            }
            else
            {
                return(sis);
            }
        }