本文整理汇总了C#中FileName类的典型用法代码示例。如果您正苦于以下问题:C# FileName类的具体用法?C# FileName怎么用?C# FileName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileName类属于命名空间,在下文中一共展示了FileName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
protected void Init()
{
output_file_name = "";
file = new FileName();
type = InputFileTemplateType.UNKNOWN;
replaceList = new Dictionary<string,string>();
}
示例2: DefaultAssemblySearcher
public DefaultAssemblySearcher(FileName mainAssemblyFileName)
{
if (mainAssemblyFileName == null)
throw new ArgumentNullException("mainAssemblyFileName");
this.mainAssemblyFileName = mainAssemblyFileName;
this.baseDirectory = mainAssemblyFileName.GetParentDirectory();
}
示例3: Parse
public ParseInformation Parse(FileName fileName, ITextSource fileContent, bool fullParseInformationRequested,
IProject parentProject, CancellationToken cancellationToken)
{
var csharpProject = parentProject as CSharpProject;
CSharpParser parser = new CSharpParser(csharpProject != null ? csharpProject.CompilerSettings : null);
parser.GenerateTypeSystemMode = !fullParseInformationRequested;
SyntaxTree cu = parser.Parse(fileContent, fileName);
cu.Freeze();
CSharpUnresolvedFile file = cu.ToTypeSystem();
ParseInformation parseInfo;
if (fullParseInformationRequested)
parseInfo = new CSharpFullParseInformation(file, fileContent.Version, cu);
else
parseInfo = new ParseInformation(file, fileContent.Version, fullParseInformationRequested);
IDocument document = fileContent as IDocument;
AddCommentTags(cu, parseInfo.TagComments, fileContent, parseInfo.FileName, ref document);
if (fullParseInformationRequested) {
if (document == null)
document = new ReadOnlyDocument(fileContent, parseInfo.FileName);
((CSharpFullParseInformation)parseInfo).newFoldings = CreateNewFoldings(cu, document);
}
return parseInfo;
}
示例4: SetPosition
public static void SetPosition(FileName fileName, IDocument document, int markerStartLine, int markerStartColumn, int markerEndLine, int markerEndColumn)
{
if (document == null)
return;
Remove();
startLine = markerStartLine;
startColumn = markerStartColumn;
endLine = markerEndLine;
endColumn = markerEndColumn;
if (startLine < 1 || startLine > document.TotalNumberOfLines)
return;
if (endLine < 1 || endLine > document.TotalNumberOfLines) {
endLine = startLine;
endColumn = int.MaxValue;
}
if (startColumn < 1)
startColumn = 1;
IDocumentLine line = document.GetLine(startLine);
if (endColumn < 1 || endColumn > line.Length)
endColumn = line.Length;
instance = new CurrentLineBookmark(fileName, new Location(startColumn, startLine));
BookmarkManager.AddMark(instance);
}
示例5: SetPosition
public static void SetPosition(FileName fileName, IDocument document, int markerStartLine, int markerStartColumn, int markerEndLine, int markerEndColumn)
{
if (document == null)
return;
Remove();
startLine = markerStartLine;
startColumn = markerStartColumn;
endLine = markerEndLine;
endColumn = markerEndColumn;
if (startLine < 1 || startLine > document.LineCount)
return;
if (endLine < 1 || endLine > document.LineCount) {
endLine = startLine;
endColumn = int.MaxValue;
}
if (startColumn < 1)
startColumn = 1;
instance = new CurrentLineBookmark();
instance.Location = new TextLocation(startLine, startColumn);
instance.FileName = fileName;
SD.BookmarkManager.AddMark(instance);
}
示例6: Create
public static SDTask Create(TestResult result, ITestProject project)
{
TaskType taskType = TaskType.Warning;
FileLineReference lineRef = null;
string message = String.Empty;
if (result.IsFailure) {
taskType = TaskType.Error;
if (!result.StackTraceFilePosition.IsEmpty) {
lineRef = new FileLineReference(result.StackTraceFilePosition.FileName, result.StackTraceFilePosition.BeginLine - 1, result.StackTraceFilePosition.BeginColumn - 1);
}
message = GetTestFailedMessage(result);
} else if (result.IsIgnored) {
message = GetTestIgnoredMessage(result);
}
if (lineRef == null) {
lineRef = FindTest(result.Name, project);
}
FileName fileName = null;
if (lineRef != null) {
fileName = new FileName(Path.GetFullPath(lineRef.FileName));
int line = lineRef.Line + 1;
return new SDTask(fileName, message, lineRef.Column, line, taskType);
}
return new SDTask(fileName, message, 0, 0, taskType);
}
示例7: DirectoryEntry
internal DirectoryEntry(FatFileSystemOptions options, FileName name, FatAttributes attrs, FatType fatVariant)
{
_options = options;
_fatVariant = fatVariant;
_name = name;
_attr = (byte)attrs;
}
示例8: GetTargetFrameworkVersionFrom
static Version GetTargetFrameworkVersionFrom(FileName fileName)
{
var project = SD.ProjectService.FindProjectContainingFile(fileName) as CompilableProject;
if (project == null)
return DotNet40;
return ScanVersion(project.TargetFrameworkVersion);
}
示例9: Compile
public Assembly Compile(FileName scriptFileName, ScriptLanguage language = ScriptLanguage.BYEXTENSION)
{
if (language == ScriptLanguage.BYEXTENSION)
{
switch (scriptFileName.Extension)
{
case "cs":
language = ScriptLanguage.CSHARP;
break;
case "vb":
language = ScriptLanguage.VB;
break;
default:
throw new Exception("Unknown script extension: '" + scriptFileName.Extension + "'");
}
}
switch (language)
{
case ScriptLanguage.VB:
throw new Exception("VB scripts are not yet implemented.");
case ScriptLanguage.CSHARP:
return CompileCSharpScript(LoadCSharpScript(scriptFileName));
default:
return null;
}
}
示例10: Parse
public ParseInformation Parse(
FileName fileName,
ITextSource fileContent,
TypeScriptProject project,
IEnumerable<TypeScriptFile> files)
{
try {
using (TypeScriptContext context = contextFactory.CreateContext()) {
context.AddFile(fileName, fileContent.Text);
context.RunInitialisationScript();
NavigationBarItem[] navigation = context.GetNavigationInfo(fileName);
var unresolvedFile = new TypeScriptUnresolvedFile(fileName);
unresolvedFile.AddNavigation(navigation, fileContent);
if (project != null) {
context.AddFiles(files);
var document = new TextDocument(fileContent);
Diagnostic[] diagnostics = context.GetDiagnostics(fileName, project.GetOptions());
TypeScriptService.TaskService.Update(diagnostics, fileName);
}
return new ParseInformation(unresolvedFile, fileContent.Version, true);
}
} catch (Exception ex) {
Console.WriteLine(ex.ToString());
LoggingService.Debug(ex.ToString());
}
return new ParseInformation(
new TypeScriptUnresolvedFile(fileName),
fileContent.Version,
true);
}
示例11: FileServiceOpenedFile
internal FileServiceOpenedFile(FileService fileService, FileName fileName)
{
this.fileService = fileService;
this.FileName = fileName;
IsUntitled = false;
fileChangeWatcher = new FileChangeWatcher(this);
}
示例12: LoadFile
public void LoadFile(string fileName)
{
TextEditor.SyntaxHighlighting =
HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(fileName));
TextEditor.Load(fileName);
this.fileName = new FileName(fileName);
}
示例13: CopyMeteoFiles
protected bool CopyMeteoFiles(MohidRunEngineData mre)
{
FileName orig = new FileName();
FileName dest = new FileName();
orig.FullPath = @"..\general.data\boundary.conditions\" + mre.sim.Start.ToString("yyyyMMdd.HHmmss") + "-" + mre.sim.End.ToString("yyyyMMdd.HHmmss") + @"\meteo.hdf5";
dest.FullPath = mre.sim.SimDirectory.Path + @"local.data\boundary.conditions\meteo.hdf5";
if (Directory.Exists(orig.Path))
{
if (File.Exists(orig.FullPath))
{
FileTools.CopyFile(orig, dest, CopyOptions.OVERWRIGHT);
}
else
{
//Console.WriteLine("File {0} does not exists.", orig.FullName);
if (!GenerateMeteoFiles(mre))
return false;
FileTools.CopyFile(orig, dest, CopyOptions.OVERWRIGHT);
}
}
else
{
Console.WriteLine("Folder {0} does not exists.", orig.Path);
return false;
}
return true;
}
示例14: SomethingWentWrongReturnsTrueWhenErrorTaskAddedToTaskService
public void SomethingWentWrongReturnsTrueWhenErrorTaskAddedToTaskService()
{
FileName fileName = new FileName("test.cs");
Task task = new Task(fileName, String.Empty, 1, 2, TaskType.Error);
taskService.Add(task);
Assert.IsTrue(taskService.SomethingWentWrong);
}
示例15: Run
public void Run(ListViewPadItemModel item)
{
var bookmarkBase = (BookmarkPadBase)Owner;
if (item == null) return;
// get current mark
var mark = item.Mark as SDBookmark;
int line = mark.LineNumber;
var fileName = new FileName(mark.FileName);
SDBookmark bookmark;
if (item.Mark is BreakpointBookmark) {
var bookmarks = DebuggerService.Breakpoints;
bookmark = bookmarks.FirstOrDefault(b => b.LineNumber == line && b.FileName == fileName);
if (bookmark == null && bookmarks.Count > 0) {
bookmark = bookmarks[0]; // jump around to first bookmark
}
}
else {
var bookmarks = BookmarkManager.Bookmarks;
bookmark = bookmarks.FirstOrDefault(b => b.LineNumber == line && b.FileName == fileName);
if (bookmark == null && bookmarks.Count > 0) {
bookmark = bookmarks[0]; // jump around to first bookmark
}
}
if (bookmark != null) {
FileService.JumpToFilePosition(bookmark.FileName, bookmark.LineNumber, bookmark.ColumnNumber);
}
// select in tree
bookmarkBase.SelectItem(item);
}