Example #1
0
 /// <summary>
 /// Not serializable, Copy contents from srcFile to destFile.
 /// </summary>
 /// <param name="srcFile"></param>
 /// <param name="destFile"></param>
 /// <param name="nextCommand"></param>
 /// <returns></returns>
 public static IScriptCommand DiskCopyFile(IEntryModel srcFile, IEntryModel destFile, IScriptCommand nextCommand = null)
 {
     return(ScriptCommands.Assign("{DiskCopyFile-Source}", srcFile, false,
                                  ScriptCommands.Assign("{DiskCopyFile-Dest}", destFile, false,
                                                        CoreScriptCommands.DiskOpenStream(dcSourceVariable, "{SourceStream}", FileExplorer.Defines.FileAccess.Read,
                                                                                          CoreScriptCommands.DiskOpenStream(dcDestVariable, "{DestinationStream}", FileExplorer.Defines.FileAccess.Write,
                                                                                                                            CoreScriptCommands.CopyStream("{CopyStream-Source}", "{CopyStream-Dest}",
                                                                                                                                                          CoreScriptCommands.NotifyEntryChanged(ChangeType.Created, null, dcSourceVariable, null, dcDestVariable,
                                                                                                                                                                                                ScriptCommands.Reset(nextCommand, dcSourceVariable, dcDestVariable))))))));
 }
Example #2
0
 /// <summary>
 /// Download a web stream to a file.
 /// </summary>
 /// <param name="urlVariable">Url to access</param>
 /// <param name="destinationFileVariable">Destination file name.</param>
 /// <param name="nextCommand"></param>
 /// <returns></returns>
 public static IScriptCommand DownloadFile(string urlVariable = "{Url}",
                                           string destinationProfileVariable = "{Profile}", string destinationFileVariable = "{DestinationFile}",
                                           IScriptCommand nextCommand        = null)
 {
     return(CoreScriptCommands.Download(urlVariable, "{DownloadStream}",
                                        CoreScriptCommands.DiskParseOrCreateFile(destinationProfileVariable, destinationFileVariable, "{Destination}",
                                                                                 CoreScriptCommands.DiskOpenStream("{Destination}", "{DestinationStream}", FileExplorer.Defines.FileAccess.Write,
                                                                                                                   CoreScriptCommands.CopyStream("{DownloadStream}", "{DestinationStream}",
                                                                                                                                                 ScriptCommands.Reset(nextCommand, "{DownloadStream}", "{Destination}"))))));
 }
 public static IScriptCommand DiskParseOrCreateArchive(string profileVariable     = "{Profile}", string pathVariable = "{Path}", string destVariable = "{Entry}",
                                                       IScriptCommand nextCommand = null)
 {
     return
         (CoreScriptCommands.ParsePath(profileVariable, pathVariable, destVariable,
                                       nextCommand, //FoundCommand
                                                    //NotFoundCommand
                                       CoreScriptCommands.DiskCreatePath(profileVariable, pathVariable, false, destVariable, NameGenerationMode.NoRename,
                                                                         IOScriptCommands.AssignArchiveBytes(pathVariable, "{ArchiveBytes}",
                                                                                                             CoreScriptCommands.DiskOpenStream(destVariable, "{DestStream}", FileAccess.Write,
                                                                                                                                               CoreScriptCommands.CopyStream("{ArchiveBytes}", "{DestStream}"),
                                                                                                                                               CoreScriptCommands.ParsePath(profileVariable, pathVariable, destVariable, nextCommand))))));
 }
Example #4
0
 /// <summary>
 /// Serializable, Copy contents from file1 to file2
 /// </summary>
 /// <param name="sourceFileVariable">Filepath of source</param>
 /// <param name="destinationFileVariable">Filepath of destination</param>
 /// <param name="nextCommand"></param>
 /// <returns></returns>
 public static IScriptCommand DiskCopyFile(string sourceProfileVariable      = "{SourceProfile}", string sourceFileVariable = "{SourceFile}",
                                           string destinationProfileVariable = "{DestinationProfile}", string destinationFileVariable = "{DestinationFile}",
                                           IScriptCommand nextCommand        = null)
 {
     return(CoreScriptCommands.ParsePath(sourceProfileVariable, sourceFileVariable, dcSourceVariable,
                                         CoreScriptCommands.DiskParseOrCreateFile(destinationProfileVariable, destinationFileVariable, dcDestVariable,
                                                                                  CoreScriptCommands.DiskOpenStream(dcSourceVariable, "{SourceStream}", FileExplorer.Defines.FileAccess.Read,
                                                                                                                    CoreScriptCommands.DiskOpenStream(dcDestVariable, "{DestinationStream}", FileExplorer.Defines.FileAccess.Write,
                                                                                                                                                      CoreScriptCommands.CopyStream("{SourceStream}", "{DestinationStream}",
                                                                                                                                                                                    CoreScriptCommands.NotifyEntryChanged(ChangeType.Created, null, dcSourceVariable, null, dcDestVariable,
                                                                                                                                                                                                                          ScriptCommands.Reset(nextCommand, dcSourceVariable, dcDestVariable)))))),
                                         ResultCommand.Error(new FileNotFoundException(sourceFileVariable))));
 }