Ejemplo n.º 1
0
 public Service(SupportedService id, string name, string api_key, string secret, string pref)
 {
     Id             = id;
     ApiKey         = api_key;
     Secret         = secret;
     Name           = name;
     PreferencePath = pref;
 }
Ejemplo n.º 2
0
            public static Service FromSupported(SupportedService id)
            {
                foreach (Service s in Supported)
                {
                    if (s.Id == id)
                    {
                        return(s);
                    }
                }

                throw new System.ArgumentException("Unknown service type");
            }
Ejemplo n.º 3
0
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection       = selection;
            this.current_service = FlickrRemote.Service.FromSupported(service);

            IconView view = new IconView(selection);

            view.DisplayTags  = display_tags;
            view.DisplayDates = false;

            xml = new Glade.XML(null, "FlickrExport.glade", dialog_name, "f-spot");
            xml.Autoconnect(this);

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            HandleSizeActive(null, null);

            public_radio.Toggled    += HandlePublicChanged;
            tag_check.Toggled       += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged(null, null);
            HandleHierarchyChanged(null, null);

            Dialog.ShowAll();
            Dialog.Response       += HandleResponse;
            auth_flickr.Clicked   += HandleClicked;
            auth_text              = string.Format(auth_label.Text, current_service.Name);
            auth_label.Text        = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference(SCALE_KEY);
            LoadPreference(SIZE_KEY);
            LoadPreference(BROWSER_KEY);
            LoadPreference(TAGS_KEY);
            LoadPreference(TAG_HIERARCHY_KEY);
            LoadPreference(IGNORE_TOP_LEVEL_KEY);
            LoadPreference(STRIP_META_KEY);
            LoadPreference(PUBLIC_KEY);
            LoadPreference(FAMILY_KEY);
            LoadPreference(FRIENDS_KEY);
            LoadPreference(current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote(token, current_service);
            if (token != null && token.Length > 0)
            {
                StartAuth();
            }
        }
Ejemplo n.º 4
0
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection  = selection;
            current_service = FlickrRemote.Service.FromSupported(service);

            var view = new TrayView(selection);

            view.DisplayTags  = display_tags;
            view.DisplayDates = false;

            builder = new GtkBeans.Builder(null, "flickr_export.ui", null);
            builder.Autoconnect(this);

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            HandleSizeActive(null, null);

            public_radio.Toggled    += HandlePublicChanged;
            tag_check.Toggled       += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged(null, null);
            HandleHierarchyChanged(null, null);

            Dialog.ShowAll();
            Dialog.Response       += HandleResponse;
            auth_flickr.Clicked   += HandleClicked;
            auth_text              = string.Format(auth_label.Text, current_service.Name);
            auth_label.Text        = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference(SCALE_KEY);
            LoadPreference(SIZE_KEY);
            LoadPreference(BROWSER_KEY);
            LoadPreference(TAGS_KEY);
            LoadPreference(TAG_HIERARCHY_KEY);
            LoadPreference(IGNORE_TOP_LEVEL_KEY);
            LoadPreference(PUBLIC_KEY);
            LoadPreference(FAMILY_KEY);
            LoadPreference(FRIENDS_KEY);
            LoadPreference(current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote(token, current_service);
            if (!string.IsNullOrEmpty(token))
            {
                StartAuth();
            }
        }
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection       = selection;
            this.current_service = FlickrRemote.Service.FromSupported(service);

            IconView view = new IconView(selection);

            view.DisplayTags  = display_tags;
            view.DisplayDates = false;

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            HandleSizeActive(null, null);

            public_radio.Toggled += HandlePublicChanged;

            Dialog.ShowAll();
            Dialog.Response     += HandleResponse;
            auth_flickr.Clicked += HandleClicked;
            auth_text            = string.Format(auth_label.Text, current_service.Name);
            auth_label.Text      = auth_text;

            LoadPreference(Preferences.EXPORT_FLICKR_SCALE);
            LoadPreference(Preferences.EXPORT_FLICKR_SIZE);
            LoadPreference(Preferences.EXPORT_FLICKR_BROWSER);
            LoadPreference(Preferences.EXPORT_FLICKR_TAGS);
            LoadPreference(Preferences.EXPORT_FLICKR_STRIP_META);
            LoadPreference(Preferences.EXPORT_FLICKR_PUBLIC);
            LoadPreference(Preferences.EXPORT_FLICKR_FAMILY);
            LoadPreference(Preferences.EXPORT_FLICKR_FRIENDS);
            LoadPreference(current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote(token, current_service);
            if (token != null && token.Length > 0)
            {
                StartAuth();
            }
        }
