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


C# SafeUri.Equals方法代码示例

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


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

示例1: PreferenceDialog

        public PreferenceDialog(Window parent)
            : base("PreferenceDialog.ui", "preference_dialog")
        {
            TransientFor = parent;

            //Photos Folder
            photosdir_chooser.SetCurrentFolderUri (FSpot.Core.Global.PhotoUri);

            SafeUri storage_path = new SafeUri (Preferences.Get<string> (Preferences.STORAGE_PATH));

            //If the user has set a photo directory on the commandline then don't let it be changed in Preferences
            if (storage_path.Equals(FSpot.Core.Global.PhotoUri))
                photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged;
            else
                photosdir_chooser.Sensitive = false;

            //Write Metadata
            LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
            LoadPreference (Preferences.METADATA_ALWAYS_USE_SIDECAR);

            //Screen profile
            ListStore sprofiles = new ListStore (typeof (string), typeof (int));
            sprofiles.AppendValues (Catalog.GetString ("None"), 0);
            if (FSpot.ColorManagement.XProfile != null)
                sprofiles.AppendValues (Catalog.GetString ("System profile"), -1);
            sprofiles.AppendValues (null, 0);

            //Pick the display profiles from the full list, avoid _x_profile_
            var dprofs = from profile in FSpot.ColorManagement.Profiles
                where (profile.Value.DeviceClass == Cms.IccProfileClass.Display && profile.Key != "_x_profile_")
                select profile;
            foreach (var p in dprofs)
                sprofiles.AppendValues (p.Key, 1);

            CellRendererText profilecellrenderer = new CellRendererText ();
            profilecellrenderer.Ellipsize = Pango.EllipsizeMode.End;

            screenprofile_combo.Model = sprofiles;
            screenprofile_combo.PackStart (profilecellrenderer, true);
            screenprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc;
            screenprofile_combo.SetCellDataFunc (profilecellrenderer, ProfileCellFunc);
            LoadPreference (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE);

            //Print profile
            ListStore pprofiles = new ListStore (typeof (string), typeof (int));
            pprofiles.AppendValues (Catalog.GetString ("None"), 0);
            pprofiles.AppendValues (null, 0);

            var pprofs = from profile in FSpot.ColorManagement.Profiles
                where (profile.Value.DeviceClass == Cms.IccProfileClass.Output && profile.Key != "_x_profile_")
                select profile;
            foreach (var p in pprofs)
                pprofiles.AppendValues (p.Key, 1);

            printprofile_combo.Model = pprofiles;
            printprofile_combo.PackStart (profilecellrenderer, true);
            printprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc;
            printprofile_combo.SetCellDataFunc (profilecellrenderer, ProfileCellFunc);
            LoadPreference (Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE);

            //Theme chooser
            ListStore themes = new ListStore (typeof (string), typeof (string));
            themes.AppendValues (Catalog.GetString ("Standard theme"), null);
            themes.AppendValues (null, null); //Separator
            string gtkrc = System.IO.Path.Combine ("gtk-2.0", "gtkrc");
            string [] search = {System.IO.Path.Combine (FSpot.Core.Global.HomeDirectory, ".themes"), "/usr/share/themes"};
            foreach (string path in search)
                if (System.IO.Directory.Exists (path))
                    foreach (string dir in System.IO.Directory.GetDirectories (path))
                        if (File.Exists (System.IO.Path.Combine (dir, gtkrc)))
                            themes.AppendValues (System.IO.Path.GetFileName (dir), System.IO.Path.Combine (dir, gtkrc));
            CellRenderer themecellrenderer = new CellRendererText ();
            theme_combo.Model = themes;
            theme_combo.PackStart (themecellrenderer, true);
            theme_combo.RowSeparatorFunc = ThemeSeparatorFunc;
            theme_combo.SetCellDataFunc (themecellrenderer, ThemeCellFunc);
            LoadPreference (Preferences.GTK_RC);

            ConnectEvents ();
        }
开发者ID:Yetangitu,项目名称:f-spot,代码行数:80,代码来源:PreferenceDialog.cs

示例2: RenameFile

        private bool RenameFile (DatabaseTrackInfo track)
        {
            SafeUri old_uri = track.Uri;
            bool in_library = old_uri.AbsolutePath.StartsWith (musicLibrarySource.BaseDirectoryWithSeparator);

            if (!in_library) {
                return false;
            }

            string new_filename = track.PathPattern.BuildFull (musicLibrarySource.BaseDirectory, track, System.IO.Path.GetExtension (old_uri.ToString ()));
            SafeUri new_uri = new SafeUri (new_filename);

            if (!new_uri.Equals (old_uri) && !Banshee.IO.File.Exists (new_uri)) {
                Banshee.IO.File.Move (old_uri, new_uri);
                Banshee.IO.Utilities.TrimEmptyDirectories (old_uri);
                track.Uri = new_uri;
                return true;
            }

            return false;
        }
开发者ID:petejohanson,项目名称:banshee,代码行数:21,代码来源:SaveTrackMetadataJob.cs

示例3: SetCoverArt

            private void SetCoverArt (TrackInfo track, string path)
            {
                if (track == null)
                    return;

                var from_uri = new SafeUri (new System.Uri (path));

                var to_uri = new SafeUri (CoverArtSpec.GetPathForNewFile (track.ArtworkId, from_uri.AbsoluteUri));
                if (to_uri != null) {
                    // Make sure it's not the same file we already have
                    if (from_uri.Equals (to_uri)) {
                        return;
                    }

                    // Make sure the incoming file exists
                    if (!Banshee.IO.File.Exists (from_uri)) {
                        Hyena.Log.WarningFormat ("New cover art file not found: {0}", path);
                        return;
                    }

                    DeleteCoverArt (track);
                    Banshee.IO.File.Copy (from_uri, to_uri, true);
                    NotifyUpdated (track);

                    Hyena.Log.DebugFormat ("Got new cover art file for {0}: {1}", track.DisplayAlbumTitle, path);
                }
            }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:27,代码来源:CoverArtEditor.cs


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