本文整理汇总了C#中Manifest.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Manifest.Write方法的具体用法?C# Manifest.Write怎么用?C# Manifest.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest.Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveManifestToFile
public static void SaveManifestToFile(string path, Manifest m)
{
if (!System.IO.Directory.Exists(Manifest.ManifestFolder))
System.IO.Directory.CreateDirectory(Manifest.ManifestFolder);
XmlTextWriter writer = new XmlTextWriter(path, System.Text.Encoding.UTF8);
writer.Indentation = 4;
writer.Formatting = Formatting.Indented;
writer.Settings.NewLineHandling = NewLineHandling.Entitize;
writer.Settings.NewLineOnAttributes = true;
writer.WriteStartDocument();
writer.WriteComment("This file is generated by Android Manifest Editor (created by Peyman Abdi peyman[at]nemo-games[dot]com).");
m.Write(writer);
writer.Close();
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
}
示例2: writeSignatureFile
/** Write a .SF file with a digest of the specified manifest. */
private static void writeSignatureFile(Manifest manifest, Stream out_)
{
Manifest sf = new Manifest();
Attributes main = sf.MainAttributes;
main.Add("Signature-Version", "1.0");
main.Add("Created-By", "1.0 (Android SignApk)");
DigestOutputStream digestStream = new DigestOutputStream("SHA1");
StreamWriter print = new StreamWriter(digestStream, new UTF8Encoding());
// Digest of the entire manifest
manifest.Write(digestStream);
print.Flush();
main.Add("SHA1-Digest-Manifest", Convert.ToBase64String(digestStream.Hash));
IDictionary<String, Attributes> entries = manifest.Entries;
foreach (var entry in entries)
{
// Digest of the manifest stanza for this entry.
print.Write("Name: " + entry.Key + "\r\n");
foreach (var att in entry.Value)
{
print.Write(att.Key + ": " + att.Value + "\r\n");
}
print.Write("\r\n");
print.Flush();
Attributes sfAttr = new Attributes();
sfAttr.Add("SHA1-Digest", Convert.ToBase64String(digestStream.Hash));
sf.Entries.Add(entry.Key, sfAttr);
}
sf.Write(out_);
// A bug in the java.util.jar implementation of Android platforms
// up to version 1.6 will cause a spurious IOException to be thrown
// if the length of the signature file is a multiple of 1024 bytes.
// As a workaround, add an extra CRLF in this case.
if ((out_.Length % 1024) == 0)
{
var b = Encoding.UTF8.GetBytes("\r\n");
out_.Write(b, 0, b.Length);
}
}