public bool Save() { try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.AppendChild(xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", null)); XmlElement xmlRoot = xmlDocument.CreateElement("UnityGameFramework"); xmlDocument.AppendChild(xmlRoot); XmlElement xmlEditor = xmlDocument.CreateElement("ResourceEditor"); xmlRoot.AppendChild(xmlEditor); XmlElement xmlSettings = xmlDocument.CreateElement("Settings"); xmlEditor.AppendChild(xmlSettings); XmlElement xmlElement = null; XmlAttribute xmlAttribute = null; xmlElement = xmlDocument.CreateElement("SourceAssetRootPath"); xmlElement.InnerText = SourceAssetRootPath.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetSearchPaths"); xmlSettings.AppendChild(xmlElement); foreach (string sourceAssetSearchRelativePath in m_SourceAssetSearchRelativePaths) { XmlElement xmlElementInner = xmlDocument.CreateElement("SourceAssetSearchPath"); xmlAttribute = xmlDocument.CreateAttribute("RelativePath"); xmlAttribute.Value = sourceAssetSearchRelativePath; xmlElementInner.Attributes.SetNamedItem(xmlAttribute); xmlElement.AppendChild(xmlElementInner); } xmlElement = xmlDocument.CreateElement("SourceAssetUnionTypeFilter"); xmlElement.InnerText = SourceAssetUnionTypeFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetUnionLabelFilter"); xmlElement.InnerText = SourceAssetUnionLabelFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetExceptTypeFilter"); xmlElement.InnerText = SourceAssetExceptTypeFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetExceptLabelFilter"); xmlElement.InnerText = SourceAssetExceptLabelFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("AssetSorter"); xmlElement.InnerText = AssetSorter.ToString(); xmlSettings.AppendChild(xmlElement); string configurationDirectoryName = Path.GetDirectoryName(m_ConfigurationPath); if (!Directory.Exists(configurationDirectoryName)) { Directory.CreateDirectory(configurationDirectoryName); } xmlDocument.Save(m_ConfigurationPath); AssetDatabase.Refresh(); } catch { if (File.Exists(m_ConfigurationPath)) { File.Delete(m_ConfigurationPath); } return(false); } return(m_ResourceCollection.Save()); }
public bool Save() { string configurationName = Utility.Path.GetCombinePath(Application.dataPath, ConfigurationName); try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.AppendChild(xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", null)); XmlElement xmlRoot = xmlDocument.CreateElement("UnityGameFramework"); xmlDocument.AppendChild(xmlRoot); XmlElement xmlEditor = xmlDocument.CreateElement("AssetBundleEditor"); xmlRoot.AppendChild(xmlEditor); XmlElement xmlSettings = xmlDocument.CreateElement("Settings"); xmlEditor.AppendChild(xmlSettings); XmlElement xmlElement = null; XmlAttribute xmlAttribute = null; xmlElement = xmlDocument.CreateElement("SourceAssetRootPath"); xmlElement.InnerText = SourceAssetRootPath.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetSearchPaths"); xmlSettings.AppendChild(xmlElement); foreach (string sourceAssetSearchRelativePath in m_SourceAssetSearchRelativePaths) { XmlElement xmlElementInner = xmlDocument.CreateElement("SourceAssetSearchPath"); xmlAttribute = xmlDocument.CreateAttribute("RelativePath"); xmlAttribute.Value = sourceAssetSearchRelativePath; xmlElementInner.Attributes.SetNamedItem(xmlAttribute); xmlElement.AppendChild(xmlElementInner); } xmlElement = xmlDocument.CreateElement("SourceAssetUnionTypeFilter"); xmlElement.InnerText = SourceAssetUnionTypeFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetUnionLabelFilter"); xmlElement.InnerText = SourceAssetUnionLabelFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetExceptTypeFilter"); xmlElement.InnerText = SourceAssetExceptTypeFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("SourceAssetExceptLabelFilter"); xmlElement.InnerText = SourceAssetExceptLabelFilter ?? string.Empty; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("AssetSorter"); xmlElement.InnerText = AssetSorter.ToString(); xmlSettings.AppendChild(xmlElement); xmlDocument.Save(configurationName); } catch { File.Delete(configurationName); return(false); } return(m_AssetBundleCollection.Save()); }