示例#1
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            idx = 0;
            code.AppendLine("['Enums'] ={");
            foreach (var val in Enums)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");


            idx = 0;
            code.AppendLine("['Entities'] ={");
            foreach (var val in Entities)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");

            code.AppendLine($@"['IsOrther'] ={(IsWeb.ToString().ToLower())},");


            idx = 0;
            code.AppendLine("['Projects'] ={");
            foreach (var val in Projects)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");

            idx = 0;
            code.AppendLine("['ApiItems'] ={");
            foreach (var val in ApiItems)
            {
                if (idx++ > 0)
                {
                    code.Append(',');
                }
                code.AppendLine($@"{val.GetLuaStruct()}");
            }
            code.AppendLine("},");
        }
示例#2
0
        public string ToXml()
        {
            using (StringWriter sw = new StringWriter()) {
                using (XmlWriter xw = new XmlTextWriter(sw)) {
                    xw.WriteStartElement("session");
                    xw.WriteElementString("id", ID);
                    xw.WriteElementString("name", Name);
                    xw.WriteElementString("path", RemotePath);
                    xw.WriteElementString("type", Utilities.OutputSessionType(Type));
                    xw.WriteElementString("web", IsWeb.ToString().ToLowerInvariant());
                    xw.WriteElementString("hasterminated", HasTerminated.ToString().ToLowerInvariant());

                    // Give derived classes a chance to add stuff
                    SerializeSession(xw);

                    xw.WriteEndElement();
                }

                return(sw.ToString());
            }
        }