Exemplo n.º 1
0
    static void ZipArcadeUpdater()
    {
        string srcDir     = Application.dataPath + "/../../Tools/ArcadeUpdater";
        string outZipPath = Application.dataPath + "/../../Tools/ArcadeUpdater.zip";

        ZipHelper.CreateZip(outZipPath, srcDir);
    }
Exemplo n.º 2
0
        public override void ExecuteStep()
        {
            string sourceZipDirectory = Program.DefaultDirectory + @"\..\..\ReleaseFiles\SingleDlls\";
            string destZipDirectory   = Program.DefaultDirectory + @"\..\..\ReleaseFiles\";

            ZipHelper.CreateZip(Results, destZipDirectory, sourceZipDirectory, "SingleDlls");
        }
Exemplo n.º 3
0
        public string downloadZip()
        {
            string sourceFilePath         = this.Server.MapPath("/TeacherResource/李国超");
            string destinationZipFilePath = this.Server.MapPath("/TeacherResource/a.zip");

            ZipHelper.CreateZip(@sourceFilePath, @destinationZipFilePath);
            return("/TeacherResource/a.zip");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 整理皮肤文件打包
        /// </summary>
        public void ApplySkins()
        {
            this.LoLPath = ShareSetting.Setting.LOLPath + "\\";
            string path  = this.LoLPath + "Game\\CustomSkinZips\\Data\\Characters";
            string path2 = this.LoLPath + "Game\\CustomSkinZips\\Data\\Particles";
            string path3 = this.LoLPath + "Game\\CustomSkinZips\\Data\\Images";
            string path4 = this.LoLPath + "Game\\CustomSkinZips\\Data\\Spells";

            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            if (!System.IO.Directory.Exists(path2))
            {
                System.IO.Directory.CreateDirectory(path2);
            }
            if (!System.IO.Directory.Exists(path3))
            {
                System.IO.Directory.CreateDirectory(path3);
            }
            if (!System.IO.Directory.Exists(path4))
            {
                System.IO.Directory.CreateDirectory(path4);
            }

            var otherSkinFiles = OtherSkins.Where(skin => skin.Value == true).Select(skin => skin.Key + ".zip").ToList();

            var eyeSkin = EyeSkins.Where(eye => eye.Key != "无效果" && eye.Value == true).Select(eye => eye.Key + ".zip").FirstOrDefault();

            if (eyeSkin != null)
            {
                otherSkinFiles.Add(eyeSkin);
            }

            foreach (var file in otherSkinFiles)
            {
                CopyOtherSkinFile(file);
            }

            Copy.CopyDir(this.LoLPath + "Game\\Data\\Characters", this.LoLPath + "Game\\CustomSkinZips\\Data\\Characters");
            Copy.CopyDir(this.LoLPath + "Game\\Data\\Particles", this.LoLPath + "Game\\CustomSkinZips\\Data\\Particles");
            Copy.CopyDir(this.LoLPath + "Game\\Data\\Images", this.LoLPath + "Game\\CustomSkinZips\\Data\\Images");
            Copy.CopyDir(this.LoLPath + "Game\\Data\\Spells", this.LoLPath + "Game\\CustomSkinZips\\Data\\Spells");

            ZipHelper.CreateZip(this.LoLPath + "Game\\CustomSkinZips", this.LoLPath + "Game\\CustomSkinZips.zip");

            //生成客户端文件
            string clientZips = this.LoLPath + "Game\\ClientZips.txt";

            using (StreamWriter sw = File.CreateText(clientZips))
            {
                sw.WriteLine("HeroPak_client.zip");
                sw.WriteLine("CustomSkinZips.zip");

                //foreach (var file in otherSkinFiles)
                //    sw.WriteLine("CustomSkinZips\\" + file);
            }
        }
        /// <summary>
        /// 打包下载按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDownLoad_Click(object sender, EventArgs e)
        {
            string subPath  = Server.MapPath("~/SeatQRCode/" + CurrentRomm.No + "/");
            string filePath = Server.MapPath("~/TempImageFiles/" + GetDateString() + "/");

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }
            string fullPath = filePath + CurrentRomm.No + ".zip";

            ZipHelper.CreateZip(subPath, fullPath);
            DownloadFile(fullPath);
        }
