mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2026-03-22 12:55:32 +07:00
add version to swf hash
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -42,7 +42,7 @@ namespace FTEditor.Postprocessors {
|
||||
}
|
||||
|
||||
static void SwfFileProcess(string swf_path) {
|
||||
var swf_hash = SwfEditorUtils.GetFileHash(swf_path);
|
||||
var swf_hash = SwfEditorUtils.GetFileHashWithVersion(swf_path);
|
||||
var swf_asset_path = Path.ChangeExtension(swf_path, ".asset");
|
||||
SwfEditorUtils.LoadOrCreateAsset<SwfAsset>(swf_asset_path, (swf_asset, created) => {
|
||||
if ( !string.IsNullOrEmpty(swf_asset.Hash) && swf_asset.Hash == swf_hash ) {
|
||||
|
||||
@@ -266,12 +266,20 @@ namespace FTEditor {
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
public static string GetFileHash(string path) {
|
||||
public static string GetFileHashWithVersion(string path) {
|
||||
return string.Format(
|
||||
"{0}={1}",
|
||||
GetFileHash(path), SwfVersion.AsString);
|
||||
}
|
||||
|
||||
static string GetFileHash(string path) {
|
||||
try {
|
||||
using ( var sha256 = SHA256.Create() ) {
|
||||
var file_bytes = File.ReadAllBytes(path);
|
||||
var hash_bytes = sha256.ComputeHash(file_bytes);
|
||||
return System.Convert.ToBase64String(hash_bytes) + file_bytes.LongLength.ToString();
|
||||
return
|
||||
System.Convert.ToBase64String(hash_bytes) +
|
||||
file_bytes.LongLength.ToString();
|
||||
}
|
||||
} catch ( System.Exception ) {
|
||||
return string.Empty;
|
||||
|
||||
15
Assets/FlashTools/Scripts/FTRuntime/SwfVersion.cs
Normal file
15
Assets/FlashTools/Scripts/FTRuntime/SwfVersion.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace FTRuntime {
|
||||
public static class SwfVersion {
|
||||
public const int Major = 1;
|
||||
public const int Minor = 3;
|
||||
public const int Revision = 8;
|
||||
|
||||
public static string AsString {
|
||||
get {
|
||||
return string.Format(
|
||||
"{0}.{1}.{2}",
|
||||
Major, Minor, Revision);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/FlashTools/Scripts/FTRuntime/SwfVersion.cs.meta
Normal file
12
Assets/FlashTools/Scripts/FTRuntime/SwfVersion.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9326b7a46761449f7bbb3d857cffacec
|
||||
timeCreated: 1495899500
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -58,7 +58,7 @@ https://gist.github.com/talecrafter/111ea3345911bd238f4998b4d5a04bf3
|
||||
**** DONE Добавить возможность брать bounds у клипа
|
||||
**** DONE Не реимпортить на каждый чих анимацию, хранить хэш
|
||||
dipyalov: фишка в том, что swf обновился, но и собранные ассеты-то тоже обновились
|
||||
**** TODO Добавить версию в хэш анимаций, дабы они конвертились при смене версии плагина
|
||||
**** DONE Добавить версию в хэш анимаций, дабы они конвертились при смене версии плагина
|
||||
**** TODO Добавить ворнинг на некорректные твины (с шейпами и группами)
|
||||
**** TODO Группы без шейпов не нужно растеризировать
|
||||
**** DONE Элемент может быть залокан (element.locked)
|
||||
|
||||
Reference in New Issue
Block a user