短视频源码php,自动查找重复贴图
时间:2022-07-25
本文章向大家介绍短视频源码php,自动查找重复贴图,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
短视频源码php的素材库中,存在各种各样的商品贴图,为了避免出现重复的情况,可以使用如下的代码进行查找:
using System.Collections;
using UnityEngine;
using UnityEditor;
using System.Security.Cryptography;
using System;
using System.IO;
using System.Collections.Generic;
public class FindRepetRes {
[MenuItem("Tools/Report/查找重复贴图")]
static void ReportTexture()
{
Dictionary<string,string> md5dic = new Dictionary<string, string> ();
string[] paths = AssetDatabase.FindAssets("t:prefab",new string[]{"Assets/Resources"});
foreach (var prefabGuid in paths) {
string prefabAssetPath = AssetDatabase.GUIDToAssetPath(prefabGuid);
string[] depend = AssetDatabase.GetDependencies (prefabAssetPath,true);
for (int i = 0; i < depend.Length; i++) {
string assetPath = depend [i];
AssetImporter importer = AssetImporter.GetAtPath(assetPath);
//满足贴图和模型资源
if (importer is TextureImporter || importer is ModelImporter) {
string md5 = GetMD5Hash(Path.Combine(Directory.GetCurrentDirectory(),assetPath));
string path;
if (!md5dic.TryGetValue (md5, out path)) {
md5dic [md5] = assetPath;
}else {
if (path != assetPath) {
Debug.LogFormat ("{0} {1} 资源发生重复!", path, assetPath);
}
}
}
}
}
}
/// <summary>
/// 获取文件Md5
/// </summary>
/// <returns>The M d5 hash.</returns>
/// <param name="filePath">File path.</param>
static string GetMD5Hash(string filePath)
{
MD5 md5 = new MD5CryptoServiceProvider();
return BitConverter.ToString(md5.ComputeHash(File.ReadAllBytes(filePath))).Replace("-", "").ToLower();
}
}
- 【2】快速代码集的由来及概览
- silverlight数据绑定模式TwoWay,OneWay,OneTime的研究
- Silverlight数据绑定/IValueConverter学习笔记
- silverlight:DeepZoom版的图片局部放大效果
- Linq之ToDictionary<TSource, TKey, TElement>的写法
- vs.net的调试小技巧之#define debug(适合新手)
- byte[]数组下标的最大值
- silverlight图片局部放大效果
- 局域网与互联网环境下MTU的快速确定方法
- 【4】通过简化的正则表达式处理字符串
- silverlight中的socket编程注意事项
- socket中的byte消息格式设计
- 在silverlight中利用socket发送图片或文件
- 多线程中的ManualResetEvent
- php概述
- php教程
- php环境搭建
- PHP书写格式
- php变量
- php常量
- PHP注释
- php数组
- php字符串 string
- PHP整型 integer
- PHP浮点型 float
- php布尔型
- php数据类型之数组
- php数据类型之对象
- php数据类型之null
- php数据类型之间的转换
- php运算符
- php表达式
- PHP循环控制
- PHP流程控制
- php函数
- php全局变量
- PHP魔术变量
- php命名空间
- php 日期
- PHP包含文件
- php文件
- PHP 文件上传
- php Cookies
- php Sessions
- php email
- php安全email
- php错误处理
- PHP异常处理
- php过滤器
- PHP 高级过滤器
- php json
- php 表单
- PHP MySQL 简介
- PHP 连接 MySQL
- php创建数据库
- php 创建表
- php mysq 插入数据
- PHP MySQL 插入多条数据
- PHP MySQL 预处理语句
- php mysql 读取数据
- php mysql where
- PHP MySQL Order By
- PHP MySQL Update
- PHP MySQL Delete
- php ODBC