public void RegisterFolder(TempFolder tempFolder)
 {
     if (ComponentIndex.Contains(tempFolder))
     {
         return;
     }
     this.ComponentIndex.Add(tempFolder);
 }
示例#2
0
        public void Move(TempFolder parent)
        {
            var tempPath = parent + "\\" + this.Name;

            //this.FileSystem.UpdateRegistration(this, tempPath);
            this.Parent?.RemoveObject(this);
            this.Parent = parent;
            this.Path   = tempPath;
        }
示例#3
0
 public TempFile(TempFileSystem fileSystem, TempFolder parent, string name, string src, TempFeature feat)
 {
     this.FileSystem = fileSystem;
     Name            = name;
     this.Source     = src;
     this.Path       = parent?.Path + "\\";
     this.Move(parent);
     this.Features.Add(feat.Title, feat);
     feat.RegisterFile(this);
 }
示例#4
0
        public TempFolder CreateSpecialFolder(string name)
        {
            if (this.Directory.ContainsKey(name))
            {
                throw new Exception("This folder already has a file or folder with the name: " + name);
            }
            var newFolder = new TempFolder(this.FileSystem, this, name, null);

            this.Directory.Add(name, newFolder);
            this.FolderDirectory.Add(name, newFolder);
            //this.FileSystem.RegisterObject(newFolder);
            return(newFolder);
        }
示例#5
0
        public TempFolder(TempFileSystem fileSystem, TempFolder parent, string name, TempFeature feat) : this(fileSystem, parent, name)
        {
            if (feat != null)
            {
                this.Features.Add(feat.Title, feat);
                feat.RegisterFolder(this);
            }

            if (feat == null && !(name == "root" || VariableConverter.VarToWixId.ContainsKey(name)))
            {
                throw new Exception(name + " must have a feature");
            }
        }
示例#6
0
        /// <summary>
        /// //////////////////////////////////////////////////////////////////><!--->-->
        /// </summary>
        /// <param name="dest"></param>
        /// <param name="src"></param>
        /// <param name="fsFeat"></param>

        public void AddFileOrUpdateFeatures(string dest, string src, TempFeature fsFeat)
        {
            var objects = dest.CleanAndSplitFilePath().ToList();

            var srcParts = src.CleanAndSplitFilePath().ToList();

            objects.Add(srcParts[srcParts.Count - 1]);


            //first let's deal with the top level, this should either be a shortcut var which will be precreated, or it's a drive letter.
            var        topLevelName   = objects[0];
            TempFolder topLevelFolder = null;

            if (this.Root.ContainsFolder(topLevelName))
            {
                topLevelFolder = this.Root.GetFolder(topLevelName);
            }
            else
            {
                if (!topLevelName.IsDriveLetter())
                {
                    throw new Exception("Attempted to add non drive or shortcut top level folder: " + topLevelName);
                }
                topLevelFolder = this.Root.CreateFolder(topLevelName, fsFeat);
            }


            //after that the middle bits should all be folders.
            TempFolder prevFolder = topLevelFolder;
            TempFolder currFolder = null;

            for (int i = 1; i < objects.Count - 1; i++)
            {
                var name = objects[i];
                //if (name == "\\") continue;
                currFolder = prevFolder.AddOrGetAndRegisterFolder(name, fsFeat);
                prevFolder = currFolder;
            }

            if (currFolder == null)
            {
                throw new Exception("unknown error 112");
            }

            //finally the last object is our file name
            var finalName = objects[objects.Count - 1];

            //it may have been required here by another feature in which case it should just update the feature registration.
            currFolder.CreateFileOrRegisterFeature(finalName, src, fsFeat);
        }
示例#7
0
 private TempFolder(TempFileSystem fileSystem, TempFolder parent, string name)
 {
     this.FileSystem = fileSystem;
     this.Name       = name;
     this.Path       = parent?.Path + "\\";
 }