最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

自動更新作用

 更新時間:2006年10月08日 00:00:00   作者:  
復(fù)制代碼 代碼如下:

function CLASS_AUTOUPDATE(instanceName,win)
{
    this.instanceName    = instanceName;
    this.updating        = false;
    this.error            = false;
    this.updateInfo        = "";
    this.nextVersion    = "";
    this.ver            = "";
    this.win            = win;
    this.updatePath        = "";
    this.updateFileName = "";
    this.softName        = "";
    this.refresh();

}
CLASS_AUTOUPDATE.prototype.onafterupdate = function()
{

    var _window                = this.win;
    var tempMessageWidth    = 360;
    var tempMessageHeight    = 160;
    var tempMessageLeft        = (document.body.clientWidth - tempMessageWidth) /2;
    var tempMessageTop        = (document.body.clientHeight - tempMessageHeight) /2;
    var feature = {
        title:"更新完畢",
        width:tempMessageWidth,
        height:tempMessageHeight,
        left:tempMessageLeft,
        top:tempMessageTop,
        borderColor:"#8B89A1",
        backgroundColor:"#FFFFFF",
        color:"#000000",
        titleBackgroundColor:"#8B89A1",
        titleColor:"#FFFFFF",
        dragable:true
    };

    var THIS = this;

    var tempMessageContent    = [];

    //tempMessageContent[tempMessageContent.length] = "<div style='font-size:12px;padding:5px'>";
    tempMessageContent[tempMessageContent.length] = this.updateInfo;
    //tempMessageContent[tempMessageContent.length] = "<br/><br/>";
    tempMessageContent[tempMessageContent.length] = "<div align=center><span class='bt'><input type='button' value=' OK ' class='bt' id='bt_update_ok'></span></div>";
    tempMessageContent[tempMessageContent.length] = "</div>";

    _window.open("updateOk",feature);
    _window.write("updateOk",tempMessageContent.join(""),false);

    _window.items["updateOk"].all("bt_update_ok").onclick = function()
                                                            {                                                                
                                                                _window.close("updateOk");                                                                
                                                            }
    _window.items["updateOk"].onunload =    function()
                                            {                                                
                                                if(THIS.error==false&&THIS.updateFileList.length>0)
                                                {
                                                    document.location.reload();
                                                }
                                            }

}
CLASS_AUTOUPDATE.prototype.check = function()
{
    var _current_version,_new_version,_exist_new_ver;


    //檢查配置文件
    var configXML = new CLASS_XML("xml\\autoupdate.xml");
    if(configXML.error==false)
    {
        var _update_date,_autoupdate_day,_current_version;

        var _save_or_not;

        var _d  = new Date();
        var _dd = _d.getFullYear() + "-" + (_d.getMonth()+1) + "-" + _d.getDate();

        //檢查是否有更新時間段設(shè)置
        if(configXML.selectSingleNode("/Config/UpdateDate")==null)
        {
            configXML.setText("/Config","UpdateDate", _dd);

            _update_date = _dd;
            _save_or_not = true;
        }
        else
        {
            _update_date = configXML.getText("/Config","UpdateDate", "1900-01-01");
        }

        if(configXML.selectSingleNode("/Config/AutoUpdateDay")==null)
        {
            configXML.setText("/Config","AutoUpdateDay", "10");

            _autoupdate_day = "10";
            _save_or_not = true;
        }
        else
        {
            _autoupdate_day = configXML.getText("/Config","AutoUpdateDay", "10");
        }
        _autoupdate_day = _autoupdate_day *1;

        if(configXML.selectSingleNode("/Config/CurrentVersion")==null)
        {
            configXML.setText("/Config","CurrentVersion", "0.32");

            _current_version = "0.32";
            _save_or_not = true;
        }
        else
        {
            _current_version = configXML.getText("/Config","CurrentVersion", "0.32");
        }
        _current_version = _current_version * 1;


        //判斷是否今天去連接服務(wù)器
        var _od = new Date(_update_date.replace(/-/g, "\/"));
        if(_d.getTime()-_od.getTime()>_autoupdate_day*24*3600*1000)
        {

            var newDoc        = new CLASS_XML();
                newDoc.loadRemoteFile(this.updatePath + this.softName + "/" + this.updateFileName);            

            if(newDoc.selectSingleNode("/Config/CurrentVersion")==null)
            {
                newDoc.setText("/Config","CurrentVersion", "0.32");
                _new_version = "0.32";
            }
            else
            {
                _new_version = newDoc.getText("/Config","CurrentVersion", "0.32");
            }
            _new_version = _new_version * 1;

            //檢查是否有新版本
            if(_new_version>_current_version)
            {
                _exist_new_ver = true;
            }

            configXML.setText("/Config","UpdateDate",_dd);
            _save_or_not = true;
        }

        if(_save_or_not)
        {
            configXML.save();
        }

    }

    if(_exist_new_ver)
    {
        var _window                = this.win;
        var tempMessageWidth    = 260;
        var tempMessageHeight    = 120;
        var tempMessageLeft        = (document.body.clientWidth - tempMessageWidth) /2;
        var tempMessageTop        = (document.body.clientHeight - tempMessageHeight) /2;
        var feature = {
            title:"升級",
            width:tempMessageWidth,
            height:tempMessageHeight,
            left:tempMessageLeft,
            top:tempMessageTop,
            borderColor:"#8B89A1",
            backgroundColor:"#FFFFFF",
            color:"#000000",
            titleBackgroundColor:"#8B89A1",
            titleColor:"#FFFFFF",
            dragable:true
        };

        var THIS = this;

        var tempMessageContent    = [];

        //tempMessageContent[tempMessageContent.length] = "<div style='font-size:12px;padding:5px'>";
        tempMessageContent[tempMessageContent.length] = "<table width='100%' height='60' cellPadding='10'><tr><td valign='top'>有新版本,是否更新?<!--insert//--></td></tr></table>";
        //tempMessageContent[tempMessageContent.length] = "<br/><br/>";
        tempMessageContent[tempMessageContent.length] = "<div align=center><span class='bt'><input type='button' value=' Yes ' class='bt' id='bt_update_yes'></span>&nbsp;&nbsp;<span class='bt'><input type='button' value=' No ' class='bt' id='bt_update_no'></span></div>";
        tempMessageContent[tempMessageContent.length] = "</div>";

        _window.open("update_or_not",feature);
        _window.write("update_or_not",tempMessageContent.join(""),false);

        THIS.ver = _current_version;

        _window.items["update_or_not"].all("bt_update_yes").onclick = function()
                                                                {        
                                                                    THIS.ver = _new_version;
                                                                    _window.close("update_or_not");

                                                                    THIS.update();
                                                                }
        _window.items["update_or_not"].all("bt_update_no").onclick = function()
                                                                {        
                                                                    _window.close("update_or_not");
                                                                }
        _window.items["update_or_not"].onunload =    function()
                                                {                                                

                                                }

    }


}

