Example #1
0
        public void SaveToInfFile(JobInfo jobInfo)
        {
            if (string.IsNullOrEmpty(jobInfo.InfFile))
            {
                throw new InvalidOperationException("The inf file must not be empty");
            }

            var infData = Data.CreateDataStorage();
            var ini     = new IniStorage(Encoding.GetEncoding("Unicode"));

            ini.SetData(infData);

            var sourceFileReader = new SourceFileInfoDataReader();

            var sectionId = 0;

            foreach (var sourceFileInfo in jobInfo.SourceFiles)
            {
                var section = sectionId.ToString(CultureInfo.InvariantCulture) + "\\";
                sourceFileReader.WriteSourceFileInfoToData(infData, section, sourceFileInfo);
                sectionId++;
            }

            ini.WriteData(jobInfo.InfFile);
        }
Example #2
0
        public void WriteAndLoadSourceFileInfo_SourceFileInfosAreEqual()
        {
            var section = "SomeSection";

            _sourceFileInfoDataReader.WriteSourceFileInfoToData(_data, section, _sfi);
            _infFileIniStorage.WriteData(_data);
            var loadedSourceFileInfo = _sourceFileInfoDataReader.ReadSourceFileInfoFromData(_tempFileInfoFile, _data, section);

            _sfi.Filename = loadedSourceFileInfo.Filename;
            AssertSfiAreEqual(_sfi, loadedSourceFileInfo);
        }
Example #3
0
        /// <summary>
        ///     Save the inf file to the path from the InfFile property
        /// </summary>
        public void SaveInf()
        {
            if (string.IsNullOrEmpty(InfFile))
            {
                throw new InvalidOperationException("The inf file must not be empty");
            }

            var infData = Data.CreateDataStorage();
            var ini     = new IniStorage(Encoding.GetEncoding("Unicode"));

            ini.SetData(infData);

            var sectionId = 0;

            foreach (var sourceFileInfo in SourceFiles)
            {
                sourceFileInfo.WriteSourceFileInfo(infData, sectionId.ToString(CultureInfo.InvariantCulture) + "\\");

                sectionId++;
            }

            ini.WriteData(InfFile);
        }