mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update YooAsset
Update YooAsset
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if YOO_ASSET_EXPERIMENT
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class MacroDefine
|
||||
@@ -15,3 +16,4 @@ namespace YooAsset.Editor
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Xml;
|
||||
using UnityEditor;
|
||||
|
||||
#if YOO_ASSET_EXPERIMENT
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
@@ -22,13 +23,21 @@ namespace YooAsset.Editor
|
||||
return content;
|
||||
|
||||
// 将修改后的XML结构重新输出为文本
|
||||
var stringWriter = new StringWriter();
|
||||
var writerSettings = new XmlWriterSettings();
|
||||
writerSettings.Indent = true;
|
||||
var xmlWriter = XmlWriter.Create(stringWriter, writerSettings);
|
||||
xmlDoc.WriteTo(xmlWriter);
|
||||
xmlWriter.Flush();
|
||||
return stringWriter.ToString();
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
var writerSettings = new XmlWriterSettings
|
||||
{
|
||||
Indent = true,
|
||||
Encoding = new UTF8Encoding(false), //无BOM
|
||||
OmitXmlDeclaration = false
|
||||
};
|
||||
|
||||
using (var xmlWriter = XmlWriter.Create(memoryStream, writerSettings))
|
||||
{
|
||||
xmlDoc.Save(xmlWriter);
|
||||
}
|
||||
return Encoding.UTF8.GetString(memoryStream.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -94,3 +103,4 @@ namespace YooAsset.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user