Common/AchieveCommon/DataConvert.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;

namespace AchieveCommon
{
    public class DataConvert
    {
        public static int DateTimeToUnixInt(DateTime time)
        {
            DateTime time2 = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(0x7b2, 1, 1));
            TimeSpan span = (TimeSpan)(time - time2);
            return (int)span.TotalSeconds;
        }

        public static decimal MoneyRound(decimal value, int decimals)
        {
            if (value < 0M)
            {
                return Math.Round((decimal)(value + (5M / ((decimal)Math.Pow(10.0, (double)(decimals + 1))))), decimals, MidpointRounding.AwayFromZero);
            }
            return Math.Round(value, decimals, MidpointRounding.AwayFromZero);
        }

        public static double MoneyRound(double value, int decimals)
        {
            if (value < 0.0)
            {
                return Math.Round((double)(value + (5.0 / Math.Pow(10.0, (double)(decimals + 1)))), decimals, MidpointRounding.AwayFromZero);
            }
            return Math.Round(value, decimals, MidpointRounding.AwayFromZero);
        }

        public static decimal MoneyToDecimal(string str)
        {
            try
            {
                str = str.Replace(",", "");
                return decimal.Parse(str);
            }
            catch
            {
                return 0M;
            }
        }

        public static decimal Round(decimal d, int i)
        {
            if (d >= 0M)
            {
                d += 5M * ((decimal)Math.Pow(10.0, (double)-(i + 1)));
            }
            else
            {
                d += -5M * ((decimal)Math.Pow(10.0, (double)-(i + 1)));
            }
            string str = d.ToString();
            string[] strArray = str.Split(new char[] { '.' });
            int index = str.IndexOf('.');
            string str2 = strArray[0];
            string str3 = strArray[1];
            if (str3.Length > i)
后面还有 189 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。