private void ProcessRecord(string outputRecordPath) { string recordPath = Icarus.GameFramework.Utility.Path.GetCombinePath(outputRecordPath, string.Format("{0}_{1}.xml", RecordName, ApplicableGameVersion.Replace('.', '_'))); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.AppendChild(xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", null)); XmlAttribute xmlAttribute = null; XmlElement xmlRoot = xmlDocument.CreateElement("ResourceVersionInfo"); xmlAttribute = xmlDocument.CreateAttribute("ApplicableGameVersion"); xmlAttribute.Value = ApplicableGameVersion.ToString(); xmlAttribute = xmlDocument.CreateAttribute("MinAppVersion"); xmlAttribute.Value = MinAppVersion.ToString(); xmlRoot.Attributes.SetNamedItem(xmlAttribute); xmlAttribute = xmlDocument.CreateAttribute("LatestInternalResourceVersion"); xmlAttribute.Value = InternalResourceVersion.ToString(); xmlRoot.Attributes.SetNamedItem(xmlAttribute); xmlDocument.AppendChild(xmlRoot); xmlDocument.Save(recordPath); }
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 xmlBuilder = xmlDocument.CreateElement("AssetBundleBuilder"); xmlRoot.AppendChild(xmlBuilder); XmlElement xmlSettings = xmlDocument.CreateElement("Settings"); xmlBuilder.AppendChild(xmlSettings); XmlElement xmlElement = null; xmlElement = xmlDocument.CreateElement("InternalResourceVersion"); xmlElement.InnerText = InternalResourceVersion.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("MinAppVersion"); xmlElement.InnerText = MinAppVersion.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("WindowsSelected"); xmlElement.InnerText = WindowsSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("MacOSXSelected"); xmlElement.InnerText = MacOSXSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("IOSSelected"); xmlElement.InnerText = IOSSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("AndroidSelected"); xmlElement.InnerText = AndroidSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("WindowsStoreSelected"); xmlElement.InnerText = WindowsStoreSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("RecordScatteredDependencyAssetsSelected"); xmlElement.InnerText = RecordScatteredDependencyAssetsSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("UncompressedAssetBundleSelected"); xmlElement.InnerText = UncompressedAssetBundleSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("DisableWriteTypeTreeSelected"); xmlElement.InnerText = DisableWriteTypeTreeSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("DeterministicAssetBundleSelected"); xmlElement.InnerText = DeterministicAssetBundleSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("ForceRebuildAssetBundleSelected"); xmlElement.InnerText = ForceRebuildAssetBundleSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("IgnoreTypeTreeChangesSelected"); xmlElement.InnerText = IgnoreTypeTreeChangesSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("AppendHashToAssetBundleNameSelected"); xmlElement.InnerText = AppendHashToAssetBundleNameSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("ChunkBasedCompressionSelected"); xmlElement.InnerText = ChunkBasedCompressionSelected.ToString(); xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("BuildEventHandlerTypeName"); xmlElement.InnerText = BuildEventHandlerTypeName; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("OutputDirectory"); xmlElement.InnerText = OutputDirectory; xmlSettings.AppendChild(xmlElement); xmlElement = xmlDocument.CreateElement("CopyStreamingAssets"); xmlElement.InnerText = IsCopyStreamingAssets.ToString(); xmlSettings.AppendChild(xmlElement); string configurationDirectoryName = Path.GetDirectoryName(m_ConfigurationPath); if (!Directory.Exists(configurationDirectoryName)) { Directory.CreateDirectory(configurationDirectoryName); } xmlDocument.Save(m_ConfigurationPath); AssetDatabase.Refresh(); return(true); } catch { if (File.Exists(m_ConfigurationPath)) { File.Delete(m_ConfigurationPath); } return(false); } }