CLASS_AUTOUPDATE.prototype.update = function()
{

    this.updating    = !this.updating;

    var t            = new Date();
    var THIS        = this;

    if(this.error == false)
    {

    //得到新配置文檔
    var newDoc        = new CLASS_XML();
        newDoc.loadRemoteFile(this.updatePath + this.softName + "/" + this.updateFileName);

        this.error = newDoc.error;

        if(this.error)
        {
            THIS.updating    = false;
            THIS.updateInfo    = "<table width='100%' height='100' cellPadding='10'><tr><td valign='top'>連接服務(wù)器失敗<!--insert//--></td></tr></table>";
        }
        else
        {
            var updateFileNodes = newDoc.selectNodes("http://SystemFile");
            var updateInfoNode    = newDoc.selectSingleNode("http://UpdateInfo");
            var nextVersion        = newDoc.selectSingleNode("http://nextversion");

            if(updateInfoNode != null)
            {
                THIS.updateInfo = updateInfoNode.childNodes[0].text;
            }

            if(nextVersion != null)
            {
                THIS.nextVersion = nextVersion.childNodes[0].text;
            }

            THIS.updateFileList = [];            

            for(var i=0;i<updateFileNodes.length;i++)
            {
                var curUpdateFileName        = updateFileNodes[i].getAttribute("name").toLowerCase();
                var curUpdateFileVersion    = updateFileNodes[i].getAttribute("version").toLowerCase();
                var curUpdateFilePath        = updateFileNodes[i].getAttribute("path").toLowerCase();

                if(THIS.systemFiles[curUpdateFileName] == null || THIS.systemFiles[curUpdateFileName] != curUpdateFileVersion)
                {                                    
                    //本地沒有該文件或者版本號不一致
                    THIS.updateFileList[THIS.updateFileList.length] = 
                    {
                        name    :curUpdateFileName,
                        version    :curUpdateFileVersion,
                        path    :curUpdateFilePath,
                        type    :"text"
                    };
                }
            }

            newDoc.dispose();


            if(THIS.updateFileList.length == 0)
            {
                THIS.updating    = false;
                THIS.updateInfo    = "<table width='100%' height='100' cellPadding='10'><tr><td valign='top'>沒有需要更新的文件<!--insert//--></td></tr></table>";
            }
            else
            {
                var configXML    = new CLASS_XML("xml\\autoupdate.xml");
                //添加更新信息
                if(configXML.error==false&&THIS.updateInfo.length>0)
                {
                    var _updateInfo    = configXML.createElement("UpdateInfo");
                    var _cdata        = configXML.createCDATASection(THIS.updateInfo);

                    _updateInfo        .appendChild(_cdata);
                    configXML.root().appendChild(_updateInfo);

                    //添加下版本預(yù)告
                    var _nextVersion = configXML.selectSingleNode("http://nextversion");
                    if( _nextVersion==null)
                    {
                        var __next = configXML.createElement("nextversion");
                        var __cdata= configXML.createCDATASection(THIS.nextVersion);

                        __next.appendChild(__cdata);

                        configXML.root().appendChild(__next);
                    }
                    else
                    {
                        if(_nextVersion.childNodes.length==0)
                        {
                            _nextVersion.appendChild(configXML.createCDATASection(""));
                        }
                        _nextVersion.childNodes[0].text = THIS.nextVersion;
                    }

                    configXML.setText("/Config","CurrentVersion",THIS.ver);

                    configXML.save();
                }
                configXML.dispose();

                THIS.updateFile();
            }
        }            
    }
    else
    {
        this.updateInfo = "<table width='100%' height='100' cellPadding='10'><tr><td valign='top'>加載配置文件失??!<!--insert//--></td></tr></table>";
    }
    this.updating = false;
    this.onafterupdate();

}

