コード例 #1
0
        public Dictionary <string, object> PlistRepresentation()
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict.SetValueForKey(Name, "Name");
            dict.SetValueForKey(Convert.ToBase64String(PublicKey), "PublicKey");
            dict.SetValueForKey(Convert.ToBase64String(PrivateKey), "PrivateKey");

            return(dict);
        }
コード例 #2
0
        public Dictionary<string, object> PlistRepresentation()
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();

            dict.SetValueForKey(Name, "Name");
            dict.SetValueForKey(Convert.ToBase64String(PublicKey), "PublicKey");
            dict.SetValueForKey(Convert.ToBase64String(PrivateKey), "PrivateKey");

            return dict;
        }
コード例 #3
0
        private static Dictionary <string, string> DictionaryForProfileItem(string key, string displayKey, string value, string displayValue)
        {
            Dictionary <string, string> item = new Dictionary <string, string>();

            item.SetValueForKey(key, SUConstants.SUProfileItemKeyKey);
            item.SetValueForKey(displayKey, SUConstants.SUProfileItemDisplayKeyKey);
            item.SetValueForKey(value, SUConstants.SUProfileItemValueKey);
            item.SetValueForKey(displayValue, SUConstants.SUProfileItemDisplayValueKey);

            return(item);
        }
コード例 #4
0
        protected virtual void VerifySignature()
        {
            // Verify in the background, since it can take a while.
            BackgroundWorker verifySignatureWorker = new BackgroundWorker();

            verifySignatureWorker.DoWork             += VerifySignatureInBackground;
            verifySignatureWorker.RunWorkerCompleted += VerifySignatureCompleted;

            Dictionary <string, object> verifyArguments = new Dictionary <string, object>();

            verifyArguments.SetValueForKey(downloadPath, "SUDownloadPath");
            verifyArguments.SetValueForKey(Host.PublicDSAKey, "SUPublicDSAKey");
            verifyArguments.SetValueForKey(updateItem.DSASignature, "SUUpdateSignature");

            verifySignatureWorker.RunWorkerAsync(verifyArguments);
        }
コード例 #5
0
 public static void AddUnarchiverForFileType(SUUnarchiver unarchiver, string fileType)
 {
     if (unarchiverCache == null)
     {
         unarchiverCache = new Dictionary <string, SUUnarchiver>();
     }
     unarchiverCache.SetValueForKey(unarchiver, fileType);
 }
コード例 #6
0
 public static void AddInstallerForFileType(SUInstaller installer, string fileType)
 {
     if (installerCache == null)
     {
         installerCache = new Dictionary <string, SUInstaller>();
     }
     installerCache.SetValueForKey(installer, fileType);
 }
コード例 #7
0
        private void AppcastWasDownloaded(Object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                ReportError(e.Error);
            }
            else
            {
                XmlNodeList xmlItems = null;

                try {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(e.Result);
                    xmlItems = doc.SelectNodes("/rss/channel/item");
                } catch (Exception ex) {
                    ReportError(ex);
                    return;
                }

                List <SUAppcastItem> appcastItems = new List <SUAppcastItem>();

                foreach (XmlNode node in xmlItems)
                {
                    Dictionary <string, ArrayList> nodesDict       = new Dictionary <string, ArrayList>();
                    Dictionary <string, Object>    itemDescription = new Dictionary <string, object>();

                    // Create a dictionary of nodes for each name present,
                    // so we can parse by xml:lang later.

                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        string    nodeName     = childNode.Name;
                        ArrayList nodesForName = null;
                        if (!nodesDict.TryGetValue(nodeName, out nodesForName))
                        {
                            nodesForName = new ArrayList();
                            nodesDict.Add(nodeName, nodesForName);
                        }
                        nodesForName.Add(childNode);
                    }


                    foreach (string itemKey in nodesDict.Keys)
                    {
                        ArrayList nodes = null;
                        nodesDict.TryGetValue(itemKey, out nodes);

                        XmlNode bestNodeForKey = BestNodeInNodes(nodes);

                        if (bestNodeForKey.Name.Equals("enclosure"))
                        {
                            // enclosure is flattened as a separate dictionary for some reason
                            Dictionary <string, string> enclosureDict = new Dictionary <string, string>();

                            foreach (XmlAttribute attribute in bestNodeForKey.Attributes)
                            {
                                enclosureDict.SetValueForKey(attribute.InnerText, attribute.Name);
                            }
                            itemDescription.SetValueForKey(enclosureDict, "enclosure");
                        }
                        else if (bestNodeForKey.Name.Equals("pubDate"))
                        {
                            try {
                                DateTime date = DateTime.Parse(bestNodeForKey.InnerText);
                                itemDescription.SetValueForKey(date, bestNodeForKey.Name);
                            } catch {
                                // Nothing
                            }
                        }
                        else
                        {
                            itemDescription.SetValueForKey(bestNodeForKey.InnerText.Trim(), bestNodeForKey.Name);
                        }
                    }

                    try {
                        SUAppcastItem item = new SUAppcastItem(itemDescription);
                        appcastItems.Add(item);
                    } catch {
                    }
                }

                appcastItems.Sort();
                appcastItems.Reverse(); // new to old

                Items = appcastItems;

                if (Delegate != null)
                {
                    Delegate.AppcastDidFinishLoading(this);
                }
            }
        }
コード例 #8
0
        protected virtual void VerifySignature()
        {
            // Verify in the background, since it can take a while.
            BackgroundWorker verifySignatureWorker = new BackgroundWorker();
            verifySignatureWorker.DoWork += VerifySignatureInBackground;
            verifySignatureWorker.RunWorkerCompleted += VerifySignatureCompleted;

            Dictionary<string, object> verifyArguments = new Dictionary<string, object>();
            verifyArguments.SetValueForKey(downloadPath, "SUDownloadPath");
            verifyArguments.SetValueForKey(Host.PublicDSAKey, "SUPublicDSAKey");
            verifyArguments.SetValueForKey(updateItem.DSASignature, "SUUpdateSignature");

            verifySignatureWorker.RunWorkerAsync(verifyArguments);
        }