Example #1
0
        public static void Process(List <Comobjectstorage> sellist, Program.lbops ops, string wcfns, string outputfoldr)
        {
            string csfilename  = "outputfile.cs";
            string vbsfilename = "outputfile.vbs";
            string regfilename = "outputfile.reg";

            bool bcs         = ((ops & Program.lbops.cs) != 0);
            bool bvb         = ((ops & Program.lbops.vb) != 0);
            bool breg        = ((ops & Program.lbops.reg) != 0);
            bool bwcf        = ((ops & Program.lbops.wcf) != 0);
            bool bnet35      = ((ops & Program.lbops.net35) != 0);
            bool bsscfserver = ((ops & Program.lbops.sscfserver) != 0);
            bool bsscfclient = ((ops & Program.lbops.sscfclient) != 0);

            UpdateStatus("Reading type information");
            CodeGenerator.Generatecode(sellist, ops);

            if (bcs || bwcf || bsscfserver)
            {
                csfilename = outputfoldr + "\\" + csfilename;
                UpdateStatus("writing " + csfilename);
                string s = CodeGenerator.sbcs.ToString();
                s = s.Replace("#1#", wcfns);
                System.IO.File.WriteAllText(csfilename, s);
            }

            if (bvb || bwcf || bsscfserver)
            {
                vbsfilename = outputfoldr + "\\" + vbsfilename;
                UpdateStatus("writing " + vbsfilename);
                string s = CodeGenerator.sbvbs.ToString();
                s = s.Replace("#1#", wcfns);
                System.IO.File.WriteAllText(vbsfilename, s);
            }

            if (breg)
            {
                regfilename = outputfoldr + "\\" + regfilename;
                UpdateStatus("writing " + regfilename);
                System.IO.File.WriteAllText(regfilename, CodeGenerator.sbreg.ToString());
            }

            if (bwcf)
            {
                if (!createwcfProject(outputfoldr, wcfns, bnet35))
                {
                    throw new Exception("wcf project cannot be created");
                }
            }
        }
Example #2
0
        private void btngo_Click(object sender, EventArgs e)
        {
            if (!validate())
            {
                return;
            }
            string txtns = "";

            try
            {
                Program.lbops ops = 0;
                if (tabControl1.SelectedIndex == 0)
                {
                    if (chkcs.Checked)
                    {
                        ops |= Program.lbops.cs;
                    }

                    if (chkvbs.Checked)
                    {
                        ops |= Program.lbops.vb;
                    }

                    if (chkregfiles.Checked)
                    {
                        ops |= Program.lbops.reg;
                    }

                    if (chkincoptional.Checked)
                    {
                        ops |= Program.lbops.incopt;
                    }

                    if (chkruntime35.Checked)
                    {
                        ops |= Program.lbops.net35;
                    }
                }
                else if (tabControl1.SelectedIndex == 1)
                {
                    txtns = txtwcfns.Text;
                    ops  |= Program.lbops.wcf;
                    if (chkwcfruntime35.Checked)
                    {
                        ops |= Program.lbops.net35;
                    }
                }
                if (chksupportcomplus.Checked)
                {
                    ops |= Program.lbops.complus;
                }

                //else if (tabControl1.SelectedIndex == 2)
                //{
                //    txtns = txtsscfserverns.Text;
                //    ops |= Program.lbops.sscfserver;
                //}
                //else if (tabControl1.SelectedIndex == 3)
                //{
                //    txtns = txtsscfclns.Text;
                //    ops |= Program.lbops.sscfclient;
                //}


                string outputdir = txtoutput.Text + "\\output";

                if (Directory.Exists(outputdir))
                {
                    Directory.Delete(outputdir, true);
                }
                Directory.CreateDirectory(outputdir);

                string tempdir = txtoutput.Text + "\\temp";

                if (Directory.Exists(tempdir))
                {
                    Directory.Delete(tempdir, true);
                }
                Directory.CreateDirectory(tempdir);


                Program.Process((from u in usersel select u.Value).ToList(), ops, txtns, outputdir);
                Program.UpdateStatus("Success");
            }
            catch (Exception ex)
            {
                Program.UpdateStatus("An error occured\r\n" + ex.Message);
            }
        }