chore: use .Core namespace for dotnet (#7103)

This commit is contained in:
Anže Vodovnik 2021-06-15 11:47:24 +02:00 committed by GitHub
parent cff04abb5e
commit 66f9aeee17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -98,7 +98,7 @@ classNameMap.set('Readable', 'Stream');
* @param {string} folder
* @param {string} extendsName
*/
function writeFile(kind, name, spec, body, folder, extendsName = null) {
function writeFile(kind, name, spec, body, folder, extendsName = null, namespace = "Microsoft.Playwright") {
const out = [];
// console.log(`Generating ${name}`);
@ -124,7 +124,7 @@ function writeFile(kind, name, spec, body, folder, extendsName = null) {
out.push(...body);
out.push('}');
let content = template.replace('[CONTENT]', out.join(EOL));
let content = template.replace('[NAMESPACE]', namespace).replace('[CONTENT]', out.join(EOL));
fs.writeFileSync(path.join(folder, name + '.cs'), content);
}
@ -184,7 +184,8 @@ function renderBaseClass(clazz) {
[],
body,
adaptersDir,
null);
null,
'Microsoft.Playwright.Core');
}
/**

View File

@ -37,7 +37,7 @@ using System.Threading.Tasks;
#nullable enable
namespace Microsoft.Playwright
namespace [NAMESPACE]
{
[CONTENT]
}

View File

@ -150,6 +150,7 @@ for (const [name, item] of Object.entries(protocol)) {
const initializerName = channelName + 'Initializer';
const superName = inherits.get(name);
channels_ts.push('using System.Collections.Generic;');
channels_ts.push('using Microsoft.Playwright.Core;');
channels_ts.push(``);
channels_ts.push(`namespace Microsoft.Playwright.Transport.Protocol`);
channels_ts.push(`{`);