No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Units.cs

Description du code

Units.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace be.gaudry.model
  6. {
  7. public static class Units
  8. {
  9. public static String[] unitsOfLength = new String[] { "octets", "Ko", "Mo", "Go", "To" };
  10. public static String[] unitsOfTime = new String[] { "milliSeconde", "seconde", "minute", "heure", "jour" };
  11. public static String getDelay(DateTime startDateTime)
  12. {
  13. TimeSpan endDateTime = (DateTime.Now - startDateTime);
  14. StringBuilder str = new StringBuilder();
  15. if (endDateTime.Days > 0) str.AppendFormat("{0} jour", endDateTime.Days);
  16. if (endDateTime.Days > 1) str.Append("s");
  17. if (endDateTime.Hours > 0) str.AppendFormat(" {0} heure", endDateTime.Hours);
  18. if (endDateTime.Hours > 1) str.Append("s");
  19. if (endDateTime.Minutes > 0) str.AppendFormat(" {0} minute", endDateTime.Minutes);
  20. if (endDateTime.Minutes > 1) str.Append("s");
  21. str.AppendFormat(" {0} seconde", endDateTime.Seconds);
  22. if (endDateTime.Seconds > 1) str.Append("s");
  23. str.AppendFormat(" {0} milliSeconde", endDateTime.Milliseconds);
  24. if (endDateTime.Milliseconds > 1) str.Append("s");
  25. return str.ToString();
  26. }
  27. /// <summary>
  28. /// Format a length in bytes to a string with the differents unitsOfLength
  29. /// </summary>
  30. /// <param name="length">(long) length in bytes</param>
  31. /// <returns></returns>
  32. public static String getLengthString(long length)
  33. {
  34. StringBuilder str = new StringBuilder();
  35.  
  36. List<long> parts = new List<long>();
  37. int i = 0;
  38. while (length >= 1)
  39. {
  40. parts.Add(length % 1024);
  41. length /= 1024;
  42. i++;
  43. }
  44. for (int j = parts.Count - 1; j >= 0; j--)
  45. {
  46. str.AppendFormat(" {0} {1}", parts[j], unitsOfLength[j]);
  47. }
  48. return str.ToString();
  49. }
  50.  
  51. }
  52. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/model/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1711705140 29/03/2024 10:39:00
| _config0 octets1541007188 31/10/2018 18:33:08
| _enums0 octets1541007189 31/10/2018 18:33:09
| _exceptions0 octets1541007189 31/10/2018 18:33:09
| _drawing0 octets1541007188 31/10/2018 18:33:08
| _win320 octets1541007190 31/10/2018 18:33:10
| _file0 octets1541007190 31/10/2018 18:33:10
| _comparators0 octets1541007188 31/10/2018 18:33:08
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/model/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csWebHelper.cs841 octets31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csHistory.cs6.96 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csValueObject.cs664 octets31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csExport.cs13.3 Ko31/10/2018 18:32:47-refusé-
Afficher le fichier .cs|.csDisposableObject.cs883 octets31/10/2018 18:32:47-refusé-
Afficher le fichier .cs|.csStat.cs3.63 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csTextHelper.cs8.11 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csUnits.cs2.07 Ko31/10/2018 18:32:48-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-broldev-source-rf-model//Units.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.