本文整理汇总了C#中SIL.Tool.PublicationInformation类的典型用法代码示例。如果您正苦于以下问题:C# PublicationInformation类的具体用法?C# PublicationInformation怎么用?C# PublicationInformation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PublicationInformation类属于SIL.Tool命名空间,在下文中一共展示了PublicationInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOpf
/// <summary>
/// Generates the manifest and metadata information file used by the .epub reader
/// (content.opf). For more information, refer to <see cref="http://www.idpf.org/doc_library/epub/OPF_2.0.1_draft.htm#Section2.0"/>
/// </summary>
/// <param name="projInfo">Project information</param>
/// <param name="contentFolder">Content folder (.../OEBPS)</param>
/// <param name="bookId">Unique identifier for the book we're generating.</param>
public void CreateOpf(PublicationInformation projInfo, string contentFolder, Guid bookId)
{
XmlWriter opf = XmlWriter.Create(Common.PathCombine(contentFolder, "content.opf"));
opf.WriteStartDocument();
// package name
opf.WriteStartElement("package", "http://www.idpf.org/2007/opf");
opf.WriteAttributeString("version", "2.0");
opf.WriteAttributeString("unique-identifier", "BookId");
// metadata - items defined by the Dublin Core Metadata Initiative:
Metadata(projInfo, bookId, opf);
StartManifest(opf);
if (_parent.EmbedFonts)
{
ManifestFontEmbed(opf);
}
string[] files = Directory.GetFiles(contentFolder);
ManifestContent(opf, files, "epub2");
Spine(opf, files);
Guide(projInfo, opf, files, "epub2");
opf.WriteEndElement(); // package
opf.WriteEndDocument();
opf.Close();
}
示例2: SourceTargetFile
private string SourceTargetFile(PublicationInformation projInfo)
{
string sourceFile = "";
sourceFile = projInfo.DefaultXhtmlFileWithPath.Replace(".xhtml", "_1.xhtml");
File.Copy(projInfo.DefaultXhtmlFileWithPath, sourceFile, true);
return sourceFile;
}
示例3: Export
/// <summary>
/// Entry point for epub 3 converter
/// </summary>
/// <param name="projInfo">values passed including epub2 exported files and changed to epub3 support</param>
/// <returns>true if succeeds</returns>
public bool Export(PublicationInformation projInfo)
{
bool epub3Export = false;
string oebpsPath = Common.PathCombine(Epub3Directory, "OEBPS");
string cssFile = Common.PathCombine(oebpsPath, "book.css");
var preProcessor = new PreExportProcess();
preProcessor.ReplaceStringInFile(cssFile, "{direction:ltr}", "{direction:ltr;}");
preProcessor.ReplaceStringInFile(cssFile, "direction:", "dir:");
//preProcessor.RemoveStringInCss(cssFile, "direction:");
var xhmltohtml5Space = Loadxhmltohtml5Xslt(projInfo.ProjectInputType.ToLower());
Convertxhtmltohtml5(oebpsPath, xhmltohtml5Space);
ModifyContainerXML();
ModifyContentOPF(projInfo, oebpsPath);
ModifyTocContent(oebpsPath);
ModifyCoverpage(oebpsPath);
epub3Export = true;
return epub3Export;
}
示例4: SetUp
protected void SetUp()
{
Common.Testing = true;
//_styleName = new Styles();
//_util = new Utility();
_projInfo = new PublicationInformation();
_errorFile = Common.PathCombine(Path.GetTempPath(), "temp.odt");
_progressBar = new ProgressBar();
string testPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles");
_inputPath = Common.PathCombine(testPath, "input");
_outputPath = Common.PathCombine(testPath, "output");
_expectedPath = Common.PathCombine(testPath, "expected");
//if (Directory.Exists(_outputPath))
//{
// Directory.Delete(_outputPath, true);
//}
Common.DeleteDirectory(_outputPath);
Directory.CreateDirectory(_outputPath);
FolderTree.Copy(FileInput("Pictures"), FileOutput("Pictures"));
_projInfo.ProgressBar = _progressBar;
_projInfo.OutputExtension = "odt";
_projInfo.ProjectInputType = "Dictionary";
_projInfo.IsFrontMatterEnabled = false;
_projInfo.FinalOutput = "odt";
Common.SupportFolder = "";
Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFIles");
Common.ProgBase = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFiles"); // for masterDocument
_styleFile = "styles.xml";
_contentFile = "content.xml";
_isLinux = Common.IsUnixOS();
}
示例5: InitializeData
private void InitializeData(PublicationInformation projInfo,
Dictionary<string, Dictionary<string, string>> idAllClass,
Dictionary<string, ArrayList> classFamily, ArrayList cssClassOrder)
{
_outputExtension = projInfo.OutputExtension;
_allStyle = new Stack<string>();
_allParagraph = new Stack<string>();
_allCharacter = new Stack<string>();
_childStyle = new Dictionary<string, string>();
IdAllClass = new Dictionary<string, Dictionary<string, string>>();
ParentClass = new Dictionary<string, string>();
_newProperty = new Dictionary<string, Dictionary<string, string>>();
_displayBlock = new Dictionary<string, string>();
_cssClassOrder = cssClassOrder;
_sourcePicturePath = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath);
_projectPath = projInfo.TempOutputFolder;
IdAllClass = idAllClass;
_classFamily = classFamily;
_isNewParagraph = false;
_characterName = "None";
}
示例6: SetUpAll
protected void SetUpAll()
{
Common.Testing = true;
Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles");
Common.SupportFolder = "";
Common.ProgBase = Common.ProgInstall;
_projInfo = new PublicationInformation();
_testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles");
_inputPath = Common.PathCombine(_testFolderPath, "input");
_outputPath = Common.PathCombine(_testFolderPath, "output");
_expectedPath = Common.PathCombine(_testFolderPath, "expected");
if (Directory.Exists(_outputPath))
Directory.Delete(_outputPath, true);
Directory.CreateDirectory(_outputPath);
_projInfo.ProjectPath = _testFolderPath;
_projInfo.OutputExtension = "odt";
string pathwayDirectory = PathwayPath.GetPathwayDir();
string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml");
ValidateXMLVersion(styleSettingFile);
Common.ProgInstall = pathwayDirectory;
Param.LoadSettings();
Param.SetValue(Param.InputType, "Scripture");
Param.LoadSettings();
}
示例7: Launch
public static bool Launch(string type, PublicationInformation publicationInformation)
{
string xhtmlFile = publicationInformation.DefaultXhtmlFileWithPath;
CreateVerbose(publicationInformation);
var localType = type.Replace(@"\", "/").ToLower();
try
{
foreach (IExportProcess process in _backend)
{
if (process.ExportType.ToLower() == "openoffice/libreoffice")
localType = OpenOfficeClassifier(publicationInformation, localType); // Cross checking for OpenOffice
if (process.ExportType.ToLower() == localType.ToLower())
return process.Export(publicationInformation);
}
}
catch(Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
publicationInformation.DefaultXhtmlFileWithPath = xhtmlFile;
ShowVerbose(publicationInformation);
}
return false;
}
示例8: InsertMacroVariable
public void InsertMacroVariable(PublicationInformation projInfo, IDictionary<string, Dictionary<string, string>> cssClass)
{
var textContent = new StringBuilder();
ArrayList insertVariable = new ArrayList();
if (projInfo.ProjectInputType == null)
projInfo.ProjectInputType = "Dictionary"; //TODO
_cssClass = cssClass;
//Create and copy file to temp folder
supportFileFolder = Common.PathCombine(Common.GetPSApplicationPath(), "InDesignFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType);
projInfo.TempOutputFolder = Common.PathCombine(Path.GetTempPath(), "InDesignFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType);
CopyFolderWithFiles(supportFileFolder, projInfo.TempOutputFolder);
//Same macro is used for dictionary and scripture
var scriptsFolder = Common.PathCombine(Common.GetPSApplicationPath(), "InDesignFiles/Dictionary/Scripts");
CopyFolderWithFiles(scriptsFolder, Common.PathCombine(projInfo.TempOutputFolder, "scripts"));
strMacroPath = Common.PathCombine(projInfo.TempOutputFolder, "Scripts/Startup Scripts/PlaceFrames.jsx");
ReadFile(false, textContent);
insertVariable.Add(GetColumnRule());
insertVariable.Add(GetBorderRule());
insertVariable.Add(GetMarginValue());
insertVariable.Add(GetCropMarks());
insertVariable.Add(GetIndexTab(projInfo.ProjectInputType));
WriteFile(textContent, insertVariable);
CopySupportFolder(projInfo);
//Copy pictures to IndesignFiles folder (inside Stories folder)
var pictureFolder = Common.PathCombine(projInfo.DictionaryPath, "Pictures");
if (File.Exists(pictureFolder))
CopyFolderWithFiles(pictureFolder, Common.PathCombine(projInfo.TempOutputFolder, "Pictures"));
}
示例9: SetUpAll
protected void SetUpAll()
{
Common.Testing = true;
Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles");
Common.SupportFolder = "";
Common.ProgBase = Common.ProgInstall;
_isLinux = Common.IsUnixOS();
_projInfo = new PublicationInformation();
string testPath = PathPart.Bin(Environment.CurrentDirectory, "/XeLatex/TestFiles");
_inputPath = Common.PathCombine(testPath, "input");
_outputPath = Common.PathCombine(testPath, "output");
if (_isLinux)
{
_expectedPath = Common.PathCombine(testPath, "LinuxExpected");
}
else
{
_expectedPath = Common.PathCombine(testPath, "Expected");
}
if (Directory.Exists(_outputPath))
Directory.Delete(_outputPath, true);
Directory.CreateDirectory(_outputPath);
_projInfo.ProjectPath = testPath;
_classInlineStyle = new Dictionary<string, List<string>>();
string pathwayDirectory = PathwayPath.GetPathwayDir();
string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml");
ValidateXMLVersion(styleSettingFile);
Common.ProgInstall = pathwayDirectory;
Param.LoadSettings();
Param.SetValue(Param.InputType, "Scripture");
Param.LoadSettings();
}
示例10: LoadXmlDocument
protected static XmlDocument LoadXmlDocument(PublicationInformation projInfo)
{
var xml = new XmlDocument {XmlResolver = FileStreamXmlResolver.GetNullResolver()};
var streamReader = new StreamReader(projInfo.DefaultXhtmlFileWithPath);
xml.Load(streamReader);
streamReader.Close();
return xml;
}
示例11: RemoveAfterBefore
public void RemoveAfterBefore(PublicationInformation projInfo, Dictionary<string, Dictionary<string, string>> idAllClass, Dictionary<string, ArrayList> classFamily, ArrayList cssClassOrder)
{
InitializeData(projInfo, idAllClass, classFamily, cssClassOrder);
string sourceFile = SourceTargetFile(projInfo);
OpenXhtmlFile(sourceFile); //reader
CreateFile(projInfo); //writer
InsertBeforeAfter();
}
示例12: InitializeLangArray
public string[] InitializeLangArray(PublicationInformation projInfo)
{
_langFontDictionary = new Dictionary<string, string>();
_embeddedFonts = new Dictionary<string, EmbeddedFont>();
BuildLanguagesList(projInfo.DefaultXhtmlFileWithPath);
var langArray = new string[_langFontDictionary.Keys.Count];
_langFontDictionary.Keys.CopyTo(langArray, 0);
return langArray;
}
示例13: DictionaryForMidsProperties
public DictionaryForMidsProperties(PublicationInformation projInfo, DictionaryForMIDsStyle contentStyles)
{
var myPath = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath);
Debug.Assert(myPath != null);
_styles = contentStyles;
Sw = new StreamWriter(Common.PathCombine(myPath, "DictionaryForMIDs.properties"));
DictionaryAbbreviation = "SIL";
Language1NumberOfContentDeclarations = _styles.NumStyles;
}
示例14: AddHeadwordWithPicturePresentTest
public void AddHeadwordWithPicturePresentTest()
{
PublicationInformation projInfo = new PublicationInformation();
projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("hornbill.xhtml");
var input = new DictionaryForMIDsInput(projInfo);
var sense = input.SelectNodes("//*[@class = 'entry']//*[@id]")[0];
var rec = new DictionaryForMIDsRec();
rec.AddHeadword(sense);
Assert.AreEqual("dagol ", rec.Rec);
}
示例15: GoBibleRearrangeVerseAlphaNumericTest
public void GoBibleRearrangeVerseAlphaNumericTest()
{
string filename = "GoBibleRearrangeVerseAlphaNumeric.xhtml";
string input = GetFileNameWithPath(filename);
PublicationInformation projInfo = new PublicationInformation();
projInfo.DefaultXhtmlFileWithPath = input;
preExportProcess = new PreExportProcess(projInfo);
string expected = GetFileNameWithExpectedPath(filename);
string output = preExportProcess.GoBibleRearrangeVerseNumbers(projInfo.DefaultXhtmlFileWithPath);
XmlAssert.AreEqual(expected, output, "");
}