Ejemplo 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();
 }
Ejemplo 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();
 }
Ejemplo n.º 3
0
 // Token: 0x06000041 RID: 65 RVA: 0x0000600C File Offset: 0x0000420C
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
         string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
         string a        = Path.GetExtension(fileName).ToLower();
         if (a != ".zip")
         {
             this.ShowErr("对不起,该文件不是系统更新文件类型。");
             return;
         }
         if (!Directory.Exists(mapPath))
         {
             Directory.CreateDirectory(mapPath);
         }
         if (File.Exists(mapPath + "\\" + fileName))
         {
             File.Delete(mapPath + "\\" + fileName);
         }
         FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
         if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
         {
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
         }
         FPZip.UnZipFile(mapPath + "\\" + fileName, "");
         File.Delete(mapPath + "\\" + fileName);
         string mapPath2   = FPUtils.GetMapPath(this.webpath);
         string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
         sysupdate.CopyDirectory(sourcePath, mapPath2);
         Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
         base.Response.Redirect("sysupdate.aspx");
     }
     base.SaveRightURL();
 }
Ejemplo n.º 4
0
        // Token: 0x0600002A RID: 42 RVA: 0x000047AC File Offset: 0x000029AC
        protected override void View()
        {
            string mapPath = FPUtils.GetMapPath(this.webpath + "sites/" + this.m_sitepath);

            if (!File.Exists(mapPath + "\\site.config"))
            {
                this.ShowErr("该站点不存在或已被删除。");
            }
            else
            {
                this.m_siteconfig = SiteConfigs.LoadConfig(mapPath + "\\site.config");
                if (this.ispost)
                {
                    string mapPath2 = FPUtils.GetMapPath(this.webpath + "cache");
                    string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
                    string a        = Path.GetExtension(fileName).ToLower();
                    if (a != ".fpsite" && a != ".zip")
                    {
                        this.ShowErr("对不起,该文件不是方配站点更新文件类型。");
                        return;
                    }
                    if (!Directory.Exists(mapPath2))
                    {
                        Directory.CreateDirectory(mapPath2);
                    }
                    if (File.Exists(mapPath2 + "\\" + fileName))
                    {
                        File.Delete(mapPath2 + "\\" + fileName);
                    }
                    FPRequest.Files["uploadfile"].SaveAs(mapPath2 + "\\" + fileName);
                    if (Directory.Exists(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName)))
                    {
                        Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                    }
                    FPZip.UnZipFile(mapPath2 + "\\" + fileName, "");
                    File.Delete(mapPath2 + "\\" + fileName);
                    if (!File.Exists(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\site.config"))
                    {
                        Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                        this.ShowErr("站点配置文件不存在或有错误。");
                        return;
                    }
                    SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\site.config");
                    Version    v          = new Version(FPUtils.StrToDecimal(this.m_siteconfig.version).ToString("0.0"));
                    Version    v2         = new Version(FPUtils.StrToDecimal(siteConfig.version).ToString("0.0"));
                    if (v > v2)
                    {
                        this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                        return;
                    }
                    string mapPath3   = FPUtils.GetMapPath(this.webpath + "sites/" + this.siteconfig.sitepath);
                    string sourcePath = mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName);
                    siteupdate.CopyDirectory(sourcePath, mapPath3);
                    Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                    base.Response.Redirect("sitemanage.aspx");
                }
                base.SaveRightURL();
            }
        }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
 // Token: 0x06000057 RID: 87 RVA: 0x00007994 File Offset: 0x00005B94
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.appid);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("该应用不存在或已被删除。");
     }
     else
     {
         if (this.ispost)
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".fpk" && a != ".zip")
             {
                 this.ShowErr("对不起,该文件不是方配系统应用更新文件类型。");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("应用配置文件不存在或有错误。");
                 return;
             }
             AppInfo appInfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config");
             if (this.appinfo.guid == "")
             {
                 this.ShowErr("对不起,该应用标识码错误,更新失败。");
                 return;
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid);
             this.appinfo = DbHelper.ExecuteModel <AppInfo>(new SqlParam[]
             {
                 sqlParam
             });
             if (this.appinfo.id == 0)
             {
                 this.ShowErr("对不起,该应用不存在或已被删除。");
                 return;
             }
             Version v  = new Version(FPUtils.StrToDecimal(appInfo.version).ToString("0.0"));
             Version v2 = new Version(FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0"));
             if (v < v2)
             {
                 this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                 return;
             }
             this.appinfo.name    = appInfo.name;
             this.appinfo.version = appInfo.version;
             this.appinfo.notes   = appInfo.notes;
             this.appinfo.author  = appInfo.author;
             string mapPath2   = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
             this.appinfo.files = appupdate.CopyDirectory(sourcePath, mapPath2, "", this.appinfo.files);
             if (DbHelper.ExecuteUpdate <AppInfo>(this.appinfo) > 0)
             {
                 foreach (string strContent in appInfo.sortapps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] array2 = FPUtils.SplitString(strContent, ",", 4);
                     if (!(array2[0] == ""))
                     {
                         SqlParam[] sqlparams = new SqlParam[]
                         {
                             DbHelper.MakeAndWhere("appid", this.appinfo.id),
                             DbHelper.MakeAndWhere("name", array2[0])
                         };
                         SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(sqlparams);
                         if (sortAppInfo.id > 0)
                         {
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo);
                         }
                         else
                         {
                             sortAppInfo.appid     = this.appinfo.id;
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo);
                         }
                     }
                 }
             }
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             CacheBll.RemoveSortCache();
             base.Response.Redirect("appmanage.aspx");
         }
         base.SaveRightURL();
     }
 }
