static public bool WriteArithmeticFile(CoreEnvelopeArithmetic wa, bool bOverWritePrompt)
        {
            string filepath = "CenterofGravityEnvelopeMethod\\" + wa.Name + ".mcem";

            return(wa.WriteArithmeticFile(filepath, bOverWritePrompt));
        }
        private void btnExport_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.SaveFileDialog dlg = new SaveFileDialog();
            dlg.FileName = selNode.Text;

            CoreEnvelopeArithmetic wa = null;

            if (selNode.Tag != null)
            {
                wa           = selNode.Tag as CoreEnvelopeArithmetic;
                dlg.FileName = wa.Name;
            }

            dlg.OverwritePrompt = false;
            dlg.DefaultExt      = "mcem";
            dlg.Filter          = "Mcem files (*.mcem)|*.mcem";
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            //从本地导出
            if (selNode.Tag == null)
            {
                if (selNode.Name != dlg.FileName)
                {
                    string strSourcefile = System.AppDomain.CurrentDomain.BaseDirectory + selNode.Name;
                    try
                    {
                        if (File.Exists(dlg.FileName))
                        {
                            if (MessageBox.Show("文件\"" + dlg.FileName + "\"已存在,是否覆盖?", "文件已存在", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                System.IO.File.Copy(strSourcefile, dlg.FileName, true);
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            System.IO.File.Copy(strSourcefile, dlg.FileName, true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }
            else
            {
                if (!wa.WriteArithmeticFile(dlg.FileName, true))
                {
                    return;
                }
            }

            if (selNode != null)
            {
                //int index = selNode.Name.LastIndexOf("\\");
                //string strSFName = index == -1 ? string.Empty : selNode.Name.Substring(index + 1, selNode.Name.Length - index - 1);

                //int index1 = strSFName.LastIndexOf(".");
                //string strName = index1 == -1 ? string.Empty : strSFName.Substring(0, index1);


                XCommon.XLog.Write("成功导出算法到文件\"" + dlg.FileName + "\"!");
            }
        }
        public static bool WriteArithmeticFile(CoreEnvelopeArithmetic wa, bool bOverWritePrompt)
        {
            string filepath = "CenterofGravityEnvelopeMethod\\" + wa.Name + ".mcem";

            return wa.WriteArithmeticFile(filepath, bOverWritePrompt);
        }