本文整理汇总了C#中Hyena.SafeUri.GetFilenameWithoutExtension方法的典型用法代码示例。如果您正苦于以下问题:C# SafeUri.GetFilenameWithoutExtension方法的具体用法?C# SafeUri.GetFilenameWithoutExtension怎么用?C# SafeUri.GetFilenameWithoutExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hyena.SafeUri
的用法示例。
在下文中一共展示了SafeUri.GetFilenameWithoutExtension方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFileUris
public void TestFileUris()
{
foreach (var test in tests) {
var suri = new SafeUri (test.Uri);
Assert.AreEqual (suri.AbsoluteUri, test.AbsoluteUri, String.Format("AbsoluteUri for {0}", test.Uri));
Assert.AreEqual (suri.GetExtension (), test.Extension, String.Format("Extension for {0}", test.Uri));
Assert.AreEqual (suri.GetBaseUri ().ToString (), test.BaseUri, String.Format("BaseUri for {0}", test.Uri));
Assert.AreEqual (suri.GetFilename (), test.Filename, String.Format("Filename for {0}", test.Uri));
Assert.AreEqual (suri.GetFilenameWithoutExtension (), test.FilenameWithoutExtension, String.Format("FilenameWithoutExtension for {0}", test.Uri));
}
}
示例2: GetUniqueFilename
SafeUri GetUniqueFilename (SafeUri dest)
{
// Find an unused name
int i = 1;
var base_uri = dest.GetBaseUri ();
var filename = dest.GetFilenameWithoutExtension ();
var extension = dest.GetExtension ();
while (file_system.File.Exists (dest)) {
dest = base_uri.Append (String.Format ("{0}-{1}{2}", filename, i++, extension));
}
return dest;
}
示例3: IsJpegRawPair
internal static bool IsJpegRawPair(SafeUri file1, SafeUri file2)
{
return file1.GetBaseUri ().ToString () == file2.GetBaseUri ().ToString () &&
file1.GetFilenameWithoutExtension () == file2.GetFilenameWithoutExtension () &&
((ImageFile.IsJpeg (file1) && ImageFile.IsRaw (file2)) ||
(ImageFile.IsRaw (file1) && ImageFile.IsJpeg (file2)));
}
示例4: FindImportDestination
SafeUri FindImportDestination(SafeUri uri, DateTime time)
{
// Find a new unique location inside the photo folder
string name = uri.GetFilename ();
var dest_uri = FSpot.Core.Global.PhotoUri.Append (time.Year.ToString ())
.Append (String.Format ("{0:D2}", time.Month))
.Append (String.Format ("{0:D2}", time.Day));
EnsureDirectory (dest_uri);
// If the destination we'd like to use is the file itself return that
if (dest_uri.Append (name) == uri)
return uri;
// Find an unused name
int i = 1;
var dest = dest_uri.Append (name);
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;
}