Monobjc.MSBuild.Tasks.CodeSigning.PerformSigning C# (CSharp) Method

PerformSigning() protected method

Performs the signing.
protected PerformSigning ( String identity ) : bool
identity String The identity.
return bool
        protected override bool PerformSigning(String identity)
        {
            ITaskItem[] items;
            if (this.Bundle != null) {
                items = new ITaskItem[]{this.Bundle};
            } else if (this.Target != null) {
                items = new ITaskItem[]{this.Target};
            } else if (this.Targets != null) {
                items = this.Targets;
            } else {
                // TODO: I18N
                this.Log.LogMessage("No element to sign.");
                return true;
            }

            // Gather all the paths
            IList<String> paths;
            if (this.Versioned) {
                // If the items are versioned, then add all the versions
                paths = new List<String>();
                foreach (ITaskItem item in items) {
                    String path = item.GetMetadata("FullPath");
                    String root = Path.Combine(path, "Versions");
                    String[] versions = Directory.GetDirectories(root);
                    foreach(String version in versions) {
                        if (Path.GetFileName(version) == "Current") {
                            continue;
                        }
                        paths.Add(version);
                    }
                }
            } else {
                // If the items are not versioned, then directly add the paths
                paths = items.Select(item => item.GetMetadata("FullPath")).ToList();
            }

            String entitlements = null;
            if (this.UseEntitlements && this.Entitlements != null && File.Exists (this.Entitlements.GetMetadata("FullPath"))) {
                entitlements = this.Entitlements.GetMetadata("FullPath");
            }

            foreach (String path in paths) {
                using (StringWriter outputWriter = new StringWriter()) {
                    using (StringWriter errorWriter = new StringWriter()) {
                        CodeSign.PerformSigning (path, identity, entitlements, outputWriter, errorWriter);
                        String outputLog = outputWriter.ToString ();
                        String errorLog = errorWriter.ToString ();
                        this.Log.LogMessage (outputLog);
                        this.Log.LogMessage (errorLog);
                    }
                }
            }
            return true;
        }
CodeSigning