Ejemplo n.º 1
0
        private void RefreshMediaFiles(object parameters)
        {
            try
            {
                if (parameters is MediaSource)
                {
                    MediaSource      ms      = (MediaSource)parameters;
                    CStorage         storage = new CStorage();
                    List <MediaFile> mfList  = storage.GetMediaFiles(ms.Path);

                    //  TODO: also here information from DB should be insert in MediaFile object (such as description and owner)
                    //          if information is absence some fields will be empty



                    MediaFiles.Clear();
                    foreach (MediaFile mf in mfList)
                    {
                        MediaFiles.Add(mf);
                    }
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Storage testing...");

            //  Testing GetMediaFiles
            CStorage         strg       = new CStorage();
            string           pathString = @"C:\Users\inspirionlake\Pictures";
            List <MediaFile> mediaFiles = strg.GetMediaFiles(pathString);

            foreach (MediaFile mf in mediaFiles)
            {
                Console.WriteLine(mf.ToString());
            }


            //  Testing DeleteFile
            string uselessFolder  = @"C:\Users\inspirionlake\Pictures\useless folder";
            string txtFile        = @"C:\Users\inspirionlake\Pictures\txtFile.txt";
            string unexistingFile = @"dskjlhsgj";

            strg.DeleteFile(uselessFolder);
            strg.DeleteFile(txtFile);
            strg.DeleteFile(unexistingFile);

            Console.Read();
        }
Ejemplo n.º 3
0
        public void TestStorage()
        {
            //  arrange
            CStorage strg = new CStorage();

            CreateAssertData();

            //  act
            List <MediaFile> mediaFiles       = strg.GetMediaFiles(path);
            List <MediaFile> assertMediaFiles = GetAssertData();

            //  assert
            Assert.AreEqual(assertMediaFiles, mediaFiles, "Data are not equal!");
        }