private void FillListWithReferencedFiles(List <string> files, ElementSave element) { RecursiveVariableFinder rvf; string value; foreach (var state in element.AllStates) { rvf = new RecursiveVariableFinder(element.DefaultState); value = rvf.GetValue <string>("SourceFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } value = rvf.GetValue <string>("CustomFontFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } List <Gum.Wireframe.ElementWithState> elementStack = new List <Wireframe.ElementWithState>(); var elementWithState = new Gum.Wireframe.ElementWithState(element); elementWithState.StateName = state.Name; elementStack.Add(elementWithState); foreach (InstanceSave instance in element.Instances) { rvf = new RecursiveVariableFinder(instance, elementStack); value = rvf.GetValue <string>("SourceFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } value = rvf.GetValue <string>("CustomFontFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } } } }
private void FillListWithReferencedFiles(List <string> files, ElementSave element) { RecursiveVariableFinder rvf; string value; foreach (var state in element.AllStates) { rvf = new RecursiveVariableFinder(element.DefaultState); value = rvf.GetValue <string>("SourceFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } value = rvf.GetValue <string>("CustomFontFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } List <Gum.Wireframe.ElementWithState> elementStack = new List <Wireframe.ElementWithState>(); var elementWithState = new Gum.Wireframe.ElementWithState(element); elementWithState.StateName = state.Name; elementStack.Add(elementWithState); foreach (InstanceSave instance in element.Instances) { // August 5, 2018 - why are we not considering // the file name of the element? Isn't that a referenced // file? var instanceElement = GetElementSave(instance); if (instanceElement != null) { string prefix = FileManager.GetDirectory(GumProjectSave.FullFileName); if (instanceElement is ComponentSave) { prefix += "Components/"; } else // standard element { prefix += "Standards/"; } files.Add(prefix + instanceElement.Name + "." + instanceElement.FileExtension); } rvf = new RecursiveVariableFinder(instance, elementStack); value = rvf.GetValue <string>("SourceFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } value = rvf.GetValue <string>("CustomFontFile"); if (!string.IsNullOrEmpty(value)) { files.Add(value); } } } }