Example #1
0
        /**
         * @brief Return stored timestamp if exists, or retrieve it from hard-drive.
         *
         * @param _asset Asset in question.
         * @return Universal time when the asset's original file was last written to.
         *
         */
        public static long GetTimestamp(Object _asset)
        {
            AssetMetaInfo info = new AssetMetaInfo();

            GetInfo(AssetDatabase.GetAssetPath(_asset), ref info);
            return(info.timestamp);
        }
Example #2
0
 static void FetchData(string _assetPath, ref AssetMetaInfo _info)
 {
     try {
         //_info.timestamp = File.GetLastWriteTime(_assetPath).ToFileTimeUtc();
     }
     catch (Exception e) {
         _info.timestamp = 0;
         Debug.LogError(LOG_TAG + "Failed to retrieve meta data for '" + _assetPath + "'! Defaults returned. Reason: " + e.ToString());
     }
 }
Example #3
0
        /**
         * @brief Update stored information if already present. This is called by an
         *	appropriate AssetPostprocessor.
         *
         * @param _assetPath Asset to update.
         *
         */
        public static void UpdateMetaInfo(string _assetPath)
        {
            if (!initialised)
            {
                return;
            }

            string guid = AssetDatabase.AssetPathToGUID(_assetPath);

            if (infoTable.ContainsKey(guid))
            {
                AssetMetaInfo info = new AssetMetaInfo();
                FetchData(_assetPath, ref info);
                infoTable[guid] = info;
            }
        }
Example #4
0
        static void GetInfo(string _assetPath, ref AssetMetaInfo _info)
        {
            if (!initialised)
            {
                Init();
            }

            string guid = AssetDatabase.AssetPathToGUID(_assetPath);

            if (infoTable.ContainsKey(guid))
            {
                // cache hit
                _info = infoTable[guid];
            }
            else
            {
                // cache miss
                FetchData(_assetPath, ref _info);
                infoTable[guid] = _info;
            }
        }
Example #5
0
        /**
         * @brief Update stored information if already present. This is called by an
         *	appropriate AssetPostprocessor.
         *
         * @param _assetPath Asset to update.
         *
         */
        public static void UpdateMetaInfo(string _assetPath)
        {
            if (! initialised) {
            return;
            }

            string guid = AssetDatabase.AssetPathToGUID(_assetPath);
            if (infoTable.ContainsKey(guid)) {
            AssetMetaInfo info = new AssetMetaInfo();
            FetchData(_assetPath, ref info);
            infoTable[guid] = info;
            }
        }
Example #6
0
 /**
  * @brief Return stored timestamp if exists, or retrieve it from hard-drive.
  *
  * @param _asset Asset in question.
  * @return Universal time when the asset's original file was last written to.
  *
  */
 public static long GetTimestamp(Object _asset)
 {
     AssetMetaInfo info = new AssetMetaInfo();
     GetInfo(AssetDatabase.GetAssetPath(_asset), ref info);
     return info.timestamp;
 }
Example #7
0
        static void GetInfo(string _assetPath, ref AssetMetaInfo _info)
        {
            if (! initialised) {
            Init();
            }

            string guid = AssetDatabase.AssetPathToGUID(_assetPath);

            if (infoTable.ContainsKey(guid)) {
            // cache hit
            _info = infoTable[guid];
            }
            else {
            // cache miss
            FetchData(_assetPath, ref _info);
            infoTable[guid] = _info;
            }
        }
Example #8
0
 static void FetchData(string _assetPath, ref AssetMetaInfo _info)
 {
     try {
     _info.timestamp = File.GetLastWriteTime(_assetPath).ToFileTimeUtc();
     }
     catch (Exception e) {
     _info.timestamp = 0;
     Debug.LogError(LOG_TAG + "Failed to retrieve meta data for '" + _assetPath + "'! Defaults returned. Reason: " + e.ToString());
     }
 }