Пример #1
0
 /// <summary>
 ///     Imports layouts from another layout collection.
 /// </summary>
 /// <param name="other">The collection to import layouts from.</param>
 public void Import(StructureLayoutCollection other)
 {
     foreach (var layout in other._layouts)
     {
         AddLayout(layout.Key, layout.Value);
     }
 }
Пример #2
0
 /// <summary>
 ///     Adds a collection of layouts to the collection.
 /// </summary>
 /// <param name="layouts">The layouts to add.</param>
 public void AddLayouts(StructureLayoutCollection layouts)
 {
     foreach (var layout in layouts._layouts)
     {
         AddLayout(layout.Key, layout.Value);
     }
 }
Пример #3
0
 public BuildInformation(string game, string localeKey, string stringidKey, IStringIDResolver stringIDResolver, string filenameKey, int headerSize, bool loadStrings, StructureLayoutCollection layouts, string shortName, string pluginFolder, string scriptDefsFile, int segmentAlignment)
 {
     _gameName = game;
     if (localeKey != null)
         _localeKey = new AESKey(localeKey);
     if (stringidKey != null)
         _stringidKey = new AESKey(stringidKey);
     _stringIDResolver = stringIDResolver;
     if (filenameKey != null)
         _filenameKey = new AESKey(filenameKey);
     _headerSize = headerSize;
     _loadStrings = loadStrings;
     _layouts = layouts;
     _shortName = shortName;
     _pluginFolder = pluginFolder;
     _scriptDefsFile = scriptDefsFile;
     _segmentAlignment = segmentAlignment;
 }
Пример #4
0
        /// <summary>
        /// Loads all of the structure layouts defined in an XML document.
        /// </summary>
        /// <param name="layoutDocument">The XML document to load structure layouts from.</param>
        /// <returns>The layouts that were loaded.</returns>
        public static StructureLayoutCollection LoadLayouts(XDocument layoutDocument)
        {
            // Make sure there is a root <layouts> tag
            XContainer layoutContainer = layoutDocument.Element("layouts");
            if (layoutContainer == null)
                throw new ArgumentException("Invalid layout document");

            // Layout tags have the format:
            // <layout for="(layout's purpose)">(structure fields)</layout>
            StructureLayoutCollection result = new StructureLayoutCollection();
            foreach (XElement layout in layoutContainer.Elements("layout"))
            {
                string name = XMLUtil.GetStringAttribute(layout, "for");
                int size = XMLUtil.GetNumericAttribute(layout, "size", 0);
                result.AddLayout(name, LoadLayout(layout, size));
            }
            return result;
        }
Пример #5
0
 /// <summary>
 ///     Imports layouts from another layout collection.
 /// </summary>
 /// <param name="other">The collection to import layouts from.</param>
 public void Import(StructureLayoutCollection other)
 {
     foreach (var layout in other._layouts)
         AddLayout(layout.Key, layout.Value);
 }
Пример #6
0
 /// <summary>
 ///     Adds a collection of layouts to the collection.
 /// </summary>
 /// <param name="layouts">The layouts to add.</param>
 public void AddLayouts(StructureLayoutCollection layouts)
 {
     foreach (var layout in layouts._layouts)
         AddLayout(layout.Key, layout.Value);
 }