コード例 #1
0
        SearchValue OnPropertyFilter(GameObject go, string propertyName)
        {
            if (!go)
            {
                return(SearchValue.invalid);
            }
            if (string.IsNullOrEmpty(propertyName))
            {
                return(SearchValue.invalid);
            }

            using (var view = SearchMonitor.GetView())
            {
                var documentKey = SearchUtils.GetDocumentKey(go);
                var recordKey   = PropertyDatabase.CreateRecordKey(documentKey, PropertyDatabase.CreatePropertyHash(propertyName));
                if (view.TryLoadProperty(recordKey, out object data) && data is SearchValue sv)
                {
                    return(sv);
                }

                foreach (var c in EnumerateSubObjects(go))
                {
                    var property = FindPropertyValue(c, propertyName);
                    if (property.valid)
                    {
                        view.StoreProperty(recordKey, property);
                        return(property);
                    }
                }

                view.StoreProperty(recordKey, SearchValue.invalid);
            }

            return(SearchValue.invalid);
        }
コード例 #2
0
 internal PropertyDatabaseView(PropertyDatabase propertyDatabase, PropertyDatabaseVolatileMemoryStore volatileMemoryStore, PropertyDatabaseMemoryStore memoryStore, PropertyDatabaseFileStore fileStore, PropertyStringTable stringTable, bool delayedSync)
 {
     m_PropertyDatabase        = propertyDatabase;
     m_MemoryStore             = memoryStore;
     m_FileStore               = fileStore;
     m_VolatileMemoryStoreView = (PropertyDatabaseVolatileMemoryStoreView)volatileMemoryStore.GetView();
     m_MemoryStoreView         = (PropertyDatabaseMemoryStoreView)memoryStore.GetView();
     m_FileStoreView           = (PropertyDatabaseFileStoreView)fileStore.GetView();
     m_StringTableView         = stringTable.GetView(delayedSync);
     m_Disposed    = false;
     m_DelayedSync = delayedSync;
 }
コード例 #3
0
        SearchValue OnPropertyFilter(GameObject go, string propertyName)
        {
            if (!go)
            {
                return(SearchValue.invalid);
            }
            if (string.IsNullOrEmpty(propertyName))
            {
                return(SearchValue.invalid);
            }

            #if USE_PROPERTY_DATABASE
            using (var view = SearchMonitor.GetView())
            #endif
            {
                #if USE_PROPERTY_DATABASE
                var documentKey = SearchUtils.GetDocumentKey(go);
                var recordKey   = PropertyDatabase.CreateRecordKey(documentKey, PropertyDatabase.CreatePropertyHash(propertyName));
                if (view.TryLoadProperty(recordKey, out object data))
                {
                    return((SearchValue)data);
                }
                #endif

                var gocs = go.GetComponents <Component>();
                for (int componentIndex = 0; componentIndex < gocs.Length; ++componentIndex)
                {
                    var c = gocs[componentIndex];
                    if (!c || (c.hideFlags & HideFlags.HideInInspector) == HideFlags.HideInInspector)
                    {
                        continue;
                    }

                    var property = FindPropertyValue(c, propertyName);
                    if (property.valid)
                    {
                        #if USE_PROPERTY_DATABASE
                        view.StoreProperty(recordKey, property);
                        #endif
                        return(property);
                    }
                }

                #if USE_PROPERTY_DATABASE
                view.StoreProperty(recordKey, SearchValue.invalid);
                #endif
            }

            return(SearchValue.invalid);
        }
コード例 #4
0
        /// <summary>
        /// gets property and tenant details corresponding to selected property
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Result <TenantPropertyModel> GetPropertyById(int id)
        {
            var propertyDB = new PropertyDatabase();

            if (id > 0)
            {
                return(propertyDB.GetPropertyById(id));
            }
            else
            {
                var respone = new Result <TenantPropertyModel>();
                respone.Success = false;
                respone.Message = "Invalid Property Id";
                return(respone);
            }
        }
コード例 #5
0
        public void Dispose()
        {
            if (m_Disposed)
            {
                return;
            }

            if (m_DelayedSync)
            {
                Sync();
            }

            m_PropertyDatabase = null;
            m_MemoryStore      = null;
            m_FileStore        = null;
            m_VolatileMemoryStoreView.Dispose();
            m_MemoryStoreView.Dispose();
            m_FileStoreView.Dispose();
            m_StringTableView.Dispose();
            m_DelayedSync = false;
            m_Disposed    = true;
        }
コード例 #6
0
        /// <summary>
        /// saves new property
        /// </summary>
        /// <param name="propertyModel"></param>
        /// <returns></returns>
        public Result <int> SaveProperty(PropertyModel propertyModel)
        {
            var propertyDB = new PropertyDatabase();

            return(propertyDB.SaveProperty(propertyModel));
        }
コード例 #7
0
        /// <summary>
        /// Get Property List
        /// </summary>
        /// <returns></returns>
        public Result <List <PropertyModel> > GetPropertyList()
        {
            var propertyDB = new PropertyDatabase();

            return(propertyDB.GetPropertyList());
        }