constructor()

in lib/generator.js [57:97]


  constructor(option = {}) {
    this.config = Object.assign({
      outputDir: '',
      indent: '    ',
      clientPath: `${option.className || 'Client'}.cs`
    }, option);
    assert.ok(this.config.outputDir, '`option.outputDir` should not empty');
    assert.ok(this.config.namespace, `Darafile -> csharp -> namespace should not empty, please add csharp option into Darafile.
      example:
        "csharp": {
          "namespace": "NameSpace",
          "className": "Client"
        }`);
    this.used = [];
    this.conflictModelNameMap = [];
    this.typedef = this.config.typedef || {};

    this.namespace = option.namespace;
    this.className = option.className || 'Client';
    this.output = '';
    this.outputDir = this.config.outputDir + '/core';
    this.csprojOutputDir = option.outputDir + '/core';
    this.release = option.releases && option.releases.csharp || this.namespace + ':0.0.1';
    this.config.packageInfo = this.config.packageInfo || {};
    this.isExec = this.config.exec;
    this.asyncOnly = this.config.asyncOnly;
    this.editable = option.editable;
    this.classNamespace = new Map();
    this.releaseVersion = this.config.releaseVersion;
    this.packageManager = this.config.packageManager;
    this.packageVersion = this.config.packageInfo.version;

    if (!fs.existsSync(this.outputDir)) {
      fs.mkdirSync(this.outputDir, {
        recursive: true
      });
    }

    remove(path.join(this.outputDir, 'Models/'));
    remove(path.join(this.outputDir, `I${this.className ? this.className : 'Client'}.cs`));
  }