Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
 public CSharpScriptCompiler(ScriptCompilerOptions options, LuaSyntaxGenerator.SettingInfo rendererOptions)
     : base(options)
 {
     _rendererOptions = rendererOptions;
 }
Exemplo n.º 5
0
 protected ScriptCompiler(ScriptCompilerOptions options)
 {
     _options = options;
 }
Exemplo n.º 6
0
 public LuaScriptCompiler(ScriptCompilerOptions options)
     : base(options)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public CSharpScriptCompiler(ScriptCompilerOptions options)
     : base(options)
 {
     options.BuilderOptions.InitializationFunctions.Add("InitCSharp");
 }