Ejemplo n.º 1
0
        /*private string CreateFolderPath(IMediaFileFolder folder)
         * {
         *  string folderName = this.GetBinding<string>("FolderName");
         *
         *  string folderPath = folder.Path;
         *
         *  if (folderPath == "/")
         *  {
         *      folderPath = folderPath + folderName;
         *  }
         *  else
         *  {
         *      folderPath = folderPath + "/" + folderName;
         *  }
         *
         *  folderPath = folderPath.Replace('\\', '/');
         *  while (folderPath.Contains("//"))
         *  {
         *      folderPath.Replace("//", "/");
         *  }
         *
         *  if ((folderPath != "/") && (folderPath.StartsWith("/")))
         *  {
         *      folderPath.Remove(0, 1);
         *  }
         *
         *  return folderPath;
         * }*/


        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);

            IMediaFileFolder folder       = this.GetBinding <IMediaFileFolder>("NewFolder");
            string           folderName   = this.GetBinding <string>("FolderName");
            string           providerName = this.GetBinding <string>("ProviderName");

            string folderPath = folder.CreateFolderPath(folderName);

            folder.Path = folderPath;

            if (folder.Title == string.Empty)
            {
                folder.Title = folderPath.GetFolderName('/');
            }

            CreateParentFolder(folder.GetParentFolderPath(), providerName);

            folder = DataFacade.AddNew <IMediaFileFolder>(folder, providerName);

            addNewTreeRefresher.PostRefreshMesseges(folder.GetDataEntityToken());

            SelectElement(folder.GetDataEntityToken());
        }
 private void ValidateFolderData(IMediaFileFolder mediaFolder)
 {
     if (!mediaFolder.Path.IsCorrectFolderName('/'))
     {
         throw new ArgumentException("Invalid folder name");
     }
     if (!DoesFolderExists(mediaFolder.GetParentFolderPath()))
     {
         throw new ArgumentException("Could not find any parents folders on path " + mediaFolder.GetParentFolderPath());
     }
     if (DoesFolderExists(mediaFolder.Path))
     {
         throw new ArgumentException("Folder already exists on path " + mediaFolder.Path);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns true if the given media folders parent folder exists
 /// </summary>
 /// <param name="mediaFileFolder"></param>
 /// <returns></returns>
 public static bool DoesParentFolderExists(this IMediaFileFolder mediaFileFolder)
 {
     return(DoesFolderExists(mediaFileFolder.GetParentFolderPath()));
 }