本文整理汇总了C#中Hyena.SafeUri类的典型用法代码示例。如果您正苦于以下问题:C# SafeUri类的具体用法?C# SafeUri怎么用?C# SafeUri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SafeUri类属于Hyena命名空间,在下文中一共展示了SafeUri类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OpenWrite
public System.IO.Stream OpenWrite (SafeUri uri, bool overwrite)
{
var file = FileFactory.NewForUri (uri.AbsoluteUri);
return new GioStream (overwrite
? file.Replace (null, false, FileCreateFlags.None, null)
: file.Create (FileCreateFlags.None, null));
}
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:7,代码来源:File.cs
示例2: AudioCdTrackInfo
public AudioCdTrackInfo (AudioCdDiscModel model, string deviceNode, int index)
{
this.model = model;
this.index_on_disc = index;
Uri = new SafeUri (String.Format ("cdda://{0}#{1}", index_on_disc + 1, deviceNode));
}
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:7,代码来源:AudioCdTrackInfo.cs
示例3: CopyIfNeeded
public void CopyIfNeeded (IPhoto item, SafeUri destinationBase)
{
// remember source uri for copying xmp file
SafeUri defaultVersionUri = item.DefaultVersion.Uri;
foreach (IPhotoVersion version in item.Versions) {
// Copy into photo folder and update IPhotoVersion uri
var source = version.Uri;
var destination = destinationBase.Append (source.GetFilename ());
if (!source.Equals (destination)) {
destination = GetUniqueFilename (destination);
file_system.File.Copy (source, destination, false);
copied_files.Add (destination);
original_files.Add (source);
version.Uri = destination;
}
}
// Copy XMP sidecar
var xmp_original = defaultVersionUri.ReplaceExtension(".xmp");
if (file_system.File.Exists (xmp_original)) {
var xmp_destination = item.DefaultVersion.Uri.ReplaceExtension (".xmp");
file_system.File.Copy (xmp_original, xmp_destination, true);
copied_files.Add (xmp_destination);
original_files.Add (xmp_original);
}
}
开发者ID:cizma,项目名称:f-spot,代码行数:27,代码来源:PhotoFileTracker.cs
示例4: DaapTrackInfo
public DaapTrackInfo(Track track, DaapSource source)
: base()
{
TrackTitle = track.Title;
AlbumTitle = track.Album;
ArtistName = track.Artist;
DateAdded = track.DateAdded;
DateUpdated = track.DateModified;
Genre = track.Genre;
FileSize = track.Size;
TrackCount = track.TrackCount;
TrackNumber = track.TrackNumber;
DiscNumber = track.DiscNumber;
DiscCount = track.DiscCount;
Year = track.Year;
Duration = track.Duration;
MimeType = track.Format;
BitRate = (int)track.BitRate;
ExternalId = track.Id;
PrimarySource = source;
Uri = new SafeUri (String.Format (
"{0}{1}/{2}", DaapService.ProxyServer.HttpBaseAddress, source.Database.GetHashCode (), track.Id
));
//this.IsLive = false;
//this.CanSaveToDatabase = false;
}
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:31,代码来源:DaapTrackInfo.cs
示例5: GetThumbnailerForUri
public IThumbnailer GetThumbnailerForUri (SafeUri uri)
{
if (ImageFile.HasLoader (uri)) {
return new ImageThumbnailer (uri, fileSystem);
}
return null;
}
开发者ID:mono,项目名称:f-spot,代码行数:7,代码来源:ThumbnailerFactory.cs
示例6: CreateThumbnail
bool CreateThumbnail (SafeUri thumbnailUri, ThumbnailSize size, IImageFile imageFile)
{
var pixels = size == ThumbnailSize.Normal ? 128 : 256;
Pixbuf pixbuf;
try {
pixbuf = imageFile.Load ();
} catch (Exception e) {
Log.DebugFormat ("Failed loading image for thumbnailing: {0}", imageFile.Uri);
Log.DebugException (e);
return false;
}
double scale_x = (double)pixbuf.Width / pixels;
double scale_y = (double)pixbuf.Height / pixels;
double scale = Math.Max (1.0, Math.Max (scale_x, scale_y));
// Ensures that the minimum value is 1 so that pixbuf.ScaleSimple doesn't return null
// Seems to only happen in rare(?) cases
int target_x = Math.Max ((int)(pixbuf.Width / scale), 1);
int target_y = Math.Max ((int)(pixbuf.Height / scale), 1);
var thumb_pixbuf = pixbuf.ScaleSimple (target_x, target_y, InterpType.Bilinear);
var mtime = fileSystem.File.GetMTime (imageFile.Uri).ToString ();
thumb_pixbuf.Savev (thumbnailUri.LocalPath, "png",
new string [] { ThumbnailService.ThumbUriOpt, ThumbnailService.ThumbMTimeOpt, null },
new string [] { imageFile.Uri, mtime });
pixbuf.Dispose ();
thumb_pixbuf.Dispose ();
return true;
}
开发者ID:mono,项目名称:f-spot,代码行数:31,代码来源:ImageThumbnailer.cs
示例7: Load
public void Load (SafeUri uri)
{
if (is_disposed)
return;
//First, send a thumbnail if we have one
if ((thumb = App.Instance.Container.Resolve<IThumbnailService> ().TryLoadThumbnail (uri, ThumbnailSize.Large)) != null) {
pixbuf_orientation = ImageOrientation.TopLeft;
EventHandler<AreaPreparedEventArgs> prep = AreaPrepared;
if (prep != null) {
prep (this, new AreaPreparedEventArgs (true));
}
EventHandler<AreaUpdatedEventArgs> upd = AreaUpdated;
if (upd != null) {
upd (this, new AreaUpdatedEventArgs (new Rectangle (0, 0, thumb.Width, thumb.Height)));
}
}
using (var image_file = ImageFile.Create (uri)) {
image_stream = image_file.PixbufStream ();
pixbuf_orientation = image_file.Orientation;
}
loading = true;
// The ThreadPool.QueueUserWorkItem hack is there cause, as the bytes to read are present in the stream,
// the Read is CompletedAsynchronously, blocking the mainloop
image_stream.BeginRead (buffer, 0, count, delegate (IAsyncResult r) {
ThreadPool.QueueUserWorkItem (delegate {
HandleReadDone (r);});
}, null);
}
开发者ID:mono,项目名称:f-spot,代码行数:31,代码来源:GdkImageLoader.cs
示例8: GenerateMD5
public static string GenerateMD5(SafeUri uri)
{
var file = GLib.FileFactory.NewForUri (uri);
var stream = new GLib.GioStream (file.Read (null));
var hash = CryptoUtil.Md5EncodeStream (stream);
stream.Close ();
return hash;
}
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:8,代码来源:HashUtils.cs
示例9: OpenPlay
public static RadioTrackInfo OpenPlay (SafeUri uri)
{
RadioTrackInfo track = Open (uri);
if (track != null) {
track.Play ();
}
return track;
}
开发者ID:mono-soc-2011,项目名称:banshee,代码行数:8,代码来源:RadioTrackInfo.cs
示例10: CopyTrackTo
public override void CopyTrackTo (DatabaseTrackInfo track, SafeUri uri, BatchUserJob job)
{
if (track.PrimarySource == this && track.Uri.Scheme.StartsWith ("http")) {
foreach (double percent in database.DownloadTrack ((int)track.ExternalId, track.MimeType, uri.AbsolutePath)) {
job.DetailedProgress = percent;
}
}
}
开发者ID:gclark916,项目名称:banshee,代码行数:8,代码来源:DaapSource.cs
示例11: ImageInfo
public ImageInfo(SafeUri uri)
{
using (var img = ImageFile.Create (uri)) {
Pixbuf pixbuf = img.Load ();
SetPixbuf (pixbuf);
pixbuf.Dispose ();
}
}
开发者ID:modulexcite,项目名称:f-spot,代码行数:8,代码来源:ImageInfo.cs
示例12: GetSize
public long GetSize(SafeUri uri)
{
try {
return new System.IO.FileInfo (uri.LocalPath).Length;
} catch {
return -1;
}
}
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:8,代码来源:File.cs
示例13: Copy
public void Copy (SafeUri source, SafeUri destination, bool overwrite)
{
var source_file = FileFactory.NewForUri (source);
var destination_file = FileFactory.NewForUri (destination);
var flags = FileCopyFlags.AllMetadata;
if (overwrite)
flags |= FileCopyFlags.Overwrite;
source_file.Copy (destination_file, flags, null, null);
}
开发者ID:mono,项目名称:f-spot,代码行数:9,代码来源:GLibFile.cs
示例14: BaseImageFile
public BaseImageFile(SafeUri uri)
{
Uri = uri;
Orientation = ImageOrientation.TopLeft;
using (var metadata_file = Metadata.Parse (uri)) {
ExtractMetadata (metadata_file);
}
}
开发者ID:GNOME,项目名称:f-spot,代码行数:9,代码来源:IImageFile.cs
示例15: TestMissingFile
public void TestMissingFile()
{
XdgThumbnailSpec.DefaultLoader = (u) => {
throw new Exception ("not found!");
};
var uri = new SafeUri ("file:///invalid");
var pixbuf = XdgThumbnailSpec.LoadThumbnail (uri, ThumbnailSize.Large);
Assert.IsNull (pixbuf);
}
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:10,代码来源:XdgThumbnailSpecTests.cs
示例16: TryCreateThumbnail
public bool TryCreateThumbnail (SafeUri thumbnailUri, ThumbnailSize size)
{
try {
var imageFile = ImageFile.Create (fileUri);
return CreateThumbnail (thumbnailUri, size, imageFile);
}
catch {
return false;
}
}
开发者ID:mono,项目名称:f-spot,代码行数:10,代码来源:ImageThumbnailer.cs
示例17: CopySidecarToTest
public static SafeUri CopySidecarToTest(SafeUri uri, string filename)
{
var target = uri.ReplaceExtension (".xmp");
var orig_uri = new SafeUri (Environment.CurrentDirectory + TestDataLocation + filename);
var file = GLib.FileFactory.NewForUri (orig_uri);
var file2 = GLib.FileFactory.NewForUri (target);
file.Copy (file2, GLib.FileCopyFlags.Overwrite, null, null);
return target;
}
开发者ID:Yetangitu,项目名称:f-spot,代码行数:10,代码来源:ImageTestHelper.cs
示例18: PhotoVersion
public PhotoVersion(IPhoto photo, uint version_id, SafeUri base_uri, string filename, string md5_sum, string name, bool is_protected)
{
Photo = photo;
VersionId = version_id;
BaseUri = base_uri;
Filename = filename;
ImportMD5 = md5_sum;
Name = name;
IsProtected = is_protected;
}
开发者ID:GNOME,项目名称:f-spot,代码行数:10,代码来源:PhotoVersion.cs
示例19: TranscodeContext
public TranscodeContext (TrackInfo track, SafeUri out_uri, ProfileConfiguration config,
TrackTranscodedHandler handler, TranscodeCancelledHandler cancelledHandler, TranscodeErrorHandler errorHandler)
{
Track = track;
OutUri = out_uri;
Config = config;
Handler = handler;
CancelledHandler = cancelledHandler;
ErrorHandler = errorHandler;
}
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:10,代码来源:TranscoderService.cs
示例20: TrimEmptyDirectories
public static void TrimEmptyDirectories(SafeUri uri)
{
try {
string old_dir = System.IO.Path.GetDirectoryName (uri.LocalPath);
while (old_dir != null && old_dir != String.Empty) {
Banshee.IO.Directory.Delete (old_dir);
old_dir = System.IO.Path.GetDirectoryName (old_dir);
}
} catch {
}
}
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:11,代码来源:Utilities.cs
注:本文中的Hyena.SafeUri类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论