Class OverviewUsed when calling internal operations of an application. This serves as a fundamental part of the Friendly library. However, it is easy to use. Please refer to the Parameter and Return Value Rules.
delegate information Type public delegate AppVar FriendlyOperation(params object[] args);
Description A delegate to call operations within the target application.
Return value When the operation has a return value, the result is stored in a variable declared within the target class, and an object for manipulating that variable is returned. When there is no return value, returns null.
Parameter
Parameters corresponding to the operation. Can be null, a serializable objecr, or an AppVar.
Parameter and Return Value Rules Method calls Parameter
Parameters that correspond to the method being called.
Return value
When the called method has a return value, AppVar. When it doesn't have a return value, null.
Sample
//Declare variables in the application AppVar dic = app.Dim(new Dictionary<int, string>());
// Calling the Add method dic["Add"](1, "1"); dic["Add"](2, "2");
// Use an AppVar to retrieve values from a method that uses out or ref parameters. // Other parameters are serialized and stored in the target application's memory. AppVar value = app.Dim(); //null AppVar isSuccess = dic["TryGetValue"](1, value);
// The return value is stored in the application. If needed, it can be serialized and retrieved. bool isSuccessCore = (bool)isSuccess.Core;
// Store the value retrieved for the value variable. string valueCore = (string)value.Core;
None
Return value
AppVar containing the retrieved value
Return valuenull
Sample
// Class for the following sample //class MyDataClass //{ // public int data; //}
// Generating an object of the target class AppVar myData = app.Dim(new NewInfo<MyDataClass>());
// setting myData["data"](100);
// getting AppVar value = myData["data"](); int coreValue = (int)value.Core;
Accessing properties When retrieving a value
Parameters
None
Return value
AppVar containing the retrieved value
When setting a value
Parameter
The value to use
Return valuenull
Sample
// declare a variable in the application AppVar point = app.Dim(new NewInfo("System.Drawing.Point")); // setting point["X"](100);
// getting AppVar x = point["X"](); int xValue = (int)x.Core;
Accessing indexers When retrieving a value
Parameters
Parameters to the indexer
Return value
AppVar containing the retrieved value
When setting a value
Parameter
Parameters to the indexer, followed by the value to use
//Initialize AppVar array = app.Dim(new List<int>()); array["Add"](0); array["Add"](1); array["Add"](2);
//Setting array["[]"](1, 100);
//Acquisition AppVar index1 = array["[]"](1); int value = (int)index1.Core;
Sample②
// Class for the following sample //class IndexAccess //{ // public int this[int index, string key]; //} //Declare variables in the application AppVar access = app.Dim(new NewInfo<IndexAccess>());
//Setting When more than one indexer parameters are involved. access ["[,]"](1, "key", 100);
// Retrieving a value AppVar value = myData["[,]"](1, "key"); int coreValue = (int)value.Core;
JR
|
|