CLASS_AUTOUPDATE.prototype.updateFile = function(curUpdateId)
{

    var t        = new Date();
    var THIS    = this;

    for(var i= 0;i<this.updateFileList.length;i++)
    {
        var curUpdateFile = this.updateFileList[i];

        if(curUpdateFile.type == "base64")
        {
            var url = this.updatePath  + this.softName + "/base64.aspx?src=" + curUpdateFile.name + "&t=" + t.valueOf();
        }
        else if(curUpdateFile.type == "text")
        {
            var url = this.updatePath + this.softName + "/" + curUpdateFile.path + "/" + curUpdateFile.name;
        }

        //下載文件
        var errors     = this.downloadFile(url,curUpdateFile.path,curUpdateFile.name);

        if(this.error==false)
        {
            //記錄當(dāng)前版本信息                    
            var configXML    = new CLASS_XML("xml\\autoupdate.xml");
            if(configXML.error==false)
            {
                var systemFiles = configXML.selectSingleNode("http://SystemFiles");
                if(systemFiles    == null)
                {
                    systemFiles = configXML.createElement("SystemFiles");
                    configXML.selectSingleNode("/Config").appendChild(systemFiles);
                }

                var systemFile    = configXML.selectSingleNode("http://SystemFiles/SystemFile[@name='" + curUpdateFile.name.toLowerCase() + "']");

                if(systemFile    == null)
                {
                    systemFile    = configXML.createElement("SystemFile");
                    systemFile.setAttribute("name",curUpdateFile.name.toLowerCase());
                    systemFile.setAttribute("path",curUpdateFile.path.toLowerCase());
                    configXML.selectSingleNode("http://SystemFiles").appendChild(systemFile);
                }
                systemFile.setAttribute("version",curUpdateFile.version);

                configXML.save();
                configXML.dispose();

                this.error         = false;
                this.updateInfo += errors + "\n";
            }
            else
            {
                this.updateInfo += "<table width='100%' height='100' cellPadding='10'><tr><td valign='top'>加載配置文件出錯!<!--insert//--></td></tr></table>";
            }
        }
    }

}

