当前位置: 首页 > news >正文

做招聘的h5用哪个网站免费wap网站推荐

做招聘的h5用哪个网站,免费wap网站推荐,怎么申请免费网站,企业类网站模板免费下载打包出来的热更文件,如果每次都要全部上传到CDN文件服务器,不进耗费时间长,还浪费流量。 所以让AI写了个简单的文件比较工具类,然后修改了一下可用。记录一下。 路径可自行更改。校验算法这里使用的是MD5,如果使用SH…

打包出来的热更文件,如果每次都要全部上传到CDN文件服务器,不进耗费时间长,还浪费流量。

所以让AI写了个简单的文件比较工具类,然后修改了一下可用。记录一下。

路径可自行更改。校验算法这里使用的是MD5,如果使用SHA256校验,时间会长达1分钟,MD5只有5秒左右。一般用MD5即可。同步拷贝的写法时间太长,改为异步拷贝的写法,时间减半,只需30秒和3秒。(项目的热更文件67个,总大小在700M左右)

代码如下,放到Assets/Editor/路径下即可。
 

using System;
using System.IO;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEditor;/// <summary>
/// 比较热更文件的差异 拷贝到另一个文件夹
/// </summary>
public class HotfixComparerAsync
{
#if UNITY_ANDROIDstatic string SourceFolder = Application.dataPath + "/../ServerData/Android"; // 源文件夹路径static string TargetFolder = Application.dataPath + "/../ServerData/Android_server"; // 目标文件夹路径static string OutputFolder = Application.dataPath + "/../ServerData/Android_hotfix"; // 输出文件夹路径,存放复制的文件
#endif
#if UNITY_IOSstatic string SourceFolder = Application.dataPath + "/../ServerData/iOS"; // 源文件夹路径static string TargetFolder = Application.dataPath + "/../ServerData/iOS_server"; // 目标文件夹路径static string OutputFolder = Application.dataPath + "/../ServerData/iOS_hotfix"; // 输出文件夹路径,存放复制的文件
#endif
#if UNITY_STANDALONE_WINstatic string SourceFolder = Application.dataPath + "/../ServerData/StandaloneWindows64"; // 源文件夹路径static string TargetFolder = Application.dataPath + "/../ServerData/StandaloneWindows64_server"; // 目标文件夹路径static string OutputFolder = Application.dataPath + "/../ServerData/StandaloneWindows64_hotfix"; // 输出文件夹路径,存放复制的文件
#endif[MenuItem("Tools/比较并拷贝热更文件Async")]public static void CompareAndCopyFiles(){DateTime startTime = DateTime.Now;if (!Directory.Exists(OutputFolder)){Directory.CreateDirectory(OutputFolder);}var sourceFiles = new HashSet<string>(Directory.GetFiles(SourceFolder, "*.*", SearchOption.AllDirectories));var targetFilesHashes = new Dictionary<string, string>();foreach (var file in Directory.GetFiles(TargetFolder, "*.*", SearchOption.AllDirectories)){string relativePath = MakeRelativePath(file, TargetFolder);targetFilesHashes[relativePath] = FileHash(file);}var tasks = new List<Task>();foreach (var sourceFile in sourceFiles){string relativePath = MakeRelativePath(sourceFile, SourceFolder);tasks.Add(Task.Run(() => ProcessFile(sourceFile, relativePath, targetFilesHashes)));}Task.WhenAll(tasks.ToArray()).Wait();TimeSpan diff = DateTime.Now - startTime;Debug.Log($"比较完成耗费:{diff.Minutes}分{diff.Seconds}秒");}private static void ProcessFile(string sourceFile, string relativePath, Dictionary<string, string> targetFilesHashes){if (targetFilesHashes.ContainsKey(relativePath)){string hash = FileHash(sourceFile);if (targetFilesHashes[relativePath] != hash){CopyFile(sourceFile, Path.Combine(OutputFolder, relativePath));}}else{CopyFile(sourceFile, Path.Combine(OutputFolder, relativePath));}}private static string MakeRelativePath(string path, string rootDirectory){return path.Substring(rootDirectory.Length + 1);}private static string FileHash(string file){using (var stream = File.OpenRead(file)){using (var hash = MD5.Create()){byte[] hashBytes = hash.ComputeHash(stream);return BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant();}}}private static void CopyFile(string sourceFile, string targetFile){//File.Copy(sourceFile, targetFile, true);// 获取目标文件的目录路径string targetDirectory = Path.GetDirectoryName(targetFile);// 如果目标目录不存在,则创建它if (!Directory.Exists(targetDirectory)){Directory.CreateDirectory(targetDirectory);}try{// 尝试复制文件File.Copy(sourceFile, targetFile, true);}catch (Exception e){// 处理可能的异常Debug.LogError($"Failed to copy file from {sourceFile} to {targetFile}. Error: {e.Message}");}}
}

http://www.yayakq.cn/news/335928/

相关文章:

  • 网站服务器上的跳转选择怎么做热门图片素材
  • 邯郸网站建设方案wordpress怎么发布文章带图片
  • 百度推广网站建设网站后台编辑器上传不了图片
  • 网站优化怎么做网页购买
  • wordpress蜘蛛湖南网站搜索排名优化公司
  • 聚牛网站建设公司ai生成建筑网站
  • 保证量身定制的营销型网站建筑模板的种类
  • 网站修改 iis6应用程序池商业网站是怎么做的
  • 企业网站脚本语言网站超级外链
  • 聊城制作手机网站多媒体网站开发
  • 做机械产品用什么网站行业报告
  • 有哪些网站可以做简历校园网拓扑图设计方案
  • 河北邢台官方网站保定官网seo分析
  • 优必选网站游戏网站模板免费下载
  • 企业门户网站建设报价定西市城乡建设局网站
  • 如何做php网站建设广州网站seo营销模板
  • 南通做微网站html网页代码案例
  • 网站建设 任务分配表上海万户网络技术有限公司
  • 国内设计好的网站案例wordpress cnzz
  • 百度站长平台提交网站石家庄网站建设的公司
  • 西安网站seo 优帮云东城网站制作公司
  • 网站建设相关推荐在线制作名片生成器
  • 客户关系管理360优化大师官方最新
  • 怎么评判一个网站做的好与坏销客多
  • 樟木头网站做翻译网站 知乎
  • 杭州网站排名flash企业网站
  • 红酒企业网站建设产品外观设计报价
  • 门户网站好处漯河网站建设服务公司
  • 网站搭建制作app下载平台哪个好
  • 地方门户网站建设要求阿图什网站