Esempio n. 1
0
    NextCall files(WorkflowMethod invoker)
    {
        WFContext.Caption = "Building filelist...";

        if (WAFRuntime.FileSystem.FileExists(_pathFromRootToAppFolder + "WAF\\Setup\\Setup.status")) // deleting setup status file from previous installation
            WAFRuntime.FileSystem.FileDelete(_pathFromRootToAppFolder + "WAF\\Setup\\Setup.status");

        if (_includeDatabase) _included.Add(_dbFilePath);
        if (_includeContentFiles) {
            addFiles(_included, _pathFromRootToAppFolder + "WAF\\Files\\Content", _pathFromRootToAppFolder + "WAF\\Files\\Content\\Settings");
        }
        if (_includeSettings) {
            addFiles(_included, _pathFromRootToAppFolder + "WAF\\Files\\Content\\Settings");
        }
        if (_includeSearchIndex) {
            addFiles(_included, _pathFromRootToAppFolder + "App_Data\\SearchIndex");
        }
        if (_includeDefinitions) {
            _included.Add(_pathFromRootToAppFolder + "WAF\\Files\\Definitions\\ContentDefinitions.xml");
        }
        if (_includeAppCode) {
            addFiles(_included, _pathFromRootToAppFolder + "App_Code");
        }
        if (_includeWAF) {
            addFiles(_included, _pathFromRootToAppFolder + "WAF", new string[] { _pathFromRootToAppFolder + "WAF\\Files\\Temp", _pathFromRootToAppFolder + "WAF\\Files\\Uploads", _pathFromRootToAppFolder + "WAF\\Files\\Content" });
        }
        if (_includeTemplates) {
            addFiles(_included, _pathFromRootToAppFolder, _pathFromRootToAppFolder + "WAF", "*.htm;*.aspx;*.cs;*.js;*.png;*.jpg;*.gif;*.ascx;*.css;");
        }
        if (_includeOther) {
            addFiles(_included, _pathFromRootToAppFolder, _pathFromRootToAppFolder + "WAF");
        }
        Dictionary<string, bool> info = new Dictionary<string, bool>();
        info.Add("includeDatabase", _includeAppCode);
        info.Add("includeContentFiles", _includeContentFiles);
        info.Add("includeSettings", _includeSettings);
        info.Add("includeSearchIndex", _includeSearchIndex);
        info.Add("includeDefinitions", _includeDefinitions);
        info.Add("includeAppCode", _includeAppCode);
        info.Add("includeTemplates", _includeTemplates);
        info.Add("includeWAF", _includeWAF);
        info.Add("includeOther", _includeOther);
        using (MemoryStream ms = new MemoryStream()) {
            BinaryFormatter bs = new BinaryFormatter();
            bs.Serialize(ms, info);
            pathInfoFile = _pathFromRootToAppFolder + "App_Data\\info.waf";
            if (WAFRuntime.FileSystem.FileExists(pathInfoFile)) WAFRuntime.FileSystem.FileDelete(pathInfoFile);
            WAFRuntime.FileSystem.FileWriteAllBytes(pathInfoFile, ms.ToArray());
            if (!_included.Contains(pathInfoFile)) _included.Add(pathInfoFile);
        }
        _fileName = WAFRuntime.Engine.FileTempPath + Guid.NewGuid();
        WMCompressFiles n = new WMCompressFiles(_fileName, _included, _pathFromRootToAppFolder, ZipErrorHandling.NotifyUserOnErrors);
        return new NextCall(n, sendFile, onException);
    }
Esempio n. 2
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     if (!Session.Access.IsAdmin()) throw new AccessViolationException();
     string path = GetSecureInput<string>();
     _tempFile = Engine.FileTempPath + Guid.NewGuid();
     UniqueList<string> files = new UniqueList<string>();
     WFContext.Caption = "Building list of files to zip...";
     buildFileList(path, files);
     WMCompressFiles d = new WMCompressFiles(_tempFile, files, path, ZipErrorHandling.NotifyUserOnErrors);
     return new NextCall(d, onComplete);
 }
Esempio n. 3
0
 public override NextCall Invoke(WorkflowMethod invoker)
 {
     _path = GetSecureInput<string>();
     _tempFile = Engine.FileTempPath + Guid.NewGuid();
     WMCompressFiles c = new WMCompressFiles(_tempFile, new UniqueList<string>(_path), Path.GetDirectoryName(_path), ZipErrorHandling.AskUserOnFirstError);
     return new NextCall(c, onZipped);
 }
Esempio n. 4
0
 NextCall start(WorkflowMethod invoker)
 {
     if (WAFRuntime.FileSystem.FileExists(_tempFile)) {
         int n = 2;
         while (WAFRuntime.FileSystem.FileExists(targetFolder + pathInfo.Name + " (" + n + ").zip")) n++;
         _tempFile = targetFolder + pathInfo.Name + " (" + n + ").zip";
     }
     UniqueList<string> files = new UniqueList<string>();
     WFContext.Caption = "Building list of files to zip...";
     buildFileList(path, files);
     WMCompressFiles d = new WMCompressFiles(_tempFile, files, path, ZipErrorHandling.NotifyUserOnErrors);
     return new NextCall(d, onComplete);
 }