Ejemplo n.º 1
0
        private static string genDefineConfig(List <ColData> members)
        {
            string ret = "";

            foreach (ColData d in members)
            {
                ret += _tab + _tab + d.vname + " : ";
                if (d.isCombineArr || d.isCommaArr)
                {
                    ret += "{";
                    ret += GenClientCpp.defaultValue(d.vtype);
                    ret += "}";
                }
                else
                {
                    ret += GenClientCpp.defaultValue(d.vtype) + "";
                }

                if (members.IndexOf(d) == members.Count - 1)
                {
                    ret += "\n";
                }
                else
                {
                    ret += ",\n";
                }
            }
            return(ret);
        }
Ejemplo n.º 2
0
        private static string genDefaultConfig(List <ColData> members)
        {
#if WRITE_WITH_FORMAT //格式化排版
            string ret = _tab + "\"-1\" : {\n";
            foreach (ColData d in members)
            {
                ret += _tab + _tab + d.vname + " : ";
                if (d.isCombineArr || d.isCommaArr)
                {
                    ret += "{}";
                }
                else if (members.IndexOf(d) == 0 && d.vtype == "int")
                {
                    ret += "-1";
                }
                else
                {
                    ret += GenClientCpp.defaultValue(d.vtype);
                }


                if (members.IndexOf(d) == members.Count - 1)
                {
                    ret += "\n";
                }
                else
                {
                    ret += ",\n";
                }
            }
            ret += _tab + "}"
#else
            string ret = _tab + "\"-1\" : { ";
            foreach (ColData d in members)
            {
                ret += d.vname + ":";
                if (d.isCombineArr || d.isCommaArr)
                {
                    ret += "{}";
                }
                else if (members.IndexOf(d) == 0 && d.vtype == "int")
                {
                    ret += "-1";
                }
                else
                {
                    ret += GenClientCpp.defaultValue(d.vtype);
                }

                if (members.IndexOf(d) < members.Count - 1)
                {
                    ret += ", ";
                }
            }
            ret += "}";
#endif

                   return(ret);
        }