コード例 #1
0
        public bool Analysis()
        {
            string key    = "ABCDEFGHIJKLMNOP";
            string result = CryptoHelper.Decrypt(this.about.Remark, key);

            if (result.Length != 12)
            {
                return(false);
            }

            try
            {
                string   tempDate = result.Substring(0, 10);
                DateTime tempTime = UnixTime.ConverUnixTimeToDateTime(Convert.ToInt32(tempDate));
                string   tempDay  = result.Remove(0, 10);

                int timespan = (int)DateTime.Now.Subtract(tempTime).TotalDays;
                if (timespan > Convert.ToInt32(tempDay))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                CLog4net.LogError(e.ToString());
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: FrmMain.cs プロジェクト: radtek/EUGV2
        private void button7_Click(object sender, EventArgs e)
        {
            //double time = UnixTime.ConvertDateTimeInt(DateTime.Now);
            DateTime begin    = DateTime.Now;
            int      timeInt  = UnixTime.ConvertDateTimeToUnixTime(begin);
            DateTime dateTime = UnixTime.ConverUnixTimeToDateTime(timeInt);

            CLog4net.LogInfo(dateTime.ToShortTimeString());
        }