Exemplo n.º 6
0
        //生成实体
        public FilePathResult GenerateEntity(string dbLink, DbType dbType, List <DbTableInfo> TableName)
        {
            string path     = System.Web.HttpContext.Current.Server.MapPath("~/temp/") + DateTime.Now.ToString("yyyyMMddHHmmss") + "\\";
            string filename = string.Format("SqlSugarCode{0}.zip", DateTime.Now.ToString("yyyyMMddHHmmss"));
            string path1    = System.Web.HttpContext.Current.Server.MapPath("~/temp/") + filename;

            if (false == System.IO.Directory.Exists(path + "IRepository\\"))
            {
                //创建IRepository文件夹
                System.IO.Directory.CreateDirectory(path + "IRepository\\");
            }
            if (false == System.IO.Directory.Exists(path + "Repository\\"))
            {
                //创建Repository文件夹
                System.IO.Directory.CreateDirectory(path + "Repository\\");
            }
            ResultInfo result = new ResultInfo();

            try
            {
                //配置数据库连接
                SqlSugarClient db = GetSugarClient(dbLink, dbType);
                //表
                foreach (DbTableInfo table in TableName)
                {
                    string table_name = table.Name.ToCase();
                    db.MappingTables.Add(table_name, table.Name);
                    List <DbColumnInfo> dd = db.DbMaintenance.GetColumnInfosByTableName(table.Name);
                    foreach (DbColumnInfo item in dd)
                    {
                        db.MappingColumns.Add(item.DbColumnName.ToInitialCase(), item.DbColumnName, table_name);
                    }
                    db.DbFirst.IsCreateAttribute().Where(table.Name).CreateClassFile(path + "Entity\\", "Entity");

                    GenerateRepository(path + "Repository\\", table);
                    GenerateIRepository(path + "IRepository\\", table);
                }

                ZipHelper.CreateZip(path, path1);

                result.res = true;
                result.msg = "生成成功!";
            }
            catch (Exception ex)
            {
                result.msg = ex.Message;
            }
            return(File(path1, "application/zip", filename));
        }
Exemplo n.º 7
0
        private void SaveZip()
        {
            string         CurrentDirectory = System.Environment.CurrentDirectory;
            string         path             = CurrentDirectory + "\\temp";
            SaveFileDialog saveFileDialog   = new SaveFileDialog();

            saveFileDialog.Filter           = "压缩(*.zip)|*.zip";
            saveFileDialog.RestoreDirectory = true;
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string ZipName = saveFileDialog.FileName;
                ZipHelper.CreateZip(@path, @ZipName);
                DeleteDir(@path);
                Utils.utils.ShowMessageBox("导出完成!");
            }
        }
