コード例 #1
0
 private void WriteLdml(WritingSystemDefinitionV1 writingSystemDefinitionV1, string sourceFilePath, string destinationFilePath)
 {
     using (Stream sourceStream = new FileStream(sourceFilePath, FileMode.Open))
     {
         var ldmlDataMapper = new LdmlAdaptorV1();
         ldmlDataMapper.Write(destinationFilePath, writingSystemDefinitionV1, sourceStream, _roundTripBogusFlex70PrivateUse);
         sourceStream.Close();
     }
 }
コード例 #2
0
 public void Write_WritePrivateUseWsFromFieldWorksLdmlThenNormalLdml_ContainsVersion2()
 {
     using (TempFile badFlexLdml = new TempFile(),
            version1Ldml = new TempFile())
     {
         var namespaceManager = new XmlNamespaceManager(new NameTable());
         namespaceManager.AddNamespace("palaso", "urn://palaso.org/ldmlExtensions/v1");
         using (var writer = new StreamWriter(badFlexLdml.Path, false, Encoding.UTF8))
         {
             writer.Write(LdmlContentForTests.Version0("x-en", "", "", "x-private"));
         }
         var wsV0    = new WritingSystemDefinitionV1();
         var adaptor = new LdmlAdaptorV1();
         adaptor.Read(badFlexLdml.Path, wsV0);
         adaptor.Write(badFlexLdml.Path, wsV0, new MemoryStream(File.ReadAllBytes(badFlexLdml.Path)));
         var wsV1 = new WritingSystemDefinitionV1();
         adaptor.Write(version1Ldml.Path, wsV1, null);
         var versionReader = new WritingSystemLdmlVersionGetter();
         Assert.That(versionReader.GetFileVersion(version1Ldml.Path), Is.EqualTo(2));
     }
 }
コード例 #3
0
		private void WriteLdml(WritingSystemDefinitionV1 writingSystemDefinitionV1, string sourceFilePath, string destinationFilePath)
		{
			using (Stream sourceStream = new FileStream(sourceFilePath, FileMode.Open))
			{
				var ldmlDataMapper = new LdmlAdaptorV1();
				ldmlDataMapper.Write(destinationFilePath, writingSystemDefinitionV1, sourceStream, _roundTripBogusFlex70PrivateUse);
				sourceStream.Close();
			}
		}