本文整理汇总了C#中FileReference类的典型用法代码示例。如果您正苦于以下问题:C# FileReference类的具体用法?C# FileReference怎么用?C# FileReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileReference类属于命名空间,在下文中一共展示了FileReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MSBuildProjectFile
/// <summary>
/// Constructs a new project file object
/// </summary>
/// <param name="InitFilePath">The path to the project file on disk</param>
public MSBuildProjectFile(FileReference InitFilePath)
: base(InitFilePath)
{
// Each project gets its own GUID. This is stored in the project file and referenced in the solution file.
// First, check to see if we have an existing file on disk. If we do, then we'll try to preserve the
// GUID by loading it from the existing file.
if (ProjectFilePath.Exists())
{
try
{
LoadGUIDFromExistingProject();
}
catch (Exception)
{
// Failed to find GUID, so just create a new one
ProjectGUID = Guid.NewGuid();
}
}
if (ProjectGUID == Guid.Empty)
{
// Generate a brand new GUID
ProjectGUID = Guid.NewGuid();
}
}
示例2: Create
/// <summary>
/// Creates a file from a list of strings; each string is placed on a line in the file.
/// </summary>
/// <param name="TempFileName">Name of response file</param>
/// <param name="Lines">List of lines to write to the response file</param>
public static FileReference Create(FileReference TempFileName, List<string> Lines, CreateOptions Options = CreateOptions.None)
{
FileInfo TempFileInfo = new FileInfo(TempFileName.FullName);
if (TempFileInfo.Exists)
{
if ((Options & CreateOptions.WriteEvenIfUnchanged) != CreateOptions.WriteEvenIfUnchanged)
{
string Body = string.Join(Environment.NewLine, Lines);
// Reuse the existing response file if it remains unchanged
string OriginalBody = File.ReadAllText(TempFileName.FullName);
if (string.Equals(OriginalBody, Body, StringComparison.Ordinal))
{
return TempFileName;
}
}
// Delete the existing file if it exists and requires modification
TempFileInfo.IsReadOnly = false;
TempFileInfo.Delete();
TempFileInfo.Refresh();
}
FileItem.CreateIntermediateTextFile(TempFileName, string.Join(Environment.NewLine, Lines));
return TempFileName;
}
示例3: ConfigManager
public ConfigManager(IKernel kernel, IFileSystem fileSystem, FileReference fileReference, ILogger logger)
{
_kernel = kernel;
_fileSystem = fileSystem;
_fileReferance = fileReference;
_logger = logger;
}
示例4: Execute
/// <summary>
/// Execute the task.
/// </summary>
/// <param name="Job">Information about the current job</param>
/// <param name="BuildProducts">Set of build products produced by this node.</param>
/// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param>
/// <returns>True if the task succeeded</returns>
public override bool Execute(JobContext Job, HashSet<FileReference> BuildProducts, Dictionary<string, HashSet<FileReference>> TagNameToFileSet)
{
// Get the full path to the project file
FileReference ProjectFile = null;
if(!String.IsNullOrEmpty(Parameters.Project))
{
ProjectFile = ResolveFile(Parameters.Project);
}
// Get the path to the editor, and check it exists
FileReference EditorExe;
if(String.IsNullOrEmpty(Parameters.EditorExe))
{
EditorExe = new FileReference(HostPlatform.Current.GetUE4ExePath("UE4Editor-Cmd.exe"));
}
else
{
EditorExe = ResolveFile(Parameters.EditorExe);
}
// Make sure the editor exists
if(!EditorExe.Exists())
{
CommandUtils.LogError("{0} does not exist", EditorExe.FullName);
return false;
}
// Run the commandlet
CommandUtils.RunCommandlet(ProjectFile, EditorExe.FullName, Parameters.Name, Parameters.Arguments);
return true;
}
示例5: PluginInfo
/// <summary>
/// Constructs a PluginInfo object
/// </summary>
/// <param name="InFile"></param>
/// <param name="InLoadedFrom">Where this pl</param>
public PluginInfo(FileReference InFile, PluginLoadedFrom InLoadedFrom)
{
Name = Path.GetFileNameWithoutExtension(InFile.FullName);
File = InFile;
Directory = File.Directory;
Descriptor = PluginDescriptor.FromFile(File, InLoadedFrom == PluginLoadedFrom.GameProject);
LoadedFrom = InLoadedFrom;
}
示例6: DeleteFile
public void DeleteFile(FileReference path)
{
path = _workingDirectory + fixPath(path);
if (File.Exists(path))
{
File.Delete(path);
}
}
示例7: ListDirectoriesInDirectory
public IEnumerable<string> ListDirectoriesInDirectory(FileReference path)
{
path = _workingDirectory + fixPath(path);
if (Directory.Exists(path))
return Directory.GetDirectories(path);
else
return null;
}
示例8: UProjectInfo
UProjectInfo(FileReference InFilePath, bool bInIsCodeProject)
{
GameName = InFilePath.GetFileNameWithoutExtension();
FileName = InFilePath.GetFileName();
FilePath = InFilePath;
Folder = FilePath.Directory;
bIsCodeProject = bInIsCodeProject;
}
示例9: OpenFile
public System.IO.Stream OpenFile(FileReference path)
{
path = _workingDirectory + fixPath(path);
if (File.Exists(path))
return File.Open(path, FileMode.Open);
else
return null;
}
示例10: DeleteDirectory
public void DeleteDirectory(FileReference path)
{
path = _workingDirectory + fixPath(path);
if (Directory.Exists(path))
{
Directory.Delete(path, true);
}
}
示例11: CreateDirectory
public void CreateDirectory(FileReference path)
{
path = _workingDirectory + fixPath(path);
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
}
示例12: Construtor_throws_ArgumentNullException_if_changes_have_different_paths
public void Construtor_throws_ArgumentNullException_if_changes_have_different_paths()
{
var file1 = new FileReference("/path1", DateTime.MinValue, 23);
var file2 = new FileReference("/path2", DateTime.MinValue, 23);
var change1 = new Change(ChangeType.Added, null, file1);
var change2 = new Change(ChangeType.Deleted, file2, null);
Assert.Throws<ArgumentException>(() => new ChangeList(new [] { change1, change2 }));
}
示例13: CreateFile
public Stream CreateFile(FileReference path)
{
path = fixPath(path);
if (File.Exists(_workingDirectory + path))
{
DeleteFile(path);
}
CreateDirectory(path.FileLocation.Substring(0, path.FileLocation.Length - Path.GetFileName(path).Length));
return File.Create(_workingDirectory + path);
}
示例14: CookCommandlet
public static void CookCommandlet(string ProjectName)
{
FileReference ProjectFile;
if(ProjectName.Contains('/') || ProjectName.Contains('\\'))
{
ProjectFile = new FileReference(ProjectName);
}
else if(!UProjectInfo.TryGetProjectFileName(ProjectName, out ProjectFile))
{
throw new AutomationException("Cannot determine project path for {0}", ProjectName);
}
CookCommandlet(ProjectFile);
}
示例15: UBTCommandline
/// <summary>
/// Builds a UBT Commandline.
/// </summary>
/// <param name="Project">Unreal project to build (optional)</param>
/// <param name="Target">Target to build.</param>
/// <param name="Platform">Platform to build for.</param>
/// <param name="Config">Configuration to build.</param>
/// <param name="AdditionalArgs">Additional arguments to pass on to UBT.</param>
public static string UBTCommandline(FileReference Project, string Target, string Platform, string Config, string AdditionalArgs = "")
{
string CmdLine;
if (Project == null)
{
CmdLine = String.Format("{0} {1} {2} {3}", Target, Platform, Config, AdditionalArgs);
}
else
{
CmdLine = String.Format("{0} {1} {2} -Project={3} {4}", Target, Platform, Config, CommandUtils.MakePathSafeToUseWithCommandLine(Project.FullName), AdditionalArgs);
}
return CmdLine;
}