Esempio n. 1
0
 // Token: 0x06000048 RID: 72 RVA: 0x00006580 File Offset: 0x00004780
 protected override void View()
 {
     if (this.ispost)
     {
         if (this.action == "delete")
         {
             string @string = FPRequest.GetString("chkid");
             DbHelper.ExecuteDelete <TaskInfo>(@string);
             TaskManager.Reset();
         }
         else if (this.action == "download")
         {
             int      @int     = FPRequest.GetInt("tid");
             TaskInfo taskInfo = DbHelper.ExecuteModel <TaskInfo>(@int);
             string   text     = FPUtils.SplitString(taskInfo.type, ",", 2)[1];
             if (text == "")
             {
                 this.ShowErr("任务类型不正确。");
                 return;
             }
             if (!File.Exists(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll")))
             {
                 this.ShowErr("任务类库DLL不存在或已被删除。");
                 return;
             }
             using (FPZip fpzip = new FPZip())
             {
                 if (File.Exists(FPUtils.GetMapPath(this.webpath + "cache/task.config")))
                 {
                     File.Delete(FPUtils.GetMapPath(this.webpath + "cache/task.config"));
                 }
                 FPSerializer.Save <TaskInfo>(taskInfo, FPUtils.GetMapPath(this.webpath + "cache/task.config"));
                 fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "cache/task.config"), "");
                 fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll"), "");
                 fpzip.ZipDown(FPUtils.UrlEncode(taskInfo.name + ".task"));
             }
         }
         else if (this.action == "run")
         {
             int      @int     = FPRequest.GetInt("tid");
             TaskInfo taskInfo = DbHelper.ExecuteModel <TaskInfo>(@int);
             if (taskInfo.id == 0)
             {
                 this.ShowErr("对不起,该任务不存在或已被删除。");
                 return;
             }
             try
             {
                 TaskManager.Execute(taskInfo);
             }
             catch (Exception ex)
             {
                 this.ShowErr("执行计划任务失败:" + ex.Message);
                 return;
             }
         }
     }
     this.tasklist = DbHelper.ExecuteList <TaskInfo>(OrderBy.ASC);
     base.SaveRightURL();
 }
Esempio n. 2
0
 // Token: 0x06000028 RID: 40 RVA: 0x000045F0 File Offset: 0x000027F0
 protected override void View()
 {
     if (this.ispost)
     {
         string @string = FPRequest.GetString("pluname");
         if (this.action == "delete")
         {
             if (@string != "" && Directory.Exists(FPUtils.GetMapPath(this.webpath + "plugins/" + @string)))
             {
                 Directory.Delete(FPUtils.GetMapPath(this.webpath + "plugins/" + @string), true);
             }
         }
         else if (this.action == "download")
         {
             using (FPZip fpzip = new FPZip())
             {
                 DirectoryInfo directoryInfo = new DirectoryInfo(FPUtils.GetMapPath(this.webpath + "plugins/" + @string));
                 foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                 {
                     fpzip.AddDirectory(directoryInfo2.FullName);
                 }
                 foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                 {
                     fpzip.AddFile(fileInfo.FullName, "");
                 }
                 fpzip.ZipDown(FPUtils.UrlEncode(@string + ".plu"));
             }
         }
     }
     this.pluginlist = PluginBll.GetPluginList();
     base.SaveRightURL();
 }
Esempio n. 3
0
 // Token: 0x0600006B RID: 107 RVA: 0x00009964 File Offset: 0x00007B64
 protected override void View()
 {
     if (this.ispost)
     {
         if (this.action == "delete")
         {
             string @string = FPRequest.GetString("chkdel");
             foreach (string text in @string.Split(new char[]
             {
                 ','
             }))
             {
                 if (text != "" && Directory.Exists(FPUtils.GetMapPath(this.webpath + "sites/" + text)))
                 {
                     Directory.Delete(FPUtils.GetMapPath(this.webpath + "sites/" + text), true);
                 }
             }
         }
         else if (this.action == "create")
         {
             string string2 = FPRequest.GetString("sitepath");
             string message = "";
             if (!SiteBll.CreateSite(string2, out message))
             {
                 this.ShowErr(message);
                 return;
             }
             base.AddMsg("站点编译成功!");
         }
         else if (this.action == "download")
         {
             string     string3  = FPRequest.GetString("sitepath");
             SiteConfig siteInfo = SiteConfigs.GetSiteInfo(string3);
             string     str      = ((siteInfo.name != "") ? siteInfo.name : siteInfo.sitepath) + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".fpsite";
             using (FPZip fpzip = new FPZip())
             {
                 DirectoryInfo directoryInfo = new DirectoryInfo(FPUtils.GetMapPath(this.webpath + "sites/" + string3));
                 foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                 {
                     fpzip.AddDirectory(directoryInfo2.FullName);
                 }
                 foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                 {
                     fpzip.AddFile(fileInfo.FullName, "");
                 }
                 fpzip.ZipDown(FPUtils.UrlEncode(str));
             }
         }
     }
     this.sitelist = SiteBll.GetSiteList();
     base.SaveRightURL();
 }