Ejemplo n.º 6
0
 public FlickrExport(SupportedService service, IBrowsableCollection selection, bool display_tags) : this()
 {
     Run(service, selection, display_tags);
 }
        /// <summary>
        /// Loads FlickrConfigurationSettings with the settings in the config file.
        /// </summary>
        /// <param name="configNode">XmlNode containing the configuration settings.</param>
        public FlickrConfigurationSettings(XmlNode configNode)
        {
            if (configNode == null) throw new ArgumentNullException("configNode");

            foreach (XmlAttribute attribute in configNode.Attributes)
            {
                switch (attribute.Name)
                {
                    case "apiKey":
                        apiKey = attribute.Value;
                        break;
                    case "secret":
                        apiSecret = attribute.Value;
                        break;
                    case "token":
                        apiToken = attribute.Value;
                        break;
                    case "cacheDisabled":
                        try
                        {
                            cacheDisabled = bool.Parse(attribute.Value);
                            break;
                        }
                        catch (FormatException ex)
                        {
                            throw new System.Configuration.ConfigurationErrorsException("cacheDisbled should be \"true\" or \"false\"", ex, configNode);
                        }
                    case "cacheSize":
                        try
                        {
                            cacheSize = int.Parse(attribute.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                            break;
                        }
                        catch (FormatException ex)
                        {
                            throw new System.Configuration.ConfigurationErrorsException("cacheSize should be integer value", ex, configNode);
                        }
                    case "cacheTimeout":
                        try
                        {
                            cacheTimeout = TimeSpan.Parse(attribute.Value);
                            break;
                        }
                        catch (FormatException ex)
                        {
                            throw new System.Configuration.ConfigurationErrorsException("cacheTimeout should be TimeSpan value ([d:]HH:mm:ss)", ex, configNode);
                        }
                    case "cacheLocation":
                        cacheLocation = attribute.Value;
                        break;

                    case "service":
                        try
                        {
                            service = (SupportedService)Enum.Parse(typeof(SupportedService), attribute.Value, true);
                            break;
                        }
                        catch (ArgumentException ex)
                        {
                            throw new System.Configuration.ConfigurationErrorsException("service must be one of the supported services (See SupportedServices enum)", ex, configNode);
                        }

                    default:
                        throw new System.Configuration.ConfigurationErrorsException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Unknown attribute '{0}' in flickrNet node", attribute.Name), configNode);
                }
            }

            foreach (XmlNode node in configNode.ChildNodes)
            {
                switch (node.Name)
                {
                    case "proxy":
                        ProcessProxyNode(node, configNode);
                        break;
                    default:
                        throw new System.Configuration.ConfigurationErrorsException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Unknown node '{0}' in flickrNet node", node.Name), configNode);
                }
            }
        }
        /// <summary>
        /// Loads FlickrConfigurationSettings with the settings in the config file.
        /// </summary>
        /// <param name="configNode">XmlNode containing the configuration settings.</param>
        public FlickrConfigurationSettings(XmlNode configNode)
        {
            if (configNode == null)
            {
                throw new ArgumentNullException("configNode");
            }

            foreach (XmlAttribute attribute in configNode.Attributes)
            {
                switch (attribute.Name)
                {
                case "apiKey":
                    apiKey = attribute.Value;
                    break;

                case "secret":
                    apiSecret = attribute.Value;
                    break;

                case "token":
                    apiToken = attribute.Value;
                    break;

                case "cacheDisabled":
                    try
                    {
                        cacheDisabled = bool.Parse(attribute.Value);
                        break;
                    }
                    catch (FormatException ex)
                    {
                        throw new System.Configuration.ConfigurationErrorsException("cacheDisbled should be \"true\" or \"false\"", ex, configNode);
                    }

                case "cacheSize":
                    try
                    {
                        cacheSize = int.Parse(attribute.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    }
                    catch (FormatException ex)
                    {
                        throw new System.Configuration.ConfigurationErrorsException("cacheSize should be integer value", ex, configNode);
                    }

                case "cacheTimeout":
                    try
                    {
                        cacheTimeout = TimeSpan.Parse(attribute.Value);
                        break;
                    }
                    catch (FormatException ex)
                    {
                        throw new System.Configuration.ConfigurationErrorsException("cacheTimeout should be TimeSpan value ([d:]HH:mm:ss)", ex, configNode);
                    }

                case "cacheLocation":
                    cacheLocation = attribute.Value;
                    break;

                case "service":
                    try
                    {
                        service = (SupportedService)Enum.Parse(typeof(SupportedService), attribute.Value, true);
                        break;
                    }
                    catch (ArgumentException ex)
                    {
                        throw new System.Configuration.ConfigurationErrorsException(
                                  "service must be one of the supported services (See SupportedServices enum)", ex, configNode);
                    }

                default:
                    throw new System.Configuration.ConfigurationErrorsException(
                              String.Format(
                                  System.Globalization.CultureInfo.InvariantCulture,
                                  "Unknown attribute '{0}' in flickrNet node", attribute.Name), configNode);
                }
            }

            foreach (XmlNode node in configNode.ChildNodes)
            {
                switch (node.Name)
                {
                case "proxy":
                    ProcessProxyNode(node, configNode);
                    break;

                default:
                    throw new System.Configuration.ConfigurationErrorsException(
                              String.Format(System.Globalization.CultureInfo.InvariantCulture,
                                            "Unknown node '{0}' in flickrNet node", node.Name), configNode);
                }
            }
        }
Ejemplo n.º 9
0
 public FlickrExport(SupportedService service, IBrowsableCollection selection, bool display_tags)
     : this()
 {
     Run (service, selection, display_tags);
 }
Ejemplo n.º 10
0
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection = selection;
            this.current_service = FlickrRemote.Service.FromSupported (service);

            IconView view = new IconView (selection);
            view.DisplayTags = display_tags;
            view.DisplayDates = false;

            xml = new Glade.XML (null, "FlickrExport.glade", dialog_name, "f-spot");
            xml.Autoconnect (this);

            Dialog.Modal = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add (view);
            HandleSizeActive (null, null);

            public_radio.Toggled += HandlePublicChanged;
            tag_check.Toggled += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged (null, null);
            HandleHierarchyChanged (null, null);

            Dialog.ShowAll ();
            Dialog.Response += HandleResponse;
            auth_flickr.Clicked += HandleClicked;
            auth_text = string.Format (auth_label.Text, current_service.Name);
            auth_label.Text = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference (SCALE_KEY);
            LoadPreference (SIZE_KEY);
            LoadPreference (BROWSER_KEY);
            LoadPreference (TAGS_KEY);
            LoadPreference (TAG_HIERARCHY_KEY);
            LoadPreference (IGNORE_TOP_LEVEL_KEY);
            LoadPreference (STRIP_META_KEY);
            LoadPreference (PUBLIC_KEY);
            LoadPreference (FAMILY_KEY);
            LoadPreference (FRIENDS_KEY);
            LoadPreference (current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote (token, current_service);
            if (token != null && token.Length > 0) {
                StartAuth ();
            }
        }
Ejemplo n.º 11
0
            public static Service FromSupported(SupportedService id)
            {
                foreach (Service s in Supported) {
                if (s.Id == id)
                    return s;
                }

                throw new System.ArgumentException ("Unknown service type");
            }
Ejemplo n.º 12
0
 public Service(SupportedService id, string name, string api_key, string secret, string pref)
 {
     Id = id;
     ApiKey = api_key;
     Secret = secret;
     Name = name;
     PreferencePath = pref;
 }
Ejemplo n.º 13
0
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection = selection;
            current_service = FlickrRemote.Service.FromSupported (service);

            var view = new TrayView (selection);
            view.DisplayTags = display_tags;
            view.DisplayDates = false;

            builder = new GtkBeans.Builder (null, "flickr_export.ui", null);
            builder.Autoconnect (this);

            Dialog.Modal = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add (view);
            HandleSizeActive (null, null);

            public_radio.Toggled += HandlePublicChanged;
            tag_check.Toggled += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged (null, null);
            HandleHierarchyChanged (null, null);

            Dialog.ShowAll ();
            Dialog.Response += HandleResponse;
            auth_flickr.Clicked += HandleClicked;
            auth_text = string.Format (auth_label.Text, current_service.Name);
            auth_label.Text = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference (SCALE_KEY);
            LoadPreference (SIZE_KEY);
            LoadPreference (BROWSER_KEY);
            LoadPreference (TAGS_KEY);
            LoadPreference (TAG_HIERARCHY_KEY);
            LoadPreference (IGNORE_TOP_LEVEL_KEY);
            LoadPreference (PUBLIC_KEY);
            LoadPreference (FAMILY_KEY);
            LoadPreference (FRIENDS_KEY);
            LoadPreference (current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote (token, current_service);
            if (!string.IsNullOrEmpty (token)) {
                StartAuth ();
            }
        }
Ejemplo n.º 14
0
		public void Run (SupportedService service, IBrowsableCollection selection, bool display_tags)
		{
			this.selection = selection;
			this.current_service = FlickrRemote.Service.FromSupported (service);

			IconView view = new IconView (selection);
			view.DisplayTags = display_tags;
			view.DisplayDates = false;

			Dialog.Modal = false;
			Dialog.TransientFor = null;

			thumb_scrolledwindow.Add (view);
			HandleSizeActive (null, null);
			
			public_radio.Toggled += HandlePublicChanged;

			Dialog.ShowAll ();
			Dialog.Response += HandleResponse;
			auth_flickr.Clicked += HandleClicked;
			auth_text = string.Format (auth_label.Text, current_service.Name);
			auth_label.Text = auth_text;

			LoadPreference (Preferences.EXPORT_FLICKR_SCALE);
			LoadPreference (Preferences.EXPORT_FLICKR_SIZE);
			LoadPreference (Preferences.EXPORT_FLICKR_BROWSER);
			LoadPreference (Preferences.EXPORT_FLICKR_TAGS);
			LoadPreference (Preferences.EXPORT_FLICKR_STRIP_META);
			LoadPreference (Preferences.EXPORT_FLICKR_PUBLIC);
			LoadPreference (Preferences.EXPORT_FLICKR_FAMILY);
			LoadPreference (Preferences.EXPORT_FLICKR_FRIENDS);
			LoadPreference (current_service.PreferencePath);

			do_export_flickr.Sensitive = false;
			fr = new FlickrRemote (token, current_service);
			if (token != null && token.Length > 0) {
				StartAuth ();
			}
		}
Ejemplo n.º 15
0
 public FlickrConfigurationSettings(XmlNode configNode)
 {
     if (configNode == null)
     throw new ArgumentNullException("configNode");
       foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) configNode.Attributes)
       {
     switch (xmlAttribute.Name)
     {
       case "apiKey":
     this.apiKey = xmlAttribute.Value;
     continue;
       case "secret":
     this.apiSecret = xmlAttribute.Value;
     continue;
       case "token":
     this.apiToken = xmlAttribute.Value;
     continue;
       case "cacheDisabled":
     try
     {
       this.cacheDisabled = bool.Parse(xmlAttribute.Value);
       continue;
     }
     catch (FormatException ex)
     {
       throw new ConfigurationErrorsException("cacheDisbled should be \"true\" or \"false\"", (Exception) ex, configNode);
     }
       case "cacheSize":
     try
     {
       this.cacheSize = int.Parse(xmlAttribute.Value, (IFormatProvider) NumberFormatInfo.InvariantInfo);
       continue;
     }
     catch (FormatException ex)
     {
       throw new ConfigurationErrorsException("cacheSize should be integer value", (Exception) ex, configNode);
     }
       case "cacheTimeout":
     try
     {
       this.cacheTimeout = TimeSpan.Parse(xmlAttribute.Value);
       continue;
     }
     catch (FormatException ex)
     {
       throw new ConfigurationErrorsException("cacheTimeout should be TimeSpan value ([d:]HH:mm:ss)", (Exception) ex, configNode);
     }
       case "cacheLocation":
     this.cacheLocation = xmlAttribute.Value;
     continue;
       case "service":
     try
     {
       this.service = (SupportedService) Enum.Parse(typeof (SupportedService), xmlAttribute.Value, true);
       continue;
     }
     catch (ArgumentException ex)
     {
       throw new ConfigurationErrorsException("service must be one of the supported services (See SupportedServices enum)", (Exception) ex, configNode);
     }
       default:
     throw new ConfigurationErrorsException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Unknown attribute '{0}' in flickrNet node", new object[1]
     {
       (object) xmlAttribute.Name
     }), configNode);
     }
       }
       foreach (XmlNode proxy in configNode.ChildNodes)
       {
     switch (proxy.Name)
     {
       case "proxy":
     this.ProcessProxyNode(proxy, configNode);
     continue;
       default:
     throw new ConfigurationErrorsException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Unknown node '{0}' in flickrNet node", new object[1]
     {
       (object) proxy.Name
     }), configNode);
     }
       }
 }