Example #1
0
        public static ArtList <Picture> GatherPictures()
        {
            string path = Environment.CurrentDirectory;
            string str  = "";

            for (int i = 0; i < path.Length - 10; i++)
            {
                str += path[i];
            }
            path = @str + @"\Info\Pictures";
            DirectoryInfo dirInf = new DirectoryInfo(path);

            FileInfo[]        FileArr       = dirInf.GetFiles();
            ArtList <Picture> resultGallery = new ArtList <Picture>();

            foreach (FileInfo fi in FileArr)
            {
                string   PathToFile = path + "\\" + fi.Name;
                string   inf        = File.ReadAllText(PathToFile);
                string[] infArr     = inf.Split('\n');

                Picture newPict = new Picture();
                newPict.Name   = infArr[0].Trim().Trim();
                newPict.Artist = infArr[1].Trim().Trim();
                newPict.Year   = Convert.ToInt32(infArr[2]);
                newPict.Style  = infArr[3].Trim().Trim();
                newPict.Path   = @path + @infArr[4];

                resultGallery.Add(newPict);
            }

            return(resultGallery);
        }
Example #2
0
        public static ArtList <Artist> GatherArtists()
        {
            string path = Environment.CurrentDirectory;
            string str  = "";

            for (int i = 0; i < path.Length - 10; i++)
            {
                str += path[i];
            }
            path = @str + @"\Info\Artists";
            DirectoryInfo dirInf = new DirectoryInfo(path);

            FileInfo[]       FileArr    = dirInf.GetFiles();
            ArtList <Artist> allArtists = new ArtList <Artist>();

            foreach (FileInfo fi in FileArr)
            {
                string   PathToFile = path + "\\" + fi.Name;
                string   inf        = File.ReadAllText(PathToFile);
                string[] separator  = new string[] { "\r\n" };
                string[] infArr     = inf.Split(separator, StringSplitOptions.None);

                Artist newArtist = new Artist();
                newArtist.Name        = infArr[0].Trim().Trim();
                newArtist.YearsOfLife = infArr[1].Trim().Trim();
                newArtist.Style       = infArr[2].Trim().Trim();
                newArtist.Nation      = infArr[3].Trim().Trim();
                newArtist.Photo       = @path + @infArr[4];

                allArtists.Add(newArtist);
            }

            return(allArtists);
        }
Example #3
0
        public T this[int index]
        {
            get
            {
                int         i       = 0;
                ArtList <T> current = Head;
                while (i < index)
                {
                    current = current.Next;
                    i++;
                }

                return(current.NItem);
            }
        }
Example #4
0
        private void Add(T item)
        {
            if (Head == null)
            {
                Head = new ArtList <T>(item);
            }
            else
            {
                ArtList <T> current = Head;

                while (current.Next != null)
                {
                    current = current.Next;
                }
                current.Next = new ArtList <T>(item);
            }
        }
Example #5
0
 private ArtList(T Item)
 {
     this.NItem = Item;
     Head       = this;
 }
        private void GatherInfo()
        {
            this.gallery = ArtList <Picture> .GatherPictures();

            this.artists = ArtList <Artist> .GatherArtists();
        }