static void Main() { List <IStreamable> filesCollection = new List <IStreamable>(); IStreamable stream; List <Artist> artistArgs = new List <Artist> { new Artist("JJ", 34, "Male"), new Artist("FF", 23, "Female"), new Artist("KK", 12, "Kid") }; stream = new File("file1", 345, 203); filesCollection.Add(stream); stream = new Music("file1", "alabala", 1230, 1230); filesCollection.Add(stream); stream = new Video("file1", artistArgs, 3450, 2235); filesCollection.Add(stream); foreach (var file in filesCollection) { var streamProgress = new StreamProgressInfo(file); Console.WriteLine($"{streamProgress.CalculateCurrentPercent()}"); } }
static void Main() { IResult music = new Music("Michael Jackson", "Ben", "Moonwalker", 300, 250); IResult file = new File("New file", 123, 500); var fileProgress = new StreamProgressInfo(file); var musicProgress = new StreamProgressInfo(music); Console.WriteLine(fileProgress.CalculateCurrentPercent()); Console.WriteLine(musicProgress.CalculateCurrentPercent()); }
static void Main(string[] args) { File file = new File("Chalga", 40, 2); Music music = new Music("Preslava", "Da gori v lyubov", 50, 4); StreamProgressInfo fileStream = new StreamProgressInfo(file); StreamProgressInfo musicStream = new StreamProgressInfo(music); Console.WriteLine(fileStream.CalculateCurrentPercent()); Console.WriteLine(musicStream.CalculateCurrentPercent()); }