FileDetails LoadIntro() { FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 1. Intro</b><p/>"); } if (_morning) { //string filebase = string.Format("{0}.{1}", _base, _baseName[PrayerSect.Intro]); //string filename = string.Format("{0}.{1}", filebase, _fileEnd); string filenamePart2 = string.Format("{0}.{1}", _baseName[PrayerSect.Intro], _fileEnd); fileDetails.Add(base.LoadIntro(filenamePart2)); // Load 1.Intro.morning/evening_opening.txt string filename = string.Format("{0}.{1}", _base, filenamePart2); fileDetails.Add(LoadFile(filename, PrayerSect.Intro)); } else { fileDetails.Add(base.LoadIntro("")); // Load 1.Intro.morning/evening_opening.txt } return(fileDetails); }
override protected FileDetails LoadPraise() { string filebase = string.Format("{0}.{1}", _base, _baseName[PrayerSect.Praise]); //string fileEnd = string.Format("ordinary{0}.{1}{2}.txt", _week,_sectionOfDay, _dayNo); string filename = ""; if (_dayInMonth >= 17 && _month == 12 && _dayNo != "1") { filename = string.Format("{0}.opening_hymn._17_31Dec.{1}.txt", filebase, _sectionOfDay); } else { filename = string.Format("{0}.opening_hymn.{1}", filebase, _fileEnd); } //string text = LoadFile(filename); FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 2. Praise</b><p/>"); } fileDetails.Add(LoadFile(filename, PrayerSect.Praise)); int weekNo = Int32.Parse(_weekNo) % 4; if (weekNo == 0) { weekNo = 4; } string fileEnd = string.Format("advent{0}.{1}{2}.txt", weekNo, _sectionOfDay, _dayNo); string psalmsFilename = string.Format("{0}.psalms.{1}", filebase, fileEnd); //fileEnd = string.Format("_17_31Dec.{1}{2}.txt", filebase, _sectionOfDay, _dayNo); if (_dayInMonth >= 17 && _month == 12) { //fileEnd = string.Format("_17_31Dec.{0}{1}.txt", _sectionOfDay, _dayNo); if (_dayNo != "1") { fileEnd = string.Format("_17_31Dec.week{0}.{1}{2}.txt", weekNo, _sectionOfDay, _dayNo); } else { fileEnd = string.Format("_17_31Dec.{0}_Dec_{1}.txt", _dayInMonth, _sectionOfDay); } } else { fileEnd = _fileEnd; } string refrainsFilename = string.Format("{0}.refrains.{1}", filebase, fileEnd); fileDetails.Add(LoadRefrainAndPsalms(refrainsFilename, psalmsFilename)); return(fileDetails); }
FileDetails SundayOfJesusAscending() { FileDetails fileDetails = new FileDetails(); string filebase = string.Format("{0}.{1}", _base, _baseName[PrayerSect.Praise]); string filename = string.Format("{0}.opening_hymn.pentecost.txt", filebase); fileDetails.Add(LoadFile(filename, PrayerSect.Praise)); filename = string.Format("{0}.psalms.pentecost.txt", filebase); fileDetails.Add(LoadFile(filename, PrayerSect.Praise)); filename = string.Format("{0}.refrains.pentecost.txt", filebase); fileDetails.Add(LoadFile(filename, PrayerSect.Praise)); return(fileDetails); }
FileDetails LoadIntro() { //am/pm opening, am psalm, am refrain. FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 1. Intro</b><p/>"); } if (_morning) { String filenamePart2 = string.Format("{0}.advent.morning.txt", _baseName[PrayerSect.Intro]); fileDetails.Add(base.LoadIntro(filenamePart2)); // Load 1.Intro.morning/evening_opening.txt string filename = string.Format("{0}.{1}", _base, filenamePart2); fileDetails.Add(LoadFile(filename, PrayerSect.Intro)); } return(fileDetails); }
// Contents are embedded in SARIF. Create a file from these contents. internal string CreateFileFromContents(string fileName) { var fileData = FileDetails[fileName]; string finalPath = TemporaryFilePath; // If the file path already starts with the temporary location, // that means we've already built the temporary file, so we can // just open it. if (fileName.StartsWith(finalPath)) { finalPath = fileName; } // Else we have to create a location under the temp path. else { // Strip off the leading drive letter and backslash (e.g., "C:\"), if present. if (Path.IsPathRooted(fileName)) { string pathRoot = Path.GetPathRoot(fileName); fileName = fileName.Substring(pathRoot.Length); } if (fileName.StartsWith("/") || fileName.StartsWith("\\")) { fileName = fileName.Substring(1); } // Combine all paths into the final. // Sha256Hash is guaranteed to exist. When SARIF file is read, only files // with Sha256 hashes are added to the FileDetails dictionary. finalPath = Path.Combine(finalPath, fileData.Sha256Hash, fileName); } string directory = Path.GetDirectoryName(finalPath); Directory.CreateDirectory(directory); if (!_fileSystem.FileExists(finalPath)) { string contents = fileData.GetContents(); _fileSystem.WriteAllText(finalPath, contents); // File should be readonly, because it is embedded. _fileSystem.SetAttributes(finalPath, FileAttributes.ReadOnly); } if (!FileDetails.ContainsKey(finalPath)) { // Add another key to our file data object, so that we can // find it if the user closes the window and reopens it. FileDetails.Add(finalPath, fileData); } return(finalPath); }
override protected FileDetails LoadPraise() { FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 2. Praise</b><p/>"); } string filebase = string.Format("{0}.{1}", _base, _baseName[PrayerSect.Praise]); string openHymnFilename = string.Format("{0}.opening_hymn.{1}", filebase, _fileEnd); string psalmsFilename = string.Format("{0}.psalms.{1}", filebase, _psalmEnd); string refrainsFilename = string.Format("{0}.refrains.{1}", filebase, _refrainEnd); System.Diagnostics.Debug.WriteLine($"{_Tag}.LoadPraise({openHymnFilename}, \n\t\t{psalmsFilename}, \n\t\t{refrainsFilename})"); fileDetails.Add(LoadFile(openHymnFilename, PrayerSect.Praise)); fileDetails.Add(LoadRefrainAndPsalms(refrainsFilename, psalmsFilename)); return(fileDetails); }
protected override FileDetails LoadPraise() { FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 2. Praise</b><p/>"); } string filebase = string.Format("{0}.{1}", _base, _baseName[PrayerSect.Praise]); string filename = string.Format("{0}.opening_hymn.{1}.txt", filebase, _sectionOfDay); // just morning/evening here fileDetails.Add(LoadFile(filename, PrayerSect.Praise)); string psalmsFilename = string.Format("{0}.psalms.{1}", filebase, _fileEnd); string refrainsFilename = string.Format("{0}.refrains.{1}", filebase, _fileEnd); fileDetails.Add(LoadRefrainAndPsalms(refrainsFilename, psalmsFilename)); return(fileDetails); }
protected override FileDetails LoadPraise() { FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 2. Praise</b><p/>"); } if (_weekNo == "7" && _dayNo == "1" && _morning) { // This Ascending morning opening is actually a special refrain for the Sunday when we celebrate Jesus ascending to Heaven. // This feast takes place on the 7th Sunday of Easter. fileDetails.Add(SundayOfJesusAscending()); } else { fileDetails.Add(base.LoadPraise()); } return(fileDetails); }
public override FileDetails LoadText(PrayerSect pSect) { //_fileEnd = string.Format("feasts.{0}_{1}.txt", GetSeasonString(), _sectionOfDay); _fileEnd = string.Format("feasts.{0}", GetSeasonString(_sectionOfDay)); //if (!_fileEnd.EndsWith(".txt")) // Debug.WriteLine($"{_Tag}.LoadText: _fileEnd = {_fileEnd}"); FileDetails fileDetails = new FileDetails(); if (pSect == PrayerSect.AllSections) { fileDetails.Add(LoadIntro()); fileDetails.Add(LoadPraise()); fileDetails.Add(base.LoadText(pSect)); } else { switch (pSect) { case PrayerSect.Intro: fileDetails.Add(LoadIntro()); break; case PrayerSect.Praise: fileDetails.Add(LoadPraise()); break; default: fileDetails.Add(base.LoadText(pSect)); break; } } return(fileDetails); }
public override FileDetails LoadText(PrayerSect pSect) { _fileEnd = string.Format("easter{0}.{1}{2}.txt", _weekNo, _sectionOfDay, _dayNo); FileDetails fileDetails = new FileDetails(); if (pSect == PrayerSect.AllSections) { fileDetails.Add(LoadIntro()); fileDetails.Add(LoadPraise()); fileDetails.Add(base.LoadText(pSect)); } else { switch (pSect) { case PrayerSect.Intro: fileDetails.Add(LoadIntro()); break; case PrayerSect.Praise: fileDetails.Add(LoadPraise()); break; default: fileDetails.Add(base.LoadText(pSect)); break; } } return(fileDetails); }
FileDetails LoadIntro() { FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 1. Intro</b><p/>"); } if (_morning) { string filenamePart2 = string.Format("{0}.ordinary{1}.refrain{2}.txt", _baseName[PrayerSect.Intro], _week, _dayNo); fileDetails.Add(base.LoadIntro(filenamePart2)); // Load 1.Intro.morning/evening_opening.txt string filename = string.Format("{0}.{1}", _base, filenamePart2); fileDetails.Add(LoadFile(filename, PrayerSect.Intro)); } else { fileDetails.Add(base.LoadIntro("")); } return(fileDetails); }
public override FileDetails LoadText(PrayerSect pSect) { if (_dayInMonth == 25 || _dayInMonth == 26) { _fileEnd = string.Format("_17_31Dec.{0}_Dec_{1}.txt", _dayInMonth, _sectionOfDay); } else { _fileEnd = string.Format("xmas{0}.{1}{2}.txt", _week, _sectionOfDay, _dayNo); } _psalmEnd = string.Format("advent{0}.{1}{2}.txt", _week, _sectionOfDay, _dayNo); _refrainEnd = string.Format("_17_31Dec.week{0}.{1}{2}.txt", _week, _sectionOfDay, _dayNo); if (!string.IsNullOrEmpty(_filename)) { System.Diagnostics.Debug.WriteLine($"{_Tag}.LoadText({pSect.ToString()}) - _filename = {_filename}"); } System.Diagnostics.Debug.WriteLine($"{_Tag}.LoadText({pSect.ToString()}) - FileEnd = {_fileEnd}"); FileDetails fileDetails = new FileDetails(); if (pSect == PrayerSect.AllSections) { fileDetails.Add(LoadIntro()); fileDetails.Add(LoadPraise()); fileDetails.Add(base.LoadText(pSect)); } else { switch (pSect) { case PrayerSect.Intro: fileDetails.Add(LoadIntro()); break; case PrayerSect.Praise: fileDetails.Add(LoadPraise()); break; default: fileDetails.Add(base.LoadText(pSect)); break; } } return(fileDetails); }
override protected FileDetails LoadResponse() { string filename = ""; if (_dayInMonth >= 17 && _month == 12 && _dayNo != "1") { filename = string.Format("{0}.{1}._17_31Dec.{2}.txt", _base, _baseName[PrayerSect.Response], _sectionOfDay); } else { filename = string.Format("{0}.{1}.{2}", _base, _baseName[PrayerSect.Response], _fileEnd); } FileDetails fileDetails = new FileDetails(); if (_testMode) { fileDetails.AddText($"<p/><b>{_Tag} - 3. Response</b><p/>"); } fileDetails.Add(LoadFile(filename, PrayerSect.Response)); return(fileDetails); }
public override FileDetails LoadText(PrayerSect pSect) { int weekNo = Int32.Parse(_weekNo) % 5; if (weekNo == 0) { weekNo = 5; } _fileEnd = string.Format("holy_week.{0}{1}.txt", _sectionOfDay, _dayNo); FileDetails fileDetails = new FileDetails(); if (pSect == PrayerSect.AllSections) { fileDetails.Add(LoadIntro()); fileDetails.Add(LoadPraise()); fileDetails.Add(base.LoadText(pSect)); } else { switch (pSect) { case PrayerSect.Intro: fileDetails.Add(LoadIntro()); break; case PrayerSect.Praise: fileDetails.Add(LoadPraise()); break; default: fileDetails.Add(base.LoadText(pSect)); break; } } return(fileDetails); }
public override FileDetails LoadText(PrayerSect pSect) { int weekNo = Int32.Parse(_weekNo) % 4; if (weekNo == 0) { weekNo = 4; } _fileEnd = string.Format("ordinary{0}.{1}{2}.txt", weekNo, _sectionOfDay, _dayNo); string ordFileEnd = CreateOrdFilename(); FileDetails fileDetails = new FileDetails(); if (pSect == PrayerSect.AllSections) { fileDetails.Add(LoadIntro()); fileDetails.Add(LoadPraise()); fileDetails.Add(LoadWordOfGod()); fileDetails.Add(LoadResponse()); fileDetails.Add(LoadCanticles(ordFileEnd)); fileDetails.Add(LoadPrayers()); fileDetails.Add(LoadConclusion(ordFileEnd)); } else { switch (pSect) { case PrayerSect.Intro: fileDetails.Add(LoadIntro()); break; case PrayerSect.Praise: fileDetails.Add(LoadPraise()); break; case PrayerSect.WordOfGod: fileDetails.Add(LoadWordOfGod()); break; case PrayerSect.Response: fileDetails.Add(LoadResponse()); break; case PrayerSect.Canticles: fileDetails.Add(LoadCanticles(ordFileEnd)); break; case PrayerSect.Prayers: fileDetails.Add(LoadPrayers()); break; case PrayerSect.Conclusion: fileDetails.Add(LoadConclusion(ordFileEnd)); break; default: break; } } return(fileDetails); }
public override FileDetails LoadText(PrayerSect pSect) { int weekNo = Int32.Parse(_weekNo) % 4; if (weekNo == 0) { weekNo = 4; } //if (_dayInMonth >= 17 && _month == 12 && _dayNo != "1") //{ // if >= 17 Dec, and NOT a Sunday, take file from 17_31Dec folder // _fileEnd = string.Format("_17_31Dec.{0}_Dec_{1}.txt", _dayInMonth, _sectionOfDay); //_fileEnd = string.Format("_17_31Dec.week{0}.{1}{2}.txt", weekNo, _sectionOfDay, _dayNo); //} if (_dayInMonth >= 17 && _month == 12) { //fileEnd = string.Format("_17_31Dec.{0}{1}.txt", _sectionOfDay, _dayNo); if (_dayNo == "1") { _fileEnd = string.Format("_17_31Dec.{0}_Dec_{1}.txt", _dayInMonth, _sectionOfDay); } else { _fileEnd = string.Format("_17_31Dec.week{0}.{1}{2}.txt", weekNo, _sectionOfDay, _dayNo); } } else { _fileEnd = string.Format("advent{0}.{1}{2}.txt", weekNo, _sectionOfDay, _dayNo); } FileDetails fileDetails = new FileDetails(); if (pSect == PrayerSect.AllSections) { fileDetails.Add(LoadIntro()); fileDetails.Add(LoadPraise()); fileDetails.Add(LoadWordOfGod()); fileDetails.Add(LoadResponse()); fileDetails.Add(LoadCanticles(_fileEnd)); fileDetails.Add(LoadPrayers()); fileDetails.Add(LoadConclusion(_fileEnd)); } else { switch (pSect) { case PrayerSect.Intro: fileDetails.Add(LoadIntro()); break; case PrayerSect.Praise: fileDetails.Add(LoadPraise()); break; case PrayerSect.WordOfGod: fileDetails.Add(LoadWordOfGod()); break; case PrayerSect.Response: fileDetails.Add(LoadResponse()); break; case PrayerSect.Canticles: fileDetails.Add(LoadCanticles(_fileEnd)); break; case PrayerSect.Prayers: fileDetails.Add(LoadPrayers()); break; case PrayerSect.Conclusion: fileDetails.Add(LoadConclusion(_fileEnd)); break; case PrayerSect.AllSections: default: break; } } return(fileDetails); }