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


C# SafeUri.ToString方法代码示例

本文整理汇总了C#中Hyena.SafeUri.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SafeUri.ToString方法的具体用法?C# SafeUri.ToString怎么用?C# SafeUri.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hyena.SafeUri的用法示例。


在下文中一共展示了SafeUri.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsValid

        static bool IsValid(SafeUri uri, Pixbuf pixbuf)
        {
            if (pixbuf == null) {
                return false;
            }

            if (pixbuf.GetOption (ThumbUriOpt) != uri.ToString ()) {
                return false;
            }

            var file = GLib.FileFactory.NewForUri (uri);
            if (!file.Exists)
                return false;

            var info = file.QueryInfo ("time::modified", GLib.FileQueryInfoFlags.None, null);

            if (pixbuf.GetOption (ThumbMTimeOpt) != info.GetAttributeULong ("time::modified").ToString ()) {
                return false;
            }

            return true;
        }
开发者ID:modulexcite,项目名称:f-spot,代码行数:22,代码来源:XdgThumbnailSpec.cs

示例2: CleanUpUrl

 /// <summary>
 /// Cleans up live365 session data from a track url
 /// </summary>
 /// <param name="url">
 /// A <see cref="SafeUri"/> -- the original url to be cleaned
 /// </param>
 /// <returns>
 /// A <see cref="SafeUri"/> -- the cleaned url
 /// </returns>
 public override SafeUri CleanUpUrl(SafeUri url)
 {
     if (url.ToString ().Contains ("session_id"))
     {
         int pos = url.ToString ().IndexOf ("session_id");
         string new_url = url.ToString ().Substring (0, pos - 1);
         return new SafeUri (new_url);
     }
     return url;
 }
开发者ID:dgupta,项目名称:banshee-community-extension-fakefork-,代码行数:19,代码来源:Live365Plugin.cs

示例3: AttemptToAddTrackToDevice

        private void AttemptToAddTrackToDevice(DatabaseTrackInfo track, SafeUri fromUri)
        {
            if (!Banshee.IO.File.Exists (fromUri)) {
                throw new FileNotFoundException (Catalog.GetString ("File not found"), fromUri.ToString ());
            }

            // Ensure there's enough space
            if (BytesAvailable - Banshee.IO.File.GetSize (fromUri) >= 0) {
                // Ensure it's not already on the device
                if (ServiceManager.DbConnection.Query<long> (track_on_dap_query, DbId, track.MetadataHash) == 0) {
                    AddTrackToDevice (track, fromUri);
                }
            }
        }
开发者ID:knocte,项目名称:banshee,代码行数:14,代码来源:DapSource.cs

示例4: RssLoader

            public RssLoader(UriCollection collection, SafeUri uri)
            {
                XmlDocument doc = new XmlDocument ();
                doc.Load (uri.ToString ());
                XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable);
                ns.AddNamespace ("media", "http://search.yahoo.com/mrss/");
                ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/");
                ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers");

                List<FilePhoto> items = new List<FilePhoto> ();
                XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns);
                foreach (XmlNode item in list) {
                    SafeUri image_uri = new SafeUri (item.Attributes ["url"].Value);
                    Hyena.Log.DebugFormat ("flickr uri = {0}", image_uri.ToString ());
                    items.Add (new FilePhoto (image_uri));
                }

                if (list.Count < 1) {
                    list = doc.SelectNodes ("/rss/channel/item/pheed:imgsrc", ns);
                    foreach (XmlNode item in list) {
                        SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
                        Hyena.Log.DebugFormat ("pheed uri = {0}", uri);
                        items.Add (new FilePhoto (image_uri));
                    }
                }

                if (list.Count < 1) {
                    list = doc.SelectNodes ("/rss/channel/item/apple:image", ns);
                    foreach (XmlNode item in list) {
                        SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
                        Hyena.Log.DebugFormat ("apple uri = {0}", uri);
                        items.Add (new FilePhoto (image_uri));
                    }
                }
                collection.Add (items.ToArray ());
            }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:36,代码来源:UriCollection.cs

