本文整理汇总了C#中FileReference.GetFileName方法的典型用法代码示例。如果您正苦于以下问题:C# FileReference.GetFileName方法的具体用法?C# FileReference.GetFileName怎么用?C# FileReference.GetFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReference
的用法示例。
在下文中一共展示了FileReference.GetFileName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UProjectInfo
UProjectInfo(FileReference InFilePath, bool bInIsCodeProject)
{
GameName = InFilePath.GetFileNameWithoutExtension();
FileName = InFilePath.GetFileName();
FilePath = InFilePath;
Folder = FilePath.Directory;
bIsCodeProject = bInIsCodeProject;
}
示例2: FileExists
/// <summary>
/// Checks if a file exists.
/// </summary>
/// <param name="fileSystem">The file system</param>
/// <param name="filePath">The path to the file</param>
/// <returns>A bool indicating if the file exists</returns>
public static bool FileExists(this IFileSystem fileSystem, FileReference filePath)
{
return fileSystem.ListFilesInDirectory(filePath.GetDirectory())
.Contains(filePath.GetFileName().FileLocation);
}
示例3: AllocSourceFile
/// <summary>
/// Allocates a generator-specific source file object
/// </summary>
/// <param name="InitFilePath">Path to the source file on disk</param>
/// <param name="InitProjectSubFolder">Optional sub-folder to put the file in. If empty, this will be determined automatically from the file's path relative to the project file</param>
/// <returns>The newly allocated source file object</returns>
public override SourceFile AllocSourceFile(FileReference InitFilePath, DirectoryReference InitProjectSubFolder)
{
if (InitFilePath.GetFileName().StartsWith("."))
{
return null;
}
return new XcodeSourceFile(InitFilePath, InitProjectSubFolder);
}
示例4: CompileCSharpProject
// @todo Mac: Full implementation.
public override void CompileCSharpProject(CSharpEnvironment CompileEnvironment, FileReference ProjectFileName, FileReference DestinationFile)
{
string ProjectDirectory = Path.GetDirectoryName(ProjectFileName.FullName);
if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
{
RPCUtilHelper.CopyFile(ProjectFileName.FullName, ConvertPath(ProjectFileName.FullName), true);
RPCUtilHelper.CopyFile("Engine/Source/Programs/DotNETCommon/MetaData.cs", ConvertPath("Engine/Source/Programs/DotNETCommon/MetaData.cs"), true);
string[] FileList = Directory.GetFiles(ProjectDirectory, "*.cs", SearchOption.AllDirectories);
foreach (string File in FileList)
{
RPCUtilHelper.CopyFile(File, ConvertPath(File), true);
}
}
string XBuildArgs = "/verbosity:quiet /nologo /target:Rebuild /property:Configuration=Development /property:Platform=AnyCPU " + ProjectFileName.GetFileName();
if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
{
RPCUtilHelper.Command(ConvertPath(ProjectDirectory), "xbuild", XBuildArgs, null);
}
else
{
Process XBuildProcess = new Process();
XBuildProcess.StartInfo.WorkingDirectory = ProjectDirectory;
XBuildProcess.StartInfo.FileName = "sh";
XBuildProcess.StartInfo.Arguments = "-c 'xbuild " + XBuildArgs + " |grep -i error; if [ $? -ne 1 ]; then exit 1; else exit 0; fi'";
XBuildProcess.OutputDataReceived += new DataReceivedEventHandler(OutputReceivedDataEventHandler);
XBuildProcess.ErrorDataReceived += new DataReceivedEventHandler(OutputReceivedDataEventHandler);
Utils.RunLocalProcess(XBuildProcess);
}
}
示例5: PackagePlugin
static void PackagePlugin(FileReference SourcePluginFile, IEnumerable<FileReference> BuildProducts, DirectoryReference TargetDir)
{
DirectoryReference SourcePluginDir = SourcePluginFile.Directory;
// Copy all the files to the output directory
FileReference[] SourceFiles = FilterPluginFiles(SourcePluginFile, BuildProducts).ToArray();
foreach(FileReference SourceFile in SourceFiles)
{
FileReference TargetFile = FileReference.Combine(TargetDir, SourceFile.MakeRelativeTo(SourcePluginDir));
CommandUtils.CopyFile(SourceFile.FullName, TargetFile.FullName);
CommandUtils.SetFileAttributes(TargetFile.FullName, ReadOnly: false);
}
// Get the output plugin filename
FileReference TargetPluginFile = FileReference.Combine(TargetDir, SourcePluginFile.GetFileName());
PluginDescriptor NewDescriptor = PluginDescriptor.FromFile(TargetPluginFile, false);
NewDescriptor.bEnabledByDefault = true;
NewDescriptor.bInstalled = true;
NewDescriptor.Save(TargetPluginFile.FullName, false);
}
示例6: CreateHostProject
FileReference CreateHostProject(FileReference HostProjectFile, FileReference PluginFile)
{
DirectoryReference HostProjectDir = HostProjectFile.Directory;
HostProjectDir.CreateDirectory();
// Create the new project descriptor
File.WriteAllText(HostProjectFile.FullName, "{ \"FileVersion\": 3, \"Plugins\": [ { \"Name\": \"" + PluginFile.GetFileNameWithoutExtension() + "\", \"Enabled\": true } ] }");
// Get the plugin directory in the host project, and copy all the files in
DirectoryReference HostProjectPluginDir = DirectoryReference.Combine(HostProjectDir, "Plugins", PluginFile.GetFileNameWithoutExtension());
CommandUtils.ThreadedCopyFiles(PluginFile.Directory.FullName, HostProjectPluginDir.FullName);
CommandUtils.DeleteDirectory(true, DirectoryReference.Combine(HostProjectPluginDir, "Intermediate").FullName);
// Return the path to the plugin file in the host project
return FileReference.Combine(HostProjectPluginDir, PluginFile.GetFileName());
}
示例7: CompileCSharpProject
public override void CompileCSharpProject(CSharpEnvironment CompileEnvironment, FileReference ProjectFileName, FileReference DestinationFile)
{
// Initialize environment variables required for spawned tools.
VCEnvironment EnvVars = VCEnvironment.SetEnvironment(CompileEnvironment.EnvironmentTargetPlatform, bSupportWindowsXP);
Action BuildProjectAction = new Action(ActionType.BuildProject);
// Specify the source file (prerequisite) for the action
FileItem ProjectFileItem = FileItem.GetExistingItemByFileReference(ProjectFileName);
if (ProjectFileItem == null)
{
throw new BuildException("Expected C# project file {0} to exist.", ProjectFileName);
}
// Add the project and the files contained to the prerequisites.
BuildProjectAction.PrerequisiteItems.Add(ProjectFileItem);
VCSharpProjectFile ProjectFile = new VCSharpProjectFile(ProjectFileName);
List<string> ProjectPreReqs = ProjectFile.GetCSharpDependencies();
DirectoryReference ProjectFolder = ProjectFileName.Directory;
foreach (string ProjectPreReqRelativePath in ProjectPreReqs)
{
FileReference ProjectPreReqAbsolutePath = FileReference.Combine(ProjectFolder, ProjectPreReqRelativePath);
FileItem ProjectPreReqFileItem = FileItem.GetExistingItemByFileReference(ProjectPreReqAbsolutePath);
if (ProjectPreReqFileItem == null)
{
throw new BuildException("Expected C# dependency {0} to exist.", ProjectPreReqAbsolutePath);
}
BuildProjectAction.PrerequisiteItems.Add(ProjectPreReqFileItem);
}
// We might be able to distribute this safely, but it doesn't take any time.
BuildProjectAction.bCanExecuteRemotely = false;
// Setup execution via MSBuild.
BuildProjectAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
BuildProjectAction.StatusDescription = ProjectFileName.GetFileName();
BuildProjectAction.CommandPath = EnvVars.MSBuildPath;
if (CompileEnvironment.TargetConfiguration == CSharpTargetConfiguration.Debug)
{
BuildProjectAction.CommandArguments = " /target:rebuild /property:Configuration=Debug";
}
else
{
BuildProjectAction.CommandArguments = " /target:rebuild /property:Configuration=Development";
}
// Be less verbose
BuildProjectAction.CommandArguments += " /nologo /verbosity:minimal";
// Add project
BuildProjectAction.CommandArguments += String.Format(" \"{0}\"", ProjectFileItem.AbsolutePath);
// Specify the output files.
FileReference PDBFilePath = FileReference.Combine(DestinationFile.Directory, DestinationFile.GetFileNameWithoutExtension() + ".pdb");
FileItem PDBFile = FileItem.GetItemByFileReference(PDBFilePath);
BuildProjectAction.ProducedItems.Add(FileItem.GetItemByFileReference(DestinationFile));
BuildProjectAction.ProducedItems.Add(PDBFile);
}