Esempio n. 4
0
 // Token: 0x0600000D RID: 13 RVA: 0x000029C8 File Offset: 0x00000BC8
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("对不起,该应用已被删除或不存在。");
     }
     else
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
         if (this.ispost)
         {
             string @string = FPRequest.GetString("setpath");
             if (@string == "")
             {
                 this.ShowErr("对不起,应用默认安装目录名称不能为空。");
             }
             else
             {
                 string pattern = "^[a-zA-Z0-9_\\w]+$";
                 if (this.err == 0 && !Regex.IsMatch(@string.Trim(), pattern, RegexOptions.IgnoreCase))
                 {
                     base.AddErr("默认安装目录名称只能由数字、字母或下划线组成。");
                 }
                 this.appinfo.setpath = @string;
                 DbHelper.ExecuteUpdate <AppInfo>(this.appinfo);
                 FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
                 string str = this.appinfo.name + ".fpk";
                 if (this.appinfo.files != "")
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         foreach (string text in FPUtils.SplitString(this.appinfo.files))
                         {
                             if (text.StartsWith("bin/"))
                             {
                                 fpzip.AddFile(FPUtils.GetMapPath(WebConfig.WebPath + text), text);
                             }
                             else
                             {
                                 fpzip.AddFile(mapPath + "/" + text, text);
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
                 else
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                         foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                         {
                             fpzip.AddDirectory(directoryInfo2.FullName);
                         }
                         foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                         {
                             if (fileInfo.Name != "site.config")
                             {
                                 fpzip.AddFile(fileInfo.FullName, "");
                             }
                         }
                         string mapPath2 = FPUtils.GetMapPath(this.webpath + "sites/" + this.appinfo.installpath + "/site.config");
                         if (File.Exists(mapPath2))
                         {
                             SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2);
                             if (siteConfig.inherits != "")
                             {
                                 if (siteConfig.inherits.EndsWith(".Controller"))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll"), "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll");
                                 }
                                 else
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits + ".dll"), "bin/" + siteConfig.inherits + ".dll");
                                 }
                             }
                             if (siteConfig.import != "")
                             {
                                 foreach (string text in siteConfig.import.Split(new string[]
                                 {
                                     "\r\n",
                                     ";",
                                     ",",
                                     "|"
                                 }, StringSplitOptions.RemoveEmptyEntries))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll"), "bin/" + text + ".dll");
                                 }
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
             }
         }
     }
 }
Esempio n. 5
0
        // Token: 0x0600027B RID: 635 RVA: 0x00008AA4 File Offset: 0x00006CA4
        public static string BackUpDatabase()
        {
            string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "backup/datas");

            if (!Directory.Exists(mapPath))
            {
                Directory.CreateDirectory(mapPath);
            }
            DbConfigInfo dbConfig = DbConfigs.GetDbConfig();
            string       str      = dbConfig.dbname + "_" + DateTime.Now.ToString("yyyyMMddHHmmss");

            if (dbConfig.dbtype == FangPage.Data.DbType.SqlServer)
            {
                SQLServer sqlserver = new SQLServerClass();
                sqlserver.Connect(dbConfig.dbpath, dbConfig.userid, dbConfig.password);
                try
                {
                    if (File.Exists(mapPath + "\\" + dbConfig.dbname + ".bak"))
                    {
                        File.Delete(mapPath + "\\" + dbConfig.dbname + ".bak");
                    }
                    ((_Backup) new BackupClass
                    {
                        Action = SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database,
                        Initialize = true,
                        Files = mapPath + "\\" + dbConfig.dbname + ".bak",
                        Database = dbConfig.dbname
                    }).SQLBackup(sqlserver);
                    if (File.Exists(mapPath + "\\" + str + ".config"))
                    {
                        using (FPZip fpzip = new FPZip())
                        {
                            fpzip.AddFile(mapPath + "\\" + dbConfig.dbname + ".bak", dbConfig.dbname + ".bak");
                            fpzip.ZipSave(mapPath + "\\" + str + ".config");
                        }
                        File.Delete(mapPath + "\\" + dbConfig.dbname + ".bak");
                    }
                    return(string.Empty);
                }
                catch (Exception ex)
                {
                    string text = ex.Message.Replace("'", " ");
                    text = text.Replace("\n", " ");
                    return(text.Replace("\\", "/"));
                }
                finally
                {
                    sqlserver.DisConnect();
                }
            }
            string result;

            try
            {
                if (File.Exists(mapPath + "\\" + str + ".config"))
                {
                    File.Delete(mapPath + "\\" + str + ".zip");
                    using (FPZip fpzip = new FPZip())
                    {
                        fpzip.AddFile(WebConfig.WebPath + dbConfig.dbpath, dbConfig.dbpath);
                        fpzip.ZipSave(mapPath + "\\" + str + ".config");
                    }
                }
                result = string.Empty;
            }
            catch (Exception ex)
            {
                string text = ex.Message.Replace("'", " ");
                text   = text.Replace("\n", " ");
                text   = text.Replace("\\", "/");
                result = text;
            }
            return(result);
        }