// Token: 0x0600025D RID: 605 RVA: 0x00015254 File Offset: 0x00013454
        public void TransferMaterial(BinaryReader reader, BinaryWriter writer, TargetMaterial trgtMat, bool overwrite)
        {
            reader.ReadString();
            writer.Write(trgtMat.editname);
            string text  = reader.ReadString();
            string value = reader.ReadString();

            if (trgtMat.shaderChanged)
            {
                text  = trgtMat.ShaderNameOrDefault(text);
                value = ShaderType.GetMateName(text);
            }
            writer.Write(text);
            writer.Write(value);
            ShaderType        type    = trgtMat.editedMat.type;
            HashSet <PropKey> hashSet = new HashSet <PropKey>();

            for (;;)
            {
                string text2 = reader.ReadString();
                if (text2 == "end")
                {
                    break;
                }
                string     text3      = reader.ReadString();
                ShaderProp shaderProp = type.GetShaderProp(text3);
                if (shaderProp == null)
                {
                    this.DiscardMateProp(reader, text2);
                }
                else
                {
                    string a;
                    if (!overwrite)
                    {
                        this.TransferMateProp(reader, writer, text2, text3);
                    }
                    else if ((a = text2) != null)
                    {
                        if (!(a == "tex"))
                        {
                            if (!(a == "col") && !(a == "vec"))
                            {
                                if (a == "f")
                                {
                                    this.Write(writer, new string[]
                                    {
                                        text2,
                                        text3
                                    });
                                    this.Write(writer, trgtMat.editedMat.material.GetFloat(text3));
                                    this.DiscardMateProp(reader, text2);
                                }
                            }
                            else
                            {
                                this.Write(writer, new string[]
                                {
                                    text2,
                                    text3
                                });
                                this.Write(writer, trgtMat.editedMat.material.GetColor(text3));
                                this.DiscardMateProp(reader, text2);
                            }
                        }
                        else
                        {
                            TargetTexture targetTexture;
                            trgtMat.texDic.TryGetValue(shaderProp.key, out targetTexture);
                            if (targetTexture == null || targetTexture.tex == null || targetTexture.fileChanged || targetTexture.colorChanged)
                            {
                                if (targetTexture != null)
                                {
                                    targetTexture.worksuffix = trgtMat.worksuffix;
                                }
                                string workfilename = null;
                                this.TransferMateProp(reader, null, text2, null, ref workfilename);
                                if (targetTexture != null)
                                {
                                    targetTexture.workfilename = workfilename;
                                }
                                this.WriteTex(writer, text3, trgtMat, targetTexture);
                            }
                            else
                            {
                                this.TransferMateProp(reader, writer, text2, text3);
                            }
                        }
                    }
                    hashSet.Add(shaderProp.key);
                }
            }
            if (type.KeyCount() != hashSet.Count)
            {
                foreach (ShaderPropTex shaderPropTex in type.texProps)
                {
                    if (!hashSet.Contains(shaderPropTex.key))
                    {
                        TargetTexture trgtTex;
                        trgtMat.texDic.TryGetValue(shaderPropTex.key, out trgtTex);
                        this.WriteTex(writer, shaderPropTex.keyName, trgtMat, trgtTex);
                    }
                }
                foreach (ShaderPropColor shaderPropColor in type.colProps)
                {
                    if (!hashSet.Contains(shaderPropColor.key))
                    {
                        this.Write(writer, new string[]
                        {
                            shaderPropColor.type.ToString(),
                            shaderPropColor.keyName
                        });
                        this.Write(writer, trgtMat.editedMat.material.GetColor(shaderPropColor.propId));
                    }
                }
                foreach (ShaderPropFloat shaderPropFloat in type.fProps)
                {
                    if (!hashSet.Contains(shaderPropFloat.key))
                    {
                        this.Write(writer, new string[]
                        {
                            shaderPropFloat.type.ToString(),
                            shaderPropFloat.keyName
                        });
                        this.Write(writer, trgtMat.editedMat.material.GetFloat(shaderPropFloat.propId));
                    }
                }
            }
            writer.Write("end");
        }