public void AsyncDeleteFiles(GxDirectory directory) { GXLogging.Debug(log, "DeleteFiles ", directory.GetName()); try { if (!DISABLED && directory.Exists()) { Thread t = new Thread(new ParameterizedThreadStart(DeleteFiles)); t.Priority = ThreadPriority.BelowNormal; t.IsBackground = true; t.Start(directory); } } catch (Exception ex) { GXLogging.Error(log, "DeleteFiles error", ex); } }
public static string getTMP_MEDIA_PATH() { bool defaultPath = true; if (mediaPath == null) { lock (syncRoot) { if (mediaPath == null) { if (Config.GetValueOf("TMPMEDIA_DIR", out mediaPath)) { mediaPath = mediaPath.Trim(); if (!String.IsNullOrEmpty(mediaPath) && !mediaPath.EndsWith("\\") && !mediaPath.EndsWith("/")) { mediaPath += Path.DirectorySeparatorChar; } if (mediaPath.StartsWith("http")) { return(mediaPath); } } else { mediaPath = ""; } if (!String.IsNullOrEmpty(mediaPath)) { defaultPath = false; } if (GXServices.Instance == null || GXServices.Instance.Get(GXServices.STORAGE_SERVICE) == null) { if (defaultPath || !Path.IsPathRooted(mediaPath)) { mediaPath = Path.Combine(GxContext.StaticPhysicalPath(), mediaPath) + Path.DirectorySeparatorChar; } } else { mediaPath = mediaPath.Replace("\\", "/"); } try { GxDirectory directory = new GxDirectory(GxContext.StaticPhysicalPath(), mediaPath); if (!defaultPath) { GXFileWatcher.Instance.AsyncDeleteFiles(directory); } if (!directory.Exists()) { directory.Create(); } } catch (Exception ex) { GXLogging.Error(log, "Error creating TMPMEDIA_DIR " + mediaPath, ex); } GXLogging.Debug(log, "TMP_MEDIA_PATH:", mediaPath); } } } return(mediaPath); }
public static string getBLOB_PATH() { bool defaultPath = true; if (blobPath == null) { lock (syncRoot) { if (blobPath == null) { if (Config.GetValueOf("CS_BLOB_PATH", out blobPath)) { blobPath = blobPath.Trim(); if (!String.IsNullOrEmpty(blobPath) && !blobPath.EndsWith("\\") && !blobPath.EndsWith("/")) { blobPath += Path.DirectorySeparatorChar; } if (blobPath.StartsWith("http")) { return(blobPath); } } else { blobPath = ""; } if (!String.IsNullOrEmpty(blobPath)) { defaultPath = false; } if (String.IsNullOrEmpty(blobPath) || !Path.IsPathRooted(blobPath)) { blobPathFolderName = String.IsNullOrEmpty(blobPath) ? blobPath : blobPath.TrimEnd('/', '\\').TrimStart('/', '\\'); if (GXServices.Instance == null || GXServices.Instance.Get(GXServices.STORAGE_SERVICE) == null) { blobPath = Path.Combine(GxContext.StaticPhysicalPath(), blobPath); if (blobPath[blobPath.Length - 1] != Path.DirectorySeparatorChar) { blobPath += Path.DirectorySeparatorChar; } } else { blobPath = blobPath.Replace("\\", "/"); } } try { GxDirectory directory = new GxDirectory(GxContext.StaticPhysicalPath(), blobPath); if (!defaultPath) { GXFileWatcher.Instance.AsyncDeleteFiles(directory); } if (!directory.Exists()) { directory.Create(); } string multimediaPath = Path.Combine(blobPath, GXDbFile.MultimediaDirectory); GxDirectory multimediaDirectory = new GxDirectory(GxContext.StaticPhysicalPath(), multimediaPath); if (!multimediaDirectory.Exists()) { multimediaDirectory.Create(); } } catch (Exception ex) { GXLogging.Error(log, "Error creating CS_BLOB_PATH " + blobPath, ex); } GXLogging.Debug(log, "BLOB_PATH:", blobPath); } } } return(blobPath); }