本文整理汇总了C#中Hyena.SafeUri.GetFilename方法的典型用法代码示例。如果您正苦于以下问题:C# SafeUri.GetFilename方法的具体用法?C# SafeUri.GetFilename怎么用?C# SafeUri.GetFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hyena.SafeUri
的用法示例。
在下文中一共展示了SafeUri.GetFilename方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SwitchToFolderSource
public void SwitchToFolderSource (SafeUri uri)
{
IImportSource source;
if (!history_sources.TryGetValue (uri, out source)) {
var name = uri.GetFilename ();
source = new FileImportSource (uri, name, "folder");
history_sources[uri] = source;
}
PopulateSourceCombo (source);
Controller.ActiveSource = source;
}
示例2: 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));
}
}
示例3: 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;
}