Example #1
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            var me = sender as BackgroundWorker;

            log("Starting .d.ts file generation.");

            var workdir           = workDir_field.Text;
            var ejsVerFldContents = tsGetText(ejsVer_field);
            var ejsToolkit        = tsGetText(ejsTk_field);
            var ejsVer            = ejsVerFldContents.Split(' ')[0]; // assume it will only have space after version number '6.2.1 (ext-6.2.1)'

            Dictionary <string, string> ejsTkList;

            if (cancelRequested(e))
            {
                return;
            }

            if (ejsToolkit == "All")
            {
                ejsTkList = new Dictionary <string, string>
                {
                    { "Classic", Constants.ExtJS_Classic_Path },
                    { "Modern", Constants.ExtJS_Modern_Path },
                };
            }
            else
            {
                ejsTkList = new Dictionary <string, string>();
                switch (ejsToolkit)
                {
                case "Classic":
                    ejsTkList.Add(ejsToolkit, Constants.ExtJS_Classic_Path);
                    break;

                case "Modern":
                    ejsTkList.Add(ejsToolkit, Constants.ExtJS_Modern_Path);
                    break;

                default:
                    throw new Exception("Unsupported toolkit specified: " + ejsToolkit);
                }
            }

            if (cancelRequested(e))
            {
                return;
            }

            var ejsPath   = string.Empty;
            var dtsPath   = string.Empty;
            var lcToolkit = string.Empty;

            foreach (var toolkit in ejsTkList)
            {
                lcToolkit = toolkit.Key.ToLowerInvariant();

                // For now, let's skip our friend JSDuck. ;) (running externally, manually.)

                /*log("Generating JSDuck docs for ExtJS " + ejsVerFldContents + " - " + lcToolkit + " toolkit.");
                 * ejsPath = Path.Combine(availableVersions[ejsVerFldContents], toolkit.Value);
                 *
                 * var jsdObject = new JSDuck(workdir, ejsPath, ejsVer, lcToolkit, log);
                 *
                 * if (cancelRequested(e)) return;
                 * var jsdp = jsdObject.RunAsync();
                 * if (cancelRequested(e)) return;
                 *
                 * JSDuck.PollExecution(jsdp, Constants.JSDuckTimeout, log, cancelRequested, e);
                 *
                 * log("Finished generating JSDuck documentation.");*/
                if (cancelRequested(e))
                {
                    return;
                }

                log("From JSDuck docs, generating the .d.ts file for ExtJS " + ejsVerFldContents + " - " + lcToolkit + " toolkit.");
                dtsPath = Path.Combine(workdir, Constants.ExtTSOut_BasePath, "ExtTS-" + ejsVer + "-" + lcToolkit + ".d.ts");

                // For now, let's use a fixed pre-provided JSDuck output path:
                //TypeScript.Generate(jsdObject.OutputPath, dtsPath, ejsVer, lcToolkit);
                TypeScript.Generate(workdir + "\\2.docs\\e621_classic", dtsPath, ejsVer, lcToolkit);

                log("Finished generating .d.ts file. Path: " + dtsPath);
                if (cancelRequested(e))
                {
                    return;
                }
            }

            log("Finished generating .d.ts file.");
        }