Пример #1
0
        private void SetModelList()
        {
            _modelList.Clear();

            foreach (DirectoryInfo model in _workingDirectory.GetDirectories())
                if (!Char.IsNumber(Convert.ToChar(model.Name.Substring(0, 1))))
                {
                    ModelB newModel = new ModelB();
                    newModel.ModelName = model.Name;
                    newModel.Location = new DirectoryInfo(model.FullName);

                    SetModelGalleries(newModel);

                    _modelList.Add(newModel);
                }
        }
Пример #2
0
        private void SetModelGalleries(ModelB newModel)
        {
            FileInfo[] galleries = newModel.Location.GetFiles();

            if (galleries.Count() > 0)
                foreach (FileInfo galleryFile in galleries)
                {
                    string galleryName = WPlusPlay.PlusPlayTools.StringManipulator.ExtractGalleryName(galleryFile);
                    bool galleryExists = false;

                    foreach (Gallery gallery in newModel.ModelGalleries)
                        if (gallery.GalleryName == galleryName)
                            galleryExists = true;

                    if (!galleryExists)
                        newModel.ModelGalleries.Add(new Gallery(galleryName, galleryFile.Directory));

                    newModel.ModelGalleries.Single(x => x.GalleryName == galleryName).Files.Add(galleryFile);
                }
        }
Пример #3
0
        internal void NameChangeRequest(Dictionary<Keyword, string> ModelGalleryName, ModelB model)
        {
            if (ModelGalleryName[Keyword.Model] != model.ModelName)
            {
                foreach (Gallery gallery in model.ModelGalleries)
                {
                    gallery.Files.ForEach(x =>
                        {
                            FileInfo newFileLocation = new FileInfo(x.FullName.Replace(model.ModelName + " - ", ModelGalleryName[Keyword.Model] + " - "));
                            File.Move(x.FullName, newFileLocation.FullName);
                        });
                }

                DirectoryInfo newModelLocation = new DirectoryInfo(model.Location.FullName.Substring(0, model.Location.FullName.Length - model.Location.Name.Length) + ModelGalleryName[Keyword.Model]);
                Directory.Move(model.Location.FullName, newModelLocation.FullName);
            }
        }