CLASS_AUTOUPDATE.prototype.downloadFile = function(url,path,filename)
{
    try
    {
        var xmlHTTP    =    new ActiveXObject("Microsoft.XMLHTTP");

            xmlHTTP.open("Get",url,false);
            xmlHTTP.send();

        if(xmlHTTP.readyState==4&&xmlHTTP.status==200)
        {
            var adodbStream = new ActiveXObject("ADODB" + "." + "Stream");

            //判斷目錄是否存在,不存在則創(chuàng)建
            this.buildPath(path);

            var strLocalURL = path.length>0?path + "\\" +filename:filename;

            //1=adTypeBinary
            adodbStream.Type= 1;        
            adodbStream.Open();
            adodbStream.write(xmlHTTP.responseBody);
            adodbStream.SaveToFile(strLocalURL,2);
            adodbStream.Close();

            adodbStream        = null;
            xmlHTTP            = null;
        }
        else
        {
            this.error        = true;
            return    filename + "下載失敗";
        }

        return "";
    }
    catch(e)
    {
        this.error        = true;
        return    e.description;
    }
}
CLASS_AUTOUPDATE.prototype.refresh = function()
{
    var configXML = new CLASS_XML("xml\\autoupdate.xml");
    if(configXML.error==false)
    {
        var _softName        = configXML.selectSingleNode ("/Config/SoftName");
        var _updatePath        = configXML.selectSingleNode ("/Config/UpdatePath");
        var _updateFileName    = configXML.selectSingleNode ("/Config/UpdateFileName");

        this.updatePath        = _updatePath     !=null?_updatePath.text    :"http://dooit.3322.org/";
        this.softName        = _softName         !=null?_softName.text        :"cc";
        this.updateFileName = _updateFileName!=null?_updateFileName.text:"autoupdate.xml";

        this.systemFiles = {};
        var tempSystemFileNodes = configXML.selectNodes("/Config/SystemFiles/SystemFile");
        for(var i=0;i<tempSystemFileNodes.length;i++)
        {
            this.systemFiles[tempSystemFileNodes[i].getAttribute("name")] = tempSystemFileNodes[i].getAttribute("version");
        }
    }
    else
    {
        this.error = true;
    }
    configXML.dispose();    
}
CLASS_AUTOUPDATE.prototype.buildPath = function(path)
{
    var _baseUrl    = unescape(document.location.href.substring(document.location.href.lastIndexOf("/")+1,-1)).replace(/^file\:\/\/\//i,"").replace(/\//g,"\\");
    var _path        = path.replace(/^\s*|\s*$/g,"");
    var _fullPath    = "";

    //得到全路徑
    if(/^\w\:\\/.test(_path) == false){
        _fullPath = _baseUrl + _path;
    }else{
        _fullPath = _path;
    }

    var p    = _fullPath.split(/\\|\//g);
    var fso = new ActiveXObject("Scripting.FileSystemObject");

    var t    = "";

    for(var i=0;i<p.length;i++){
        t += p[i] + "\\";

        try
        {
            if(!fso.FolderExists(t))
            {
                fso.CreateFolder(t);
            }
        }
        catch(e)
        {
            return false;
        }
    }

    return true;
}

相關(guān)文章

  • Javascript Event(事件)的傳播與冒泡

    Javascript Event(事件)的傳播與冒泡

    本文主要介紹了Event(事件)的傳播與冒泡。具有很好的參考價值,下面跟著小編一起來看下吧
    2017-01-01
  • 多種方式實現(xiàn)JS調(diào)用后臺方法進行數(shù)據(jù)交互

    多種方式實現(xiàn)JS調(diào)用后臺方法進行數(shù)據(jù)交互

    幾種典型常用的方法如利用控件的AutopostBack屬性、Button提交表單等等,下面為大家分享下JS調(diào)用后臺方法進行數(shù)據(jù)交互示例
    2013-08-08
  • js實現(xiàn)可旋轉(zhuǎn)的立方體模型

    js實現(xiàn)可旋轉(zhuǎn)的立方體模型

    這里給大家分享的是通過js腳本來控制頁面中的正方體轉(zhuǎn)動特效,用戶可以點擊按鈕向右轉(zhuǎn)動,也可以向下轉(zhuǎn)動,結(jié)合自己的需求控制即可。效果非常棒,這里推薦給大家
    2016-10-10
  • JavaScript生成隨機驗證碼代碼實例

    JavaScript生成隨機驗證碼代碼實例

    這篇文章主要介紹了JavaScript生成隨機驗證碼代碼實例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2019-09-09
  • 微信小程序如何加載數(shù)據(jù)庫真實數(shù)據(jù)的實現(xiàn)

    微信小程序如何加載數(shù)據(jù)庫真實數(shù)據(jù)的實現(xiàn)

    這篇文章主要介紹了微信小程序如何加載數(shù)據(jù)庫真實數(shù)據(jù)的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-03-03
  • [js高手之路]單例模式實現(xiàn)模態(tài)框的示例

    [js高手之路]單例模式實現(xiàn)模態(tài)框的示例

    下面小編就為大家?guī)硪黄猍js高手之路]單例模式實現(xiàn)模態(tài)框的示例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-09-09
  • javascript變量作用域使用中常見錯誤總結(jié)

    javascript變量作用域使用中常見錯誤總結(jié)

    剛看了一篇文章對js作用域的理解又會上升到一個新的臺階,javascript里變量作用域是個經(jīng)常讓人頭痛抓狂的問題,接下來對經(jīng)常遇到又容易出錯的情況進行了簡單總結(jié),感興趣的各位可以參考下哈
    2013-03-03
  • javascript跨域請求包裝函數(shù)與用法示例

    javascript跨域請求包裝函數(shù)與用法示例

    這篇文章主要介紹了javascript跨域請求包裝函數(shù)與用法,結(jié)合實例形式分析了javascript基于ajax的跨域請求封裝函數(shù)與相關(guān)使用技巧,需要的朋友可以參考下
    2016-11-11
  • 使用JS location實現(xiàn)搜索框歷史記錄功能

    使用JS location實現(xiàn)搜索框歷史記錄功能

    這篇文章主要介紹了使用JS location實現(xiàn)搜索框歷史記錄功能,本文通過實例 代碼講解的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-12-12
  • js錨點、操作滾動條滑動scroll代碼演示

    js錨點、操作滾動條滑動scroll代碼演示

    滑動錨點挺有意思的,可增加一些瀏覽性,下面這篇文章主要給大家介紹了關(guān)于js錨點、操作滾動條滑動scroll的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-03-03

最新評論

沁阳市| 彭泽县| 修文县| 色达县| 济阳县| 澄江县| 仙桃市| 林甸县| 临桂县| 东乌| 岚皋县| 湘乡市| 安庆市| 八宿县| 德化县| 安丘市| 鱼台县| 沙坪坝区| 五指山市| 屏东县| 石林| 桃园市| 富川| 玉龙| 黔西县| 镇沅| 清新县| 瑞丽市| 澄城县| 延川县| 德庆县| 苍南县| 白城市| 洪洞县| 揭西县| 华池县| 商南县| 汾西县| 化州市| 盐城市| 大关县|