AcTools.Kn5File.Kn5.ExportIni_Materials C# (CSharp) Method

ExportIni_Materials() private method

private ExportIni_Materials ( System.IO.IniFile iniFile ) : void
iniFile System.IO.IniFile
return void
        private void ExportIni_Materials(IniFile iniFile) {
            iniFile["MATERIAL_LIST"]["COUNT"] = Convert.ToString(Materials.Count);

            var materialId = 0;
            foreach (var material in Materials.Values) {
                var section = iniFile["MATERIAL_" + materialId++];
                section.Set("NAME", material.Name);
                section.Set("SHADER", material.ShaderName);
                section.Set("ALPHABLEND", (int)material.BlendMode);
                section.Set("ALPHATEST", material.AlphaTested);
                section.Set("DEPTHMODE", (int)material.DepthMode);

                section.Set("VARCOUNT", material.ShaderProperties.Length);
                for (var i = 0; i < material.ShaderProperties.Length; i++) {
                    section.Set("VAR_" + i + "_NAME", material.ShaderProperties[i].Name);
                    section.Set("VAR_" + i + "_FLOAT1", material.ShaderProperties[i].ValueA);
                    section.Set("VAR_" + i + "_FLOAT2", material.ShaderProperties[i].ValueB);
                    section.Set("VAR_" + i + "_FLOAT3", material.ShaderProperties[i].ValueC);
                    section.Set("VAR_" + i + "_FLOAT4", material.ShaderProperties[i].ValueD);
                }
                
                section.Set("RESCOUNT", material.TextureMappings.Length);
                for (var i = 0; i < material.TextureMappings.Length; i++) {
                    section.Set("RES_" + i + "_NAME", material.TextureMappings[i].Name);
                    section.Set("RES_" + i + "_SLOT", material.TextureMappings[i].Slot);
                    section.Set("RES_" + i + "_TEXTURE", material.TextureMappings[i].Texture);
                }
            }
        }