private void PrintFileDescription(VssWMFileDescriptor file, string type = null) { string alternateDisplayPath = ""; if (!String.IsNullOrEmpty(file.AlternateLocation)) alternateDisplayPath = String.Format(", Alternate Location={0}" + file.AlternateLocation); Host.PushIndent(); StringTable table = new StringTable(); if (type != null) table.Add("Type:", type); table.Add("Path:", file.Path); table.Add("Filespec:", file.FileSpecification); table.Add("Recursive:", file.IsRecursive); if (!String.IsNullOrEmpty(file.AlternateLocation)) table.Add("Alternate Location:", file.AlternateLocation); Host.WriteTable(table); Host.PopIndent(); }
private void PrintComponent(VssComponentDescriptor component, bool detailed) { Host.WriteHeader("Component \"{0}:{1}\"", component.WriterName, component.FullPath); Host.PushIndent(); StringTable table = new StringTable(); table.Add("Name:", component.ComponentName); table.Add("Logical Path:", component.LogicalPath); table.Add("Full Path:", component.FullPath); table.Add("Caption: ", component.Caption); table.Add("Type:", component.ComponentType); table.Add("Is Selectable:", component.IsSelectable); table.Add("Is Top Level:", component.IsTopLevel); table.Add("Notify on backup complete:", component.NotifyOnBackupComplete); Host.WriteTable(table); if (detailed) { Host.WriteLine("Components:"); Host.PushIndent(); foreach (VssWMFileDescriptor file in component.Files) { PrintFileDescription(file, "File"); Host.WriteLine(); } foreach (VssWMFileDescriptor file in component.DatabaseFiles) { PrintFileDescription(file, "Database"); Host.WriteLine(); } foreach (VssWMFileDescriptor file in component.DatabaseLogFiles) { PrintFileDescription(file, "Database Log File"); Host.WriteLine(); } Host.PopIndent(); } Host.WriteLine("Paths affected by this component:"); Host.PushIndent(); foreach (string path in component.AffectedPaths) Host.WriteLine("{0}", path); Host.PopIndent(); Host.WriteLine("Volumes affected by this component:"); Host.PushIndent(); foreach (string volume in component.AffectedVolumes) { string displayName; try { displayName = Volume.GetDisplayNameForVolume(volume); } catch { displayName = "Not valid for local machine"; } Host.WriteLine("{0} [{1}]", volume, displayName); } Host.PopIndent(); if (component.Dependencies.Any()) { Host.WriteLine("Component Dependencies:"); Host.PushIndent(); foreach (var dependency in component.Dependencies) PrintDependency(dependency); Host.PopIndent(); } Host.PopIndent(); }
private void PrintSnapshotProperties(VssSnapshotProperties props) { StringTable table = new StringTable(); Host.WriteLine(); Host.WriteHeader("SNAPSHOT ID = {0:B}", props.SnapshotId); table.Add("Shadow Copy Set ID:", props.SnapshotSetId.ToString("B")); table.Add("Original Shadow Copy Count:", props.SnapshotsCount); table.Add("Original Volume Name:", props.OriginalVolumeName); table.Add("Creation Time:", props.CreationTimestamp); table.Add("Device Name:", props.SnapshotDeviceObject); table.Add("Originating Machine:", props.OriginatingMachine); table.Add("Service Machine:", props.ServiceMachine); if ((props.SnapshotAttributes & VssVolumeSnapshotAttributes.ExposedLocally) != 0) table.Add("Exposed Locally as:", props.ExposedName); else if ((props.SnapshotAttributes & VssVolumeSnapshotAttributes.ExposedRemotely) != 0) { table.Add("Exposed Remotely as:", props.ExposedName); if (!String.IsNullOrEmpty(props.ExposedPath)) table.Add("Path Exposed:", props.ExposedPath); } else { table.Add("Is Exposed:", "No"); } table.Add("Provider ID:", props.ProviderId.ToString("B")); StringBuilder attributes = new StringBuilder(); foreach (VssVolumeSnapshotAttributes value in Enum.GetValues(typeof(VssVolumeSnapshotAttributes))) { if (value != VssVolumeSnapshotAttributes.ExposedLocally && value != VssVolumeSnapshotAttributes.ExposedRemotely && (props.SnapshotAttributes & value) == value) { attributes.AppendFormat("{0} ", value); } } table.Add("Snapshot Attributes:", attributes.ToString()); Host.WriteTable(table, 2); }
internal void ListWriterMetadata(bool detailed) { Host.WriteLine("Listing writer metadata..."); foreach (VssWriterDescriptor writer in m_writers) { Host.WriteLine(); // Print writer identity information Host.WriteHeader("Writer \"{0}\"", writer.WriterMetadata.WriterName); Host.PushIndent(); StringTable table = new StringTable(); table.Add("Writer ID:", writer.WriterMetadata.WriterId.ToString("B")); table.Add("Instance ID:", writer.WriterMetadata.InstanceId.ToString("B")); if (writer.WriterMetadata.RestoreMethod == null) { table.Add("Restore Method:", "No restore method specified by this writer."); } else { table.Add("Supports restore events:", (writer.WriterMetadata.RestoreMethod.WriterRestore != VssWriterRestore.Never).ToString()); table.Add("Writer restore conditions:", writer.WriterMetadata.RestoreMethod.Method); table.Add("Requires reboot after restore:", writer.WriterMetadata.RestoreMethod.RebootRequired); } if (!writer.WriterMetadata.ExcludeFiles.Any()) table.Add("Excluded files:", "<none>"); else table.Add("Excluded files:", ""); Host.WriteTable(table); foreach (VssWMFileDescriptor file in writer.WriterMetadata.ExcludeFiles) { PrintFileDescription(file); Host.WriteLine(); } foreach (VssComponentDescriptor component in writer.ComponentDescriptors) { PrintComponent(component, detailed); Host.WriteLine(); } Host.PopIndent(); } }
public void ListWriterStatus() { Host.WriteLine("Listing writer status..."); using (var i1 = Host.GetIndent()) { IList<VssWriterStatusInfo> statusList = m_backupComponents.WriterStatus; Host.WriteLine("Number of writers that responded: {0}", statusList.Count); using (var i2 = Host.GetIndent()) { foreach (VssWriterStatusInfo info in statusList) { Host.WriteLine(); Host.WriteHeader("Writer \"{0}\"", info.Name); StringTable table = new StringTable(); table.Add("Status:", info.State); table.Add("Writer failure code:", info.Failure); table.Add("Writer ID:", info.ClassId.ToString("B")); table.Add("Instance ID:", info.InstanceId.ToString("B")); Host.WriteTable(table, 3); } } } }