Esempio n. 1
0
        //关闭工艺
        private bool CloseProject(bool isSave)
        {
            bool           result    = false;
            List <S_Model> ModelList = XML3DPPM.GetModelList(XmlFile);

            //关闭所有并保存压缩
            foreach (S_Model model in ModelList)
            {
                if (!String.IsNullOrEmpty(model.filename))
                {
                    NXFun.ClosePrt(ToFullPath(model.filename), isSave);
                }
            }
            if (isSave)
            {
                //压缩
                string tempZip = ProPath + "\\" + ProName + ".tmp";
                bool   isSaved = Compress.RAR(NXFun.TDPPMPath + NXFun.RarEXE, tempZip, ProPath + "\\" + ProName);
                if (isSaved)
                {
                    File.Copy(tempZip, ProPath + "\\" + ProName + ".3dppm", true);
                    File.Delete(tempZip);
                    NXFun.DeleteDirectory(ProPath + "\\" + ProName);
                    SetStatusLabel("保存工艺成功!", 2);
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            else
            {
                result = true;
            }
            return(result);
        }
Esempio n. 2
0
 //保存工艺
 private bool SaveProject(bool isQuit)
 {
     try
     {
         bool           result    = false;
         List <S_Model> ModelList = XML3DPPM.GetModelList(XmlFile);
         if (isQuit)
         {
             //关闭所有并保存压缩
             foreach (S_Model model in ModelList)
             {
                 if (!String.IsNullOrEmpty(model.filename))
                 {
                     NXFun.ClosePrt(ToFullPath(model.filename), true);
                 }
             }
             //压缩
             string tempZip = ProPath + "\\" + ProName + ".tmp";
             bool   isSaved = Compress.RAR(NXFun.TDPPMPath + NXFun.RarEXE, tempZip, ProPath + "\\" + ProName);
             if (isSaved)
             {
                 File.Copy(tempZip, ProPath + "\\" + ProName + ".3dppm", true);
                 File.Delete(tempZip);
                 NXFun.DeleteDirectory(ProPath + "\\" + ProName);
                 SetStatusLabel("保存工艺成功!", 2);
                 result = true;
             }
             else
             {
                 SetStatusLabel("工艺保存失败!", 1);
                 MessageBox.Show("工艺保存失败!");
                 result = false;
             }
         }
         else
         {
             //仅保存
             foreach (S_Model model in ModelList)
             {
                 if (!String.IsNullOrEmpty(model.filename))
                 {
                     NXFun.SavePrt(ToFullPath(model.filename));
                 }
             }
             //压缩
             string tempZip = ProPath + "\\" + ProName + ".tmp";
             bool   isSaved = Compress.RAR(NXFun.TDPPMPath + NXFun.RarEXE, tempZip, ProPath + "\\" + ProName);
             if (isSaved)
             {
                 File.Copy(tempZip, ProPath + "\\" + ProName + ".3dppm", true);
                 File.Delete(tempZip);
                 SetStatusLabel("保存工艺成功!", 2);
                 result = true;
             }
             else
             {
                 SetStatusLabel("工艺保存失败!", 1);
                 MessageBox.Show("工艺保存失败!");
                 result = false;
             }
         }
         return(result);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }