Пример #1
0
        public static ParseResult ParseGraphDescriptionFromXmlFile(string inputXmlPath)
        {
            XmlGraphReader graphReader;

            try
            {
                graphReader = XmlGraphReader.CreateFromXmlFile(inputXmlPath);
                return(ParseGraphDescriptionWithXmlGraphReader(graphReader));
            }
            catch (Exception ex)
            {
                var safeReadingEx = new FileReadingSafeException("Error occured while accessing and parsing the file: \"" + inputXmlPath + "\".", ex);
                try
                {
                    throw;
                }
                catch (System.IO.IOException)
                {
                    safeReadingEx.AugmentMessageWithLine("The file or directory wasn't found.");
                }
                catch (System.Security.SecurityException)
                {
                    safeReadingEx.AugmentMessageWithLine("Program has no permissions to access the file.");
                }
                catch (Exception e)
                {
                    if (e is ArgumentException || e is UriFormatException)
                    {
                        safeReadingEx.AugmentMessageWithLine("The file path format is malformed.");
                    }
                }
                throw safeReadingEx;
            }
        }
 public static ParseResult ParseGraphDescriptionFromXmlFile(string inputXmlPath)
 {
     XmlGraphReader graphReader;
     try
     {
         graphReader = XmlGraphReader.CreateFromXmlFile(inputXmlPath);
         return ParseGraphDescriptionWithXmlGraphReader(graphReader);
     }
     catch (Exception ex)
     {
         var safeReadingEx = new FileReadingSafeException("Error occured while accessing and parsing the file: \"" + inputXmlPath + "\".", ex);
         try
         {
             throw;
         }
         catch (System.IO.IOException)
         {
             safeReadingEx.AugmentMessageWithLine("The file or directory wasn't found.");
         }
         catch (System.Security.SecurityException)
         {
             safeReadingEx.AugmentMessageWithLine("Program has no permissions to access the file.");
         }
         catch (Exception e)
         {
             if (e is ArgumentException || e is UriFormatException)
                 safeReadingEx.AugmentMessageWithLine("The file path format is malformed.");
         }
         throw safeReadingEx;
     }
 }