public static void AddHDD(HDD hdd) { HDDs.Add(hdd); }
public static void GetTimeToCopy(TypeDevice typeDevice, int choise, double sizeData, double[] total) { switch (typeDevice) { case TypeDevice.Flash: { Flash chFlash = Flashes[choise - 1]; Console.WriteLine("/////////////////////////////////////"); Flashes[choise - 1].StorageInfo(); Console.WriteLine(Flashes[choise - 1]); Console.WriteLine("\n/////////////////////////////////////"); Flash[] flashesD = new Flash[(int)total[choise - 1]]; TimeSpan d = new TimeSpan(); for (int i = 0; i < (int)total[choise - 1]; i++) { Flash temp = new Flash(chFlash.Memory, chFlash.TypeUSB); flashesD[i] = temp; d += flashesD[i].GetTimeToCopy(sizeData); flashesD[i].CopyData(sizeData); if (sizeData >= flashesD[i].Memory) { sizeData -= flashesD[i].Memory; } } Console.WriteLine("На копирования ушло {0} сек.", d.Seconds); } break; case TypeDevice.DVD: { DVD chDVD = DVDs[choise - 1]; Console.WriteLine("/////////////////////////////////////"); DVDs[choise - 1].StorageInfo(); Console.WriteLine(DVDs[choise - 1]); Console.WriteLine("\n/////////////////////////////////////"); DVD[] dvdsD = new DVD[(int)total[choise - 1]]; TimeSpan d = new TimeSpan(); for (int i = 0; i < (int)total[choise - 1]; i++) { DVD temp = new DVD(chDVD.TypeDVD); dvdsD[i] = temp; d += dvdsD[i].GetTimeToCopy(sizeData); dvdsD[i].CopyData(sizeData); if (sizeData >= (int)dvdsD[i].TypeDVD) { sizeData -= (int)dvdsD[i].TypeDVD; } } Console.WriteLine("На копирования ушло {0} сек.", d.Seconds); } break; case TypeDevice.HDD: { HDD chHDD = HDDs[choise - 1]; Console.WriteLine("/////////////////////////////////////"); HDDs[choise - 1].StorageInfo(); Console.WriteLine(HDDs[choise - 1]); Console.WriteLine("\n/////////////////////////////////////"); double x = chHDD.KolRazd * chHDD.ObemRazd; HDD[] hddsD = new HDD[(int)total[choise - 1]]; TimeSpan d = new TimeSpan(); for (int i = 0; i < (int)total[choise - 1]; i++) { HDD temp = new HDD(chHDD.TypeUSB, chHDD.KolRazd, chHDD.ObemRazd); hddsD[i] = temp; d += hddsD[i].GetTimeToCopy(sizeData); hddsD[i].CopyData(sizeData); if (sizeData >= hddsD[i].KolRazd * hddsD[i].ObemRazd) { sizeData -= hddsD[i].KolRazd * hddsD[i].ObemRazd; } } Console.WriteLine("На копирования ушло {0} сек.", d.Seconds); } break; default: break; } }