コード例 #1
0
 internal static BuildProperties ReadModFile(TmodFile modFile)
 {
     return(ReadFromStream(modFile.GetStream("Info")));
 }
コード例 #2
0
        internal static BuildProperties ReadModFile(TmodFile modFile)
        {
            BuildProperties properties = new BuildProperties();

            using (var reader = new BinaryReader(modFile.GetStream("Info")))
            {
                for (string tag = reader.ReadString(); tag.Length > 0; tag = reader.ReadString())
                {
                    if (tag == "dllReferences")
                    {
                        properties.dllReferences = ReadList(reader).ToArray();
                    }
                    if (tag == "modReferences")
                    {
                        properties.modReferences = ReadList(reader).Select(ModReference.Parse).ToArray();
                    }
                    if (tag == "weakReferences")
                    {
                        properties.weakReferences = ReadList(reader).Select(ModReference.Parse).ToArray();
                    }
                    if (tag == "sortAfter")
                    {
                        properties.sortAfter = ReadList(reader).ToArray();
                    }
                    if (tag == "sortBefore")
                    {
                        properties.sortBefore = ReadList(reader).ToArray();
                    }
                    if (tag == "author")
                    {
                        properties.author = reader.ReadString();
                    }
                    if (tag == "version")
                    {
                        properties.version = new Version(reader.ReadString());
                    }
                    if (tag == "displayName")
                    {
                        properties.displayName = reader.ReadString();
                    }
                    if (tag == "homepage")
                    {
                        properties.homepage = reader.ReadString();
                    }
                    if (tag == "description")
                    {
                        properties.description = reader.ReadString();
                    }
                    if (tag == "noCompile")
                    {
                        properties.noCompile = true;
                    }
                    if (tag == "!hideCode")
                    {
                        properties.hideCode = false;
                    }
                    if (tag == "!hideResources")
                    {
                        properties.hideResources = false;
                    }
                    if (tag == "includeSource")
                    {
                        properties.includeSource = true;
                    }
                    if (tag == "includePDB")
                    {
                        properties.includePDB = true;
                    }
                    if (tag == "editAndContinue")
                    {
                        properties.editAndContinue = true;
                    }
                    if (tag == "side")
                    {
                        properties.side = (ModSide)reader.ReadByte();
                    }
                    if (tag == "beta")
                    {
                        properties.beta = true;
                    }
                    if (tag == "buildVersion")
                    {
                        properties.buildVersion = new Version(reader.ReadString());
                    }
                }
            }
            return(properties);
        }