示例#1
0
        public void SimpleSave()
        {
            System.Console.WriteLine(System.IO.Directory.GetCurrentDirectory());
            System.Console.WriteLine(System.IO.Path.GetFullPath(System.IO.Directory.GetCurrentDirectory() + "..\\..\\UnitTests\\artifacts\\MSProject_Test_Save.mpp"));

            String fileName = System.IO.Path.GetFullPath(System.IO.Directory.GetCurrentDirectory() + "..\\..\\UnitTests\\artifacts\\MSProject_Test_Save.mpp");

            SimpleProjectInit();
            simpleProj.LoadMPP();
            simpleProj.SaveProjectFilePath = fileName;

            // Delete the file which we will try to write to
            File.Delete(simpleProj.SaveProjectFilePath);
            simpleProj.SaveMPP();
            Assert.IsTrue(File.Exists(simpleProj.SaveProjectFilePath));
            SimpleProjectClose();
            File.Delete(fileName);
            simpleProj = null;
        }
示例#2
0
        public static void Generate(MSProject proj)
        {
            #region Pre Conditions
            Debug.Assert(null != proj.LoadProjectFilePath);
            Debug.Assert(null != proj.SaveProjectFilePath);
            Debug.Assert(null != proj.InputPath);
            Debug.Assert(InputDataFormat.None != proj.InputType);
            #endregion

            if ((proj.SaveProjectFilePath != null) && (proj.LoadProjectFilePath != null) && (proj.InputPath != null))
            {
                proj.LoadMPP();
                proj.Update();
                proj.SaveMPP();
                proj.Close();
            }
            else
            {
                MessageBox.Show("Unable to load one of {LoadProjectFilePath, SaveProjectFilePath, bugzillaXMLFilePath}", "File not Errror", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }