Beispiel #1
0
        public void DownloadDir(  )
        {
            try
            {
                clsFTP ftp = new clsFTP(mLog);
                ftp.setFace(this);
                clsConfig config = new clsConfig();
                string[] monitorDirectory = config.GetConfigValue(clsConfig.ConfigItem.MonitorRootFolder).Split(new char[] { '\\', '\\' });
                int FtpPort = 21;

                try
                {
                    string portStr = config.GetConfigValue(clsConfig.ConfigItem.FTPServerPort);
                    FtpPort = int.Parse(portStr);
                }
                catch
                {
                    FtpPort = 21;
                }

                mLog.WriteSingleLog("Start to connect to FTP.");
                ftp.Connect(config.GetConfigValue(clsConfig.ConfigItem.FTPServerIP),
                            FtpPort,
                            config.GetConfigValue(clsConfig.ConfigItem.FTPAccount),
                            config.GetConfigValue(clsConfig.ConfigItem.FTPPassword),
                            string.Empty,
                            "DEFAULT");
                mLog.WriteSingleLog("Connect to FTP success.");

                //if exists,add additional sequence to identify
                for (int i = 0; i < monitorDirectory.Length; i++)
                {

                    if (ftp.Exists(monitorDirectory[i]))
                    {   string localFile =updateFolder ;
                        ftp.FTPDownloadDir(localFile, monitorDirectory[i]);
                        mLog.WriteSingleLog("FTP get  OK ==> " + "local file: " + localFile + " | remote file: " + monitorDirectory[i]);
                    }
                    else
                    {
                        mLog.WriteSingleLog("FTP get  faild ==>   | remote file: " + monitorDirectory[i]);
                        MessageBox.Show( "服务器上没有" + monitorDirectory[i] ,"提示" );
                        return;
                    }
                }

                ftp.Disconnect();
                setPersent(100);
                setInfo("下载完成!");
                Install();
                return;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public void getConfigFile(  )
        {
            //string updateFolder = Application.StartupPath + "\\_Update\\";
            //DirectoryInfo info1 = new DirectoryInfo(updateFolder);
            //if (!info1.Exists)
            //{
            //    info1.Create();
            //}

            try
            {
                clsFTP ftp = new clsFTP(mLog);
                clsConfig config = new clsConfig();
                string[] monitorDirectory = config.GetConfigValue(clsConfig.ConfigItem.MonitorRootFolder).Split(new char[] { '\\', '\\' });
                int FtpPort = 21;

                try
                {
                    string portStr = config.GetConfigValue(clsConfig.ConfigItem.FTPServerPort);
                    FtpPort = int.Parse(portStr);
                }
                catch
                {
                    FtpPort = 21;
                }

                mLog.WriteSingleLog(  "Start to connect to FTP.");
                ftp.Connect(config.GetConfigValue(clsConfig.ConfigItem.FTPServerIP),
                            FtpPort,
                            config.GetConfigValue(clsConfig.ConfigItem.FTPAccount),
                            config.GetConfigValue(clsConfig.ConfigItem.FTPPassword),
                            string.Empty,
                            "DEFAULT");
                mLog.WriteSingleLog(  "Connect to FTP success.");

                string remoteFileName =monitorDirectory[0] + "\\UpdateFile.xml";
                string localFile = "UpdateFile_tmp.xml";
                //if exists,add additional sequence to identify
               if (ftp.Exists(remoteFileName))
               {
                   ftp.FTPDownloadFile(localFile, remoteFileName);
                   mLog.WriteSingleLog("FTP get config file OK ==> " + "local file: " + localFile + " | remote file: " + remoteFileName);
               }
               else
               {
                   mLog.WriteSingleLog("FTP get t config file faild ==> " + "local file: " + localFile + " | remote file: " + remoteFileName);
               }

                ftp.Disconnect();

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
 public clsLog(clsConfig _config)
 {
     config = _config;
         InitLogDirectory();
 }
Beispiel #4
0
 private void InitLogDirectory()
 {
     clsConfig config = new clsConfig();
         logDirectory = config.GetConfigValue(clsConfig.ConfigItem.LogFilePath);
         if (logDirectory == string.Empty)
             logDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
         else
         {
             DirectoryInfo dirInfo = new DirectoryInfo(logDirectory);
             if (!dirInfo.Exists)
             {
                 //logDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
                 dirInfo.Create();
             }
             dirInfo = null;
         }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            strCmd      = Request.QueryString["cmd"] + "";
            strType     = Request.QueryString["type"] + "";
            strFolder   = Request.QueryString["folder"] + "";
            strFile     = Request.QueryString["file"] + "";
            strLang     = Request.QueryString["lang"] + "";  //not used right now, but grab it
            strEditor   = Request.QueryString["editor"] + "";
            strCurrPath = Request.QueryString["currpath"] + "";
            strProfile  = Request.QueryString["profile"] + "";

            // load config
            objConfig = new clsConfig(strProfile);

            //check inputs
            if (strCurrPath.Length > 0)
            {
                strCurrPath = strCurrPath.TrimEnd('\\') + "\\";
            }

            //set the apply string, based on the passed type
            if (strType == "")
            {
                strType = "0";
            }
            switch (strType)
            {
            case "1":
                strApply          = "apply_img";
                boolOnlyImage     = true;
                strAllowedFileExt = objConfig.strAllowedImageExtensions;
                break;

            case "2":
                strApply          = "apply_link";
                strAllowedFileExt = objConfig.strAllowedAllExtensions;
                break;

            default:
                if (Convert.ToInt32(strType) >= 3)
                {
                    strApply          = "apply_video";
                    boolOnlyVideo     = true;
                    strAllowedFileExt = objConfig.strAllowedVideoExtensions;
                }
                else
                {
                    strApply          = "apply";
                    strAllowedFileExt = objConfig.strAllowedAllExtensions;
                }
                break;
            }

            //setup current link
            strCurrLink = "dialog.aspx?type=" + strType + "&editor=" + strEditor + "&lang=" + strLang + "&profile=" + strProfile;

            switch (strCmd)
            {
            case "debugsettings":
                Response.Write("<style>");
                Response.Write("body {font-family: Verdana; font-size: 10pt;}");
                Response.Write(".table {display: table; border-collapse: collapse; margin: 20px; background-color: #E7F6F7;}");
                Response.Write(".tcaption {display: table-caption; padding: 5px; font-size: 14pt; font-weight: bold; background-color: #9fcff7;}");
                Response.Write(".tr {display: table-row;}");
                Response.Write(".tr:hover {background-color: #E7F6F7;}");
                Response.Write(".td {display: table-cell; padding: 5px; border: 1px solid #a19e9e;}");
                Response.Write("</style>");

                Response.Write("<div class=\"table\">");                            //start table

                Response.Write("<div class=\"tcaption\">Operating Settings</div>"); //caption

                Response.Write("<div class=\"tbody\">");                            //start body

                Response.Write("<div class=\"tr\">");                               // start row
                Response.Write("<div class=\"td\"><b>AllowCreateFolder:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.boolAllowCreateFolder + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowDeleteFile:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.boolAllowDeleteFile + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowDeleteFolder:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.boolAllowDeleteFolder + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowUploadFile:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.boolAllowUploadFile + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>MaxUploadSizeMb:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.intMaxUploadSizeMb + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowedAllExtensions:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strAllowedAllExtensions + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowedFileExtensions:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strAllowedFileExtensions + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowedImageExtensions:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strAllowedImageExtensions + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowedMiscExtensions:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strAllowedMiscExtensions + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowedMusicExtensions:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strAllowedMusicExtensions + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>AllowedVideoExtensions:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strAllowedVideoExtensions + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>BaseURL:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strBaseURL + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>DocRoot:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strDocRoot + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>ThumbPath:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strThumbPath + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>ThumbURL:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strThumbURL + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>UploadPath:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strUploadPath + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>UploadURL:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strUploadURL + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>FillSelector:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strFillSelector + "</div>");
                Response.Write("</div>");             //end row

                Response.Write("<div class=\"tr\">"); // start row
                Response.Write("<div class=\"td\"><b>PopupCloseCode:</b></div>");
                Response.Write("<div class=\"td\">" + objConfig.strPopupCloseCode + "</div>");
                Response.Write("</div>");       //end row

                Response.Write("</div>");       //end body
                Response.Write("</div>");       //end table



                Response.End();
                break;

            case "createfolder":
                try
                {
                    strFolder = Request.Form["folder"] + "";
                    //forge ahead without checking for existence
                    //catch will save us
                    Directory.CreateDirectory(objConfig.strUploadPath + "\\" + strFolder.ToLower().Replace(" ", "-"));
                    Directory.CreateDirectory(objConfig.strThumbPath + "\\" + strFolder.ToLower().Replace(" ", "-"));

                    // end response, since it's an ajax call
                    Response.End();
                }
                catch
                {
                    //TODO: write error
                }
                break;

            case "upload":
                strFolder = Request.Form["folder"] + "";
                HttpPostedFile filUpload = Request.Files["file"];
                string         strTargetFile;
                string         strThumbFile;

                //check file was submitted
                if ((filUpload != null) && (filUpload.ContentLength > 0))
                {
                    var nameFile = Util.RemoveSignInVietnameseString(filUpload.FileName);
                    strTargetFile = objConfig.strUploadPath + strFolder + nameFile;
                    strThumbFile  = objConfig.strThumbPath + strFolder + nameFile;
                    if (File.Exists(strTargetFile))
                    {
                        var chars  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                        var random = new Random();
                        var bee    = new string(
                            Enumerable.Repeat(chars, 4)
                            .Select(s => s[random.Next(s.Length)])
                            .ToArray());
                        strTargetFile = objConfig.strUploadPath + strFolder + bee + nameFile;
                        strThumbFile  = objConfig.strThumbPath + strFolder + bee + nameFile;
                    }

                    filUpload.SaveAs(strTargetFile);
                    if (isImageFile(strTargetFile))
                    {
                        createThumbnail(strTargetFile, strThumbFile);
                    }
                }

                // end response
                if (Request.Form["fback"] == "true")
                {
                    Response.Redirect(strCurrLink);
                }
                else
                {
                    Response.End();
                }

                break;

            case "download":
                FileInfo objFile = new FileInfo(objConfig.strUploadPath + "\\" + strFile);
                Response.ClearHeaders();
                Response.AddHeader("Pragma", "private");
                Response.AddHeader("Cache-control", "private, must-revalidate");
                Response.AddHeader("Content-Type", "application/octet-stream");
                Response.AddHeader("Content-Length", objFile.Length.ToString());
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(strFile));
                Response.WriteFile(objConfig.strUploadPath + "\\" + strFile);
                break;

            case "delfile":
                try
                {
                    File.Delete(objConfig.strUploadPath + "\\" + strFile);
                    if (File.Exists(objConfig.strThumbPath + "\\" + strFile))
                    {
                        File.Delete(objConfig.strThumbPath + "\\" + strFile);
                    }
                }
                catch
                {
                    //TODO: set error
                }
                goto default;

            case "delfolder":
                try
                {
                    Directory.Delete(objConfig.strUploadPath + "\\" + strFolder, true);
                    Directory.Delete(objConfig.strThumbPath + "\\" + strFolder, true);
                }
                catch
                {
                    //TODO: set error
                }
                goto default;

            default:        //just a regular page load
                if (strCurrPath != "")
                {
                    // add "up one" folder
                    objFItem                = new clsFileItem();
                    objFItem.strName        = "..";
                    objFItem.boolIsFolder   = true;
                    objFItem.boolIsFolderUp = true;
                    objFItem.intColNum      = getNextColNum();
                    objFItem.strPath        = getUpOneDir(strCurrPath);
                    objFItem.strClassType   = "dir";
                    objFItem.strDeleteLink  = "<a class=\"btn erase-button top-right disabled\" title=\"Erase\"><i class=\"icon-trash\"></i></a>";
                    objFItem.strThumbImage  = "img/ico/folder_return.png";
                    objFItem.strLink        = "<a title=\"Open\" href=\"" + strCurrLink + "&currpath=" + objFItem.strPath + "\"><img class=\"directory-img\" src=\"" + objFItem.strThumbImage + "\" alt=\"folder\" /><h3>..</h3></a>";
                    arrLinks.Add(objFItem);
                }

                //load folders
                arrFolders = Directory.GetDirectories(objConfig.strUploadPath + strCurrPath);
                foreach (string strF in arrFolders)
                {
                    objFItem              = new clsFileItem();
                    objFItem.strName      = Path.GetFileName(strF);
                    objFItem.boolIsFolder = true;
                    objFItem.intColNum    = getNextColNum();
                    objFItem.strPath      = strCurrPath + Path.GetFileName(strF);
                    objFItem.strClassType = "dir";
                    if (objConfig.boolAllowDeleteFolder)
                    {
                        objFItem.strDeleteLink = "<a href=\"" + strCurrLink + "&cmd=delfolder&folder=" + objFItem.strPath + "&currpath=" + strCurrPath + "\" class=\"btn erase-button top-right\" onclick=\"return confirm('Are you sure to delete the folder and all the objects in it?');\" title=\"Erase\"><i class=\"icon-trash\"></i></a>";
                    }
                    else
                    {
                        objFItem.strDeleteLink = "<a class=\"btn erase-button top-right disabled\" title=\"Erase\"><i class=\"icon-trash\"></i></a>";
                    }
                    objFItem.strThumbImage = "img/ico/folder.png";
                    objFItem.strLink       = "<a title=\"Open\" href=\"" + strCurrLink + "&currpath=" + objFItem.strPath + "\"><img class=\"directory-img\" src=\"" + objFItem.strThumbImage + "\" alt=\"folder\" /><h3>" + objFItem.strName + "</h3></a>";
                    arrLinks.Add(objFItem);
                }

                // load files
                arrFiles = Directory.GetFiles(objConfig.strUploadPath + strCurrPath);
                foreach (string strF in arrFiles)
                {
                    objFItem              = new clsFileItem();
                    objFItem.strName      = Path.GetFileNameWithoutExtension(strF);
                    objFItem.boolIsFolder = false;
                    objFItem.strPath      = strCurrPath + Path.GetFileName(strF);
                    objFItem.boolIsImage  = isImageFile(Path.GetFileName(strF));
                    objFItem.boolIsVideo  = isVideoFile(Path.GetFileName(strF));
                    objFItem.boolIsMusic  = isMusicFile(Path.GetFileName(strF));
                    objFItem.boolIsMisc   = isMiscFile(Path.GetFileName(strF));

                    // check to see if it's the type of file we are looking at
                    if ((boolOnlyImage && objFItem.boolIsImage) || (boolOnlyVideo && objFItem.boolIsVideo) || (!boolOnlyImage && !boolOnlyVideo))
                    {
                        objFItem.intColNum = getNextColNum();
                        // get display class type
                        if (objFItem.boolIsImage)
                        {
                            objFItem.strClassType = "2";
                        }
                        else
                        {
                            if (objFItem.boolIsMisc)
                            {
                                objFItem.strClassType = "3";
                            }
                            else
                            {
                                if (objFItem.boolIsMusic)
                                {
                                    objFItem.strClassType = "5";
                                }
                                else
                                {
                                    if (objFItem.boolIsVideo)
                                    {
                                        objFItem.strClassType = "4";
                                    }
                                    else
                                    {
                                        objFItem.strClassType = "1";
                                    }
                                }
                            }
                        }
                        // get delete link
                        if (objConfig.boolAllowDeleteFile)
                        {
                            objFItem.strDeleteLink = "<a href=\"" + strCurrLink + "&cmd=delfile&file=" + objFItem.strPath + "&currpath=" + strCurrPath + "\" class=\"btn erase-button\" onclick=\"return confirm('Are you sure to delete this file?');\" title=\"Erase\"><i class=\"icon-trash\"></i></a>";
                        }
                        else
                        {
                            objFItem.strDeleteLink = "<a class=\"btn erase-button disabled\" title=\"Erase\"><i class=\"icon-trash\"></i></a>";
                        }
                        // get thumbnail image
                        if (objFItem.boolIsImage)
                        {
                            // first check to see if thumb exists
                            if (!File.Exists(objConfig.strThumbPath + objFItem.strPath))
                            {
                                // thumb doesn't exist, create it
                                strTargetFile = objConfig.strUploadPath + objFItem.strPath;
                                strThumbFile  = objConfig.strThumbPath + objFItem.strPath;
                                createThumbnail(strTargetFile, strThumbFile);
                            }
                            objFItem.strThumbImage = objConfig.strThumbURL + "/" + objFItem.strPath.Replace('\\', '/');
                        }
                        else
                        {
                            if (File.Exists(Directory.GetParent(Request.PhysicalPath).FullName + "\\img\\ico\\" + Path.GetExtension(strF).TrimStart('.').ToUpper() + ".png"))
                            {
                                objFItem.strThumbImage = "img/ico/" + Path.GetExtension(strF).TrimStart('.').ToUpper() + ".png";
                            }
                            else
                            {
                                objFItem.strThumbImage = "img/ico/Default.png";
                            }
                        }
                        objFItem.strDownFormOpen = "<form action=\"dialog.aspx?cmd=download&file=" + objFItem.strPath + "\" method=\"post\" class=\"download-form\">";
                        if (objFItem.boolIsImage)
                        {
                            objFItem.strPreviewLink = "<a class=\"btn preview\" title=\"Preview\" data-url=\"" + objConfig.strUploadURL + "/" + objFItem.strPath.Replace('\\', '/') + "\" data-toggle=\"lightbox\" href=\"#previewLightbox\"><i class=\"icon-eye-open\"></i></a>";
                        }
                        else
                        {
                            objFItem.strPreviewLink = "<a class=\"btn preview disabled\" title=\"Preview\"><i class=\"icon-eye-open\"></i></a>";
                        }
                        objFItem.strLink = "<a class=\"abcx\" href=\"#\" title=\"Select\" onclick=\"" + strApply + "('" + objConfig.strUploadURL + "/" + objFItem.strPath.Replace('\\', '/') + "'," + strType + ")\";\"><img data-src=\"holder.js/140x100\" alt=\"140x100\" src=\"" + objFItem.strThumbImage + "\" height=\"100\"><h4>" + objFItem.strName + "</h4></a>";

                        arrLinks.Add(objFItem);
                    }
                }     // foreach

                break;
            } // switch
        }     // page load
Beispiel #6
0
        //private bool IsUseFile()
        //{
        //    bool flag1 = false;
        //    Process[] processArray1 = Process.GetProcesses();
        //    Process[] processArray2 = processArray1;
        //    for (int i = 0; i < processArray2.Length; i++)
        //    {
        //        Process process1 = processArray2[i];
        //        foreach (string appName in updateInfo.AppList)
        //        {
        //            if (process1.ProcessName.ToLower() == appName.ToLower())
        //            {
        //                return true;
        //            }
        //        }
        //    }
        //    return flag1;
        //}
        private void KillProcess()
        {
            Process[] processArray1 = Process.GetProcesses();
            Process[] processArray2 = processArray1;
            mConfig = new clsConfig();

            string App = mConfig.GetConfigValue(clsConfig.ConfigItem.Execute);
            for (int i = 0; i < processArray2.Length; i++)
            {
                Process process1 = processArray2[i];

                if (process1.ProcessName.ToLower() == App.ToLower())
                    {
                        for (int j = 0; j < process1.Threads.Count; j++)
                        {
                            process1.Threads[j].Dispose();
                        }
                        //process1.CloseMainWindow();
                        process1.Kill();
                    }

            }
        }
Beispiel #7
0
        private void Install()
        {
            this.lblUpdateInfo.Text = "正在安装更新...";
            Thread.Sleep(2000);
            this.lblUpdateInfo.Text = "开始拷贝文件...";
            Copy(updateFolder, Application.StartupPath);
            this.lblUpdateInfo.Text = "清除安装文件...";
            DeleteFolder(updateFolder);
            mConfig = new clsConfig();

            string executeFile = mConfig.GetConfigValue(clsConfig.ConfigItem.Execute);
            this.lblUpdateInfo.Text = "开始重新启动..." + Application.StartupPath + @"\" + executeFile;
            Process.Start(Application.StartupPath + @"\" + executeFile);

            Application.Exit();
        }
Beispiel #8
0
        private void ftpConfig()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                mConfig = new clsConfig();
                if (mConfig.GetConfigValue(clsConfig.ConfigItem.FTPServerIP).Trim() != string.Empty)
                {
                    mLog = InitLog();
                    mLog.WriteSingleLog("###");
                    mLog.WriteSingleLog(">>>>>>Monitor was opened at " + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "<<<<<<");
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                this.Close();
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #9
0
        private void frmAutoUpdate_Load(object sender, EventArgs e)
        {
            mConfig = new clsConfig();
            InitLog();
            ftpConfig();

            UpdateInfo info = new UpdateInfo();
            FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(info.ExecuteFile);
            string currVesion = myFileVersionInfo.FileVersion;

            if (currVesion == info.Version)
            {
                MessageBox.Show("当前已经是最新版本");
            }
            else
            {
                this.lblVersionInfo.Text = "从版本" + currVesion + "更新至版本" + info.Version;
                KillProcess();
                if (!Directory.Exists(updateFolder))
                {
                    Directory.CreateDirectory(updateFolder);
                }
                //if (updateInfo.UpdateFileList.Count > 0)
                //{
                //    DownloadFiles(updateInfo.URLAddress, updateInfo.UpdateFileList[0]);
                //    fileCount++;
                //}
                /////////////////////download dir from FTP
               // DownloadDir();
            }
        }
        public static clsConfig GetFileManagerConfig()
        {
            var fileManagerConfig = new clsConfig();

            return(fileManagerConfig);
        }