本文整理汇总了C#中FilePath类的典型用法代码示例。如果您正苦于以下问题:C# FilePath类的具体用法?C# FilePath怎么用?C# FilePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilePath类属于命名空间,在下文中一共展示了FilePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetObjectReaderForFile
WorkspaceObjectReader GetObjectReaderForFile (FilePath file, Type type)
{
foreach (var r in GetObjectReaders ())
if (r.CanRead (file, type))
return r;
return null;
}
示例2: RunDialog
bool RunDialog (OpenFileDialogData data)
{
Application.EnableVisualStyles ();
FileDialog fileDlg = null;
if (data.Action == Gtk.FileChooserAction.Open)
fileDlg = new OpenFileDialog ();
else
fileDlg = new SaveFileDialog ();
var dlg = new CustomOpenFileDialog (fileDlg, data);
SelectFileDialogHandler.SetCommonFormProperties (data, dlg.FileDialog);
using (dlg) {
rootForm = new WinFormsRoot ();
if (dlg.ShowDialog (rootForm) == DialogResult.Cancel) {
return false;
}
FilePath[] paths = new FilePath [fileDlg.FileNames.Length];
for (int n = 0; n < fileDlg.FileNames.Length; n++)
paths [n] = fileDlg.FileNames [n];
data.SelectedFiles = paths;
if (dlg.SelectedEncodingId != null)
data.Encoding = dlg.SelectedEncodingId > 0 ? Encoding.GetEncoding (dlg.SelectedEncodingId) : null;
if (dlg.SelectedViewer != null)
data.SelectedViewer = dlg.SelectedViewer;
data.CloseCurrentWorkspace = dlg.CloseCurrentWorkspace;
}
return true;
}
示例3: Setup
public override void Setup ()
{
// Generate directories and a svn util.
rootUrl = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
rootCheckout = new FilePath (FileService.CreateTempDirectory () + Path.DirectorySeparatorChar);
Directory.CreateDirectory (rootUrl.FullPath + "repo.git");
repoLocation = "file:///" + rootUrl.FullPath + "repo.git";
// Initialize the bare repo.
InitCommand ci = new InitCommand ();
ci.SetDirectory (new Sharpen.FilePath (rootUrl.FullPath + "repo.git"));
ci.SetBare (true);
ci.Call ();
FileRepository bare = new FileRepository (new Sharpen.FilePath (rootUrl.FullPath + "repo.git"));
string branch = Constants.R_HEADS + "master";
RefUpdate head = bare.UpdateRef (Constants.HEAD);
head.DisableRefLog ();
head.Link (branch);
// Check out the repository.
Checkout (rootCheckout, repoLocation);
repo = GetRepo (rootCheckout, repoLocation);
DOT_DIR = ".git";
}
示例4: GetNextForPath
FileSystemExtension GetNextForPath (FilePath file, bool isDirectory)
{
FileSystemExtension nx = next;
while (nx != null && !nx.CanHandlePath (file, isDirectory))
nx = nx.next;
return nx;
}
示例5: Package
public static IAsyncOperation Package (MonoMacProject project, ConfigurationSelector configSel,
MonoMacPackagingSettings settings, FilePath target)
{
IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (
GettextCatalog.GetString ("Packaging Output"),
MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true);
var t = new System.Threading.Thread (() => {
try {
using (mon) {
BuildPackage (mon, project, configSel, settings, target);
}
} catch (Exception ex) {
mon.ReportError ("Unhandled error in packaging", null);
LoggingService.LogError ("Unhandled exception in packaging", ex);
} finally {
mon.Dispose ();
}
}) {
IsBackground = true,
Name = "Mac Packaging",
};
t.Start ();
return mon.AsyncOperation;
}
示例6: Run
protected override void Run ()
{
var doc = IdeApp.Workbench.ActiveDocument;
var currentLocation = doc.Editor.Caret.Location;
var controller = doc.ParsedDocument.GetTopLevelTypeDefinition (currentLocation);
string controllerName = controller.Name;
int pos = controllerName.LastIndexOf ("Controller", StringComparison.Ordinal);
if (pos > 0)
controllerName = controllerName.Remove (pos);
var baseDirectory = doc.FileName.ParentDirectory.ParentDirectory;
string actionName = doc.ParsedDocument.GetMember (currentLocation).Name;
var viewFoldersPaths = new FilePath[] {
baseDirectory.Combine ("Views", controllerName),
baseDirectory.Combine ("Views", "Shared")
};
var viewExtensions = new string[] { ".aspx", ".cshtml" };
foreach (var folder in viewFoldersPaths) {
foreach (var ext in viewExtensions) {
var possibleFile = folder.Combine (actionName + ext);
if (File.Exists (possibleFile)) {
IdeApp.Workbench.OpenDocument (possibleFile);
return;
}
}
}
MessageService.ShowError ("Matching view cannot be found.");
}
示例7: GetPathUrl
public override string GetPathUrl (FilePath path)
{
lock (client) {
Uri u = client.GetUriFromWorkingCopy (path);
return u != null ? u.ToString () : null;
}
}
示例8: Run
public bool Run(SelectFileDialogData data)
{
CommonDialog dlg = null;
if (data.Action == Gtk.FileChooserAction.Open)
dlg = new OpenFileDialog();
else if (data.Action == Gtk.FileChooserAction.Save)
dlg = new SaveFileDialog();
else if (data.Action == Gtk.FileChooserAction.SelectFolder)
dlg = new FolderBrowserDialog ();
if (dlg is FileDialog)
SetCommonFormProperties (data, dlg as FileDialog);
else
SetFolderBrowserProperties (data, dlg as FolderBrowserDialog);
using (dlg) {
WinFormsRoot root = new WinFormsRoot();
if (dlg.ShowDialog(root) == DialogResult.Cancel)
return false;
if (dlg is FileDialog) {
var fileDlg = dlg as OpenFileDialog;
FilePath[] paths = new FilePath [fileDlg.FileNames.Length];
for (int n=0; n < fileDlg.FileNames.Length; n++)
paths [n] = fileDlg.FileNames [n];
data.SelectedFiles = paths;
} else {
var folderDlg = dlg as FolderBrowserDialog;
data.SelectedFiles = new [] { new FilePath (folderDlg.SelectedPath) };
}
return true;
}
}
示例9: AvdWatcher
//TODO: handle errors
public AvdWatcher ()
{
VirtualDevices = new AndroidVirtualDevice[0];
FilePath home = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
if (PropertyService.IsWindows) {
home = home.ParentDirectory;
}
avdDir = home.Combine (".android", "avd");
if (!Directory.Exists (avdDir))
Directory.CreateDirectory (avdDir);
var avds = Directory.GetFiles (avdDir, "*.ini");
UpdateAvds (avds, null);
//FSW on mac is unreliable
if (PropertyService.IsMac) {
modTimes = new Dictionary<string, DateTime> ();
foreach (var f in avds)
modTimes[f] = File.GetLastWriteTimeUtc (f);
timeoutId = GLib.Timeout.Add (750, HandleTimeout);
} else {
CreateFsw ();
}
}
示例10: Setup
public override void Setup ()
{
RemotePath = new FilePath (FileService.CreateTempDirectory ());
RemoteUrl = "svn://localhost:3690/repo";
SvnServe = new Process ();
base.Setup ();
}
示例11: Run
public bool Run(ConfigNode cfg)
{
fLastException = null;
Console.WriteLine("Starting CreateHDFFromASC...");
fWorkingDir = cfg["working.dir", AppDomain.CurrentDomain.BaseDirectory].AsFilePath();
try
{
if (cfg["from.asc.to.xyz", false].AsBool())
ConvertToXYZ(cfg);
if (cfg["from.xyz.to.mgd", false].AsBool())
ConvertToMGD(cfg);
if (cfg["from.mgd.to.hdf", false].AsBool())
ConvertToHDF(cfg);
if (cfg["glue.hdfs", false].AsBool())
GlueHDFs(cfg);
Console.WriteLine("CreateHDFFromASC finished successfully...");
return true;
}
catch (Exception ex)
{
fLastException = ex;
return false;
}
}
示例12: androidPackageTest
void androidPackageTest (bool signed)
{
var projectFile = context.WorkingDirectory
.Combine ("TestProjects/HelloWorldAndroid/HelloWorldAndroid/")
.CombineWithFilePath ("HelloWorldAndroid.csproj");
projectFile = new FilePath ("./TestProjects/HelloWorldAndroid/HelloWorldAndroid/HelloWorldAndroid.csproj");
FilePath apkFile = null;
try {
apkFile = context.CakeContext.AndroidPackage(
projectFile,
signed,
c => {
c.Verbosity = Verbosity.Diagnostic;
c.Configuration = "Release";
});
} catch (Exception ex) {
Console.WriteLine(ex);
context.DumpLogs();
Assert.Fail(context.GetLogs());
}
Assert.IsNotNull (apkFile);
Assert.IsNotNull (apkFile.FullPath);
Assert.IsNotEmpty (apkFile.FullPath);
Assert.IsTrue (System.IO.File.Exists (apkFile.FullPath));
}
示例13: CanExecute
public override bool CanExecute(FilePath path)
{
UnixFileInfo fi = new UnixFileInfo (path);
if (!fi.Exists)
return false;
return 0 != (fi.FileAccessPermissions & (FileAccessPermissions.UserExecute | FileAccessPermissions.GroupExecute | FileAccessPermissions.OtherExecute));
}
示例14: FindReferences
public override IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, IEnumerable<INode> searchedMembers)
{
var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
AspNetAppProject project = dom.Project as AspNetAppProject;
if (project == null)
yield break;
var unit = AspNetParserService.GetCompileUnit (project, fileName, true);
if (unit == null)
yield break;
var refman = new DocumentReferenceManager (project);
var parsedAspDocument = (AspNetParsedDocument)new AspNetParser ().Parse (dom, fileName, editor.Text);
refman.Doc = parsedAspDocument;
var usings = refman.GetUsings ();
var documentInfo = new DocumentInfo (dom, unit, usings, refman.GetDoms ());
var builder = new AspLanguageBuilder ();
var buildDocument = new Mono.TextEditor.Document ();
var offsetInfos = new List<LocalDocumentInfo.OffsetInfo> ();
buildDocument.Text = builder.BuildDocumentString (documentInfo, editor, offsetInfos, true);
var parsedDocument = AspLanguageBuilder.Parse (dom, fileName, buildDocument.Text);
foreach (var member in searchedMembers) {
foreach (var reference in SearchMember (member, dom, fileName, editor, buildDocument, offsetInfos, parsedDocument)) {
yield return reference;
}
}
}
示例15: GetRepositoryReference
public override Repository GetRepositoryReference(FilePath path, string id)
{
if (!IsVersioned(path))
return null;
return new GitRepository(this, FindRepositoryPath(path));
}