Exemplo n.º 1
0
 /// <summary>
 ///     Loads a new instance of the <see cref="VCard" /> class from a text file.
 /// </summary>
 /// <param name="path">
 ///     The path to a text file containing vCard data in any recognized vCard format.
 /// </param>
 public VCard(string path) : this()
 {
     using (var streamReader = new StreamReader(path))
     {
         var reader = new VCardReader();
         reader.ReadInto(this, streamReader);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// This method will read the given <paramref name="inputFile"/> convert it to HTML and write it to the <paramref name="outputFolder"/>
        /// </summary>
        /// <param name="inputFile">The vcf file</param>
        /// <param name="outputFolder">The folder where to save the converted vcf file</param>
        /// <param name="hyperlinks">When true hyperlinks are clickable, otherwhise they are written as plain text</param>
        /// <returns>String array containing the full path to the converted VCF file</returns>
        /// <exception cref="ArgumentNullException">Raised when the <paramref name="inputFile" /> or <paramref name="outputFolder" /> is null or empty</exception>
        /// <exception cref="FileNotFoundException">Raised when the <paramref name="inputFile" /> does not exists</exception>
        /// <exception cref="DirectoryNotFoundException">Raised when the <paramref name="outputFolder" /> does not exist</exception>
        /// <exception cref="VCRFileTypeNotSupported">Raised when the extension is not .vcf</exception>
        public string[] ExtractToFolder(string inputFile, string outputFolder, bool hyperlinks = false)
        {
            outputFolder = FileManager.CheckForBackSlash(outputFolder);

            _errorMessage = string.Empty;

            CheckFileNameAndOutputFolder(inputFile, outputFolder);

            using (TextReader textReader = File.OpenText(inputFile))
            {
                var vcardReader = new VCardReader();
                var vCard       = new VCard();
                vcardReader.ReadInto(vCard, textReader);
                return(WriteVCard(vCard, outputFolder, hyperlinks).ToArray());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Loads a new instance of the <see cref="VCard" /> class from a text reader.
        /// </summary>
        /// <param name="input">
        ///     An initialized text reader.
        /// </param>
        public VCard(TextReader input) : this()
        {
            var reader = new VCardReader();

            reader.ReadInto(this, input);
        }