Ejemplo n.º 7
0
 // Token: 0x0600001E RID: 30 RVA: 0x00003758 File Offset: 0x00001958
 protected override void View()
 {
     if (this.pluname != "")
     {
         this.pluginconfig             = FPSerializer.Load <PluginConfig>(FPUtils.GetMapPath(this.webpath + "plugins/" + this.pluname + "/plugin.config"));
         this.pluginconfig.installpath = this.pluname;
     }
     if (this.ispost)
     {
         string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
         string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
         string a        = Path.GetExtension(fileName).ToLower();
         if (a != ".plu" && a != ".zip")
         {
             this.ShowErr("对不起,该文件不是方配系统插件更新文件类型。");
         }
         else
         {
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\plugin.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("插件配置文件不存在或有错误。");
             }
             else
             {
                 PluginConfig pluginConfig = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\plugin.config");
                 if (pluginConfig.guid == "")
                 {
                     this.ShowErr("对不起,该插件标识码错误,更新失败。");
                 }
                 else
                 {
                     Version v  = new Version(FPUtils.StrToDecimal(pluginConfig.version).ToString("0.0"));
                     Version v2 = new Version(FPUtils.StrToDecimal(this.pluginconfig.version).ToString("0.0"));
                     if (v < v2)
                     {
                         this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                     }
                     else
                     {
                         string mapPath2   = FPUtils.GetMapPath(this.webpath + "plugins/" + pluginConfig.installpath);
                         string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
                         pluginupdate.CopyDirectory(sourcePath, mapPath2);
                         Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                         base.Response.Redirect("pluginmanage.aspx");
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 8
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));
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
 // Token: 0x06000068 RID: 104 RVA: 0x000093E8 File Offset: 0x000075E8
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".zip" && a != ".fpsite")
             {
                 this.ShowErr("该文件不是方配站点安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config"))
             {
                 string mapPath2   = FPUtils.GetMapPath(this.webpath + "sites");
                 string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
                 siteinstall.CopyDirectory(sourcePath, mapPath2);
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 base.Response.Redirect("sitemanage.aspx");
             }
             else
             {
                 this.siteinfo = SiteConfigs.LoadConfig(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config");
             }
         }
         else if (this.step == "step2")
         {
             string text = FPRequest.GetString("installpath").ToLower();
             if (text == "")
             {
                 this.ShowErr("安装目录不能为空。");
                 return;
             }
             this.filename          = FPRequest.GetString("filename");
             this.siteinfo          = SiteConfigs.LoadConfig(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config");
             this.siteinfo.sitepath = text;
             string mapPath2    = FPUtils.GetMapPath(this.webpath + "sites/" + this.siteinfo.sitepath);
             string sourcePath2 = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             siteinstall.CopyDirectory(sourcePath2, mapPath2);
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             base.Response.Redirect("sitemanage.aspx");
         }
     }
     base.SaveRightURL();
 }
Ejemplo n.º 10
0
 // Token: 0x06000021 RID: 33 RVA: 0x00003C60 File Offset: 0x00001E60
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
         string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
         string a        = Path.GetExtension(fileName).ToLower();
         if (a != ".task")
         {
             this.ShowErr("对不起,该文件不是方配系统任务安装文件类型。");
         }
         else
         {
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\task.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("应用配置文件不存在或有错误。");
             }
             else
             {
                 TaskInfo taskInfo = FPSerializer.Load <TaskInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\task.config");
                 if (taskInfo.key == "")
                 {
                     taskInfo.key = Guid.NewGuid().ToString();
                 }
                 SqlParam sqlParam  = DbHelper.MakeAndWhere("key", taskInfo.key);
                 TaskInfo taskInfo2 = DbHelper.ExecuteModel <TaskInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 if (taskInfo2.id > 0)
                 {
                     taskInfo2.type = taskInfo.type;
                     taskInfo2.name = taskInfo.name;
                     DbHelper.ExecuteUpdate <TaskInfo>(taskInfo2);
                 }
                 else
                 {
                     DbHelper.ExecuteInsert <TaskInfo>(taskInfo);
                 }
                 DirectoryInfo directoryInfo = new DirectoryInfo(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName));
                 foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                 {
                     if (fileInfo.Extension == ".dll")
                     {
                         fileInfo.CopyTo(FPUtils.GetMapPath(WebConfig.WebPath + "bin/" + fileInfo.Name), true);
                     }
                 }
                 base.Response.Redirect("taskmanage.aspx");
             }
         }
     }
 }
