public JassScriptCompiler(ScriptCompilerOptions options, JassRendererOptions rendererOptions) : base(options) { /*if (options.SourceDirectory != null) * { * if (options.JasshelperCliPath is null) * { * throw new System.Exception(); * } * * // todo: retrieve these vals from somewhere * var x86 = true; * var ptr = false; * // var reforged = ?; * * // _jasshelperPath = Path.Combine(new FileInfo(WarcraftPathProvider.GetExePath(x86, ptr)).DirectoryName, "JassHelper", "jasshelper.exe"); * * var jasshelperDocuments = Path.Combine( * System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), * ptr ? "Warcraft III Public Test" : "Warcraft III", * "Jasshelper"); * * _commonPath = Path.Combine(jasshelperDocuments, "common.j"); * _blizzardPath = Path.Combine(jasshelperDocuments, "Blizzard.j"); * }*/ _rendererOptions = rendererOptions; }
public static ScriptCompiler GetUnknownLanguageCompiler(ScriptCompilerOptions options) { var sourceDirectory = options.SourceDirectory; var countJassFiles = 0; var countLuaFiles = 0; var countCSharpFiles = 0; var sourceDirectoryPathLength = sourceDirectory.Length + (sourceDirectory.EndsWith("\\") ? 0 : 1); foreach (var file in Directory.EnumerateFiles(sourceDirectory, "*", SearchOption.AllDirectories)) { var relativePath = file.Substring(sourceDirectoryPathLength); if (relativePath.StartsWith(@"bin\") || relativePath.StartsWith(@"obj\")) { continue; } switch (new FileInfo(file).Extension.ToLower()) { case ".j": countJassFiles++; break; case ".lua": countLuaFiles++; break; case ".cs": countCSharpFiles++; break; default: break; } } var countScriptLanguages = Math.Min(countJassFiles, 1) + Math.Min(countLuaFiles, 1) + Math.Min(countCSharpFiles, 1); if (countScriptLanguages == 1) { if (countJassFiles > 0) { return(new JassScriptCompiler(options)); } if (countCSharpFiles > 0) { return(new CSharpScriptCompiler(options)); } if (countLuaFiles > 0) { return(new LuaScriptCompiler(options)); } } return(null); }
public JassScriptCompiler(ScriptCompilerOptions options) : base(options) { // todo: retrieve these vals from somewhere var x86 = true; var ptr = false; _jasshelperPath = Path.Combine(new FileInfo(Providers.WarcraftPathProvider.GetExePath(x86, ptr)).DirectoryName, "JassHelper", "jasshelper.exe"); var jasshelperDocuments = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ptr ? "Warcraft III Public Test" : "Warcraft III", "Jasshelper"); _commonPath = Path.Combine(jasshelperDocuments, "common.j"); _blizzardPath = Path.Combine(jasshelperDocuments, "Blizzard.j"); }
public CSharpScriptCompiler(ScriptCompilerOptions options, LuaSyntaxGenerator.SettingInfo rendererOptions) : base(options) { _rendererOptions = rendererOptions; }
protected ScriptCompiler(ScriptCompilerOptions options) { _options = options; }
public LuaScriptCompiler(ScriptCompilerOptions options) : base(options) { throw new NotImplementedException(); }
public CSharpScriptCompiler(ScriptCompilerOptions options) : base(options) { options.BuilderOptions.InitializationFunctions.Add("InitCSharp"); }