示例5: UpdateFolderTree

        /*
         * UpdateFolderTree queries for directories in database and updates
         * a possibly existing folder-tree to the queried structure
         */
        private void UpdateFolderTree()
        {
            Clear ();

            count_all = 0;

            /* points at start of each iteration to the leaf of the last inserted uri */
            TreeIter iter = TreeIter.Zero;

            /* stores the segments of the last inserted uri */
            string[] last_segments = new string[] {};

            int last_count = 0;

            IDataReader reader = database.Database.Query (query_string);

            while (reader.Read ()) {
                var base_uri = new SafeUri (reader["base_uri"].ToString (), true);

                int count = Convert.ToInt32 (reader["count"]);

                // FIXME: this is a workaround hack to stop things from crashing - https://bugzilla.gnome.org/show_bug.cgi?id=622318
                int index = base_uri.ToString ().IndexOf ("://");
                var hack = base_uri.ToString ().Substring (index + 3);
                hack = hack.IndexOf ('/') == 0 ? hack : "/" + hack;
                string[] segments = hack.TrimEnd ('/').Split ('/');

                /* First segment contains nothing (since we split by /), so we
                 * can overwrite the first segment for our needs and put the
                 * scheme here.
                 */
                segments[0] = base_uri.Scheme;

                int i = 0;

                /* find first difference of last inserted an current uri */
                while (i < last_segments.Length && i < segments.Length) {
                    if (segments[i] != last_segments[i])
                        break;

                    i++;
                }

                /* points to the parent node of the current iter */
                TreeIter parent_iter = iter;

                /* step back to the level, where the difference occur */
                for (int j = 0; j + i < last_segments.Length; j++) {

                    iter = parent_iter;

                    if (IterParent (out parent_iter, iter)) {
                        last_count += (int)GetValue (parent_iter, 1);
                        SetValue (parent_iter, 1, last_count);
                    } else
                        count_all += (int)last_count;
                }

                while (i < segments.Length) {
                    if (IterIsValid (parent_iter)) {
                        iter =
                            AppendValues (parent_iter,
                                          Uri.UnescapeDataString (segments[i]),
                                          (segments.Length - 1 == i)? count : 0,
                                          (GetValue (parent_iter, 2) as SafeUri).Append (String.Format ("{0}/", segments[i]))
                                          );
                    } else {
                        iter =
                            AppendValues (Uri.UnescapeDataString (segments[i]),
                                          (segments.Length - 1 == i)? count : 0,
                                          new SafeUri (String.Format ("{0}:///", base_uri.Scheme), true));
                    }

                    parent_iter = iter;

                    i++;
                }

                last_count = count;
                last_segments = segments;

            }

            if (IterIsValid (iter)) {
                /* and at least, step back and update photo count */
                while (IterParent (out iter, iter)) {
                    last_count += (int)GetValue (iter, 1);
                    SetValue (iter, 1, last_count);
                }
                count_all += last_count;
            }
        }
开发者ID:GNOME,项目名称:f-spot,代码行数:96,代码来源:FolderTreeModel.cs

示例6: IsValid

		// internal for unit testing with Moq
		internal bool IsValid (SafeUri uri, Pixbuf pixbuf)
		{
			if (pixbuf == null) {
				return false;
			}

			if (pixbuf.GetOption (ThumbUriOpt) != uri.ToString ()) {
				return false;
			}

			if (!fileSystem.File.Exists (uri))
				return false;

			var mTime = fileSystem.File.GetMTime (uri);
			return pixbuf.GetOption (ThumbMTimeOpt) == mTime.ToString ();
		}
开发者ID:mono,项目名称:f-spot,代码行数:17,代码来源:ThumbnailService.cs

示例7: CreateUriId

 private static string CreateUriId(SafeUri uri)
 {
     string digestible = uri.ToString ();
     return CreateId ("unknown", digestible);
 }
开发者ID:kelsieflynn,项目名称:banshee,代码行数:5,代码来源:CoverArtSpec.cs


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