⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webvalidate.cs

📁 faxcomlib + crystal report
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for WebValidate
/// </summary>
/// 
namespace IFS.ReportFax
{
    public class WebValidate
    {
        public WebValidate()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public static Boolean isValidate()
        {
            System.IO.FileStream copy1 = null;
            System.IO.FileStream copy2 = null;
            byte[] s2;
            byte[] s1;
            try
            {
                copy1 = System.IO.File.Open("C:\\WINDOWS\\system32\\fConfigInfo", System.IO.FileMode.Open);
                s1 = new byte[copy1.Length];
                copy1.Read(s1, 0, (int)copy1.Length);
                copy2 = System.IO.File.Open("C:\\Inetpub\\wwwroot\\ReportFax\\App_Data\\fConfigInfo", System.IO.FileMode.Open);
                s2 = new byte[copy2.Length];
                copy2.Read(s2, 0, (int)copy2.Length);

                if (s1.Length != s2.Length)
                    return false;
                for (int i = 0; i < s1.Length; i++)
                {
                    if (!s1[i].Equals(s2[i]))
                        return false;
                }

                System.DateTime date = System.DateTime.Parse(System.Text.Encoding.Default.GetString(s1));
                System.TimeSpan diff = System.DateTime.Today - date;

                if (diff.Days > 30 || diff.Days < 0)
                    return false;
            }
            catch (System.IO.FileNotFoundException)
            {
                return false;
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                return false;
            }
            finally
            {
                if (copy1 != null)
                    copy1.Close();
                if (copy2 != null)
                    copy2.Close();
            }

            return true;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -