本文整理汇总了C#中System.IO.FileInfo.GetNameWithoutExtension方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.GetNameWithoutExtension方法的具体用法?C# FileInfo.GetNameWithoutExtension怎么用?C# FileInfo.GetNameWithoutExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileInfo
的用法示例。
在下文中一共展示了FileInfo.GetNameWithoutExtension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartMenuResult
public StartMenuResult(IResultProvider provider, FileInfo file)
{
_file = file;
ID = Hash.CreateFrom(file.FullName);
Title = file.GetNameWithoutExtension();
Description = file.Directory.FullName;
Provider = provider;
}
示例2: StringSplitByKeyTest
public void StringSplitByKeyTest()
{
String target = "a: bcd e: fg h: i h:";
Dictionary<String, String> answers = target.SplitByKey("a:|e:|h:", true);
Assert.True(answers.Count == 3);
String location = @"C:\WebPage\FortinetIDS\12113.html";
FileInfo file = new FileInfo(location);
String answer = file.GetNameWithoutExtension();
}
示例3: FileSearchResult
public FileSearchResult(IResultProvider provider, FileInfo fileInfo)
{
_fileInfo = fileInfo;
Provider = provider;
ID = Hash.CreateFrom(_fileInfo.FullName);
Title = fileInfo.GetNameWithoutExtension();
}
示例4: GetNameFromFilePath
private string GetNameFromFilePath(string filePath)
{
FileInfo keyFile = new FileInfo(filePath);
return keyFile.GetNameWithoutExtension();
}
示例5: ExportTableConfiguration_Click
private void ExportTableConfiguration_Click(object sender, EventArgs e)
{
if (!Pinball.Table.TableConfigurationFilename.IsNullOrWhiteSpace())
{
FileInfo FI = new FileInfo(Pinball.Table.TableConfigurationFilename);
SaveTableConfigDialog.InitialDirectory = FI.Directory.FullName;
SaveTableConfigDialog.FileName = FI.FullName;
}
else if (!Pinball.Table.TableFilename.IsNullOrWhiteSpace())
{
FileInfo FI = new FileInfo(Pinball.Table.TableFilename);
SaveTableConfigDialog.InitialDirectory = FI.Directory.FullName;
SaveTableConfigDialog.FileName = Path.Combine(FI.Directory.FullName,"{0}.xml".Build(FI.GetNameWithoutExtension()));
}
else
{
SaveTableConfigDialog.InitialDirectory = Pinball.GlobalConfig.GetGlobalConfigDirectory().FullName;
}
if (SaveTableConfigDialog.ShowDialog() == DialogResult.OK)
{
Pinball.Table.TableConfigurationFilename = SaveTableConfigDialog.FileName;
try
{
Pinball.Table.SaveConfigXmlFile(SaveTableConfigDialog.FileName);
UpdateWindowTitle();
MessageBox.Show("Table configuration saved to\n{0}".Build(SaveTableConfigDialog.FileName), "Table configuration saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception E)
{
MessageBox.Show("Could not save table config to\n{0}\n\nThe following error occured:\n{1}".Build(SaveTableConfigDialog.FileName, E.Message), "File save error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}