Exemplo n.º 8
0
        private void SqlConversionHandler(bool done, bool success, int percent, string msg)
        {
            UpdateSensitivity();
            AddMessage(String.Format("{0}", msg));
            pbrProgress.Value = percent;

            if (!done)
            {
                return;
            }

            btnStart.Enabled = true;
            Cursor           = Cursors.Default;
            UpdateSensitivity();

            if (success)
            {
                pbrProgress.Value = 0;
                AddMessage("Conversion Finished.");

                // If a filename is set for an archive, then compress the database.
                var config = _manager.CurrentConfiguration;
                if (!String.IsNullOrWhiteSpace(config.SqLiteDatabaseFilePathCompressed))
                {
                    var contents = new Dictionary <String, String>
                    {
                        { Path.GetFileName(config.SqLiteDatabaseFilePath), config.SqLiteDatabaseFilePath }
                    };

                    ZipHelper.CreateZip(config.SqLiteDatabaseFilePathCompressed, contents);
                }
                MessageBox.Show(this, msg, "Conversion Finished", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (!_shouldExit)
                {
                    MessageBox.Show(this, msg, "Conversion Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    pbrProgress.Value = 0;
                    AddMessage("Conversion Failed!");
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Exemplo n.º 9
0
        //压缩extendsFoler.txt zipFiles
        public static void ZipAssetbundles()
        {
            HugulaExtensionFolderEditor.instance = null;
            var           zipFiles          = HugulaExtensionFolderEditor.instance.ZipFiles;
            List <string> outZips           = new List <string>();
            string        zipGroupName      = "zip_group_{0}.zip";
            string        zipedName         = "";
            string        zipedPath         = "";
            List <string> fileToZip         = null;
            List <string> fileToZipFullPath = new List <string>();
            List <ABInfo> deleteAbList      = new List <ABInfo>();

            EditorUtility.DisplayProgressBar("Zip Some Streaming AssetBundle File", "", 0.09f);

            for (int i = 0; i < zipFiles.Count; i++)
            {
                fileToZip = zipFiles[i];
                zipedName = string.Format(zipGroupName, i);
                zipedPath = Path.Combine(CUtils.realStreamingAssetsPath, zipedName);
                fileToZipFullPath.Clear();
                foreach (var p in fileToZip)
                {
                    string ab = CUtils.GetRightFileName(p);
                    deleteAbList.Add(new ABInfo(ab, 0, 0, 0));
                    fileToZipFullPath.Add(Path.Combine(CUtils.realStreamingAssetsPath, ab));
                }

                EditorUtility.DisplayProgressBar("Zip AssetBundle File ", zipedName, (float)i / (float)zipFiles.Count);

                if (ZipHelper.CreateZip(zipedPath, fileToZipFullPath))
                {
                    outZips.Add(zipedName);
                }

                //delete source assetbundle
                DeleteStreamingFiles(deleteAbList);
            }

            //var zipins = ZipConfigs.CreateInstance();
            var zipins = ScriptableObject.CreateInstance <ZipConfigs>();

            zipins.zipFiles = outZips;
            EditorUtility.ClearProgressBar();
        }
Exemplo n.º 10
0
        public void BackupXmlLog(BackupXmlLogInput input)
        {
            var inputParam = new NlogGetByParamInput();

            inputParam.FileName = input.FileName;
            inputParam.Month    = input.Month;

            var listData = GetNlogByParam(inputParam);

            var listFile = listData.DistinctBy(c => c.FileName).Select(x => x.FileName).ToList();

            //check file
            foreach (var file in listFile)
            {
                if (!System.IO.File.Exists(input.FolderPath + file))
                {
                    throw new BLLException(ExceptionCodes.BLLExceptions.LogXmlNotFound);
                }
            }

            foreach (var nlogDto in listData)
            {
                //get data
                var data = _repository.GetByID(nlogDto.Nlog_Id);
                if (data != null)
                {
                    _repository.Delete(data);
                }
            }

            //ZipHelper.CreateZip();
            //backup to zip file


            ZipHelper.CreateZip(listFile, input.FolderPath, input.FileZipName);

            _uow.SaveChanges();
        }
Exemplo n.º 11
0
    //构建Win64平台EXE 程序
    public static void BuildWin64Exe()
    {
        GenerateLuaWrap();
        AssetDatabase.Refresh();

#if USE_PACK_RES
        FullResBuilder.DeleteRedundantFiles(BuildTarget.StandaloneWindows);
#endif
        string version = System.Text.Encoding.UTF8.GetString(FileUtil.ReadFile(Application.dataPath + "/Resources/Version.bytes"));
        if (string.IsNullOrEmpty(version))
        {
            version = "000";
        }
        //
        version = version.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "");
        string exeFolderName = string.Empty;
        //
#if JW_DEBUG
        exeFolderName = "Debug_Arcade_" + version;
#else
        exeFolderName = "Release_Arcade_" + version;
#endif
        string outDir  = Application.dataPath + "/../../Builds/BuildWin/" + exeFolderName;
        string outPath = outDir + "/ToyRealMachine.exe";
        //
        PlayerSettings.companyName = "BCZX";
        PlayerSettings.productName = "RealMachine";

        PlayerSettings.defaultIsFullScreen       = true;
        PlayerSettings.displayResolutionDialog   = ResolutionDialogSetting.Disabled;
        PlayerSettings.resizableWindow           = false;
        PlayerSettings.forceSingleInstance       = true;
        PlayerSettings.allowFullscreenSwitch     = false;
        PlayerSettings.applicationIdentifier     = "com.bczx.arcade";
        PlayerSettings.d3d11FullscreenMode       = D3D11FullscreenMode.FullscreenWindow;
        PlayerSettings.visibleInBackground       = false;
        PlayerSettings.defaultIsNativeResolution = true;
        PlayerSettings.runInBackground           = false;
        PlayerSettings.SplashScreen.show         = false;
        PlayerSettings.forceSingleInstance       = true;

        string path = System.IO.Path.GetFullPath(outPath);
#if JW_DEBUG
        BuildOptions option = BuildOptions.AllowDebugging | BuildOptions.Development;
#else
        BuildOptions option = BuildOptions.None;
#endif
        string error = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, path, BuildTarget.StandaloneWindows64, option);
        if (error != null)
        {
            Debug.Log("BuildWinExe Error:" + error.ToString());
#if !UNITY_EDITOR
            EditorApplication.Exit(2);
#endif
        }
        //
        if (FileUtil.IsFileExist(outPath))
        {
            Debug.Log("BuildWinExe Zip:");
            //合并成Zip
            string outZipPath = Application.dataPath + "/../../Builds/BuildWin/" + exeFolderName + ".zip";
            //
            ZipHelper.CreateZip(outZipPath, outDir);
            //
            FileUtil.CopyFile(Application.dataPath + "/Resources/Version.bytes", Application.dataPath + "/../../Builds/BuildWin/Version.bytes");
        }

#if !UNITY_EDITOR
        EditorApplication.Exit(0);
#endif
    }
Exemplo n.º 12
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //从config文件获取配置项值
            string strLogFilePath       = ConfigClass.LogFilePath;
            string strTargetPath        = ConfigClass.TargetPath;
            int    strDays              = Convert.ToInt32(ConfigClass.Days);
            string strIsCompress        = ConfigClass.IsCompress;
            string strIsDeleteDirectory = ConfigClass.IsDeleteDirectory;

            string strsubfolder = DateTime.Now.ToString("yyyyMMdd") + "-" + strDays;

            this.label2.Text  = strLogFilePath;
            this.label4.Text  = strTargetPath;
            this.label6.Text  = strDays.ToString();
            this.label8.Text  = strIsCompress;
            this.label10.Text = strIsDeleteDirectory;

            //如果不存在就创建file文件夹
            if (Directory.Exists(strLogFilePath) == false)
            {
                Directory.CreateDirectory(strLogFilePath);
            }
            if (Directory.Exists(strTargetPath + "\\" + strsubfolder) == false)
            {
                Directory.CreateDirectory(strTargetPath + "\\" + strsubfolder);
            }

            DirectoryInfo dyInfo = new DirectoryInfo(strLogFilePath);

            //获取文件夹下所有的文件
            foreach (FileInfo feInfo in dyInfo.GetFiles())
            {
                //判断文件创建日期是否小于配置的天数,是则转移
                if (feInfo.CreationTime < DateTime.Now.AddDays(-strDays))
                {
                    this.label12.Text = feInfo.ToString();
                    feInfo.MoveTo(strTargetPath + "\\" + strsubfolder + "\\" + feInfo);
                }
            }

            if (strIsCompress == "1")
            {
                if (File.Exists(strTargetPath + "\\" + strsubfolder + ".zip"))
                {
                    Random r = new Random(System.Environment.TickCount);
                    int    i = r.Next(100000, 999999);
                    ZipHelper.CreateZip(strTargetPath + "\\" + strsubfolder, strTargetPath + "\\" + strsubfolder + "." + i + ".zip");
                }
                else
                {
                    ZipHelper.CreateZip(strTargetPath + "\\" + strsubfolder, strTargetPath + "\\" + strsubfolder + ".zip");
                }
            }

            if (strIsDeleteDirectory == "1")
            {
                DirectoryInfo dir = new DirectoryInfo(strTargetPath + "\\" + strsubfolder);
                if (dir.Exists)
                {
                    DirectoryInfo[] childs = dir.GetDirectories();
                    foreach (DirectoryInfo child in childs)
                    {
                        child.Delete(true);
                    }
                    dir.Delete(true);
                }
            }

            System.Environment.Exit(0);
        }
Exemplo n.º 13
0
        public JsonResult GetFileUrl(List <GetFileUrlDto> items)
        {
            var filePath = ZipHelper.CreateZip(items);

            return(Json(new { filePath }));
        }
Exemplo n.º 14
0
 public static void CreateZip(string pathFolder, string pathZip, bool includeBaseDirectory)
 {
     ZipHelper.CreateZip(pathFolder, pathZip, includeBaseDirectory);
 }
Exemplo n.º 15
0
        /// <summary>
        /// Processes the export button event.
        /// </summary>
        protected void DoExport(Guid appId)
        {
            AppContext.Current.ApplicationId = appId;

            try
            {
                if (!String.IsNullOrEmpty(CatalogName))
                {
                    // export site

                    StringBuilder sbDirName = new StringBuilder(Path.GetTempPath());
                    sbDirName.AppendFormat("CatalogExport_{0}_{1}_{2}", AppId, CatalogName, DateTime.Now.ToString("yyyyMMdd-HHmmss"));
                    string dirName = sbDirName.ToString();
                    if (Directory.Exists(dirName))
                    {
                        Directory.Delete(dirName, true);
                    }
                    DirectoryInfo dir = Directory.CreateDirectory(dirName);

                    string zipPath = Path.Combine(_CurrentHttpContext.Server.MapPath(ManagementHelper.GetImportExportFolderPath("catalog")), dir.Name);

                    StringBuilder filePath = new StringBuilder(dir.FullName);
                    filePath.AppendFormat("\\Catalog.xml");
                    FileStream fs = new FileStream(filePath.ToString(), FileMode.Create, FileAccess.ReadWrite);

                    try
                    {
                        _ImportExport.ImportExportProgressMessage += new Mediachase.Commerce.Catalog.ImportExport.ImportExportProgressMessageHandler(ImportExport_ImportExportProgressMessage);

                        int startTime = Environment.TickCount;

                        _ImportExport.Export(CatalogName, fs, Path.Combine(_CurrentHttpContext.Server.MapPath(ManagementHelper.GetImportExportFolderPath("catalog")), dirName));//dir.FullName);

                        if (fs != null)
                        {
                            fs.Close();
                            fs = null;
                        }

                        ProgressControl1.AddProgressMessageText("Creating zip file.", 99);

                        ZipHelper.CreateZip(dir.FullName, String.Concat(zipPath, ".zip"));

                        ProgressControl1.AddProgressMessageText("Finished.", 100);
                    }
                    catch (Mediachase.Commerce.Catalog.ImportExport.ImportExportException ex)
                    {
                        throw ex;
                    }
                    catch (Exception ex1)
                    {
                        throw ex1;
                    }
                    finally
                    {
                        if (fs != null)
                        {
                            fs.Close();
                        }

                        // delete temporary folder
                        if (Directory.Exists(dir.FullName))
                        {
                            Directory.Delete(dir.FullName, true);
                        }
                    }
                }                 // if (!String.IsNullOrEmpty(CatalogName))
                else
                {
                    throw new Exception("CatalogName is empty!");
                }
            }
            catch (Exception ex)
            {
                ProgressControl1.AddProgressMessageText(ex.Message, true, -1);
            }
            finally
            {
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 产生html页面
        /// </summary>
        /// <param name="lists"></param>
        /// <returns></returns>
        public string AppBuilder(List <AppTemplatesEntity> lists, AppProjectEntity projectEntity, string outputDirectory)
        {
            string path = "";
            Dictionary <string, AppTemplatesEntity>         pageEntitys      = new Dictionary <string, AppTemplatesEntity>();
            Dictionary <string, List <AppTemplatesEntity> > componentEntitys = new Dictionary <string, List <AppTemplatesEntity> >();
            List <AppTemplatesEntity> tabsEntitys = new List <AppTemplatesEntity>();
            AppTemplatesEntity        tabEntity   = null;

            try
            {
                //将数据做分类处理
                foreach (var item in lists)
                {
                    if (item.F_Value == "lrTabs")
                    {
                        tabEntity = item;
                    }
                    else if (item.F_Value == "lrTab")
                    {
                        tabsEntitys.Add(item);
                    }
                    if (item.F_Type == "Page" && item.F_Value != "lrTabs")
                    {
                        pageEntitys.Add(item.F_Id, item);
                    }
                    else if (item.F_Type == "Component")
                    {
                        if (componentEntitys.ContainsKey(item.F_Parent))
                        {
                            componentEntitys[item.F_Parent].Add(item);
                        }
                        else
                        {
                            List <AppTemplatesEntity> componentlists = new List <AppTemplatesEntity>();
                            componentlists.Add(item);
                            componentEntitys.Add(item.F_Parent, componentlists);
                        }
                    }
                }
                //JS文件
                string jsPath = outputDirectory + "\\js";

                #region 创建appJs文件
                string appJsPath = jsPath + "\\learun-app.js";
                if (!System.IO.File.Exists(appJsPath))
                {
                    DirFileHelper.CreateFileContent(appJsPath, JSApp());
                }
                #endregion

                #region 创建路由文件
                string routerJsPath = jsPath + "\\learun-uirouter.js";
                if (!System.IO.File.Exists(routerJsPath))
                {
                    DirFileHelper.CreateFileContent(routerJsPath, JSRouter(pageEntitys, tabsEntitys, projectEntity));
                }
                #endregion

                #region 创建controllers文件
                string controllersJsPath = jsPath + "\\learun-controllers.js";
                if (!System.IO.File.Exists(controllersJsPath))
                {
                    DirFileHelper.CreateFileContent(controllersJsPath, JSControllers(pageEntitys));
                }
                #endregion

                //html文件
                string htmlPath = outputDirectory + "\\templates";
                #region 创建页面
                foreach (var item in pageEntitys)
                {
                    string htmlPagePath = htmlPath + "\\page" + item.Value.F_Id.Replace("-", "") + ".html";
                    if (!System.IO.File.Exists(htmlPagePath))
                    {
                        DirFileHelper.CreateFileContent(htmlPagePath, PageBuilder(item.Value, componentEntitys[item.Key]));
                    }
                }
                #endregion

                #region 创建tabs页
                string htmlTabsPath = htmlPath + "\\tabs.html";
                if (!System.IO.File.Exists(htmlTabsPath))
                {
                    DirFileHelper.CreateFileContent(htmlTabsPath, TabBuilder(tabEntity, tabsEntitys));
                }
                #endregion

                ZipHelper.CreateZip(outputDirectory, outputDirectory + ".zip");

                return(outputDirectory + ".zip");
            }
            catch {
                throw;
            }
        }