예제 #1
0
    public override void WriteToWriter(StreamWriter writer)
    {
        //Start
        writer.WriteLine(VerySimpleXml.StartNode(nodeName, 2));

        //Name
        writer.WriteLine(VerySimpleXml.StartNode(nameNodeName, 3) + name + VerySimpleXml.EndNode(nameNodeName));

        //Path
//		writer.WriteLine(VerySimpleXml.StartNode(pathNodeName, 3) + path + VerySimpleXml.EndNode(pathNodeName));

        //GUID
        writer.WriteLine(VerySimpleXml.StartNode(guidNodeName, 3) + guid + VerySimpleXml.EndNode(guidNodeName));

        //IMPORT SETTINGS
        writer.WriteLine(VerySimpleXml.StartNode("compressionBitrate", 3) + compressionBitrate.ToString() + VerySimpleXml.EndNode("compressionBitrate"));
        writer.WriteLine(VerySimpleXml.StartNode("forceToMono", 3) + forceToMono.ToString() + VerySimpleXml.EndNode("forceToMono"));
        writer.WriteLine(VerySimpleXml.StartNode("format", 3) + format.ToString() + VerySimpleXml.EndNode("format"));
        writer.WriteLine(VerySimpleXml.StartNode("hardware", 3) + hardware.ToString() + VerySimpleXml.EndNode("hardware"));
        writer.WriteLine(VerySimpleXml.StartNode("loadType", 3) + loadType.ToString() + VerySimpleXml.EndNode("loadType"));
        writer.WriteLine(VerySimpleXml.StartNode("loopable", 3) + loopable.ToString() + VerySimpleXml.EndNode("loopable"));
        writer.WriteLine(VerySimpleXml.StartNode("threeD", 3) + threeD.ToString() + VerySimpleXml.EndNode("threeD"));

        //End
        writer.WriteLine(VerySimpleXml.EndNode(nodeName, 2));
    }
예제 #2
0
    public AssetConfiguration(StreamReader reader)
    {
        assets = new List <Asset>();

        string line = string.Empty;

        while ((line = reader.ReadLine()) != null)
        {
            if (line.Contains(VerySimpleXml.EndNode(nodeName)))
            {
                break;
            }

            //Name
            if (line.Contains(VerySimpleXml.StartNode(nameNodeName)))
            {
                name = VerySimpleXml.NodeValue(line, nameNodeName);
            }

            //////////
            //ASSETS//

            //Audio asset
            if (line.Contains(VerySimpleXml.StartNode(AudioAsset.nodeName)))
            {
                assets.Add(new AudioAsset(reader));
            }

            //Texture asset
            if (line.Contains(VerySimpleXml.StartNode(TextureAsset.nodeName)))
            {
                assets.Add(new TextureAsset(reader));
            }
        }
    }
예제 #3
0
    public void WriteToWriter(StreamWriter writer)
    {
        writer.WriteLine(VerySimpleXml.StartNode(nodeName, 1));
        //Name
        writer.WriteLine(VerySimpleXml.StartNode(nameNodeName, 2) + name + VerySimpleXml.EndNode(nameNodeName));

        //Assets
        for (int i = 0; i < assets.Count; i++)
        {
            assets[i].WriteToWriter(writer);
        }
        writer.WriteLine(VerySimpleXml.EndNode(nodeName, 1));
    }
