private void EnsureFullPathProperty() { if (Parent is ProjectItem parentProjectItem && PropertiesList.FirstOrDefault(x => x.Name == "FullPath") == null) { MockProperty fullpath = new MockProperty { Name = "FullPath" }; if (parentProjectItem.Collection.Parent is ProjectItem projectItem) { fullpath.Value = Path.Combine(projectItem.Properties.GetValue("FullPath", string.Empty), parentProjectItem.Name); } else { fullpath.Value = Path.Combine(Path.GetDirectoryName(((Project)parentProjectItem.Collection.Parent).FullName), parentProjectItem.Name); } PropertiesList.Add(fullpath); } }
private void EnsureFullPathProperty() { ProjectItem parentProjectItem = Parent as ProjectItem; if (parentProjectItem != null && PropertiesList.FirstOrDefault(x => x.Name == "FullPath") == null) { MockProperty fullpath = new MockProperty() { Name = "FullPath" }; ProjectItem projectItem = parentProjectItem.Collection.Parent as ProjectItem; if (projectItem != null) { fullpath.Value = Path.Combine(projectItem.Properties.GetValue("FullPath", string.Empty), parentProjectItem.Name); } else { fullpath.Value = Path.Combine(Path.GetDirectoryName(((Project)parentProjectItem.Collection.Parent).FullName), parentProjectItem.Name); } PropertiesList.Add(fullpath); } }