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

📄 comparefilesonline.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace PowerEasy.WebSite.Admin.Accessories
{
    using PowerEasy.Common;
    using PowerEasy.Components;
    using PowerEasy.Controls;
    using PowerEasy.Web.UI;
    using System;
    using System.Data;
    using System.Drawing;
    using System.Globalization;
    using System.IO;
    using System.Net;
    using System.Net.Sockets;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class CompareFilesOnline : AdminPage
    {
        protected Button BtnCompareTogether;
        private const string CannotReadServerFiles = "<li><span style='Color:#f00'>获取官方数据失败,可能是您的服务器不支持 XMLHTTP 组件或者是通过代理服务器访问网络。</span></li>";
        private const string FileExt = "asax|ascs|ashx|asmx|asp|aspx|axd|cdx|cer|idc|licx|rem|resources|resx|soap|stm|vsdisco|webinfo";
        protected Label LblLocalFiles;
        protected Label lblLocalNoExists;
        protected Label LblOnlyDateDiff;
        protected Label LblSame;
        protected Label LblServerFiles;
        protected Label LblServerNoExists;
        protected Label LblSizeDiff;
        protected LinkButton LbtnLocalFileName;
        protected LinkButton LbtnLocalSize;
        protected LinkButton LbtnLocalTime;
        protected LinkButton LbtnServerFileName;
        protected LinkButton LbtnServerSize;
        protected LinkButton LbtnServerTime;
        private bool m_ItemCssClass;
        private int m_LocalNotExsis;
        private int m_OnlyDateDiffNum;
        private int m_ServerNotExsis;
        private int m_SizeAndDataDiffNum;
        private int m_SizeDiffNum;
        protected HtmlGenericControl notes;
        protected Panel PnlCompareFiles;
        protected ScriptManager ScriptManager2;
        private const string ServerNoResponse = "由于官方在一段时间后没有正确答复或连接的官方主机没有反应,连接尝试失败,请稍后再试。";
        protected ExtendedSiteMapPath SmpNavigator;
        protected TableCell TableCell1;
        protected TableCell TableCell2;
        protected TableCell TableCell3;
        protected TableCell TableCell4;
        protected TableCell TableCell5;
        protected TableCell TableCell6;
        protected TableCell TableCell7;
        protected TableRow TableRow1;
        protected Table TbCompareFiles;
        protected System.Web.UI.UpdatePanel UpdatePanel2;

        protected void BtnCompareTogether_Click(object sender, EventArgs e)
        {
            this.notes.Visible = false;
            this.PnlCompareFiles.Visible = true;
            this.CompareFile(this.IsShowAll(), this.ReadLocalFileInfo().Select());
            this.LblSame.Text = this.m_SizeAndDataDiffNum.ToString();
            this.LblSizeDiff.Text = this.m_SizeDiffNum.ToString();
            this.LblOnlyDateDiff.Text = this.m_OnlyDateDiffNum.ToString();
            this.LblServerNoExists.Text = this.m_ServerNotExsis.ToString();
            this.lblLocalNoExists.Text = this.m_LocalNotExsis.ToString();
        }

        private void CompareFile(bool isShowAll, DataRow[] dataRowList)
        {
            foreach (DataRow row in dataRowList)
            {
                if (string.IsNullOrEmpty(row["ServerSize"].ToString()))
                {
                    DateTime time3 = (DateTime) row["LocalTime"];
                    this.NewRow(this.NewCell(""), this.NewCell(""), this.NewCell(""), this.NewFileCell(row["FileName"].ToString(), Color.Blue), this.NewCell(string.Format("{0:N0}", row["LocalSize"]), Color.Blue), this.NewCell(time3.ToString("yyyy-MM-dd HH:mm:ss"), Color.Blue), this.NewCell(""));
                }
                else if (string.IsNullOrEmpty(row["LocalSize"].ToString()))
                {
                    this.NewRow(this.NewFileCell(row["FileName"].ToString(), Color.Blue), this.NewCell(string.Format("{0:N0}", row["ServerSize"]), Color.Blue), this.NewCell(DataConverter.CDate(row["ServerTime"]).ToString("yyy-MM-dd HH:mm:ss"), Color.Blue), this.NewCell(""), this.NewCell(""), this.NewCell(""), this.NewCell(""));
                    this.m_LocalNotExsis++;
                }
                else
                {
                    Color color2;
                    Color color3;
                    Color color4;
                    Color color5;
                    Color color6;
                    Color gray;
                    Color color = color2 = color3 = color4 = color5 = color6 = gray = Color.Black;
                    bool flag = false;
                    string text = "=";
                    string str2 = row["FileName"].ToString();
                    long num = DataConverter.CLng(row["ServerSize"]);
                    long num2 = DataConverter.CLng(row["LocalSize"]);
                    DateTime time = DataConverter.CDate(row["ServerTime"]);
                    DateTime time2 = DataConverter.CDate(row["LocalTime"]);
                    if (num != num2)
                    {
                        text = "≠";
                        this.m_SizeDiffNum++;
                        if (time > time2)
                        {
                            color = color2 = color3 = gray = Color.Red;
                            color4 = color5 = color6 = Color.Gray;
                        }
                        else
                        {
                            color4 = color5 = color6 = gray = color = color2 = color3 = Color.Red;
                        }
                    }
                    else if (time != time2)
                    {
                        color6 = color3 = Color.Red;
                        gray = Color.Gray;
                        text = "≈";
                        this.m_OnlyDateDiffNum++;
                    }
                    else
                    {
                        text = "=";
                        this.m_SizeAndDataDiffNum++;
                        flag = true;
                    }
                    if (isShowAll || !flag)
                    {
                        this.NewRow(this.NewFileCell(str2, color), this.NewCell(num.ToString(), color2), this.NewCell(time.ToString("yyyy-MM-dd HH:mm:ss"), color3), this.NewFileCell(row["FileName"].ToString(), color4), this.NewCell(num2.ToString(), color5), this.NewCell(time2.ToString("yyyy-MM-dd HH:mm:ss"), color6), this.NewCell(text, gray));
                    }
                }
            }
        }

        private bool IsShowAll()
        {
            return (BasePage.RequestInt32("IsShowAll") == 0);
        }

        protected void LbtnSort_Click(object sender, EventArgs e)
        {
            LinkButton button = sender as LinkButton;
            if (button != null)
            {
                button.CommandArgument = (button.CommandArgument == "DESC") ? "ASC" : "DESC";
                this.CompareFile(this.IsShowAll(), this.ReadLocalFileInfo().Select("", button.CommandName + " " + button.CommandArgument));
            }
        }

        private TableCell NewCell(string text)
        {
            TableCell cell = new TableCell();
            cell.Text = text;
            return cell;
        }

        private TableCell NewCell(string text, Color color)
        {
            TableCell cell = this.NewCell(text);
            cell.ForeColor = color;
            return cell;
        }

        private TableCell NewFileCell(string text, Color color)
        {
            TableCell cell = new TableCell();
            cell.Text = "<b>\x00b7</b>" + ((text.Length > 0x19) ? (text.Substring(0, 0x19) + "...") : text);
            cell.ToolTip = text;
            cell.ForeColor = color;
            return cell;
        }

⌨️ 快捷键说明

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