本文整理汇总了C#中Hyena.SafeUri.Append方法的典型用法代码示例。如果您正苦于以下问题:C# SafeUri.Append方法的具体用法?C# SafeUri.Append怎么用?C# SafeUri.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hyena.SafeUri
的用法示例。
在下文中一共展示了SafeUri.Append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: CreateDirectory
public void CreateDirectory (SafeUri uri)
{
var parts = uri.AbsolutePath.Split('/');
var current = new SafeUri (uri.Scheme + ":///", true);
for (int i = 0; i < parts.Length; i++) {
current = current.Append (parts [i]);
var file = FileFactory.NewForUri (current);
if (!file.Exists) {
file.MakeDirectory (null);
}
}
}
示例3: ImageName
protected virtual string ImageName(int image_num)
{
var uri = Collection [image_num].DefaultVersion.Uri;
var dest_uri = new SafeUri (GalleryPath);
// Find an unused name
int i = 1;
var dest = dest_uri.Append (uri.GetFilename ());
var file = GLib.FileFactory.NewForUri (dest);
while (file.Exists) {
var filename = uri.GetFilenameWithoutExtension ();
var extension = uri.GetExtension ();
dest = dest_uri.Append (String.Format ("{0}-{1}{2}", filename, i++, extension));
file = GLib.FileFactory.NewForUri (dest);
}
return dest.GetFilename ();
}
示例4: FindImportDestination
internal static SafeUri FindImportDestination (IPhoto item, SafeUri baseUri)
{
DateTime time = item.Time;
return baseUri
.Append (time.Year.ToString ())
.Append (String.Format ("{0:D2}", time.Month))
.Append (String.Format ("{0:D2}", time.Day));
}