public override IScriptCommand Execute(ParameterDic pm)
        {
            string path = pm.ReplaceVariableInsideBracketed(PathKey);
            string ext  = (path.Contains(".") ? PathFE.GetExtension(path) : path).TrimStart('.');

            pm.SetValue(DestinationKey, SevenZipWrapper.GetArchiveBytes(ext));
            return(NextCommand);
        }
        public static IScriptCommand ParseOrCreateArchive(IDiskProfile profile, string path, Func <IEntryModel, IScriptCommand> thenFunc)
        {
            string type = profile.Path.GetExtension(path).ToLower();

            byte[] bytes = SevenZipWrapper.GetArchiveBytes(type);

            if (bytes == null)
            {
                return(ResultCommand.Error(new ArgumentException(type + " is not recognized type.")));
            }

            return(WPFScriptCommands.ParseOrCreatePath(profile, path, false,
                                                       em => WPFScriptCommands.WriteBytes(em, bytes, thenFunc)));
        }
        public static IScriptCommand CreateArchive(IEntryModel entryModel, string name, bool renameIfExists,
                                                   Func <IEntryModel, IScriptCommand> thenFunc)
        {
            string type = entryModel.Profile.Path.GetExtension(name).ToLower();

            byte[] bytes = SevenZipWrapper.GetArchiveBytes(type);

            if (bytes == null)
            {
                return(ResultCommand.Error(new ArgumentException(type + " is not recognized type.")));
            }

            return(WPFScriptCommands.CreatePath(entryModel, name, false, renameIfExists,
                                                em => WPFScriptCommands.WriteBytes(em, bytes, thenFunc)));
        }