Exemple #1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null)
     {
         return(null);
     }
     return(FileSize.ConvertFileSizeUnit((long)value));
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }
            var lv = System.Convert.ToInt64(value);

            return(FileSize.ConvertFileSizeUnit(lv));
        }
Exemple #3
0
 private void CreateTaskToCopyImage(string Path, string source, string destination)
 {
     try
     {
         var fileInfo = new FileInfo(source);
         FileLength = fileInfo.Length;
         File.Copy(source, destination);
         s_logger.Debug($"Copy:{source} {FileSize.ConvertFileSizeUnit(FileLength)}");
     }
     catch (IOException e)
     {
         s_logger.Error($"Failed to copy:{Path}");
         s_logger.Debug(e);
         throw;
     }
 }
Exemple #4
0
 public void GBytes511()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(511L * 1024 * 1024 * 1024), Is.EqualTo("511 GB"));
 }
Exemple #5
0
 public void MBytes1024()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(1024 * 1024 * 1024), Is.EqualTo("1.0 GB"));
 }
Exemple #6
0
 public void MBytes512()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(512 * 1024 * 1024), Is.EqualTo("512 MB"));
 }
Exemple #7
0
 public void KBytes1023()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(1023 * 1024), Is.EqualTo("1,023 KB"));
 }
Exemple #8
0
 public void Bytes1023()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(1023), Is.EqualTo("1,023 bytes"));
 }
Exemple #9
0
 public void Bytes512()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(512), Is.EqualTo("512 bytes"));
 }
Exemple #10
0
 public void Bytes1()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(1), Is.EqualTo("1 bytes"));
 }
Exemple #11
0
 public void Bytes0()
 {
     Assert.That(FileSize.ConvertFileSizeUnit(0), Is.EqualTo("0 bytes"));
 }