本文整理汇总了C#中FlatRedBall.Glue.SaveClasses.ReferencedFileSave.GetRelativePath方法的典型用法代码示例。如果您正苦于以下问题:C# ReferencedFileSave.GetRelativePath方法的具体用法?C# ReferencedFileSave.GetRelativePath怎么用?C# ReferencedFileSave.GetRelativePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlatRedBall.Glue.SaveClasses.ReferencedFileSave
的用法示例。
在下文中一共展示了ReferencedFileSave.GetRelativePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveReferencedFile
//.........这里部分代码省略.........
ProjectManager.GlueProjectSave.GlobalContentHasChanged = true;
// Much faster to just remove the tree node. This was done
// to reuse code and make things reactive, but this has gotten
// slow on bigger projects.
//ElementViewWindow.UpdateGlobalContentTreeNodes(false); // don't save here because projects will get saved below
Action refreshUiAction = () =>
{
TreeNode treeNode = GlueState.Self.Find.ReferencedFileSaveTreeNode(referencedFileToRemove);
if (treeNode.Tag != referencedFileToRemove)
{
throw new Exception("Error removing the tree node - the selected tree node doesn't reference the file being removed");
}
treeNode.Parent.Nodes.Remove(treeNode);
};
MainGlueWindow.Self.Invoke((MethodInvoker)delegate
{
refreshUiAction();
}
);
ContentLoadWriter.UpdateLoadGlobalContentCode();
List<IElement> elements = ObjectFinder.Self.GetAllElementsReferencingFile(referencedFileToRemove.Name);
foreach (IElement element in elements)
{
if (regenerateCode)
{
CodeWriter.GenerateCode(element);
}
}
}
#endregion
// November 10, 2015
// I feel like this may
// have been old code before
// we had full dependency tracking
// in Glue. This file should only be
// removed from the project if nothing
// else references it, including no entities.
// This code does just entities/screens/global
// content, but doesn't check the full dependency
// tree. I think we can just remove it and depend on
// the code below.
// Actually, removing this seems to cause problems - files
// that should be removed aren't. So instead we'll chnage the
// call to use the dependency tree:
// replace:
List<string> referencedFiles =
GlueCommands.Self.FileCommands.GetAllReferencedFileNames().Select(item=>item.ToLowerInvariant()).ToList();
string absoluteToLower = GlueCommands.Self.GetAbsoluteFileName(referencedFileToRemove).ToLowerInvariant();
string relativeToProject = FileManager.MakeRelative(absoluteToLower, GlueState.Self.ContentDirectory);
bool isReferencedByOtherContent = referencedFiles.Contains(relativeToProject);
if (isReferencedByOtherContent == false)
{
additionalFilesToRemove.Add(referencedFileToRemove.GetRelativePath());
string itemName = referencedFileToRemove.GetRelativePath();
string absoluteName = ProjectManager.MakeAbsolute(referencedFileToRemove.Name, true);
// I don't know why we were removing the file from the ProjectBase - it should
// be from the Content project
//ProjectManager.RemoveItemFromProject(ProjectManager.ProjectBase, itemName);
ProjectManager.RemoveItemFromProject(ProjectManager.ProjectBase.ContentProject, itemName, performSave: false);
foreach (ProjectBase syncedProject in ProjectManager.SyncedProjects)
{
ProjectManager.RemoveItemFromProject(syncedProject.ContentProject, absoluteName);
}
}
if (ProjectManager.IsContent(referencedFileToRemove.GetRelativePath()))
{
UnreferencedFilesManager.Self.RefreshUnreferencedFiles(false);
foreach (var file in UnreferencedFilesManager.LastAddedUnreferencedFiles)
{
additionalFilesToRemove.Add(file.FilePath);
}
}
ReactToRemovalIfCsv(referencedFileToRemove, additionalFilesToRemove);
GluxCommands.Self.SaveGlux();
}
示例2: UpdateFileMembershipInProject
/// <summary>
/// Updates the presence of the RFS in the main project. If the RFS has project specific files, then those
/// files are updated in the appropriate synced project.
/// </summary>
/// <remarks>
/// This method does not update synced projects if the synced projects use the same file. The reason is because
/// this is taken care of when the projects are saved later on.
/// </remarks>
/// <param name="referencedFileSave">The RFS representing the file to update membership on.</param>
/// <returns>Whether anything was added to any projects.</returns>
public static bool UpdateFileMembershipInProject(ReferencedFileSave referencedFileSave)
{
var assetTypeInfo = referencedFileSave.GetAssetTypeInfo();
bool shouldSkip = assetTypeInfo != null && assetTypeInfo.ExcludeFromContentProject;
bool wasAnythingAdded = false;
if (!shouldSkip)
{
bool useContentPipeline = referencedFileSave.UseContentPipeline || (assetTypeInfo != null && assetTypeInfo.MustBeAddedToContentPipeline);
wasAnythingAdded = UpdateFileMembershipInProject(ProjectBase, referencedFileSave.GetRelativePath(), useContentPipeline, false);
foreach (ProjectSpecificFile projectSpecificFile in referencedFileSave.ProjectSpecificFiles)
{
wasAnythingAdded |= UpdateFileMembershipInProject(GetProjectByTypeId(projectSpecificFile.ProjectId), projectSpecificFile.FilePath, useContentPipeline, true);
}
if (wasAnythingAdded)
{
int m = 3;
}
}
return wasAnythingAdded;
}