private void DoNewManifest() { var manifest = new DeployitManifest("My application", "1.0"); SetManifest(manifest); _openedManifestFileName = null; RaisePropertyChanged(() => Title); }
private void DoOpenManifest() { string filename = FileDialogs.OpenManifestFileDialog("Select a manifest file"); if (filename == null) { return; } using (var reader = new StreamReader(filename, DeployitManifest.Encoding)) { DeployitManifest manifest = DeployitManifest.Load(reader); _openedManifestFileName = filename; SetManifest(manifest); RaisePropertyChanged(() => Title); } }
public static void Build(DeployitManifest manifest, string packageRootPath, string packagePath) { using (var z = new ZipFile(System.Text.Encoding.UTF8)) { var stream = new MemoryStream(); var writer = new StreamWriter(stream, DeployitManifest.Encoding); manifest.Save(writer); writer.Flush(); stream.Seek(0L, SeekOrigin.Begin); z.AddEntry(@"deployit-manifest.xml", stream); foreach (var entry in manifest.Entries) { if (string.IsNullOrEmpty(entry.Path)) { continue; } var formattedPath = FormatPath(entry.Path); var path = Path.Combine(packageRootPath, formattedPath); if (EntryExists(z, formattedPath)) { continue; } if (Directory.Exists(path)) { z.AddDirectory(path, formattedPath); } else if (File.Exists(path)) { z.AddFile(path, Path.GetDirectoryName(formattedPath)); } else { throw new InvalidOperationException(string.Format("Cannot find data in '{0}' for entry '{1}'", path, entry.Name)); } } z.SortEntriesBeforeSaving = false; z.ParallelDeflateThreshold = -1; z.Save(packagePath); } }
public override bool Execute() { if (!File.Exists(ManifestPath)) { Log.LogError("Cannont find manifest '{0}", ManifestPath); return(false); } if (string.IsNullOrWhiteSpace(ApplicationVersion)) { Log.LogError("Version not provided"); return(false); } if (!Directory.Exists(PackageDataRootDirectory)) { Log.LogError("Package root directory'{0}' does not exist", PackageDataRootDirectory); return(false); } DeployitManifest manifest; try { var reader = new StreamReader(ManifestPath, DeployitManifest.Encoding); using (reader) { manifest = DeployitManifest.Load(reader); } } catch (Exception ex) { Log.LogErrorFromException(ex); return(false); } manifest.Version = ApplicationVersion; ApplicationName = manifest.ApplicationName; PackageBuilder.Build(manifest, PackageDataRootDirectory, PackagePath); return(true); }
public ManifestItemViewModel(ManifestEditorViewModel editor, DeployitManifest manifest) : base(null) { if (manifest == null) { throw new ArgumentNullException("manifest", "manifest is null."); } if (editor == null) { throw new ArgumentNullException("editor", "editor is null."); } _manifest = manifest; TreeItemLabel = manifest.ApplicationName; _manifest.ApplicationNameChanged += (_, __) => OnApplicationNameChanged(); _manifest.VersionChanged += (_, __) => OnApplicationVersionChanged(); _editor = editor; IsExpanded = true; ItemEditor = new ManifestEditorInfoViewModel(manifest); BuildMenuItems(); }
/// <summary> /// Initializes a new instance of the ManifestEditorViewModel class. /// </summary> /// <param name="manifest"></param> /// <param name="server"></param> public ManifestEditorViewModel(DeployitManifest manifest, IDeployitServer server) { Manifest = manifest; Manifest.ApplicationNameChanged += (_, __) => RaisePropertyChanged(() => ManifestAppName); Manifest.VersionChanged += (_, __) => RaisePropertyChanged(() => ManifestVersion); Server = server; var descriptorsList = server.MetadataService.GetDescriptors(); AllDescriptors = descriptorsList.ToDictionary(_ => _.Type); Descriptors = descriptorsList .Where(_ => _.Interfaces.Contains("udm.Deployable") && !_.IsVirtual) .ToDictionary(_ => _.Type); AvailableDescriptors = ( from d in Descriptors.Values where !d.IsVirtual orderby d.Type select d ).ToList(); TreeRoots = new List <ManifestItemViewModel> { new ManifestItemViewModel(this, manifest) }; }
/// <summary> /// Initializes a new instance of the ManifestEditorViewModel class. /// </summary> /// <param name="manifest"></param> public ManifestEditorInfoViewModel(DeployitManifest manifest) { _manifest = manifest; _manifest.ApplicationNameChanged += (_, __) => RaisePropertyChanged(() => ApplicationName); _manifest.VersionChanged += (_, __) => RaisePropertyChanged(() => Version); }
private void SetManifest(DeployitManifest manifest) { Manifest = new ManifestEditorViewModel(manifest, _server); Manifest.PropertyChanged += ManifestOnPropertyChanged; }