Ejemplo n.º 1
0
            public override void Execute(FileSysEmulator fse)
            {
                FileSysEmulator.FileSystemItem itemLinkTo = _sourcePath.Resolved.ResolvedFsi;
                if (itemLinkTo is FileSysEmulator.FsLink)
                {
                    throw new ApplicationException("Can't create link to link.");
                }

                FileSysEmulator.FileSystemItem targetContainer = _destPath.Resolved.ResolvedFsi;
                if (targetContainer is FileSysEmulator.FsLink)
                {
                    targetContainer = fse.GetTargetItemOfLink((FileSysEmulator.FsLink)targetContainer);
                }

                if (targetContainer is FileSysEmulator.FsDir)
                {
                    FileSysEmulator.FsDir dir = (FileSysEmulator.FsDir)targetContainer;
                    dir.AddLink(itemLinkTo, true);
                }
                else if (targetContainer is FileSysEmulator.FsDrive)
                {
                    FileSysEmulator.FsDrive drv = (FileSysEmulator.FsDrive)targetContainer;
                    drv.AddLink(itemLinkTo, true);
                }
                else
                {
                    throw new ApplicationException(String.Format("Unsupported link target '{0}'.", targetContainer.GetType().Name));
                }
            }
Ejemplo n.º 2
0
            public override void Execute(FileSysEmulator fse)
            {
                FileSysEmulator.FileSystemItem item = _targetDir.Resolved.ResolvedFsi;

                if (item is FileSysEmulator.FsLink)
                {
                    item = fse.GetTargetItemOfLink((FileSysEmulator.FsLink)item);
                }

                if (item is FileSysEmulator.FsDrive)
                {
                    FileSysEmulator.FsDrive drv = (FileSysEmulator.FsDrive)item;
                    drv.AddDir(_newSubDir.Arg.Replace("\\", ""));
                }
                else
                {
                    FileSysEmulator.FsDir dir = (FileSysEmulator.FsDir)item;
                    dir.AddDir(_newSubDir.Arg.Replace("\\", ""));
                }
            }
Ejemplo n.º 3
0
        public void Resolve(FileSysEmulator fse)
        {
            FileSysEmulator.FsDrive currDrv = fse.CurrentDrive;
            if (currDrv == null)
            {
                throw new ApplicationException(String.Format("Can't resolve path '{0}': there isn't current drive.", ToString()));
            }

            _resolved = (ArgInfo)this.MemberwiseClone();
            _resolved._locationSteps = new String[0];

            if (_drive.Length == 0)
            {
                _resolved._drive = currDrv.Name;
            }

            if (_relativity == PathType.RelativeToDir || _relativity == PathType.RelativeToDriveDir)
            {
                _resolved._relativity = PathType.RelativeToDriveRoot;
                FileSysEmulator.FsDir currDir = currDrv.CurrentDir;
                if (currDir != null)
                {
                    List <String> lst = currDir.GetLocationSteps(false);
                    lst.AddRange(_locationSteps);
                    _resolved._locationSteps = lst.ToArray();
                }
                else
                {
                    _resolved._locationSteps = _locationSteps;
                }
            }
            else
            {
                _resolved._locationSteps = _locationSteps;
            }


            _resolved._arg = _resolved.GetFullPath();
        }