当前位置: 首页>>代码示例>>C#>>正文


C# Manifest.Write方法代码示例

本文整理汇总了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);
 }
开发者ID:peyman-abdi,项目名称:unity_agents,代码行数:15,代码来源:AndroidManifestEditor.cs

示例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);
            }
        }
开发者ID:sebmarkbage,项目名称:signapk,代码行数:45,代码来源:SignApk.cs


注:本文中的Manifest.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。