Esempio n. 1
0
        public bool LoadDocument(IImportExportCmdletBaseDataObject cmdlet, string path)
        {
            try {
                var pathToImportFile = cmdlet.Path;

                if (!System.IO.File.Exists(pathToImportFile))
                {
                    throw new Exception(
                              "There is no such file '" +
                              cmdlet.Path +
                              "'.");
                }

                ImportedDocument = XDocument.Load(pathToImportFile);
                return(true);
            }
            catch (Exception eImportDocument) {
                throw new Exception(
                          "Unable to load an XML report from the file '" +
                          path +
                          "'. " +
                          eImportDocument.Message);
            }
        }
Esempio n. 2
0
 public bool LoadDocument(IImportExportCmdletBaseDataObject cmdlet, string path)
 {
     try {
         
         var pathToImportFile = cmdlet.Path;
         
         if (!System.IO.File.Exists(pathToImportFile)) {
             throw new Exception(
                 "There is no such file '" +
                 cmdlet.Path +
                 "'.");
         }
         
         ImportedDocument = XDocument.Load(pathToImportFile);
         return true;
     }
     catch (Exception eImportDocument) {
         throw new Exception(
             "Unable to load an XML report from the file '" +
             path +
             "'. " + 
             eImportDocument.Message);
     }
 }