Ejemplo n.º 11
0
        // Token: 0x0600027C RID: 636 RVA: 0x00008E34 File Offset: 0x00007034
        public static string RestoreDatabase(string backupfile)
        {
            string result;

            if (!File.Exists(backupfile))
            {
                result = "备份文件已不存在。";
            }
            else
            {
                DbConfigInfo dbConfig = DbConfigs.GetDbConfig();
                if (dbConfig.dbtype == FangPage.Data.DbType.SqlServer)
                {
                    SQLServer sqlserver = new SQLServerClass();
                    if (Path.GetExtension(backupfile) == ".zip" || Path.GetExtension(backupfile) == ".config")
                    {
                        FPZip.UnZipFile(backupfile, "");
                    }
                    backupfile = string.Concat(new string[]
                    {
                        Path.GetDirectoryName(backupfile),
                        "\\",
                        Path.GetFileName(backupfile),
                        "\\",
                        dbConfig.dbname,
                        ".bak"
                    });
                    if (!File.Exists(backupfile))
                    {
                        return("备份文件已不存在。");
                    }
                    try
                    {
                        sqlserver.Connect(dbConfig.dbpath, dbConfig.userid, dbConfig.password);
                        QueryResults queryResults = sqlserver.EnumProcesses(-1);
                        int          num          = -1;
                        int          num2         = -1;
                        for (int i = 1; i <= queryResults.Columns; i++)
                        {
                            string text = queryResults.get_ColumnName(i);
                            if (text.ToUpper().Trim() == "SPID")
                            {
                                num = i;
                            }
                            else if (text.ToUpper().Trim() == "DBNAME")
                            {
                                num2 = i;
                            }
                            if (num != -1 && num2 != -1)
                            {
                                break;
                            }
                        }
                        for (int i = 1; i <= queryResults.Rows; i++)
                        {
                            int    columnLong   = queryResults.GetColumnLong(i, num);
                            string columnString = queryResults.GetColumnString(i, num2);
                            if (columnString.ToUpper() == dbConfig.dbname.ToUpper())
                            {
                                sqlserver.KillProcess(columnLong);
                            }
                        }
                        ((_Restore) new RestoreClass
                        {
                            Action = SQLDMO_RESTORE_TYPE.SQLDMORestore_Database,
                            Files = backupfile,
                            Database = dbConfig.dbname,
                            ReplaceDatabase = true
                        }).SQLRestore(sqlserver);
                        File.Delete(backupfile);
                        return(string.Empty);
                    }
                    catch (Exception ex)
                    {
                        return(ex.Message);
                    }
                    finally
                    {
                        sqlserver.DisConnect();
                    }
                }
                string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + Path.GetDirectoryName(dbConfig.dbpath));
                try
                {
                    if (!Directory.Exists(mapPath))
                    {
                        Directory.CreateDirectory(mapPath);
                    }
                    if (Path.GetExtension(backupfile) == ".zip" || Path.GetExtension(backupfile) == ".config")
                    {
                        FPZip.UnZipFile(backupfile, mapPath);
                    }
                    else
                    {
                        File.Copy(backupfile, mapPath + "\\" + dbConfig.dbname);
                    }
                    result = string.Empty;
                }
                catch (Exception ex)
                {
                    result = ex.Message;
                }
            }
            return(result);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
 // Token: 0x06000025 RID: 37 RVA: 0x00004088 File Offset: 0x00002288
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".zip" && a != ".plu")
             {
                 this.ShowErr("该文件不是方配WMS系统插件安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\plugin.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 this.ShowErr("插件安装配置文件不存在。");
                 return;
             }
             this.plugininfo = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\plugin.config");
             if (this.plugininfo.guid == "")
             {
                 this.ShowErr("对不起,该插件安装标识码不能为空。");
                 return;
             }
         }
         else if (this.step == "step2")
         {
             string @string = FPRequest.GetString("installpath");
             if (@string == "")
             {
                 this.ShowErr("安装目录不能为空。");
                 return;
             }
             this.filename               = FPRequest.GetString("filename");
             this.plugininfo             = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\plugin.config");
             this.plugininfo.installpath = @string;
             string mapPath2   = FPUtils.GetMapPath(this.webpath + "plugins/" + this.plugininfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             plugininstall.CopyDirectory(sourcePath, mapPath2);
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             base.Response.Redirect("pluginmanage.aspx");
         }
     }
     base.SaveRightURL();
 }
Ejemplo n.º 14
0
 // Token: 0x06000050 RID: 80 RVA: 0x00006B80 File Offset: 0x00004D80
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".fpk" && a != ".zip")
             {
                 this.ShowErr("该文件不是方配站点应用安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\app.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 this.ShowErr("应用安装配置文件不存在。");
                 return;
             }
             this.appinfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\app.config");
             if (this.appinfo.guid == "")
             {
                 this.ShowErr("对不起,该应用安装标识码不能为空。");
                 return;
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid);
             if (DbHelper.ExecuteCount <AppInfo>(new SqlParam[]
             {
                 sqlParam
             }) > 0)
             {
                 this.ShowErr("对不起,该应用已安装,不能重复安装。");
                 return;
             }
         }
         else if (this.step == "step2")
         {
             this.filename = FPRequest.GetString("filename");
             this.appinfo  = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\app.config");
             if (this.appinfo.name == "")
             {
                 this.appinfo.name = "无应用名称";
             }
             if (FPRequest.GetString("installpath") == "")
             {
                 this.ShowErr("对不起,安装目录不能为空");
                 return;
             }
             this.appinfo.installpath = FPRequest.GetString("installpath");
             if (!Directory.Exists(FPUtils.GetMapPath(this.webpath + this.appinfo.installpath)))
             {
                 Directory.CreateDirectory(FPUtils.GetMapPath(this.webpath + this.appinfo.installpath));
             }
             string mapPath2   = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             this.appinfo.files = this.CopyDirectory(sourcePath, mapPath2, "");
             this.appinfo.id    = DbHelper.ExecuteInsert <AppInfo>(this.appinfo);
             if (this.appinfo.id > 0)
             {
                 foreach (string strContent in this.appinfo.sortapps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] array2 = FPUtils.SplitString(strContent, ",", 4);
                     if (!(array2[0] == ""))
                     {
                         DbHelper.ExecuteInsert <SortAppInfo>(new SortAppInfo
                         {
                             appid       = this.appinfo.id,
                             name        = array2[0],
                             markup      = array2[1],
                             indexpage   = array2[2],
                             viewpage    = array2[3],
                             installpath = this.appinfo.installpath
                         });
                     }
                 }
             }
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             CacheBll.RemoveSortCache();
             base.Response.Redirect("appmanage.aspx");
         }
     }
     base.SaveRightURL();
 }