public SourceCode GenerateReloaderImplCode() { var code = new SourceCode(); code.Append("template <>"); code.Append("inline void data_referer<{0}>::add()", TypeName); code.BracketStart(); code.Append("data_depend_map::instance().add(data::type_id::{0});", SimpleName); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline void data_referer<{0}>::release()", TypeName); code.BracketStart(); code.Append("data_depend_map::instance().release(data::type_id::{0});", SimpleName); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline bool data_reloader_impl<{0}>::is_reloadable()", TypeName); code.BracketStart(); code.Append("return !({0});", string.Join(" \n && ", from clazz in DataDepender.Instance[this] select clazz.GenerateDependMapCheckCode().Generate())); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline void data_reloader_impl<{0}>::reload()", TypeName); code.BracketStart(); code.Append("data_center<{0}>::clear();", TypeName); code.Append("data_center<{0}>::load();", TypeName); code.Append("data_center<{0}>::link();", TypeName); code.BracketEnd(); return(code); }
private SourceCode GenerateReaderWriter(CodeContext context) { var code = new SourceCode(); code.Append("#pragma region /* reader & writer */"); code.NewLine(); foreach (var msg in SortedMessages) { var accessor = context.StartAccessor("msg"); code.Append("template <>"); code.Append("inline msg_writer& msg_writer::operator << (const {0}& {1})", msg.CanonicalName, accessor); code.BracketStart(); code.Append("(*this) << {0};", msg.MessageTypeName); msg.Fields.ForEach(field => code.Append(field.GenerateWriter(context))); code.Append("return (*this);"); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline msg_reader& msg_reader::operator >> ({0}& {1})", msg.CanonicalName, accessor); code.BracketStart(); msg.Fields.ForEach(field => code.Append(field.GenerateReader(context))); code.Append("return (*this);"); code.BracketEnd(); code.NewLine(); context.EndAccessor(); } code.Append("#pragma endregion"); return(code); }
public SourceCode GenerateParseCode() { var code = new SourceCode(); code.Append(GenerateParsePrototypeCode()); code.BracketStart(); { code.Append("if (root_node == nullptr) return;"); code.BracketStart("for (TiXmlElement* each_node = root_node->FirstChildElement(); each_node != nullptr; each_node = each_node->NextSiblingElement())"); { code.Append("{0}* ptr = new {0};", QualifiedTypeName); foreach (var field in Fields.Values) { code.Append(field.GenerateParseCode()); } if (HasContent) { code.Append("ptr->{0} = std::string(each_node->GetText() != nullptr? each_node->GetText(): \"\");", IsNameContent ? "name" : "content"); } code.NewLine(); if (IsTopMost) { code.Append("{0}_data::add(ptr);", SimpleName); } else { code.Append(HasId ? "parent->{0}.insert(std::make_pair(ptr->id, ptr));" : "parent->{0}.push_back(ptr);", CollectionName); } if (NeedLinker) { code.NewLine(); } foreach (var field in ReferenceFields) { code.Append(field.GenerateParseRefCode()); } } code.BracketEnd(); } code.BracketEnd(); foreach (var field in DataClassFields) { code.Append(field.GenerateParseBodyCode()); } return(code); }
public override SourceCode GenerateParseCode() { var code = new SourceCode(); switch (ValueType) { case TypeEnum.BOOL: code.BracketStart(); code.Append("const char* _temp = each_node->Attribute(\"{0}\");", CanonicalName); code.Append("ptr->{0} = _temp == nullptr? false: boost::lexical_cast<bool>(_temp);", CanonicalName); code.BracketEnd(); break; case TypeEnum.DATA_ENUM: code.BracketStart(); code.Append("const char* _temp = each_node->Attribute(\"{0}\");", CanonicalName); foreach (var value in Values.Distinct()) { code.Append("if (stricmp(_temp, \"{2}\") == 0) ptr->{0} = {1}::{2};", CanonicalName, OwnedClass.QualifiedTypeName, value.Substring(1).ToEnumName()); } // remove leading _ char code.BracketEnd(); break; case TypeEnum.DATA_ID: case TypeEnum.INT: case TypeEnum.DOUBLE: code.Append("each_node->Attribute(\"{0}\", &ptr->{0});", CanonicalName); break; case TypeEnum.DATA_POS: code.Append("parse_data_xyz(each_node->Attribute(\"{0}\"), &ptr->{0});", CanonicalName); break; case TypeEnum.STRING: code.Append("ptr->{0} = std::string(each_node->Attribute(\"{0}\"));", CanonicalName); break; case TypeEnum.DATA_REFERENCE: code.Append("ptr->{0} = nullptr;", CanonicalName); break; case TypeEnum.DATA_EXPRESSION: code.Append("ptr->{0} = expression_parser_t(each_node->Attribute(\"{0}\")).result();", CanonicalName); break; } return(code); }
public SourceCode GenerateEntityBindBodyCode(Direction dir) { var operatorDir = dir == Direction.From ? "<<" : ">>"; var code = new SourceCode(); code.Append("inline void operator {2} ({0}{1}& msg, entity_ref entity)", dir == Direction.To ? "const " : "", CanonicalName, operatorDir); code.BracketStart(); if (dir == Direction.From && Fields.Exists(e => e.Name.Equals("id"))) { code.Append("msg.id = entity->id;"); } foreach (var field in Fields.OfType <SimpleField>().Where(e => e.BindAttribute != null)) { var msgVar = String.Format("msg.{0}", field.Name); var entityVar = String.Format("entity->get<{0}_t>()->{1}", field.BindAttribute.AttributeName, field.BindAttribute.FieldName); var format = String.Format("if (entity->has<{0}_t>()) ", field.BindAttribute.AttributeName) + (dir == Direction.From ? "{0} = {1};" : "{1} = {0};"); code.Append(format, msgVar, entityVar); } var bindedRefMessageFields = Fields.OfType <RefField>().Where(e => e.Target != null && e.Target.HasAttributeBindedField && !(e is RefListField)); foreach (var field in bindedRefMessageFields) { code.Append("msg.{0} {1} entity;", field.TargetName, operatorDir); } code.BracketEnd(); code.NewLine(); return(code); }
public void Generate() { _define.Load(PathConfig.DataXmlPath); var generatedFiles = new HashSet <string>(); foreach (var template in _define.Templates) { var code = new SourceCode(); code.Append("using Server.Core.Data;"); code.Append("using System.Collections.Generic;"); code.NewLine(); code.Append("namespace Server.Data"); code.BracketStart(); WriteTemplateToCode(template, code); code.BracketEnd(); code.NewLine(); var dataFileName = template.Name + ".cs"; var dataFilePath = Path.Combine(PathConfig.DataProjectPath, dataFileName); code.WriteToFile(dataFilePath); generatedFiles.Add(dataFileName); } GeneratorHelper.UpdateProjectFile(PathConfig.DataProjectFilePath, generatedFiles); }
public SourceCode GenerateHandlerBody(CodeContext context) { var code = new SourceCode(); code.Append("inline void {0}::handle(msg_session_ref session, const type& msg)", CanonicalName); code.BracketStart(); code.Append("_ASSERT(_handler != NULL);"); code.Append("_handler(session, msg);"); Fields.ForEach(field => code.Append(field.GenerateHandler(context))); code.BracketEnd(); code.NewLine(); code.Append("inline void {0}::handle(msg_session_ref session, msg_reader reader)", CanonicalName); code.BracketStart(); var accessor = context.StartAccessor("msg"); { code.Append("{0} {1};", ClassName, accessor); code.Append("reader >> {0};", accessor); code.Append("handle(session, {0});", accessor); } context.EndAccessor(); code.BracketEnd(); code.NewLine(); code.Append("inline void {0}::broadcast(const type& msg)", CanonicalName); code.BracketStart(); context.StartAccessor("msg"); { code.Append(CodeUtil.ForEachCode("listener_list", "_listeners.", "iter", false)); code.IndentRight(); // not-recursive ref code.Append("(*iter)(msg);"); code.BracketEnd(); } context.EndAccessor(); code.BracketEnd(); return(code); }
public SourceCode GenerateModelCode() { var code = new SourceCode(); code.BracketStart("struct {0}", TypeName); code.IndentRight(); foreach (var field in Fields.Values) { code.Append(field.GenerateModelCode()); } if (HasContent) { code.Append("std::string {0};", IsNameContent ? "name" : "content"); } if (NodeCount > 1) { code.NewLine(); code.Append("~{0}()", TypeName); code.BracketStart(); foreach (var field in DataClassFields) { if (field.Class.HasId) { code.Append("CLEAR_POINTER_MAP({0}, {1});", field.Class.CollectionTypeName, field.Class.CollectionName); } else { code.Append("CLEAR_POINTER_LIST({0}, {1});", field.Class.TypeName, field.Class.CollectionName); } } code.BracketEnd(); } code.BracketEnd(";"); return(code); }
public override SourceCode GenerateModelCode() { var code = new SourceCode(); if (ValueType == TypeEnum.DATA_ENUM) { code.BracketStart("enum {0}", EnumTypeName); foreach (var value in Values.Distinct()) { code.Append("{0},", value.Substring(1).ToEnumName()); // remove leading _ char } code.BracketEnd(";"); } code.Append("{0} {1};", TypeString, CanonicalName); return(code); }
private SourceCode GenerateMsgType() { var code = new SourceCode(); code.BracketStart("namespace msg_type"); var msgSerial = 0; foreach (var msg in Messages) { code.Append("const msg_type_t {0} = {1};", msg.Name, _id * 1000 + msgSerial); ++msgSerial; } code.BracketEnd(); code.NewLine(); code.NewLine(); return(code); }
public SourceCode GenerateEntityBindBodyCode(Direction dir) { var operatorDir = dir == Direction.From ? "<<" : ">>"; var code = new SourceCode(); code.Append("inline void operator {2} ({0}{1}& msg, entity_ref entity)", dir == Direction.To ? "const " : "", CanonicalName, operatorDir); code.BracketStart(); if (dir == Direction.From && Fields.Exists(e => e.Name.Equals("id"))) code.Append("msg.id = entity->id;"); foreach (var field in Fields.OfType<SimpleField>().Where(e => e.BindAttribute != null)) { var msgVar = String.Format("msg.{0}", field.Name); var entityVar = String.Format("entity->get<{0}_t>()->{1}", field.BindAttribute.AttributeName, field.BindAttribute.FieldName); var format = String.Format("if (entity->has<{0}_t>()) ", field.BindAttribute.AttributeName) + (dir == Direction.From ? "{0} = {1};" : "{1} = {0};"); code.Append(format, msgVar, entityVar); } var bindedRefMessageFields = Fields.OfType<RefField>().Where(e => e.Target != null && e.Target.HasAttributeBindedField && !(e is RefListField)); foreach (var field in bindedRefMessageFields) code.Append("msg.{0} {1} entity;", field.TargetName, operatorDir); code.BracketEnd(); code.NewLine(); return code; }
public SourceCode GenerateParseCode() { var code = new SourceCode(); code.Append(GenerateParsePrototypeCode()); code.BracketStart(); { code.Append("if (root_node == nullptr) return;"); code.BracketStart("for (TiXmlElement* each_node = root_node->FirstChildElement(); each_node != nullptr; each_node = each_node->NextSiblingElement())"); { code.Append("{0}* ptr = new {0};", QualifiedTypeName); foreach (var field in Fields.Values) code.Append(field.GenerateParseCode()); if (HasContent) code.Append("ptr->{0} = std::string(each_node->GetText() != nullptr? each_node->GetText(): \"\");", IsNameContent ? "name" : "content"); code.NewLine(); if (IsTopMost) code.Append("{0}_data::add(ptr);", SimpleName); else { code.Append(HasId ? "parent->{0}.insert(std::make_pair(ptr->id, ptr));" : "parent->{0}.push_back(ptr);", CollectionName); } if (NeedLinker) code.NewLine(); foreach (var field in ReferenceFields) code.Append(field.GenerateParseRefCode()); } code.BracketEnd(); } code.BracketEnd(); foreach (var field in DataClassFields) code.Append(field.GenerateParseBodyCode()); return code; }
private void GenerateHeaders(AttributeClass attributeClass) { var code = new SourceCode(); code.Append("#pragma once"); code.NewLine(); code.Append("#include \"cbes/attribute.h\""); code.NewLine(); code.BracketStart("struct {0} : public attribute_t<{0}>", attributeClass.StructName); foreach (var attributeField in attributeClass.Fields) { code.Append("{2}{0} {1};", TypeUtil.ToDeclareTypeName(attributeField.Type), attributeField.Name, attributeField.Volatile ? "volatile " : ""); } code.NewLine(); code.Append("// default constructor"); var constructorArgs = attributeClass.Fields.Select( e => string.Format("{0}({1})", e.Name, e.Default ?? TypeUtil.ToDefaultValueInInitializer(e.Type))).ToList(); if (constructorArgs.Count > 0) { code.Append("{0}()", attributeClass.StructName); code.IndentRight(); code.Append(": {0} {{}}", string.Join(", ", constructorArgs)); code.IndentLeft(); } else { code.Append("{0}() {{}}", attributeClass.StructName); } if (attributeClass.NonDefaultFields.Any()) { code.NewLine(); code.Append("// argumented constructor"); var paramArgs = new List <string>(); var initializeArgs = new List <string>(); // default가 없는 field를 대상으로만 argumented constructor를 만들어준다. foreach (var attributeField in attributeClass.Fields) { if (attributeField.Default == null) { paramArgs.Add(string.Format("{0} _{1}", TypeUtil.ToArgumentTypeName(attributeField.Type), attributeField.Name)); initializeArgs.Add(string.Format("{0}(_{0})", attributeField.Name)); } else { initializeArgs.Add(string.Format("{0}({1})", attributeField.Name, attributeField.Default)); } } if (initializeArgs.Count > 0) { code.Append("{0}({1})", attributeClass.StructName, string.Join(", ", paramArgs)); code.IndentRight(); code.Append(": {0} {{}}", string.Join(", ", initializeArgs)); code.IndentLeft(); } } code.NewLine(); code.Append(SourceCode.Parse(@" virtual void from_bson(bson_iterator*); virtual void to_bson(bson*); virtual void from_xml(TiXmlElement*); virtual void to_xml(std::ostream&);".Trim())); if (attributeClass.CustomCode != null) { code.NewLine(); code.Append(SourceCode.Parse(attributeClass.CustomCode)); } code.BracketEnd(";"); code.Append("typedef boost::shared_ptr<{0}> {1};", attributeClass.StructName, attributeClass.ReferenceName); code.NewLine(); var headerPath = Path.Combine(_outputDirectory, attributeClass.HeaderFileName); code.WriteToFile(headerPath); }
private void GenerateCpp() { _cppCode = new SourceCode(); _cppCode.Append("#include \"{0}\"", Configuration.Stdafx); foreach (var dependancy in new[] {"singleton.h", "cbes/attribute.h"}) _cppCode.Append("#include \"{0}\"", dependancy); _cppCode.NewLine(); _cppCode.Append("#pragma warning (disable: 4189 4100 4505)"); _cppCode.NewLine(); foreach (var attributeClass in _attributes) _cppCode.Append("#include \"{0}\"", attributeClass.HeaderFileName); _cppCode.NewLine(); #region factory _cppCode.Append("#pragma region /* factory-register */"); _cppCode.StaticInitializerStart(); foreach (var attributeClass in _attributes) _cppCode.Append("sys<attribute_factory>().factory_map.insert(std::make_pair(\"{0}\", [=] () {{ return attribute_ref(new {1}); }}));", attributeClass.Name, attributeClass.StructName); _cppCode.StaticInitializerEnd(); _cppCode.Append("#pragma endregion"); _cppCode.NewLine(); #endregion foreach (var attributeClass in _attributes) { _cppCode.Append("#pragma region /* {0} */", attributeClass.Name); #region from_bson { var nonVolatiles = attributeClass.NonVolatileFields.ToArray(); if (nonVolatiles.Any()) { _cppCode.Append("void {0}::from_bson(bson_iterator*)", attributeClass.StructName); _cppCode.Append("{"); _cppCode.Append("}"); } else { _cppCode.Append("void {0}::from_bson(bson_iterator* iterator)", attributeClass.StructName); _cppCode.BracketStart(); _cppCode.BracketStart("while (bson_iterator_next(iterator))"); _cppCode.Append("const char* field_name = bson_iterator_key(iterator);"); _cppCode.Append("const char* field_value = bson_iterator_string(iterator);"); foreach (var attributeField in nonVolatiles) { _cppCode.Append("if (stricmp(\"{0}\", field_name) == 0) {0} = boost::lexical_cast<{1}>(field_value);", attributeField.Name, TypeUtil.ToDeclareTypeName(attributeField.Type)); } _cppCode.BracketEnd(); _cppCode.BracketEnd(); } } #endregion #region to_bson { _cppCode.Append("void {0}::to_bson(bson* obj)", attributeClass.StructName); _cppCode.BracketStart(); _cppCode.Append("bson_append_start_object(obj, \"{0}\");", attributeClass.Name); foreach (var attributeField in attributeClass.NonVolatileFields) { _cppCode.Append("bson_append_string(obj, \"{0}\", boost::lexical_cast<std::string>({0}).c_str());", attributeField.Name); } _cppCode.Append("bson_append_finish_object(obj);"); _cppCode.BracketEnd(); } #endregion #region from_xml { var nonVolatileFields = attributeClass.NonVolatileFields.ToArray(); var primitives = nonVolatileFields.Where(e => TypeUtil.IsPrimitiveType(e.Type)).ToArray(); var nonPrimitives = nonVolatileFields.Where(e => !TypeUtil.IsPrimitiveType(e.Type)).ToArray(); if (!primitives.Any() && !nonPrimitives.Any()) { _cppCode.Append("void {0}::from_xml(TiXmlElement*)", attributeClass.StructName); _cppCode.Append("{"); _cppCode.Append("}"); } else { _cppCode.Append("void {0}::from_xml(TiXmlElement* node)", attributeClass.StructName); _cppCode.BracketStart(); // primitive type은 attribute로 값을 넣어준다. _cppCode.Append("const char* attr_value = nullptr;"); foreach (var attributeField in primitives) { if (attributeField.Type == TypeEnum.INT || attributeField.Type == TypeEnum.DOUBLE) { _cppCode.Append("node->Attribute(\"{0}\", &{0});", attributeField.Name); } else { _cppCode.Append("attr_value = node->Attribute(\"{0}\");", attributeField.Name); _cppCode.Append("if (attr_value != nullptr) {0} = boost::lexical_cast<{1}>(attr_value);", attributeField.Name, TypeUtil.ToDeclareTypeName(attributeField.Type)); } } // non-primitive type은 child element로 값을 넣어준다. if (nonPrimitives.Any()) { _cppCode.BracketStart("for (TiXmlElement* each_node = node->FirstChildElement(); each_node != nullptr; each_node = each_node->NextSiblingElement())"); _cppCode.Append("const char* node_name = each_node->Value();"); foreach (var attributeField in nonPrimitives) { _cppCode.BracketStart("if (stricmp(\"{0}\", node_name) == 0)", attributeField.Name); _cppCode.Append( attributeField.Type == TypeEnum.STRING ? "{0} = std::string(each_node->GetText() != nullptr? each_node->GetText(): \"\");" : "xml_custom_convert(each_node, &{0});", attributeField.Name); _cppCode.BracketEnd(); } _cppCode.BracketEnd(); } _cppCode.BracketEnd(); } } #endregion #region to_xml { _cppCode.Append("void {0}::to_xml(std::ostream& out)", attributeClass.StructName); _cppCode.BracketStart(); var nonVolatileFields = attributeClass.NonVolatileFields.ToArray(); var primitives = nonVolatileFields.Where(e => TypeUtil.IsPrimitiveType(e.Type)).ToArray(); var nonPrimitives = nonVolatileFields.Where(e => !TypeUtil.IsPrimitiveType(e.Type)).ToArray(); if (!primitives.Any() && !nonPrimitives.Any()) _cppCode.Append("out << \"<{0}/>\";", attributeClass.Name); else { _cppCode.Append("out << \"<{0}\";", attributeClass.Name); if (primitives.Any()) { _cppCode.IndentRight(); // primitive type은 attribute로 값을 넣어준다. foreach (var attributeField in primitives) _cppCode.Append(@"out << "" {0}=\"""" << {0} << ""\"""";", attributeField.Name); _cppCode.IndentLeft(); } if (!nonPrimitives.Any()) _cppCode.Append("out << \"/>\";"); else { _cppCode.Append("out << \">\";"); _cppCode.IndentRight(); // non-primitive type은 child element로 값을 넣어준다. foreach (var attributeField in nonPrimitives) _cppCode.Append(@"out << ""<{0}>"" << {0} << ""</{0}>"";", attributeField.Name); _cppCode.IndentLeft(); _cppCode.Append("out << \"</{0}>\";", attributeClass.Name); } } _cppCode.Append("out << std::endl;"); _cppCode.BracketEnd(); } #endregion _cppCode.Append("#pragma endregion"); _cppCode.NewLine(); } var cppFileName = Path.Combine(_outputDirectory, "bind_attributes.cpp"); _cppCode.WriteToFile(cppFileName); }
public SourceCode GenerateHandlerBody(CodeContext context) { var code = new SourceCode(); code.Append("inline void {0}::handle(msg_session_ref session, const type& msg)", CanonicalName); code.BracketStart(); code.Append("_ASSERT(_handler != NULL);"); code.Append("_handler(session, msg);"); Fields.ForEach(field => code.Append(field.GenerateHandler(context))); code.BracketEnd(); code.NewLine(); code.Append("inline void {0}::handle(msg_session_ref session, msg_reader reader)", CanonicalName); code.BracketStart(); var accessor = context.StartAccessor("msg"); { code.Append("{0} {1};", ClassName, accessor); code.Append("reader >> {0};", accessor); code.Append("handle(session, {0});", accessor); } context.EndAccessor(); code.BracketEnd(); code.NewLine(); code.Append("inline void {0}::broadcast(const type& msg)", CanonicalName); code.BracketStart(); context.StartAccessor("msg"); { code.Append(CodeUtil.ForEachCode("listener_list", "_listeners.", "iter", false)); code.IndentRight(); // not-recursive ref code.Append("(*iter)(msg);"); code.BracketEnd(); } context.EndAccessor(); code.BracketEnd(); return code; }
public override SourceCode GenerateParseCode() { var code = new SourceCode(); switch (ValueType) { case TypeEnum.BOOL: code.BracketStart(); code.Append("const char* _temp = each_node->Attribute(\"{0}\");", CanonicalName); code.Append("ptr->{0} = _temp == nullptr? false: boost::lexical_cast<bool>(_temp);", CanonicalName); code.BracketEnd(); break; case TypeEnum.DATA_ENUM: code.BracketStart(); code.Append("const char* _temp = each_node->Attribute(\"{0}\");", CanonicalName); foreach (var value in Values.Distinct()) code.Append("if (stricmp(_temp, \"{2}\") == 0) ptr->{0} = {1}::{2};", CanonicalName, OwnedClass.QualifiedTypeName, value.Substring(1).ToEnumName()); // remove leading _ char code.BracketEnd(); break; case TypeEnum.DATA_ID: case TypeEnum.INT: case TypeEnum.DOUBLE: code.Append("each_node->Attribute(\"{0}\", &ptr->{0});", CanonicalName); break; case TypeEnum.DATA_POS: code.Append("parse_data_xyz(each_node->Attribute(\"{0}\"), &ptr->{0});", CanonicalName); break; case TypeEnum.STRING: code.Append("ptr->{0} = std::string(each_node->Attribute(\"{0}\"));", CanonicalName); break; case TypeEnum.DATA_REFERENCE: code.Append("ptr->{0} = nullptr;", CanonicalName); break; case TypeEnum.DATA_EXPRESSION: code.Append("ptr->{0} = expression_parser_t(each_node->Attribute(\"{0}\")).result();", CanonicalName); break; } return code; }
public override SourceCode GenerateModelCode() { var code = new SourceCode(); if (ValueType == TypeEnum.DATA_ENUM) { code.BracketStart("enum {0}", EnumTypeName); foreach (var value in Values.Distinct()) code.Append("{0},", value.Substring(1).ToEnumName()); // remove leading _ char code.BracketEnd(";"); } code.Append("{0} {1};", TypeString, CanonicalName); return code; }
private void GenerateHeaders(AttributeClass attributeClass) { var code = new SourceCode(); code.Append("#pragma once"); code.NewLine(); code.Append("#include \"cbes/attribute.h\""); code.NewLine(); code.BracketStart("struct {0} : public attribute_t<{0}>", attributeClass.StructName); foreach (var attributeField in attributeClass.Fields) { code.Append("{2}{0} {1};", TypeUtil.ToDeclareTypeName(attributeField.Type), attributeField.Name, attributeField.Volatile ? "volatile " : ""); } code.NewLine(); code.Append("// default constructor"); var constructorArgs = attributeClass.Fields.Select( e => string.Format("{0}({1})", e.Name, e.Default ?? TypeUtil.ToDefaultValueInInitializer(e.Type))).ToList(); if (constructorArgs.Count > 0) { code.Append("{0}()", attributeClass.StructName); code.IndentRight(); code.Append(": {0} {{}}", string.Join(", ", constructorArgs)); code.IndentLeft(); } else code.Append("{0}() {{}}", attributeClass.StructName); if (attributeClass.NonDefaultFields.Any()) { code.NewLine(); code.Append("// argumented constructor"); var paramArgs = new List<string>(); var initializeArgs = new List<string>(); // default가 없는 field를 대상으로만 argumented constructor를 만들어준다. foreach (var attributeField in attributeClass.Fields) { if (attributeField.Default == null) { paramArgs.Add(string.Format("{0} _{1}", TypeUtil.ToArgumentTypeName(attributeField.Type), attributeField.Name)); initializeArgs.Add(string.Format("{0}(_{0})", attributeField.Name)); } else { initializeArgs.Add(string.Format("{0}({1})", attributeField.Name, attributeField.Default)); } } if (initializeArgs.Count > 0) { code.Append("{0}({1})", attributeClass.StructName, string.Join(", ", paramArgs)); code.IndentRight(); code.Append(": {0} {{}}", string.Join(", ", initializeArgs)); code.IndentLeft(); } } code.NewLine(); code.Append(SourceCode.Parse(@" virtual void from_bson(bson_iterator*); virtual void to_bson(bson*); virtual void from_xml(TiXmlElement*); virtual void to_xml(std::ostream&);".Trim())); if (attributeClass.CustomCode != null) { code.NewLine(); code.Append(SourceCode.Parse(attributeClass.CustomCode)); } code.BracketEnd(";"); code.Append("typedef boost::shared_ptr<{0}> {1};", attributeClass.StructName, attributeClass.ReferenceName); code.NewLine(); var headerPath = Path.Combine(_outputDirectory, attributeClass.HeaderFileName); code.WriteToFile(headerPath); }
public void Generate(string outputDirectory, string directionName) { var msgFileName = Path.Combine(outputDirectory, Name + "_msg.h"); var code = new SourceCode(); code.Append("#pragma once"); code.NewLine(); code.Append("#include <msg_def.h>"); code.Append("#include <msg_reader.h>"); code.Append("#include <msg_writer.h>"); code.Append("#include <msg_session_ref.h>"); code.NewLine(); code.Append("#pragma warning (disable: 4100)"); code.NewLine(); code.Append(GenerateMsgType()); code.Append("namespace msg {"); code.NewLine(); var context = new CodeContext(); foreach (var msg in SortedMessages) { code.BracketStart("struct {0}", msg.ClassName); code.Append("static const msg_type_t __type = msg_type::{0};", msg.Name); code.NewLine(); context.StartAccessor("msg"); msg.Fields.ForEach(field => code.Append(field.GenerateField(context))); code.NewLine(); code.Append(msg.GenerateArgumentedConstructor()); code.Append(msg.Fields.GenerateDefaultConstructor(msg.ClassName)); code.Append(msg.GenerateHandlerDeclaration()); context.EndAccessor(); code.BracketEnd(";"); code.NewLine(); } code.Append("}"); code.NewLine(); code.NewLine(); code.Append(GenerateReaderWriter(context)); code.NewLine(); code.NewLine(); code.Append("namespace msg {"); foreach (var msg in SortedMessages) { context.StartAccessor("msg"); code.Append(msg.GenerateHandlerBody(context)); context.EndAccessor(); code.NewLine(); } code.Append("}"); code.NewLine(); if (!String.IsNullOrWhiteSpace(directionName)) { code.Append(GenerateEntityBindCode(directionName)); code.NewLine(); } code.NewLine(); code.Append("#pragma warning (default: 4100)"); code.WriteToFile(msgFileName); }
private void GenerateCpp() { _cppCode = new SourceCode(); _cppCode.Append("#include \"{0}\"", Configuration.Stdafx); foreach (var dependancy in new[] { "singleton.h", "cbes/attribute.h" }) { _cppCode.Append("#include \"{0}\"", dependancy); } _cppCode.NewLine(); _cppCode.Append("#pragma warning (disable: 4189 4100 4505)"); _cppCode.NewLine(); foreach (var attributeClass in _attributes) { _cppCode.Append("#include \"{0}\"", attributeClass.HeaderFileName); } _cppCode.NewLine(); #region factory _cppCode.Append("#pragma region /* factory-register */"); _cppCode.StaticInitializerStart(); foreach (var attributeClass in _attributes) { _cppCode.Append("sys<attribute_factory>().factory_map.insert(std::make_pair(\"{0}\", [=] () {{ return attribute_ref(new {1}); }}));", attributeClass.Name, attributeClass.StructName); } _cppCode.StaticInitializerEnd(); _cppCode.Append("#pragma endregion"); _cppCode.NewLine(); #endregion foreach (var attributeClass in _attributes) { _cppCode.Append("#pragma region /* {0} */", attributeClass.Name); #region from_bson { var nonVolatiles = attributeClass.NonVolatileFields.ToArray(); if (nonVolatiles.Any()) { _cppCode.Append("void {0}::from_bson(bson_iterator*)", attributeClass.StructName); _cppCode.Append("{"); _cppCode.Append("}"); } else { _cppCode.Append("void {0}::from_bson(bson_iterator* iterator)", attributeClass.StructName); _cppCode.BracketStart(); _cppCode.BracketStart("while (bson_iterator_next(iterator))"); _cppCode.Append("const char* field_name = bson_iterator_key(iterator);"); _cppCode.Append("const char* field_value = bson_iterator_string(iterator);"); foreach (var attributeField in nonVolatiles) { _cppCode.Append("if (stricmp(\"{0}\", field_name) == 0) {0} = boost::lexical_cast<{1}>(field_value);", attributeField.Name, TypeUtil.ToDeclareTypeName(attributeField.Type)); } _cppCode.BracketEnd(); _cppCode.BracketEnd(); } } #endregion #region to_bson { _cppCode.Append("void {0}::to_bson(bson* obj)", attributeClass.StructName); _cppCode.BracketStart(); _cppCode.Append("bson_append_start_object(obj, \"{0}\");", attributeClass.Name); foreach (var attributeField in attributeClass.NonVolatileFields) { _cppCode.Append("bson_append_string(obj, \"{0}\", boost::lexical_cast<std::string>({0}).c_str());", attributeField.Name); } _cppCode.Append("bson_append_finish_object(obj);"); _cppCode.BracketEnd(); } #endregion #region from_xml { var nonVolatileFields = attributeClass.NonVolatileFields.ToArray(); var primitives = nonVolatileFields.Where(e => TypeUtil.IsPrimitiveType(e.Type)).ToArray(); var nonPrimitives = nonVolatileFields.Where(e => !TypeUtil.IsPrimitiveType(e.Type)).ToArray(); if (!primitives.Any() && !nonPrimitives.Any()) { _cppCode.Append("void {0}::from_xml(TiXmlElement*)", attributeClass.StructName); _cppCode.Append("{"); _cppCode.Append("}"); } else { _cppCode.Append("void {0}::from_xml(TiXmlElement* node)", attributeClass.StructName); _cppCode.BracketStart(); // primitive type은 attribute로 값을 넣어준다. _cppCode.Append("const char* attr_value = nullptr;"); foreach (var attributeField in primitives) { if (attributeField.Type == TypeEnum.INT || attributeField.Type == TypeEnum.DOUBLE) { _cppCode.Append("node->Attribute(\"{0}\", &{0});", attributeField.Name); } else { _cppCode.Append("attr_value = node->Attribute(\"{0}\");", attributeField.Name); _cppCode.Append("if (attr_value != nullptr) {0} = boost::lexical_cast<{1}>(attr_value);", attributeField.Name, TypeUtil.ToDeclareTypeName(attributeField.Type)); } } // non-primitive type은 child element로 값을 넣어준다. if (nonPrimitives.Any()) { _cppCode.BracketStart("for (TiXmlElement* each_node = node->FirstChildElement(); each_node != nullptr; each_node = each_node->NextSiblingElement())"); _cppCode.Append("const char* node_name = each_node->Value();"); foreach (var attributeField in nonPrimitives) { _cppCode.BracketStart("if (stricmp(\"{0}\", node_name) == 0)", attributeField.Name); _cppCode.Append( attributeField.Type == TypeEnum.STRING ? "{0} = std::string(each_node->GetText() != nullptr? each_node->GetText(): \"\");" : "xml_custom_convert(each_node, &{0});", attributeField.Name); _cppCode.BracketEnd(); } _cppCode.BracketEnd(); } _cppCode.BracketEnd(); } } #endregion #region to_xml { _cppCode.Append("void {0}::to_xml(std::ostream& out)", attributeClass.StructName); _cppCode.BracketStart(); var nonVolatileFields = attributeClass.NonVolatileFields.ToArray(); var primitives = nonVolatileFields.Where(e => TypeUtil.IsPrimitiveType(e.Type)).ToArray(); var nonPrimitives = nonVolatileFields.Where(e => !TypeUtil.IsPrimitiveType(e.Type)).ToArray(); if (!primitives.Any() && !nonPrimitives.Any()) { _cppCode.Append("out << \"<{0}/>\";", attributeClass.Name); } else { _cppCode.Append("out << \"<{0}\";", attributeClass.Name); if (primitives.Any()) { _cppCode.IndentRight(); // primitive type은 attribute로 값을 넣어준다. foreach (var attributeField in primitives) { _cppCode.Append(@"out << "" {0}=\"""" << {0} << ""\"""";", attributeField.Name); } _cppCode.IndentLeft(); } if (!nonPrimitives.Any()) { _cppCode.Append("out << \"/>\";"); } else { _cppCode.Append("out << \">\";"); _cppCode.IndentRight(); // non-primitive type은 child element로 값을 넣어준다. foreach (var attributeField in nonPrimitives) { _cppCode.Append(@"out << ""<{0}>"" << {0} << ""</{0}>"";", attributeField.Name); } _cppCode.IndentLeft(); _cppCode.Append("out << \"</{0}>\";", attributeClass.Name); } } _cppCode.Append("out << std::endl;"); _cppCode.BracketEnd(); } #endregion _cppCode.Append("#pragma endregion"); _cppCode.NewLine(); } var cppFileName = Path.Combine(_outputDirectory, "bind_attributes.cpp"); _cppCode.WriteToFile(cppFileName); }
private SourceCode GenerateMsgType() { var code = new SourceCode(); code.BracketStart("namespace msg_type"); var msgSerial = 0; foreach (var msg in Messages) { code.Append("const msg_type_t {0} = {1};", msg.Name, _id*1000 + msgSerial); ++msgSerial; } code.BracketEnd(); code.NewLine(); code.NewLine(); return code; }
public SourceCode GenerateModelCode() { var code = new SourceCode(); code.BracketStart("struct {0}", TypeName); code.IndentRight(); foreach (var field in Fields.Values) code.Append(field.GenerateModelCode()); if (HasContent) code.Append("std::string {0};", IsNameContent ? "name" : "content"); if (NodeCount > 1) { code.NewLine(); code.Append("~{0}()", TypeName); code.BracketStart(); foreach (var field in DataClassFields) { if (field.Class.HasId) code.Append("CLEAR_POINTER_MAP({0}, {1});", field.Class.CollectionTypeName, field.Class.CollectionName); else code.Append("CLEAR_POINTER_LIST({0}, {1});", field.Class.TypeName, field.Class.CollectionName); } code.BracketEnd(); } code.BracketEnd(";"); return code; }
private SourceCode GenerateReaderWriter(CodeContext context) { var code = new SourceCode(); code.Append("#pragma region /* reader & writer */"); code.NewLine(); foreach (var msg in SortedMessages) { var accessor = context.StartAccessor("msg"); code.Append("template <>"); code.Append("inline msg_writer& msg_writer::operator << (const {0}& {1})", msg.CanonicalName, accessor); code.BracketStart(); code.Append("(*this) << {0};", msg.MessageTypeName); msg.Fields.ForEach(field => code.Append(field.GenerateWriter(context))); code.Append("return (*this);"); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline msg_reader& msg_reader::operator >> ({0}& {1})", msg.CanonicalName, accessor); code.BracketStart(); msg.Fields.ForEach(field => code.Append(field.GenerateReader(context))); code.Append("return (*this);"); code.BracketEnd(); code.NewLine(); context.EndAccessor(); } code.Append("#pragma endregion"); return code; }
public SourceCode GenerateReloaderImplCode() { var code = new SourceCode(); code.Append("template <>"); code.Append("inline void data_referer<{0}>::add()", TypeName); code.BracketStart(); code.Append("data_depend_map::instance().add(data::type_id::{0});", SimpleName); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline void data_referer<{0}>::release()", TypeName); code.BracketStart(); code.Append("data_depend_map::instance().release(data::type_id::{0});", SimpleName); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline bool data_reloader_impl<{0}>::is_reloadable()", TypeName); code.BracketStart(); code.Append("return !({0});", string.Join(" \n && ", from clazz in DataDepender.Instance[this] select clazz.GenerateDependMapCheckCode().Generate())); code.BracketEnd(); code.NewLine(); code.Append("template <>"); code.Append("inline void data_reloader_impl<{0}>::reload()", TypeName); code.BracketStart(); code.Append("data_center<{0}>::clear();", TypeName); code.Append("data_center<{0}>::load();", TypeName); code.Append("data_center<{0}>::link();", TypeName); code.BracketEnd(); return code; }
private void WriteTemplateToCode(DataTemplate dataTemplate, SourceCode code) { var templateCanonicalName = _define.GetCanonicalName(dataTemplate); // root만 IData를 상속 받는다. code.Append(dataTemplate.Parent.IsRoot ? "public class {0} : IData" : "public class {0}", templateCanonicalName); code.BracketStart(); foreach (var child in dataTemplate.Children) { WriteTemplateToCode(child, code); } foreach (var attribute in dataTemplate.Attributes) { var valueType = DataTemplateHelper.InferenceType(attribute.Value); if (valueType == "enum") { var enumName = attribute.Key + (attribute.Key.EndsWith("s") || attribute.Key.EndsWith("x") ? "es" : "s"); if (attribute.Key.Equals("id", StringComparison.OrdinalIgnoreCase)) { code.Append("public int {0} {{ get; set; }}", attribute.Key); } else { code.Append("public {0} {1} {{ get; set; }}", enumName, attribute.Key); } code.Append("public enum {0}", enumName); code.BracketStart(); foreach (var value in attribute.Value.Distinct()) { code.Append("{0},", value.Substring(1).ToCamelCase()); // remove leading _ character. } code.BracketEnd(); } else { code.Append("public {0} {1} {{ get; set; }}", valueType, attribute.Key); } } foreach (var attributeName in from e in dataTemplate.Attributes where e.Key.EndsWith("Ref") select e.Key) { // Ref를 제거하고 남은 이름 var typeName = attributeName.Substring(0, attributeName.Length - 3); code.Append("public {0} {0} {{ get {{ return DataCenter.Instance[typeof ({0}), {1}] as {0}; }} }}", typeName, attributeName); } foreach (var child in dataTemplate.Children) { code.Append("public List<{0}> {0}s {{ get; private set; }}", _define.GetCanonicalName(child)); } if (dataTemplate.Children.Count > 0) { code.NewLine(); code.Append("public {0}()", templateCanonicalName); code.BracketStart(); foreach (var child in dataTemplate.Children) { code.Append("{0}s = new List<{0}>();", _define.GetCanonicalName(child)); } code.BracketEnd(); } code.BracketEnd(); code.NewLine(); }
private void GenerateParserFile() { const string clientCppFileName = "data_center_client.cpp"; const string serverCppFileName = "data_center_server.cpp"; // generate parser file var parser = new SourceCode(); parser.Append("#include <data_expression.h>"); parser.Append("#include <data_center.h>"); foreach (var clazz in DataCenter.Instance.Values) parser.Append("#include \"{0}\"", clazz.HeaderFileName); parser.NewLine(); parser.Append("#pragma warning( disable : 4996 )"); parser.NewLine(); parser.Append("using namespace data;"); parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) parser.Append("template <> typename data_center<{0}>::storage_t* data_center<{0}>::storage = nullptr;", clazz.TypeName); foreach (var clazz in DataCenter.Instance.Values) parser.Append("template <> data_linker_t data_center<{0}>::linker;", clazz.TypeName); parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) parser.Append(clazz.GenerateParseDeclsCode().Generate()); parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append(clazz.GenerateParseCode().Generate()); parser.NewLine(); } parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append("void data::__data_load(data_type_t<{0}>)", clazz.TypeName); parser.BracketStart(); parser.Append("TiXmlDocument document;"); parser.Append("document.LoadFile(user_defined_path_resolver(\"{0}\"));", clazz.XmlFileName.Replace("\\", "\\\\")); parser.Append("TiXmlElement* root_node = document.FirstChildElement(\"{0}\");", clazz.XmlRootName); parser.Append("parse_{0}(root_node->FirstChildElement(\"{1}-list\"));", clazz.ParserName, clazz.XmlNodeName); parser.BracketEnd(); parser.NewLine(); } SourceCode.StaticInitializerSerial = 99; parser.StaticInitializerStart(); { foreach (var clazz in DataCenter.Instance.Values) parser.Append("data::__data_load(data_type_t<{0}>());", clazz.TypeName); parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) parser.Append("{0}_data::linker.link();", clazz.SimpleName); } parser.StaticInitializerEnd(); parser.NewLine(); parser.Append("#pragma warning( default : 4996 )"); parser.NewLine(); parser.WriteToFile(Path.Combine(_outputDirectory, clientCppFileName), "#include <clientpch.h>"); parser.WriteToFile(Path.Combine(_outputDirectory, serverCppFileName), "#include <serverpch.h>"); }
private void GenerateParserFile() { const string clientCppFileName = "data_center_client.cpp"; const string serverCppFileName = "data_center_server.cpp"; // generate parser file var parser = new SourceCode(); parser.Append("#include <data_expression.h>"); parser.Append("#include <data_center.h>"); foreach (var clazz in DataCenter.Instance.Values) { parser.Append("#include \"{0}\"", clazz.HeaderFileName); } parser.NewLine(); parser.Append("#pragma warning( disable : 4996 )"); parser.NewLine(); parser.Append("using namespace data;"); parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append("template <> typename data_center<{0}>::storage_t* data_center<{0}>::storage = nullptr;", clazz.TypeName); } foreach (var clazz in DataCenter.Instance.Values) { parser.Append("template <> data_linker_t data_center<{0}>::linker;", clazz.TypeName); } parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append(clazz.GenerateParseDeclsCode().Generate()); } parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append(clazz.GenerateParseCode().Generate()); parser.NewLine(); } parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append("void data::__data_load(data_type_t<{0}>)", clazz.TypeName); parser.BracketStart(); parser.Append("TiXmlDocument document;"); parser.Append("document.LoadFile(user_defined_path_resolver(\"{0}\"));", clazz.XmlFileName.Replace("\\", "\\\\")); parser.Append("TiXmlElement* root_node = document.FirstChildElement(\"{0}\");", clazz.XmlRootName); parser.Append("parse_{0}(root_node->FirstChildElement(\"{1}-list\"));", clazz.ParserName, clazz.XmlNodeName); parser.BracketEnd(); parser.NewLine(); } SourceCode.StaticInitializerSerial = 99; parser.StaticInitializerStart(); { foreach (var clazz in DataCenter.Instance.Values) { parser.Append("data::__data_load(data_type_t<{0}>());", clazz.TypeName); } parser.NewLine(); foreach (var clazz in DataCenter.Instance.Values) { parser.Append("{0}_data::linker.link();", clazz.SimpleName); } } parser.StaticInitializerEnd(); parser.NewLine(); parser.Append("#pragma warning( default : 4996 )"); parser.NewLine(); parser.WriteToFile(Path.Combine(_outputDirectory, clientCppFileName), "#include <clientpch.h>"); parser.WriteToFile(Path.Combine(_outputDirectory, serverCppFileName), "#include <serverpch.h>"); }
public void Generate() { // ReSharper disable AssignNullToNotNullAttribute // ReSharper disable PossibleNullReferenceException var document = new XmlDocument(); document.Load(PathConfig.MessageXmlPath); var postfix = document.SelectSingleNode("/mmo-msgs/@postfix").Value.ToCamelCase(); var generatedFiles = new List <string>(); var groupIndex = 0; foreach (var groupNode in document.SelectNodes("//group").OfType <XmlElement>()) { ++groupIndex; var groupName = groupNode.GetAttribute("name").ToCamelCase(); var groupPath = Path.Combine(PathConfig.MessageProjectPath, groupName); IoHelper.CreateDirectory(groupPath); var typeIndex = 0; foreach (var msgNode in groupNode.SelectNodes("msg").OfType <XmlElement>()) { var typeId = groupIndex * 1000 + typeIndex; ++typeIndex; if (msgNode.GetAttribute("internal").Equals("true")) { continue; } var messageName = msgNode.GetAttribute("name"); var messageClassName = messageName.ToCamelCase() + postfix; var code = new SourceCode(); code.Append("using System.Collections.Generic;"); code.Append("using Server.Core.Component;"); code.Append("using Server.Core.Messaging;"); code.NewLine(); code.Append("namespace Server.Message.{0}", groupName); code.BracketStart(); code.Append("public class {0} : IMessage", messageClassName); code.BracketStart(); code.Append("public const int TypeId = {0};", typeId); code.NewLine(); var listMembers = new Dictionary <string, string>(); foreach (var fieldNode in msgNode.SelectNodes("field").OfType <XmlElement>()) { var fieldType = fieldNode.GetAttribute("type"); var fieldName = fieldNode.GetAttribute("name").ToCamelCase(); if (fieldType.Equals("bin", StringComparison.OrdinalIgnoreCase)) { fieldType = "byte[]"; } if (fieldName.Equals("id", StringComparison.OrdinalIgnoreCase)) { code.Append("[Attribute(EntityId = true)]"); } if (fieldNode.HasAttribute("attribute")) { var attributeBind = fieldNode.GetAttribute("attribute").Split('.'); var attributeClassName = attributeBind[0].ToCamelCase(); var attributeFieldName = attributeBind[1].ToCamelCase(); code.Append("[Attribute(Attribute = \"{0}\", Field = \"{1}\")]", attributeClassName, attributeFieldName); } code.Append("public {0} {1} {{ get; set; }}", fieldType, fieldName); code.NewLine(); } foreach (var refNode in msgNode.SelectNodes("ref").OfType <XmlElement>()) { var refName = refNode.GetAttribute("msg").ToCamelCase(); var onceRef = refNode.GetAttribute <bool>("once"); if (onceRef) { code.Append("public {0}{1} {0} {{ get; set; }}", refName, postfix); } else { var listTypeName = string.Format("List<{0}{1}>", refName, postfix); var listMemberName = string.Format("{0}List", refName); code.Append("public {0} {1} {{ get; private set; }}", listTypeName, listMemberName); listMembers.Add(listMemberName, listTypeName); } } if (listMembers.Count > 0) { code.NewLine(); code.Append("public {0}()", messageClassName); code.BracketStart(); foreach (var pair in listMembers) { code.Append("{0} = new {1}();", pair.Key, pair.Value); } code.BracketEnd(); } code.BracketEnd(); code.NewLine(); code.BracketEnd(); code.NewLine(); var messageFileName = messageClassName + ".cs"; var messageFilePath = Path.Combine(groupPath, messageFileName); code.WriteToFile(messageFilePath); generatedFiles.Add(Path.Combine(groupName, messageFileName)); } } GeneratorHelper.UpdateProjectFile(PathConfig.MessageProjectFilePath, generatedFiles); // ReSharper restore AssignNullToNotNullAttribute // ReSharper restore PossibleNullReferenceException }