Exemple #1
0
        /// <summary>
        ///     Creates a JobInfo based on the given Inf file
        /// </summary>
        /// <param name="infFile">full path to the Inf file to use</param>
        /// <param name="titleReplacements">Replacements to use when extracting title</param>
        public JobInfo(string infFile, IEnumerable <TitleReplacement> titleReplacements)
        {
            var titleReplacer = new TitleReplacer();

            titleReplacer.AddReplacements(titleReplacements);
            ReadInf(infFile, titleReplacer);
        }
Exemple #2
0
        private void ReadInf(string infFile, TitleReplacer titleReplacer)
        {
            InfFile = infFile;
            var infData = Data.CreateDataStorage();
            var ini     = new IniStorage(Helper.EncodingHelper.GetEncoding(infFile));

            ini.SetData(infData);
            ini.ReadData(infFile);

            foreach (var section in infData.GetSections())
            {
                var sfi = SourceFileInfo.ReadSourceFileInfo(infFile, infData, section);
                if (sfi != null)
                {
                    SourceFiles.Add(sfi);
                }
            }

            Metadata = new Metadata();

            if (SourceFiles.Count > 0)
            {
                Metadata.PrintJobAuthor = SourceFiles[0].Author;
                Metadata.PrintJobName   = titleReplacer.Replace(SourceFiles[0].DocumentTitle);
                Metadata.Title          = ""; //Set to avoid null exception when replacing tokens
                Metadata.Author         = "";

                JobType = SourceFiles[0].Type;
            }
        }
Exemple #3
0
 /// <summary>
 ///     Creates a JobInfo based on the given Inf file
 /// </summary>
 /// <param name="infFile">full path to the Inf file to use</param>
 /// <param name="titleReplacer">TitleReplacer to use when extracting title</param>
 public JobInfo(string infFile, TitleReplacer titleReplacer)
 {
     ReadInf(infFile, titleReplacer);
 }