Ejemplo n.º 1
0
        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)));
        }
 public static IScriptCommand ParseOrCreatePath(IDiskProfile profile, string path,
                                                bool isFolder, Func <IEntryModel, IScriptCommand> thenFunc)
 {
     return(WPFScriptCommands.ParsePath(new[] { profile }, path, thenFunc,
                                        WPFScriptCommands.CreatePath(profile, path, isFolder, false, thenFunc)));
 }