private bool processProxy()
        {
            string targetFilename = string.Format(CultureInfo.InvariantCulture, "{0}.cs", Path.Combine(_prj.ProjectFolder, textBoxSourceFilename.Text));
            string configFilename = string.Format(CultureInfo.InvariantCulture, "{0}.config", Path.Combine(_prj.ProjectFolder, textBoxSourceFilename.Text));

            if (!System.IO.File.Exists(targetFilename))
            {
                MessageBox.Show(this, string.Format(System.Globalization.CultureInfo.InvariantCulture, "Proxy file not generated: [{0}].", targetFilename), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            string dllFilename = string.Format(CultureInfo.InvariantCulture, "{0}.dll", Path.Combine(_prj.ProjectFolder, textBoxSourceFilename.Text));

            if (System.IO.File.Exists(dllFilename))
            {
                File.Delete(dllFilename);
            }
            string targetFilename2 = string.Format(CultureInfo.InvariantCulture, "{0}2.cs", Path.Combine(_prj.ProjectFolder, textBoxSourceFilename.Text));

            if (File.Exists(targetFilename2))
            {
                File.Delete(targetFilename2);
            }
            string       className = null;
            StreamReader sr        = new StreamReader(targetFilename);

            while (!sr.EndOfStream && string.IsNullOrEmpty(className))
            {
                string line = sr.ReadLine();
                if (!string.IsNullOrEmpty(line))
                {
                    if (line.StartsWith("public partial class ", StringComparison.Ordinal))
                    {
                        int n = line.IndexOf(':');
                        if (n > 0)
                        {
                            string s = line.Substring(0, n).Trim();
                            n         = s.LastIndexOf(' ');
                            className = s.Substring(n).Trim();
                        }
                    }
                }
            }
            sr.Close();
            if (string.IsNullOrEmpty(className))
            {
                throw new DesignerException("WCF proxy class not found in {0}", targetFilename);
            }
            StreamWriter sw    = new StreamWriter(targetFilename2);
            string       code2 = Resources.CodeFileWcfProxy;

            code2 = code2.Replace("proxyName", className);
            sw.Write(code2);
            sw.Close();
            CompilerParameters cp = new CompilerParameters();
            StringCollection   sc = new StringCollection();
            string             sLoc;

            sLoc = typeof(System.ServiceModel.ServiceHost).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(Uri).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(Process).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(System.Xml.Serialization.IXmlSerializable).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(System.ComponentModel.AsyncOperation).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(System.Threading.SendOrPostCallback).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(System.Web.Services.Protocols.InvokeCompletedEventArgs).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(System.Data.DataSet).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(System.Windows.Forms.Form).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(UITypeEditor).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            sLoc = typeof(IWindowsFormsEditorService).Assembly.Location;
            if (!sc.Contains(sLoc))
            {
                sc.Add(sLoc);
            }
            foreach (string loc in sc)
            {
                cp.ReferencedAssemblies.Add(loc);
            }
            cp.CompilerOptions         = "/t:library";
            cp.GenerateExecutable      = false;
            cp.GenerateInMemory        = false;
            cp.IncludeDebugInformation = true;
            cp.OutputAssembly          = dllFilename;
            //
            string pdbFile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(dllFilename), System.IO.Path.GetFileNameWithoutExtension(dllFilename)) + ".pdb";

            if (System.IO.File.Exists(pdbFile))
            {
                try
                {
                    System.IO.File.Delete(pdbFile);
                }
                catch (Exception err0)
                {
                    MessageBox.Show(this, string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                        "{0}\r\nCannot overwrite {1}. Please close Limnor Studio and all programs that may use this file. Then manually delete this file", err0.Message, pdbFile),
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return(false);
                }
            }
            //
            string[] sourceFiles = new string[] { targetFilename, targetFilename2 };
            //
            //use C# code provider
            CSharpCodeProvider ccp = new CSharpCodeProvider(new Dictionary <string, string>()
            {
                { "CompilerVersion", "v3.5" }
            });

            CompilerResults cr = ccp.CompileAssemblyFromFile(cp, sourceFiles);

            //
            if (cr.Errors.HasErrors)
            {
                FormStringList.ShowErrors("Error compiling the web service proxy", this, cr.Errors);
                return(false);
            }
            if (_prj != null)
            {
                string appDllFilename = string.Format(CultureInfo.InvariantCulture, "{0}.dll",
                                                      Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), textBoxSourceFilename.Text));
                List <WcfServiceProxy> proxyList = _prj.GetTypedProjectData <List <WcfServiceProxy> >();
                if (proxyList == null)
                {
                    proxyList = new List <WcfServiceProxy>();
                    _prj.SetTypedProjectData <List <WcfServiceProxy> >(proxyList);
                }
                try
                {
                    File.Copy(dllFilename, appDllFilename, true);
                }
                catch (Exception err)
                {
                    MessageBox.Show(this, string.Format(CultureInfo.InvariantCulture, "Error copying [{0}] to [{1}]. You may close Limnor Studio and manually copy the file. \r\n{2}",
                                                        dllFilename, appDllFilename, err.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                Assembly a = Assembly.LoadFile(appDllFilename);
                _proxy = new WcfServiceProxy(Path.GetFileName(dllFilename), a, textBoxServiceUrl.Text,
                                             string.Format(CultureInfo.InvariantCulture, "{0}.config", textBoxSourceFilename.Text));
                proxyList.Add(_proxy);
                MessageBox.Show(this, "The WCF Remoting Service proxy has been added to the Toolbox", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(true);
        }