Repairs a clip by fixing any faults such as missing files. Supports bulk repair where all clips of a similar type may be repaired using the same information.

Namespace:  ScreenMonkey.Clips
Assembly:  ScreenMonkey.Clips (in ScreenMonkey.Clips.dll) Version: 3.2.0.0 (3.3.1.4)

Syntax

C#
public virtual IRepairInformation Repair(
	IRepairInformation info
)
Visual Basic (Declaration)
Public Overridable Function Repair ( _
	info As IRepairInformation _
) As IRepairInformation
Visual C++
public:
virtual IRepairInformation^ Repair(
	IRepairInformation^ info
)

Parameters

info
Type: ScreenMonkey.Clips..::.IRepairInformation
Contains information to try and repair the clip with. If it is null then you should gather any information required to repair the clip and pass in back through the return value.

Return Value

Information to pass to other similar clips to reapir the clip with.

Remarks

Override to provide functionality to repair your clip or find any missing files. Pass any information to repair other clips back in the IRepairInformation interface. If the info object is null then this is the first clip being repaired. If info is not null then you should use the information in IRepairInformation to try and repair the clip instead of prompting the user again. If you want to provide bulk repair where all clips of this type can be repaired using the same information the override Repair(IRepairInformation) instead.

Examples

Displays a file dialog to the user asking to locate the missing media file.
CopyC#
public override IRepairInformation Repair(IRepairInformation info)
{
   FileInfo repairedFile = default(FileInfo);
   RepairInformation repairInfo = null;

   if (info is RepairInformation)
   {
       //We already have the information to repair this clip.
       repairedFile = new FileInfo(Path.Combine(info.NewPath, MediaFile.Name));
       //Try to find the file by using the previous repair directory.

       //Does this directory contain this image.
       if (repairedFile.Exists)
       {
           //Set the file to this new file.
           MediaFile = repairedFile;

           //Now re-load the clip with this new file.
           Load();
       }

       repairInfo = (RepairInformation)info;
   }
   else
   {
       OpenFileDialog openFileDlg = new OpenFileDialog();

       if (openFileDlg.ShowDialog() == DialogResult.OK)
       {
           repairedFile = new FileInfo(openFileDlg.FileName);

           //Set the file to this new file.
           MediaFile = repairedFile;

           //Now re-load the clip with this new file.
           Load();

           //Pass this file info to other clips so they might also be repaired.
           repairInfo = new RepairInformation();
           repairInfo.Repaired = true;
           repairInfo.RepairAll = true;
           repairInfo.NewPath = MediaFile.Directory.FullName;
       }
   }

   return repairInfo;
}

See Also