mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
TE6 打飞机Demo
TE6 打飞机Demo
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
@@ -29,7 +27,7 @@ namespace YooAsset
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return str;
|
||||
|
||||
int index = str.LastIndexOf(".");
|
||||
int index = str.LastIndexOf('.');
|
||||
if (index == -1)
|
||||
return str;
|
||||
else
|
||||
@@ -121,7 +119,7 @@ namespace YooAsset
|
||||
public static string ReadAllText(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath) == false)
|
||||
return string.Empty;
|
||||
return null;
|
||||
return File.ReadAllText(filePath, Encoding.UTF8);
|
||||
}
|
||||
|
||||
@@ -214,13 +212,21 @@ namespace YooAsset
|
||||
/// 获取文件的Hash值
|
||||
/// </summary>
|
||||
public static string FileSHA1(string filePath)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return StreamSHA1(fs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件的Hash值
|
||||
/// </summary>
|
||||
public static string FileSHA1Safely(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return StreamSHA1(fs);
|
||||
}
|
||||
return FileSHA1(filePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -266,13 +272,21 @@ namespace YooAsset
|
||||
/// 获取文件的MD5
|
||||
/// </summary>
|
||||
public static string FileMD5(string filePath)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return StreamMD5(fs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件的MD5
|
||||
/// </summary>
|
||||
public static string FileMD5Safely(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return StreamMD5(fs);
|
||||
}
|
||||
return FileMD5(filePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -316,13 +330,21 @@ namespace YooAsset
|
||||
/// 获取文件的CRC32
|
||||
/// </summary>
|
||||
public static string FileCRC32(string filePath)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return StreamCRC32(fs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件的CRC32
|
||||
/// </summary>
|
||||
public static string FileCRC32Safely(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
return StreamCRC32(fs);
|
||||
}
|
||||
return FileCRC32(filePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user