Esempio n. 1
0
        /// <summary>
        /// Validate and save the asset file path to the database
        /// Also create require subfolders if necessary
        /// </summary>
        private static void Save(AssetFilePath assetFilePath)
        {
            ValidateAssetFilePathWithException(assetFilePath);
            AssetFilePath.Update(assetFilePath);

            foreach (string subfolder in m_RequiredSubFolders)
            {
                string fullpath = Path.Combine(assetFilePath.Path, subfolder);

                if (!Directory.Exists(fullpath))
                {
                    try
                    {
                        Directory.CreateDirectory(fullpath);
                        m_Logger.InfoFormat("Created directory: {0}", fullpath);
                    }
                    catch (Exception ex)
                    {
                        m_Logger.Warn(string.Format("Unable to create folder: {0}.  Error : {1}", fullpath, ex.Message), ex);
                    }
                }
            }

            CacheManager.InvalidateCache("AssetFilePath", CacheType.All);
        }
Esempio n. 2
0
        /// <summary>
        /// Set the default asset file path to that with the specified id
        /// All other asset file paths are marked as not default as there can only be one
        /// default asset file path at any time
        /// </summary>
        public static void SetDefault(int assetFilePathId)
        {
            foreach (var afp in GetList())
            {
                afp.IsDefault = (afp.AssetFilePathId == assetFilePathId);
                AssetFilePath.Update(afp);
            }

            CacheManager.InvalidateCache("AssetFilePath", CacheType.All);
        }