コード例 #1
0
 /// <summary>
 /// Necessary for files to be copied
 /// </summary>
 /// <param name="sourceDirectoryPath">
 /// In the form: 'SCSIDRV' or 'SCSIDRV\AMDAHCI'
 /// </param>
 public void AddOptionalSourceDirectory(string sourceDirectoryPath)
 {
     if (!SectionNames.Contains("OptionalSrcDirs"))
     {
         AddSection("OptionalSrcDirs");
     }
     if (GetLineIndex("OptionalSrcDirs", sourceDirectoryPath) == -1)
     {
         AppendLineToSection("OptionalSrcDirs", sourceDirectoryPath);
     }
 }
コード例 #2
0
ファイル: API.cs プロジェクト: jkoritzinsky/ShipSections
 public static void ChangeSectionName(string currentSectionName, string newSectionName)
 {
     if (currentSectionName == newSectionName)
     {
         return;
     }
     if (SectionNames.Contains(newSectionName))
     {
         MergeSections(currentSectionName, newSectionName);
     }
     else
     {
         RenameSection(currentSectionName, newSectionName);
     }
 }
コード例 #3
0
        /// <summary>
        /// The section will be created if it does not exist
        /// </summary>
        public void AddFileToFilesSection(string sectionName, string fileName, int winntDirectoryID)
        {
            if (!SectionNames.Contains(sectionName))
            {
                AddSection(sectionName);
            }

            // Note: the key here is a combination of filename and directory,
            // so the same file could be copied to two directories.
            string entry     = String.Format("{0},{1}", fileName, winntDirectoryID);
            int    lineIndex = GetLineIndexByKey(sectionName, entry);

            if (lineIndex == -1)
            {
                AppendLineToSection(sectionName, entry);
            }
        }
コード例 #4
0
        public string GetSectionText(string sectionName)
        {
            LoadSections();
            if (!SectionNames.Contains(sectionName))
            {
                throw new Exception("No section called '" + sectionName + "'");
            }
            if (string.IsNullOrWhiteSpace(sectionText[sectionName]))
            {
                return("");
            }
            XDocument xdoc = XDocument.Parse(sectionText[sectionName]);

            if (xdoc.Declaration == null)
            {
                return(xdoc.ToString());
            }
            else
            {
                return(xdoc.Declaration.ToString() + "\r\n" + xdoc.ToString());
            }
        }
コード例 #5
0
 public bool SetSectionText(string sectionName, string text)
 {
     LoadSections();
     if (!SectionNames.Contains(sectionName))
     {
         throw new Exception("No section called '" + sectionName + "'");
     }
     if (text != sectionText[sectionName])
     {
         IsChanged = true;
     }
     sectionText[sectionName] = text;
     bytesInSync = false;
     if (string.IsNullOrWhiteSpace(text))
     {
         deleteSection(sectionName);
     }
     else
     {
         setSectionBytes(sectionName);
     }
     return(true);
 }