Example #1
0
        public override void Evaluate()
        {
            var targetFile = RegexMatch.Groups[1].Value.Trim();
            var volumeName = RegexMatch.Groups[3].Value.Trim();

            Persistance.File file;

            if (volumeName.Trim() != "")
            {
                var targetVolume = GetVolume(volumeName);
                file = targetVolume.GetByName(targetFile);
                if (file == null)
                {
                    throw new KOSException("File '" + targetFile + "' not found", this);
                }
                targetVolume.DeleteByName(targetFile);
            }
            else
            {
                file = SelectedVolume.GetByName(targetFile);
                if (file == null)
                {
                    throw new KOSException("File '" + targetFile + "' not found", this);
                }
                SelectedVolume.DeleteByName(targetFile);
            }

            State = ExecutionState.DONE;
        }
Example #2
0
        public override void Evaluate()
        {
            String targetFile = RegexMatch.Groups[1].Value.Trim();
            String operation  = RegexMatch.Groups[3].Value.Trim().ToUpper();
            String volumeName = RegexMatch.Groups[5].Value.Trim();
            File   file       = null;

            Volume targetVolume = null;

            switch (operation)
            {
            case "FROM":
                targetVolume = GetVolume(volumeName);     // Will throw if not found
                file         = targetVolume.GetByName(targetFile);
                if (file == null)
                {
                    throw new kOSException("File '" + targetFile + "' not found");
                }
                targetVolume.DeleteByName(targetFile);
                break;

            default:
                file = SelectedVolume.GetByName(targetFile);
                if (file == null)
                {
                    throw new kOSException("File '" + targetFile + "' not found");
                }
                SelectedVolume.DeleteByName(targetFile);
                break;
            }

            State = ExecutionState.DONE;
        }
Example #3
0
        public override void Evaluate()
        {
            String targetFile = RegexMatch.Groups[1].Value.Trim();
            String volumeName = RegexMatch.Groups[3].Value.Trim();

            File   file         = null;
            Volume targetVolume = null;

            if (volumeName.Trim() != "")
            {
                targetVolume = GetVolume(volumeName); // Will throw if not found
                file         = targetVolume.GetByName(targetFile);
                if (file == null)
                {
                    throw new kOSException("File '" + targetFile + "' not found", this);
                }
                targetVolume.DeleteByName(targetFile);
            }
            else
            {
                file = SelectedVolume.GetByName(targetFile);
                if (file == null)
                {
                    throw new kOSException("File '" + targetFile + "' not found", this);
                }
                SelectedVolume.DeleteByName(targetFile);
            }

            State = ExecutionState.DONE;
        }