I'm creating an Add-in for ArcCatalog using C# that modifies the datasources of layers in a MXD and .LYR files by themselves. I have gotten the MXD code to work but I'm lost with how to modify a .LYR file without the use of IMap. Does anyone have any code suggestions?
To load an MXD and loop and start modifying layers in the TOC was simply something like:
UID pUID = new UIDClass();
pDoc.Open("C:\\Test\\File1.mxd");
for (int i = 0; i < pDoc.MapCount; i++)
{
pMap = pDoc.get_Map(i);
UID uid = new UIDClass();
uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}"; //IFeatureLayer
IEnumLayer layers = pMap.get_Layers(uid, true); //Returns all layers
But I'm unsure how to get this process going for standalone .LYR files..
ILayerFile l = new LayerFileClass();
l.Open(fileName);