Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Celsius"></param>
 /// <param name="Decimal"></param>
 /// <param name="Comma"></param>
 /// <param name="PostComma"></param>
 /// <param name="Text"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string CtoF(string Celsius, bool Decimal, bool Comma, int PostComma = 0, bool Text = true, string Error = Constants.ErrorMessage)
 {
     try
     {
         if (Celsius.Length <= Constants.VariableLength && Cores.NumberCheck(Celsius) && !Celsius.StartsWith("0") && PostComma >= Constants.PostCommaMinimum && PostComma <= Constants.PostCommaMaximum && Cores.UseCheck(Celsius))
         {
             if (Text)
             {
                 return(Cores.LastCheck2((Convert.ToDouble(Celsius) / Convert.ToInt32(Values.GetValue("Temperature", "Celsius", "Divide", Error)) * Convert.ToInt32(Values.GetValue("Temperature", "Celsius", "Multipy", Error)) + Convert.ToInt32(Values.GetValue("Temperature", "Celsius", "Add", Error))).ToString(), Decimal, Comma, PostComma, Error) + " F");
             }
             else
             {
                 return(Cores.LastCheck2((Convert.ToDouble(Celsius) / Convert.ToInt32(Values.GetValue("Temperature", "Celsius", "Divide", Error)) * Convert.ToInt32(Values.GetValue("Temperature", "Celsius", "Multipy", Error)) + Convert.ToInt32(Values.GetValue("Temperature", "Celsius", "Add", Error))).ToString(), Decimal, Comma, PostComma, Error));
             }
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "TE-CTF1!)");
     }
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Centimeter"></param>
 /// <param name="Decimal"></param>
 /// <param name="Comma"></param>
 /// <param name="PostComma"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string CMtoINCH(string Centimeter, bool Decimal, bool Comma, int PostComma = 0, string Error = Constants.ErrorMessage)
 {
     try
     {
         if (Centimeter.Length <= Constants.VariableLength && Cores.NumberCheck(Centimeter) && !Centimeter.StartsWith("0") && PostComma >= Constants.PostCommaMinimum && PostComma <= Constants.PostCommaMaximum && Cores.UseCheck(Centimeter))
         {
             if (Convert.ToInt64(Centimeter) >= 3)
             {
                 return(Cores.LastCheck2((Convert.ToInt64(Centimeter) * Convert.ToDouble(Values.GetValue("Typography", "CM", "INCH", Error))).ToString(), Decimal, Comma, PostComma, Error));
             }
             else
             {
                 return(Cores.LastCheck2("0", Decimal, Comma, PostComma, Error));
             }
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "TY-CTI1!)");
     }
 }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Pixel"></param>
 /// <param name="Decimal"></param>
 /// <param name="Comma"></param>
 /// <param name="PostComma"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string PXtoCM(string Pixel, bool Decimal, bool Comma, int PostComma = 0, string Error = Constants.ErrorMessage)
 {
     try
     {
         if (Pixel.Length <= Constants.VariableLength && Cores.NumberCheck(Pixel) && !Pixel.StartsWith("0") && PostComma >= Constants.PostCommaMinimum && PostComma <= Constants.PostCommaMaximum && Cores.UseCheck(Pixel))
         {
             if (Convert.ToInt64(Pixel) >= 38)
             {
                 return(Cores.LastCheck2((Convert.ToInt64(Pixel) * Convert.ToDouble(Values.GetValue("Typography", "PX", "CM", Error))).ToString(), Decimal, Comma, PostComma, Error));
             }
             else
             {
                 return(Cores.LastCheck2("0", Decimal, Comma, PostComma, Error));
             }
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "TY-PTC1!)");
     }
 }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Kilometers"></param>
 /// <param name="Decimal"></param>
 /// <param name="Comma"></param>
 /// <param name="PostComma"></param>
 /// <param name="Text"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string KPHtoMPH(string Kilometers, bool Decimal, bool Comma, int PostComma = 0, bool Text = true, string Error = Constants.ErrorMessage)
 {
     try
     {
         if (Kilometers.Length <= Constants.VariableLength && Cores.NumberCheck(Kilometers) && !Kilometers.StartsWith("0") && PostComma >= Constants.PostCommaMinimum && PostComma <= Constants.PostCommaMaximum && Cores.UseCheck(Kilometers))
         {
             if (Text)
             {
                 return(Cores.LastCheck2((Convert.ToDouble(Kilometers) * Convert.ToDouble(Values.GetValue("Speed", "KPH", "MPH", Error))).ToString(), Decimal, Comma, PostComma, Error) + " MPH");
             }
             else
             {
                 return(Cores.LastCheck2((Convert.ToDouble(Kilometers) * Convert.ToDouble(Values.GetValue("Speed", "KPH", "MPH", Error))).ToString(), Decimal, Comma, PostComma, Error));
             }
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "SD-KTM1!)");
     }
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ASCII"></param>
 /// <param name="Bracket"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string ASCIItoCHAR(string ASCII, char Bracket = ',', string Error = Constants.ErrorMessage)
 {
     try
     {
         if (ASCII.Length <= Constants.TextLength && Cores.UseCheck(ASCII, Bracket == ' '))
         {
             string Result = string.Empty;
             if (ASCII.Contains(Bracket.ToString()))
             {
                 string[] Letters = ASCII.Split(Bracket);
                 for (int i = 0; i < Letters.Length; i++)
                 {
                     if (Cores.NumberCheck(Letters[i], false, Enums.IntType.Int32) && Letters[i].Length >= 1 && Letters[i].Length <= 3 && Convert.ToInt32(Letters[i]) >= 0 && Convert.ToInt32(Letters[i]) <= 255)
                     {
                         Result += UTF8Encoding.UTF8.GetString(new byte[] { Convert.ToByte(Letters[i]) }); //Encoding.ASCII
                     }
                     else
                     {
                         return(Error);
                     }
                 }
             }
             else
             {
                 if (Cores.NumberCheck(ASCII, false, Enums.IntType.Int32) && ASCII.Length >= 1 && ASCII.Length <= 3 && Convert.ToInt32(ASCII) >= 0 && Convert.ToInt32(ASCII) <= 255)
                 {
                     Result = UTF8Encoding.UTF8.GetString(new byte[] { Convert.ToByte(ASCII) }); //Encoding.ASCII
                 }
                 else
                 {
                     return(Error);
                 }
             }
             return(Result);
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "US-ATC1!)");
     }
 }
Exemple #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Inch"></param>
 /// <param name="Decimal"></param>
 /// <param name="Comma"></param>
 /// <param name="PostComma"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string INCHtoPX(string Inch, bool Decimal, bool Comma, int PostComma = 0, string Error = Constants.ErrorMessage)
 {
     try
     {
         if (Inch.Length <= Constants.VariableLength && Cores.NumberCheck(Inch) && !Inch.StartsWith("0") && PostComma >= Constants.PostCommaMinimum && PostComma <= Constants.PostCommaMaximum && Cores.UseCheck(Inch))
         {
             string Result = (Convert.ToInt64(Inch) * Convert.ToDouble(Values.GetValue("Typography", "INCH", "PX", Error))).ToString();
             return(Cores.LastCheck2(Result, Decimal, Comma, PostComma, Error));
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "TY-ITP1!)");
     }
 }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Fahrenheit"></param>
 /// <param name="Decimal"></param>
 /// <param name="Comma"></param>
 /// <param name="PostComma"></param>
 /// <param name="Text"></param>
 /// <param name="Error"></param>
 /// <returns></returns>
 public static string FtoC(string Fahrenheit, bool Decimal, bool Comma, int PostComma = 0, bool Text = true, string Error = Constants.ErrorMessage)
 {
     try
     {
         if (Fahrenheit.Length <= Constants.VariableLength && Cores.NumberCheck(Fahrenheit) && !Fahrenheit.StartsWith("0") && PostComma >= Constants.PostCommaMinimum && PostComma <= Constants.PostCommaMaximum && Cores.UseCheck(Fahrenheit))
         {
             if (Convert.ToInt64(Fahrenheit) >= 32)
             {
                 if (Text)
                 {
                     return(Cores.LastCheck2(((Convert.ToDouble(Fahrenheit) - Convert.ToInt32(Values.GetValue("Temperature", "Fahrenheit", "Deduct", Error))) * Convert.ToInt32(Values.GetValue("Temperature", "Fahrenheit", "Multipy", Error)) / Convert.ToInt32(Values.GetValue("Temperature", "Fahrenheit", "Divide", Error))).ToString(), Decimal, Comma, PostComma, Error) + " C");
                 }
                 else
                 {
                     return(Cores.LastCheck2(((Convert.ToDouble(Fahrenheit) - Convert.ToInt32(Values.GetValue("Temperature", "Fahrenheit", "Deduct", Error))) * Convert.ToInt32(Values.GetValue("Temperature", "Fahrenheit", "Multipy", Error)) / Convert.ToInt32(Values.GetValue("Temperature", "Fahrenheit", "Divide", Error))).ToString(), Decimal, Comma, PostComma, Error));
                 }
             }
             else
             {
                 if (Text)
                 {
                     return(Cores.LastCheck2("0", Decimal, Comma, PostComma, Error) + " C");
                 }
                 else
                 {
                     return(Cores.LastCheck2("0", Decimal, Comma, PostComma, Error));
                 }
             }
         }
         else
         {
             return(Error);
         }
     }
     catch
     {
         return(Error + Constants.ErrorTitle + "TE-FTC1!)");
     }
 }