Example #1
0
        private void AddReferencedFilesToElement(GumElement from, GlueElement to, Dictionary <string, CopiedFileReference> copiedFiles)
        {
            string gumDirectory     = FileManager.GetDirectory(mGumProjectSave.FullFileName);
            string contentDirectory = GetContentFolder();

            foreach (GumStateSave stateSave in from.States)
            {
                foreach (VariableSave variable in stateSave.Variables.Where(item => item.IsFile && item.Value != null && item.SetsValue))
                {
                    string sourceFile = (string)variable.Value;

                    string absoluteFile = FileManager.RemoveDotDotSlash(gumDirectory + sourceFile).ToLower();

                    if (copiedFiles.ContainsKey(absoluteFile))
                    {
                        string destination = copiedFiles[absoluteFile].Destination;
                        string rfsName     = FileManager.MakeRelative(destination, contentDirectory);
                        if (!to.ReferencedFiles.Any(item => item.Name == rfsName))
                        {
                            // create a RFS here
                            ReferencedFileSave rfs = new ReferencedFileSave();
                            rfs.Name        = rfsName;
                            rfs.RuntimeType = "Microsoft.Xna.Framework.Graphics.Texture2D";
                            to.ReferencedFiles.Add(rfs);
                        }
                    }
                }
            }
        }
Example #2
0
        public void AddNamedObjectSavesToGlueElement(global::Gum.DataTypes.ElementSave element, IElement toReturn, Dictionary <string, CopiedFileReference> copiedFiles)
        {
            foreach (var instance in element.Instances)
            {
                NamedObjectSave nos = CreateNosFor(instance, toReturn);

                toReturn.NamedObjects.Add(nos);
            }
        }
        private void AddReferencedFilesToElement(GumElement from, GlueElement to, Dictionary<string, CopiedFileReference> copiedFiles)
        {
            string gumDirectory = FileManager.GetDirectory(mGumProjectSave.FullFileName);
            string contentDirectory = GetContentFolder();
            foreach (GumStateSave stateSave in from.States)
            {

                foreach (VariableSave variable in stateSave.Variables.Where(item=>item.IsFile && item.Value != null && item.SetsValue))
                {
                    string sourceFile = (string)variable.Value;

                    string absoluteFile = FileManager.RemoveDotDotSlash(gumDirectory + sourceFile).ToLower();

                    if (copiedFiles.ContainsKey(absoluteFile))
                    {
                        string destination = copiedFiles[absoluteFile].Destination;
                        string rfsName = FileManager.MakeRelative(destination, contentDirectory);
                        if (!to.ReferencedFiles.Any(item => item.Name == rfsName))
                        {
                            // create a RFS here
                            ReferencedFileSave rfs = new ReferencedFileSave();
                            rfs.Name = rfsName;
                            rfs.RuntimeType = "Microsoft.Xna.Framework.Graphics.Texture2D";
                            to.ReferencedFiles.Add(rfs);
                        }
                    }
                }
            }

        }