public SchemaPath(Schema schema) { if (schema == null) return; string schemaName = schema.Name; RepositoryPath repositoryPath = new RepositoryPath(schema.Repository); var schemaPath = Path.Combine(repositoryPath.PhysicalPath, "Schemas", schema.Name); //Schema is link // if (!Directory.Exists(schemaPath) && File.Exists(schemaPath + ".lnk")) { PhysicalPath = LinkHelper.ResolveShortcut(schemaPath + ".lnk"); SettingFile = Path.Combine(PhysicalPath, PathHelper.SettingFileName); VirtualPath = UrlUtility.GetVirtualPath(PhysicalPath); } else { var basePhysicalPath = GetBaseDir(schema.Repository); this.PhysicalPath = Path.Combine(basePhysicalPath, schemaName); this.SettingFile = Path.Combine(PhysicalPath, PathHelper.SettingFileName); VirtualPath = UrlUtility.RawCombine(repositoryPath.VirtualPath, PATH_NAME, schemaName); } }
public DataPath(string repositoryName) { var repository = new Repository(repositoryName); var repositoryPath = new RepositoryPath(repository); this.PhysicalPath = Path.Combine(repositoryPath.PhysicalPath, DirName); this.VirtualPath = UrlUtility.Combine(repositoryPath.VirtualPath, DirName); }
public SchemaPath(Schema schema) { RepositoryPath repositoryPath = new RepositoryPath(schema.Repository); var basePhysicalPath = GetBaseDir(schema.Repository); this.PhysicalPath = Path.Combine(basePhysicalPath, schema.Name); this.SettingFile = Path.Combine(PhysicalPath, PathHelper.SettingFileName); VirtualPath = UrlUtility.RawCombine(repositoryPath.VirtualPath, PATH_NAME, schema.Name); }
public PendingWorkflowItemPath(PendingWorkflowItem pendingWorkflowItem) { var repositoryPath = new RepositoryPath(pendingWorkflowItem.Repository); this.PhysicalPath = SettingFile = Path.Combine(repositoryPath.PhysicalPath, PATH_NAME, pendingWorkflowItem.RoleName, GetFileName(pendingWorkflowItem)); this.VirtualPath = UrlUtility.Combine(repositoryPath.VirtualPath, PATH_NAME, pendingWorkflowItem.RoleName, GetFileName(pendingWorkflowItem)); }
public void TestPhysicalPath() { var name = "repository1"; var expected = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Cms_Data", "Contents", name); RepositoryPath path = new RepositoryPath(new Repository(name)); Assert.AreEqual(expected, path.PhysicalPath, true); }
public WorkflowPath(Repository repository) { var repositoryPath = new RepositoryPath(repository); PhysicalPath = Path.Combine(repositoryPath.PhysicalPath, PATH_NAME); VirtualPath = UrlUtility.Combine(repositoryPath.VirtualPath, PATH_NAME); IO.IOUtility.EnsureDirectoryExists(PhysicalPath); }
public PendingWorkflowItemPath(Repository repository, string roleName) { var repositoryPath = new RepositoryPath(repository); PhysicalPath = Path.Combine(repositoryPath.PhysicalPath, PATH_NAME, roleName); VirtualPath = UrlUtility.Combine(repositoryPath.VirtualPath, PATH_NAME, roleName); IO.IOUtility.EnsureDirectoryExists(PhysicalPath); }
/// <summary> /// Remote attribute /// </summary> /// <param name="name"></param> /// <returns></returns> public virtual ActionResult IsNameAvailable(string name) { Repository repository = new Repository(name); RepositoryPath path = new RepositoryPath(repository); if (!path.Exists()) { return Json(true, JsonRequestBehavior.AllowGet); } int i = 1; while (path.Exists()) { repository = new Repository(name + i.ToString()); path = new RepositoryPath(repository); } return Json(string.Format("{0} is not available. Try {1}.", name, repository.Name), JsonRequestBehavior.AllowGet); }
public virtual ActionResult TempFile() { var entry = new JsonResultEntry(); try { if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { var postFile = Request.Files[0]; var repositoryPath = new RepositoryPath(Repository); var tempPath = Kooboo.Web.Url.UrlUtility.Combine(repositoryPath.VirtualPath, "Temp"); Kooboo.IO.IOUtility.EnsureDirectoryExists(Server.MapPath(tempPath)); var fileUrl = Kooboo.Web.Url.UrlUtility.Combine(tempPath, UniqueIdGenerator.GetInstance().GetBase32UniqueId(24) + Path.GetExtension(postFile.FileName)); postFile.SaveAs(Server.MapPath(fileUrl)); entry.Model = Url.Content(fileUrl); } else { entry.SetFailed().AddMessage("It is not a valid image file.".Localize()); } } catch (Exception e) { entry.AddException(e); } return Json(entry); }
public virtual ActionResult ImageCrop() { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { var postFile = Request.Files[0]; var repositoryPath = new RepositoryPath(Repository); var tempPath = Kooboo.Web.Url.UrlUtility.Combine(repositoryPath.VirtualPath, "Temp"); Kooboo.IO.IOUtility.EnsureDirectoryExists(Server.MapPath(tempPath)); var fileUrl = Kooboo.Web.Url.UrlUtility.Combine(tempPath, UniqueIdGenerator.GetInstance().GetBase32UniqueId(24) + Path.GetExtension(postFile.FileName)); postFile.SaveAs(Server.MapPath(fileUrl)); resultData.Model = new { ImageUrl = Url.Content(fileUrl), PreviewUrl = this.Url.Action("ResizeImage", "Resource", new { siteName = Site.FullName, url = fileUrl, area = "", width = 600, height = 400, preserverAspectRatio = true, quality = 80 }) }; } else { resultData.AddErrorMessage("It is not a valid image file.".Localize()); } }); return Json(data); }
private static string GetFileName(Repository repository, string providerName) { RepositoryPath path = new RepositoryPath(repository); return System.IO.Path.Combine(path.PhysicalPath, "Logs", string.Format("{0}-{1}.log", providerName, DateTime.Now.ToString("yyyyMMdd"))); }
public BroadcastingPath(Repository repository) { var repositoryPath = new RepositoryPath(repository); this.PhysicalPath = Path.Combine(repositoryPath.PhysicalPath, DIR); }
public static string GetDataDir(string repositoryName) { var repository = new Repository(repositoryName); var repositoryPath = new RepositoryPath(repository); return Path.Combine(repositoryPath.PhysicalPath, DirName); }
public static string GetBasePhysicalPath(Repository repository) { var repositoryPath = new RepositoryPath(repository); return Path.Combine(repositoryPath.PhysicalPath, SearchDir.DirName); }
public static string GetBaseDir <T>(Repository repository) { var repositoryPath = new RepositoryPath(repository); return(Path.Combine(repositoryPath.PhysicalPath, GetRootPath(typeof(T)))); }
public BroadcastingPath(Repository repository) { var repositoryPath = new RepositoryPath(repository); this.PhysicalPath = Path.Combine(repositoryPath.PhysicalPath, DIR); }