FindInModulesResult FindInModules(FindInModulesArg tArgs)
tArgs. Operation execution parameters.
The FindInModules operation searches for text by code of development environment objects.
The operation finds all units/forms, which code contains the specified string. The search is executed according to parameters specified in tArgs. The operation results in the list of found objects and also information about found text (string that contains the searched text and index of position in it).
Below is the example of using the FindInModules operation to search the specified string in units code. The request contains moniker of the folder used in search, searched text, and other search options. The response contains information about the unit, which code contains searched text. The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{
"FindInModules" :
{
"tArgs" :
{
"root" :
{
"id" : "S1!M!171999"
},
"caseSensitive" : "false",
"wholeWordsOnly" : "false",
"findString" : "Create"
}
}
}
{
"FindInModulesResult" :
{
"result" :
{
"it" :
[
{
"moduleId" :
{
"id" : "M_ADDITIONAL"
},
"foundLine" : "Public Constructor Create;",
"row" : "4",
"pos" : "21"
},
{
"moduleId" :
{
"id" : "M_ADDITIONAL"
},
"foundLine" : "End Constructor Create;",
"row" : "7",
"pos" : "18"
},
{
"moduleId" :
{
"id" : "M_ADDITIONAL"
},
"foundLine" : "Public Constructor CreateWithParams(Size: Integer; DefaultValue: Double = 0);",
"row" : "9",
"pos" : "21"
},
{
"moduleId" :
{
"id" : "M_ADDITIONAL"
},
"foundLine" : "End Constructor CreateWithParams;",
"row" : "15",
"pos" : "18"
},
{
"moduleId" :
{
"id" : "M_ADDITIONAL"
},
"foundLine" : "obj := New TestObject.CreateWithParams(10, 100);",
"row" : "27",
"pos" : "24"
},
{
"moduleId" :
{
"id" : "M_ADDITIONAL"
},
"foundLine" : "Debug.WriteLine("The main procedure is running. The object is created.");",
"row" : "28",
"pos" : "64"
}
]
}
}
}
public static FindInModulesResult FindInModules(MbId mb, string root, string text)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tFind = new FindInModules()
{
tArgs = new FindInModulesArg()
{
findString = text,
root = new OdId() { id = mb.id + "!" + FindObjectById(mb, root).k },
caseSensitive = false,
wholeWordsOnly = false
}
};
//Search by unit code
var result = somClient.FindInModules(tFind);
return result;
}
See also: