public static SUUnarchiver UnarchiverForPath(string archivePath) { if (unarchiverCache != null && unarchiverCache.ContainsKey(Path.GetExtension(archivePath))) { return((SUUnarchiver)unarchiverCache.ValueForKey(Path.GetExtension(archivePath))); } return(null); }
public static SUInstaller InstallerForFile(string path) { if (installerCache != null && installerCache.ContainsKey(Path.GetExtension(path))) { return((SUInstaller)installerCache.ValueForKey(Path.GetExtension(path))); } return(null); }
public void ObserveValueForKeyPathOfObject(string keyPath, object obj, Dictionary<string, object> change, object context) { if (keyPath.Equals("IsActive")) { if (IsActive) { DropShadowEffect effect = new DropShadowEffect(); effect.BlurRadius = 3.0; effect.Color = Colors.Black; effect.Direction = 90.0; effect.ShadowDepth = 0.0; Effect = effect; } else { DropShadowEffect effect = new DropShadowEffect(); effect.BlurRadius = 2.0; effect.Color = Colors.DarkGray; effect.Direction = 90.0; effect.ShadowDepth = 0.0; Effect = null; } InvalidateVisual(); } else if (keyPath.Equals("RepresentedObject")) { KNTabViewItem oldItem = (KNTabViewItem)change.ValueForKey(KNKVOConstants.KNKeyValueChangeOldKey); if (oldItem != null) { oldItem.RemoveObserverFromKeyPath(this, "Title"); oldItem.RemoveObserverFromKeyPath(this, "Icon"); oldItem.RemoveObserverFromKeyPath(this, "TintColor"); } KNTabViewItem newItem = (KNTabViewItem)change.ValueForKey(KNKVOConstants.KNKeyValueChangeNewKey); if (newItem != null) { newItem.AddObserverToKeyPathWithOptions(this, "Title", 0, null); newItem.AddObserverToKeyPathWithOptions(this, "Icon", 0, null); newItem.AddObserverToKeyPathWithOptions(this, "TintColor", 0, null); } formattedText = null; InvalidateVisual(); } else if (keyPath.Equals("Title")) { EventHandler<EventArgs> handler = TabMayWantNewSize; if (handler != null) { handler(this, null); } formattedText = null; InvalidateVisual(); } else if (keyPath.Equals("Icon")) { EventHandler<EventArgs> handler = TabMayWantNewSize; if (handler != null) { handler(this, null); } InvalidateVisual(); } else if (keyPath.Equals("TintColor")) { InvalidateVisual(); } }
public void ObserveValueForKeyPathOfObject(string keyPath, object obj, Dictionary<string, object> change, object context) { if (keyPath.Equals("TabHeight") || keyPath.Equals("LeftControl")) { UpdateTabViewLayout(); InvalidateArrange(); } else if (keyPath.Equals("ActiveItem")) { if (ActiveItem != null && ActiveItem.ViewController != null) { contentCanvas.Child = ActiveItem.ViewController.View; ActiveItem.ViewController.ViewWillBeShown(); } else { contentCanvas.Child = null; } if (ActiveItem.TintColor == Color.FromArgb(0,0,0,0)) { contentCanvas.Background = new SolidColorBrush(kDefaultTintColor); } else { contentCanvas.Background = new SolidColorBrush(ActiveItem.TintColor); } UpdateTabViewLayout(); InvalidateArrange(); } else if (keyPath.Equals("Items")) { KNTabViewItem[] oldItems = (KNTabViewItem[])change.ValueForKey(KNKVOConstants.KNKeyValueChangeOldKey); if (oldItems != null) { foreach (KNTabViewItem item in oldItems) { RemoveTabForItem(item); } } KNTabViewItem[] newItems = (KNTabViewItem[])change.ValueForKey(KNKVOConstants.KNKeyValueChangeNewKey); if (newItems != null) { foreach (KNTabViewItem item in newItems) { CreateTabForItem(item); } if (newItems.Length > 0) { ActiveItem = newItems[0]; } } UpdateTabViewLayout(); InvalidateArrange(); } }
public SUAppcastItem(Dictionary <string, object> dict) { Dictionary <string, string> enclosure = (Dictionary <string, string>)dict.ValueForKey("enclosure"); // Try to find a version string. // Finding the new version number from the RSS feed is a little bit hacky. There are two ways: // 1. A "sparkle:version" attribute on the enclosure tag, an extension from the RSS spec. // 2. If there isn't a version attribute, Sparkle will parse the path in the enclosure, expecting // that it will look like this: http://something.com/YourApp_0.5.zip. It'll read whatever's between the last // underscore and the last period as the version number. So name your packages like this: APPNAME_VERSION.extension. // The big caveat with this is that you can't have underscores in your version strings, as that'll confuse Sparkle. // Feel free to change the separator string to a hyphen or something more suited to your needs if you like. string newVersion = (string)enclosure.ValueForKey("sparkle:version"); if (newVersion == null) { string[] components = ((string)enclosure.ValueForKey("url")).Split('_'); if (components.Count() > 1) { newVersion = Path.GetFileNameWithoutExtension(components.Last()); } } if (enclosure == null || enclosure.ValueForKey("url") == null || newVersion == null) { throw new Exception("Item doesn't contain version information."); } else { Title = (string)dict.ValueForKey("title"); Date = (DateTime)dict.ValueForKey("pubDate"); ItemDescription = (string)dict.ValueForKey("description"); FileURL = new Uri((string)enclosure.ValueForKey("url")); DSASignature = (string)enclosure.ValueForKey("sparkle:dsaSignature"); VersionString = newVersion; MinimumSystemVersion = (string)enclosure.ValueForKey("sparkle:minimumSystemVersion"); string shortVersionString = (string)enclosure.ValueForKey("sparkle:shortVersionString"); if (shortVersionString != null) { DisplayVersionString = shortVersionString; } else { DisplayVersionString = VersionString; } if (enclosure.ContainsKey("sparkleDotNET:executableType")) { ExecutableType = (string)enclosure.ValueForKey("sparkleDotNET:executableType"); } if (enclosure.ContainsKey("sparkleDotNET:primaryInstallationFile")) { PrimaryInstallationFile = (string)enclosure.ValueForKey("sparkleDotNET:primaryInstallationFile"); } if (dict.ContainsKey("sparkle:releaseNotesLink")) { ReleaseNotesURL = new Uri((string)dict.ValueForKey("sparkle:releaseNotesLink")); } else if (ItemDescription.Substring(0, 7).Equals("http://")) { ReleaseNotesURL = new Uri(ItemDescription); } } }
public UpdateSigningKey(Dictionary <string, object> plistRep) { Name = (string)plistRep.ValueForKey("Name"); PublicKey = Convert.FromBase64String((string)plistRep.ValueForKey("PublicKey")); PrivateKey = Convert.FromBase64String((string)plistRep.ValueForKey("PrivateKey")); }
public UpdateSigningKey(Dictionary<string, object> plistRep) { Name = (string)plistRep.ValueForKey("Name"); PublicKey = Convert.FromBase64String((string)plistRep.ValueForKey("PublicKey")); PrivateKey = Convert.FromBase64String((string)plistRep.ValueForKey("PrivateKey")); }