X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FUtils.fs;h=9f51436dc1d93d9ce41a50e006c0a8506f5f4a1d;hb=e37e89a261df15d46d5128f18f9764d1cf81fd86;hp=810494e679ec3a01f5ee09651468d10ac9120b35;hpb=77cb62e17c3e8e7de65b8dab6769be84ca794b92;p=master-thesis.git diff --git a/Parasitemia/ParasitemiaUI/Utils.fs b/Parasitemia/ParasitemiaUI/Utils.fs index 810494e..9f51436 100644 --- a/Parasitemia/ParasitemiaUI/Utils.fs +++ b/Parasitemia/ParasitemiaUI/Utils.fs @@ -3,7 +3,6 @@ open System.IO open Newtonsoft.Json -open Newtonsoft.Json.Converters open Types @@ -62,6 +61,38 @@ let sensorSizes : SensorSize list = saveSensorSizesToFile defaultSensorSizes defaultSensorSizes +let toRomanNumber (v : int) : string = + let rec decompose (v : int) : string = + if v >= 1000 then + "M" + decompose (v - 1000) + elif v >= 900 then + "CM" + decompose (v - 900) + elif v >= 500 then + "D" + decompose (v - 500) + elif v >= 400 then + "CD" + decompose (v - 400) + elif v >= 100 then + "C" + decompose (v - 100) + elif v >= 90 then + "XC" + decompose (v - 90) + elif v >= 50 then + "L" + decompose (v - 50) + elif v >= 40 then + "XL" + decompose (v - 40) + elif v >= 10 then + "X" + decompose (v - 10) + elif v >= 9 then + "IX" + decompose (v - 9) + elif v >= 5 then + "V" + decompose (v - 5) + elif v >= 4 then + "IV" + decompose (v - 4) + elif v >= 1 then + "I" + decompose (v - 1) + else + "" + decompose v + let argsHelp = let programName = System.AppDomain.CurrentDomain.FriendlyName "Usage of Parasitemia:\n" +