private void btnCreateTree_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validateControls())
                {
                    MessageBox.Show("Check all mandatory fields are entered.");
                    return;
                }
                StringBuilder sb     = new StringBuilder();
                Int32         lcount = 1;
                //open the template file for creating the input json file
                string jsonContent = KarmaRunnerHelper.OpenFileSharedMode(jsonTemplate);
                string jcontemp;
                treeView1.Nodes.Clear();
                if (lstFiles.Items.Count == 0)
                {
                    MessageBox.Show("No Spec files are selected.");
                    return;
                }
                foreach (string sp in SpecFiles)
                {
                    jcontemp = string.Format("{2}{0}{2}{1}", sp.Replace(@"\", @"\\"), (lcount == SpecFiles.Count) ? "" : ",", dquotes);
                    sb.AppendLine(jcontemp);
                    lcount++;
                }
                jsonContent = string.Format(jsonContent, "{", "}", sb.ToString());

                File.WriteAllText(inputjson, jsonContent);

                //Execute the batch file which will use the input json for processing  and create json file to build tree.
                ExecuteNodeProcess();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Updatejasmineconfig()
        {
            string        searchstr = "{specfiles}";
            string        filePattern = @"specs.push('{0}');";
            string        strAppend = string.Empty;
            string        fileContent, sfile, outfile, outDir;
            StringBuilder sb = new StringBuilder();
            Int32         projDepth;
            string        cfaked, je, cfakedsource, jesource;
            string        jsonfile;


            fileContent = File.ReadAllText(jasminespecconfig);
            LogInfo("started updating jasmine configuration file");
            projDepth = KarmaRunnerHelper.DirDepth(txtProjDir.Text, txtProjDir.Text + buildOutput);
            strAppend = strAppend.Replicate(@"../", projDepth);

            foreach (string spec in SpecFiles)
            {
                sfile = spec.Replace(txtProjDir.Text + @"\", "").Replace(@"\", "/");
                sfile = strAppend + sfile;
                sfile = string.Format(filePattern, sfile);
                sb.AppendLine(sfile);
            }

            outfile = string.Format("{0}{1}", txtProjDir.Text, jasminespecconfig.Replace(buildInput, buildOutput));
            outDir  = Path.GetDirectoryName(outfile);
            if (!Directory.Exists(outDir))
            {
                Directory.CreateDirectory(outDir);
            }
            fileContent = fileContent.Replace(searchstr, sb.ToString());

            LogInfo("updating jasmine spec configuration : " + outfile);


            File.WriteAllText(outfile, fileContent);

            //update specrunner.html for vendor placeholder
            outfile     = string.Format("{0}{1}", txtProjDir.Text, specrunner.Replace(buildInput, buildOutput));
            strAppend   = string.Empty; //intialize this
            projDepth   = KarmaRunnerHelper.DirDepth(txtProjDir.Text, txtTestdir.Text);
            strAppend   = strAppend.Replicate(@"../", projDepth);
            projDepth   = KarmaRunnerHelper.DirDepth(txtProjDir.Text, Path.GetDirectoryName(outfile));
            strAppend   = strAppend.Replicate(@"../", projDepth);
            fileContent = File.ReadAllText(specrunner);
            fileContent = fileContent.Replace("{vendor}", strAppend + libPath.Replace(basePath + @"\", @"").Replace(@"\", @"/"));

            LogInfo("updating jasmine spec runner file : " + outfile);


            File.WriteAllText(outfile, fileContent);

            //updatejasmineRequireConfig.js  for vendor placeholder
            outfile     = string.Format("{0}{1}", txtProjDir.Text, jasmineRequireconfig.Replace(buildInput, buildOutput));
            fileContent = File.ReadAllText(jasmineRequireconfig);
            fileContent = fileContent.Replace("{vendor}", strAppend + libPath.Replace(basePath + @"\", @"").Replace(@"\", @"/"));
            strAppend   = string.Empty; //intialize this
            projDepth   = KarmaRunnerHelper.DirDepth(txtProjDir.Text, baseUrl);
            strAppend   = strAppend.Replicate(@"../", projDepth);
            fileContent = fileContent.Replace("{baseUrl}", strAppend + baseUrl.Replace(basePath + @"\", @"").Replace(@"\", @"/"));
            LogInfo("updating jasmine require config  file : " + outfile);
            File.WriteAllText(outfile, fileContent);

            cfaked       = string.Format(@"{0}\{1}", outDir, "commonFaked.js");
            je           = string.Format(@"{0}\{1}", outDir, "jasmine-extn.js");
            cfakedsource = string.Format(@"{0}\{1}", Path.GetDirectoryName(jasmineRequireconfig), "commonFaked.js");
            jesource     = string.Format(@"{0}\{1}", Path.GetDirectoryName(jasmineRequireconfig), "jasmine-extn.js");

            if (!File.Exists(cfaked))
            {
                File.Copy(cfakedsource, cfaked);
            }
            if (!File.Exists(je))
            {
                File.Copy(jesource, je);
            }


            LogInfo("Sucessfully updated all jasmine files.");
        }