Пример #1
0
 internal void NameChangeRequest(string galleryName, Gallery gallery)
 {
     if (galleryName != gallery.GalleryName)
     {
         gallery.Files.ForEach(x =>
             {
                 FileInfo newFileLocation = new FileInfo(x.FullName.Replace(" - " + gallery.GalleryName, " - " + galleryName));
                 File.Move(x.FullName, newFileLocation.FullName);
             });
     }
 }
Пример #2
0
 /// <summary>
 /// Re-reads the gallery from hard drive and checks for an updated filename
 /// (The purpose of this is determine whether or not it's a "posted" gallery or not)
 /// </summary>
 /// <param name="gallery"></param>
 internal void RefreshGallery(Gallery gallery)
 {
     gallery.Files.Clear();
     gallery.Files = gallery.Location.GetFiles("*" + gallery.GalleryName + "*").ToList();
 }
Пример #3
0
        internal string GetDLinks(Gallery gallery)
        {
            StringBuilder sb = new StringBuilder();

            foreach (FileInfo file in gallery.Files)
                sb.AppendLine("[IMG]" + DropBoxLinkerLib.Linker.GetPublicURLFromFile(file.FullName) + "[/IMG]");

            return sb.ToString();
        }
Пример #4
0
        internal void SetGalleryStatus(Gallery gallery, bool posted)
        {
            List<string> filesToDelete = new List<string>();

            foreach (FileInfo file in gallery.Files)
                if (posted)
                {
                    if (file.Name.Contains('}'))
                    {
                        File.Copy(file.FullName, file.FullName.Replace('}', ']'));
                        filesToDelete.Add(file.FullName);
                    }
                }
                else
                {
                    if (file.Name.Contains(']'))
                    {
                        File.Copy(file.FullName, file.FullName.Replace(']', '}'));
                        filesToDelete.Add(file.FullName);
                    }
                }

            foreach (string deleting in filesToDelete)
                File.Delete(deleting);
        }