本文整理汇总了C#中FullPath类的典型用法代码示例。如果您正苦于以下问题:C# FullPath类的具体用法?C# FullPath怎么用?C# FullPath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FullPath类属于命名空间,在下文中一共展示了FullPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileWithSections
public FileWithSections(IFileSystem fileSystem, FullPath filename)
{
_fileSystem = fileSystem;
_filename = filename;
_fileUpdateVolatileToken = new FileUpdateVolatileToken(_fileSystem, filename);
_sections = new Lazy<Dictionary<string, List<string>>>(ReadFile);
}
示例2: LoadProcesses
public void LoadProcesses() {
_processes.Clear();
List<ChromiumProcess> chromes = new List<ChromiumProcess>();
HashSet<int> chromePids = new HashSet<int>();
foreach (Process p in Process.GetProcesses()) {
// System.Diagnostics.Process uses a naive implementation that is unable to deal with many
// types of processes (such as those already under a debugger, or those with a high
// privilege level), so use NtProcess instead.
NtProcess ntproc = new NtProcess(p.Id);
if (!ntproc.IsValid)
continue;
FullPath processPath = new FullPath(ntproc.Win32ProcessImagePath);
if (processPath.StartsWith(_installationData.InstallationPath)) {
chromes.Add(new ChromiumProcess(ntproc, _installationData));
chromePids.Add(p.Id);
}
}
foreach (ChromiumProcess chrome in chromes) {
// Only insert root processes at this level, child processes will be children of one of
// these processes.
if (!chromePids.Contains(chrome.ParentPid)) {
ChromeProcessViewModel viewModel = new ChromeProcessViewModel(_root, chrome);
viewModel.LoadProcesses(chromes.ToArray());
_processes.Add(viewModel);
}
}
}
示例3: GetProjectFromRootPath
public IProject GetProjectFromRootPath(FullPath projectRootPath)
{
var name = projectRootPath;
lock (_lock) {
return _knownProjectRootDirectories.Get(name);
}
}
示例4: CreateEntries
private void CreateEntries(DirectoryEntry searchResults) {
if (!_enabled)
return;
using (new TimeElapsedLogger("Creating document tracking entries for search results")) {
_searchResults.Clear();
foreach (DirectoryEntry projectRoot in searchResults.Entries) {
var rootPath = new FullPath(projectRoot.Name);
foreach (FileEntry fileEntry in projectRoot.Entries) {
var path = rootPath.Combine(new RelativePath(fileEntry.Name));
var spans = fileEntry.Data as FilePositionsData;
if (spans != null) {
_searchResults[path] = spans;
// If the document is open, create the tracking spans now.
var document = _textDocumentTable.GetOpenDocument(path);
if (document != null) {
var entry = new DocumentChangeTrackingEntry(spans);
_trackingEntries[path] = entry;
entry.CreateTrackingSpans(document.TextBuffer);
}
}
}
}
}
}
示例5: GetPathChangeKind
public PathChangeKind GetPathChangeKind(FullPath path) {
PathChangeKind result;
if (!_map.Value.TryGetValue(path, out result)) {
result = PathChangeKind.None;
}
return result;
}
示例6: EnumerateParents
private IEnumerable<FullPath> EnumerateParents(FullPath path)
{
var directory = path.Parent;
for (var parent = directory; parent != default(FullPath); parent = parent.Parent) {
yield return parent;
}
}
示例7: FetchRunningDocumentTable
private bool FetchRunningDocumentTable() {
var rdt = new RunningDocumentTable(_serviceProvider);
foreach (var info in rdt) {
// Get doc data
if (!FullPath.IsValid(info.Moniker))
continue;
var path = new FullPath(info.Moniker);
if (_openDocuments.ContainsKey(path))
continue;
// Get vs buffer
IVsTextBuffer docData = null;
try {
docData = info.DocData as IVsTextBuffer;
}
catch (Exception e) {
Logger.LogWarning(e, "Error getting IVsTextBuffer for document {0}, skipping document", path);
}
if (docData == null)
continue;
// Get ITextDocument
var textBuffer = _vsEditorAdaptersFactoryService.GetDocumentBuffer(docData);
if (textBuffer == null)
continue;
ITextDocument document;
if (!_textDocumentFactoryService.TryGetTextDocument(textBuffer, out document))
continue;
_openDocuments[path] = document;
}
return true;
}
示例8: FileWithSections
public FileWithSections(IFileSystem fileSystem, FullPath filename) {
_fileSystem = fileSystem;
_filename = filename;
_fileLines = new Lazy<IList<string>>(ReadFileLines);
_hash = new Lazy<string>(ComputeHash);
_sections = new Lazy<Dictionary<string, List<string>>>(ReadFile);
}
示例9: ReadFile
private FileContents ReadFile(FullPath fullName)
{
try {
var fileInfo = new SlimFileInfo(fullName);
const int trailingByteCount = 2;
var block = NativeFile.ReadFileNulTerminated(fileInfo, trailingByteCount);
var contentsByteCount = (int)block.ByteLength - trailingByteCount; // Padding added by ReadFileNulTerminated
var kind = NativeMethods.Text_GetKind(block.Pointer, contentsByteCount);
switch (kind) {
case NativeMethods.TextKind.Ascii:
return new AsciiFileContents(new FileContentsMemory(block, 0, contentsByteCount), fileInfo.LastWriteTimeUtc);
case NativeMethods.TextKind.AsciiWithUtf8Bom:
const int utf8BomSize = 3;
return new AsciiFileContents(new FileContentsMemory(block, utf8BomSize, contentsByteCount - utf8BomSize), fileInfo.LastWriteTimeUtc);
case NativeMethods.TextKind.Utf8WithBom:
var utf16Block = Conversion.UTF8ToUnicode(block);
block.Dispose();
return new UTF16FileContents(new FileContentsMemory(utf16Block, 0, utf16Block.ByteLength), fileInfo.LastWriteTimeUtc);
case NativeMethods.TextKind.Unknown:
default:
// TODO(rpaquay): Figure out a better way to detect encoding.
//Logger.Log("Text Encoding of file \"{0}\" is not recognized.", fullName);
return new AsciiFileContents(new FileContentsMemory(block, 0, contentsByteCount), fileInfo.LastWriteTimeUtc);
//throw new NotImplementedException(string.Format("Text Encoding of file \"{0}\" is not recognized.", fullName));
}
}
catch (Exception e) {
Logger.LogException(e, "Error reading content of text file \"{0}\", skipping file.", fullName);
return StringFileContents.Empty;
}
}
示例10: FindRootDirectory
public DirectorySnapshot FindRootDirectory(FullPath rootPath) {
var index = SortedArrayHelpers.BinarySearch(_snapshot.ProjectRoots, rootPath, ProjectRootComparer);
if (index >= 0)
return _snapshot.ProjectRoots[index].Directory;
return null;
}
示例11: CreateAbsoluteDirectoryName
public DirectoryName CreateAbsoluteDirectoryName(FullPath rootPath) {
var rootdirectory = FindRootDirectory(rootPath);
if (rootdirectory != null)
return rootdirectory.DirectoryName;
return _previous.CreateAbsoluteDirectoryName(rootPath);
}
示例12: AddDirectory
private void AddDirectory(FullPath directory) {
FileSystemWatcher watcher;
lock (_watchersLock) {
if (_pollingThread == null) {
_pollingThread = new Thread(ThreadLoop) { IsBackground = true };
_pollingThread.Start();
}
if (_watchers.TryGetValue(directory, out watcher))
return;
watcher = new FileSystemWatcher();
_watchers.Add(directory, watcher);
}
Logger.LogInfo("Starting monitoring directory \"{0}\" for change notifications.", directory);
watcher.Path = directory.Value;
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.DirectoryName | NotifyFilters.FileName;
watcher.IncludeSubdirectories = true;
watcher.InternalBufferSize = 50 * 1024; // 50KB sounds more reasonable than 8KB
watcher.Changed += WatcherOnChanged;
watcher.Created += WatcherOnCreated;
watcher.Deleted += WatcherOnDeleted;
watcher.Renamed += WatcherOnRenamed;
watcher.Error += WatcherOnError;
watcher.EnableRaisingEvents = true;
}
示例13: GetProject
public IProject GetProject(FullPath filename) {
return _providers
.Select(t => t.GetProjectFromAnyPath(filename))
.Where(project => project != null)
.OrderByDescending(p => p.RootPath.Value.Length)
.FirstOrDefault();
}
示例14: Options
public Options(FullPath fullPath)
{
Path = fullPath.RelativePath;
Url = fullPath.Root.Url;
ThumbnailsUrl = fullPath.Root.TmbUrl;
}
示例15: ApplyCodingStyle
public bool ApplyCodingStyle(string filename) {
var path = new FullPath(filename);
var root = _chromiumDiscoveryProvider.GetEnlistmentRootFromFilename(path, x => x);
if (root == default(FullPath))
return false;
return _applyCodingStyleResults.GetOrAdd(filename, (key) => ApplyCodingStyleWorker(root, key));
}