예제 #4
0
    void WriteToFile()
    {
        //Early out if there are no configurations to write to file
        if (configurations.Count == 0)
        {
            return;
        }

        StreamWriter writer = new StreamWriter(assetConfigFile.Open(FileMode.Truncate, FileAccess.Write, FileShare.Read));

        writer.WriteLine(VerySimpleXml.StartNode("AssetSettings"));
        for (int i = 0; i < configurations.Count; i++)
        {
            configurations[i].WriteToWriter(writer);
        }
        writer.WriteLine(VerySimpleXml.EndNode("AssetSettings"));

        writer.Close();
    }
    public override void WriteToWriter(StreamWriter writer)
    {
        //Start
        writer.WriteLine(VerySimpleXml.StartNode(nodeName, 2));

        //Name
        writer.WriteLine(VerySimpleXml.StartNode(nameNodeName, 3) + name + VerySimpleXml.EndNode(nameNodeName));

        //Path
//		writer.WriteLine(VerySimpleXml.StartNode(pathNodeName, 3) + path + VerySimpleXml.EndNode(pathNodeName));

        //GUID
        writer.WriteLine(VerySimpleXml.StartNode(guidNodeName, 3) + guid + VerySimpleXml.EndNode(guidNodeName));

        //IMPORT SETTINGS
        writer.WriteLine(VerySimpleXml.StartNode("anisoLevel", 3) + anisoLevel.ToString() + VerySimpleXml.EndNode("anisoLevel"));
        writer.WriteLine(VerySimpleXml.StartNode("borderMipmap", 3) + borderMipmap.ToString() + VerySimpleXml.EndNode("borderMipmap"));
        writer.WriteLine(VerySimpleXml.StartNode("convertToNormalmap", 3) + convertToNormalmap.ToString() + VerySimpleXml.EndNode("convertToNormalmap"));
        writer.WriteLine(VerySimpleXml.StartNode("correctGamma", 3) + generateMipsInLinearSpace.ToString() + VerySimpleXml.EndNode("correctGamma"));
        writer.WriteLine(VerySimpleXml.StartNode("fadeout", 3) + fadeout.ToString() + VerySimpleXml.EndNode("fadeout"));
        writer.WriteLine(VerySimpleXml.StartNode("filterMode", 3) + filterMode.ToString() + VerySimpleXml.EndNode("filterMode"));
        writer.WriteLine(VerySimpleXml.StartNode("generateCubemap", 3) + generateCubemap.ToString() + VerySimpleXml.EndNode("generateCubemap"));
        writer.WriteLine(VerySimpleXml.StartNode("grayscaleToAlpha", 3) + grayscaleToAlpha.ToString() + VerySimpleXml.EndNode("grayscaleToAlpha"));
        writer.WriteLine(VerySimpleXml.StartNode("heightmapScale", 3) + heightmapScale.ToString() + VerySimpleXml.EndNode("heightmapScale"));
        writer.WriteLine(VerySimpleXml.StartNode("isReadable", 3) + isReadable.ToString() + VerySimpleXml.EndNode("isReadable"));
        writer.WriteLine(VerySimpleXml.StartNode("lightmap", 3) + lightmap.ToString() + VerySimpleXml.EndNode("lightmap"));
        writer.WriteLine(VerySimpleXml.StartNode("maxTextureSize", 3) + maxTextureSize.ToString() + VerySimpleXml.EndNode("maxTextureSize"));
        writer.WriteLine(VerySimpleXml.StartNode("mipMapBias", 3) + mipMapBias.ToString() + VerySimpleXml.EndNode("mipMapBias"));
        writer.WriteLine(VerySimpleXml.StartNode("mipmapEnabled", 3) + mipmapEnabled.ToString() + VerySimpleXml.EndNode("mipmapEnabled"));
        writer.WriteLine(VerySimpleXml.StartNode("mipmapFadeDistanceEnd", 3) + mipmapFadeDistanceEnd.ToString() + VerySimpleXml.EndNode("mipmapFadeDistanceEnd"));
        writer.WriteLine(VerySimpleXml.StartNode("mipmapFadeDistanceStart", 3) + mipmapFadeDistanceStart.ToString() + VerySimpleXml.EndNode("mipmapFadeDistanceStart"));
        writer.WriteLine(VerySimpleXml.StartNode("mipmapFilter", 3) + mipmapFilter.ToString() + VerySimpleXml.EndNode("mipmapFilter"));
        writer.WriteLine(VerySimpleXml.StartNode("normalmap", 3) + normalmap.ToString() + VerySimpleXml.EndNode("normalmap"));
        writer.WriteLine(VerySimpleXml.StartNode("normalmapFilter", 3) + normalmapFilter.ToString() + VerySimpleXml.EndNode("normalmapFilter"));
        writer.WriteLine(VerySimpleXml.StartNode("npotScale", 3) + npotScale.ToString() + VerySimpleXml.EndNode("npotScale"));
        writer.WriteLine(VerySimpleXml.StartNode("textureFormat", 3) + textureFormat.ToString() + VerySimpleXml.EndNode("textureFormat"));
        writer.WriteLine(VerySimpleXml.StartNode("textureType", 3) + textureType.ToString() + VerySimpleXml.EndNode("textureType"));
        writer.WriteLine(VerySimpleXml.StartNode("wrapMode", 3) + wrapMode.ToString() + VerySimpleXml.EndNode("wrapMode"));

        //End
        writer.WriteLine(VerySimpleXml.EndNode(nodeName, 2));
    }
    public TextureAsset(StreamReader reader)
    {
        string line = string.Empty;

        while ((line = reader.ReadLine()) != null)
        {
            if (line.Contains(VerySimpleXml.EndNode(nodeName)))
            {
                break;
            }

            //Name
            if (line.Contains(VerySimpleXml.StartNode(nameNodeName)))
            {
                name = VerySimpleXml.NodeValue(line, nameNodeName);
            }

            //Path
            if (line.Contains(VerySimpleXml.StartNode(pathNodeName)))
            {
                guid = AssetDatabase.AssetPathToGUID(VerySimpleXml.NodeValue(line, pathNodeName));
            }

            if (line.Contains(VerySimpleXml.StartNode(guidNodeName)))
            {
                guid = VerySimpleXml.NodeValue(line, guidNodeName);
            }

            //IMPORT SETTINGS
            if (line.Contains(VerySimpleXml.StartNode("anisoLevel")))
            {
                anisoLevel = int.Parse(VerySimpleXml.NodeValue(line, "anisoLevel"));
            }

            if (line.Contains(VerySimpleXml.StartNode("borderMipmap")))
            {
                borderMipmap = bool.Parse(VerySimpleXml.NodeValue(line, "borderMipmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("convertToNormalmap")))
            {
                convertToNormalmap = bool.Parse(VerySimpleXml.NodeValue(line, "convertToNormalmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("correctGamma")))
            {
                generateMipsInLinearSpace = bool.Parse(VerySimpleXml.NodeValue(line, "correctGamma"));
            }

            if (line.Contains(VerySimpleXml.StartNode("fadeout")))
            {
                fadeout = bool.Parse(VerySimpleXml.NodeValue(line, "fadeout"));
            }

            if (line.Contains(VerySimpleXml.StartNode("filterMode")))
            {
                filterMode = (FilterMode)System.Enum.Parse(typeof(FilterMode), VerySimpleXml.NodeValue(line, "filterMode"));
            }

            if (line.Contains(VerySimpleXml.StartNode("generateCubemap")))
            {
                generateCubemap = (TextureImporterGenerateCubemap)System.Enum.Parse(typeof(TextureImporterGenerateCubemap), VerySimpleXml.NodeValue(line, "generateCubemap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("grayscaleToAlpha")))
            {
                grayscaleToAlpha = bool.Parse(VerySimpleXml.NodeValue(line, "grayscaleToAlpha"));
            }

            if (line.Contains(VerySimpleXml.StartNode("heightmapScale")))
            {
                heightmapScale = float.Parse(VerySimpleXml.NodeValue(line, "heightmapScale"));
            }

            if (line.Contains(VerySimpleXml.StartNode("isReadable")))
            {
                isReadable = bool.Parse(VerySimpleXml.NodeValue(line, "isReadable"));
            }

            if (line.Contains(VerySimpleXml.StartNode("lightmap")))
            {
                lightmap = bool.Parse(VerySimpleXml.NodeValue(line, "lightmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("maxTextureSize")))
            {
                maxTextureSize = int.Parse(VerySimpleXml.NodeValue(line, "maxTextureSize"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipMapBias")))
            {
                mipMapBias = float.Parse(VerySimpleXml.NodeValue(line, "mipMapBias"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapEnabled")))
            {
                mipmapEnabled = bool.Parse(VerySimpleXml.NodeValue(line, "mipmapEnabled"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapFadeDistanceEnd")))
            {
                mipmapFadeDistanceEnd = int.Parse(VerySimpleXml.NodeValue(line, "mipmapFadeDistanceEnd"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapFadeDistanceStart")))
            {
                mipmapFadeDistanceStart = int.Parse(VerySimpleXml.NodeValue(line, "mipmapFadeDistanceStart"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapFilter")))
            {
                mipmapFilter = (TextureImporterMipFilter)System.Enum.Parse(typeof(TextureImporterMipFilter), VerySimpleXml.NodeValue(line, "mipmapFilter"));
            }

            if (line.Contains(VerySimpleXml.StartNode("normalmap")))
            {
                normalmap = bool.Parse(VerySimpleXml.NodeValue(line, "normalmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("normalmapFilter")))
            {
                normalmapFilter = (TextureImporterNormalFilter)System.Enum.Parse(typeof(TextureImporterNormalFilter), VerySimpleXml.NodeValue(line, "normalmapFilter"));
            }

            if (line.Contains(VerySimpleXml.StartNode("npotScale")))
            {
                npotScale = (TextureImporterNPOTScale)System.Enum.Parse(typeof(TextureImporterNPOTScale), VerySimpleXml.NodeValue(line, "npotScale"));
            }

            if (line.Contains(VerySimpleXml.StartNode("textureFormat")))
            {
                textureFormat = (TextureImporterFormat)System.Enum.Parse(typeof(TextureImporterFormat), VerySimpleXml.NodeValue(line, "textureFormat"));
            }

            if (line.Contains(VerySimpleXml.StartNode("textureType")))
            {
                textureType = (TextureImporterType)System.Enum.Parse(typeof(TextureImporterType), VerySimpleXml.NodeValue(line, "textureType"));
            }

            if (line.Contains(VerySimpleXml.StartNode("wrapMode")))
            {
                wrapMode = (TextureWrapMode)System.Enum.Parse(typeof(TextureWrapMode), VerySimpleXml.NodeValue(line, "wrapMode"));
            }
        }
    }
예제 #7
0
    public AudioAsset(StreamReader reader)
    {
        string line = string.Empty;

        while ((line = reader.ReadLine()) != null)
        {
            if (line.Contains(VerySimpleXml.EndNode(nodeName)))
            {
                break;
            }

            //Name
            if (line.Contains(VerySimpleXml.StartNode(nameNodeName)))
            {
                name = VerySimpleXml.NodeValue(line, nameNodeName);
            }

            //Path
            if (line.Contains(VerySimpleXml.StartNode(pathNodeName)))
            {
                guid = AssetDatabase.AssetPathToGUID(VerySimpleXml.NodeValue(line, pathNodeName));
            }

            if (line.Contains(VerySimpleXml.StartNode(guidNodeName)))
            {
                guid = VerySimpleXml.NodeValue(line, guidNodeName);
            }

            //IMPORT SETTINGS
            if (line.Contains(VerySimpleXml.StartNode("compressionBitrate")))
            {
                compressionBitrate = int.Parse(VerySimpleXml.NodeValue(line, "compressionBitrate"));
            }

            if (line.Contains(VerySimpleXml.StartNode("forceToMono")))
            {
                forceToMono = bool.Parse(VerySimpleXml.NodeValue(line, "forceToMono"));
            }

            if (line.Contains(VerySimpleXml.StartNode("format")))
            {
                format = (AudioImporterFormat)System.Enum.Parse(typeof(AudioImporterFormat), VerySimpleXml.NodeValue(line, "format"));
            }

            if (line.Contains(VerySimpleXml.StartNode("hardware")))
            {
                hardware = bool.Parse(VerySimpleXml.NodeValue(line, "hardware"));
            }

            if (line.Contains(VerySimpleXml.StartNode("loadType")))
            {
                loadType = (AudioImporterLoadType)System.Enum.Parse(typeof(AudioImporterLoadType), VerySimpleXml.NodeValue(line, "loadType"));
            }

            if (line.Contains(VerySimpleXml.StartNode("loopable")))
            {
                loopable = bool.Parse(VerySimpleXml.NodeValue(line, "loopable"));
            }

            if (line.Contains(VerySimpleXml.StartNode("threeD")))
            {
                threeD = bool.Parse(VerySimpleXml.NodeValue(line, "threeD"));
            }
        }
    }