public static string mmSaveObjs(object[,] objNames, object[,] objTypes, string location) { string resultData = ""; if (objNames.GetLength(0) != objTypes.GetLength(0) || objNames.GetLength(1) != 1 || objTypes.GetLength(1) != 1) { return("objNames and objTypes must be Vectors of the same length!"); } for (int iObj = 0; iObj < objNames.GetLength(0); iObj++) { ObjHandle obj = ObjectHandler.GetObject(objNames[iObj, 0].ToString(), objTypes[iObj, 0].ToString()); if (obj == null) { return("Object " + objNames[iObj, 0] + " of type " + objTypes[iObj, 0] + "does not exist!"); } resultData += obj.Serialize() + "\r\n"; } try { File.WriteAllText(location, resultData); } catch (Exception e) { return(e.Message); } return(objNames.GetLength(0) + " object(s) was/were saved!"); }
public static string mmGetObj(string objName, string objType) { ObjHandle obj = ObjectHandler.GetObject(objName, objType); if (obj == null) { return("Object not found."); } return(obj.ToStringWithCounter()); }
public static string mmModifyObj(string objName, string objType, string key, object value) { ObjHandle obj = ObjectHandler.GetObject(objName, objType); if (obj == null) { return("Object not found."); } return(obj.Modify(key, value)); }
public static object[,] mmDisplayObj(string objName, string objType) { ObjHandle obj = ObjectHandler.GetObject(objName, objType); if (obj == null) { return new object[, ] { { "Object not found." } } } ; return(obj.Display()); }
public static object mmCurveDF(string objName, double time) { ObjHandle curveObj = ObjectHandler.GetObject(objName, "CURVE"); if (curveObj == null) { return("Object not found."); } try { return(((Curve)curveObj).GetDF(time)); } catch (Exception e) { return(e.Message); } }
public static object[,] mmGetObjInfo(string objName, string objType, string key, object column, object row) { ObjHandle obj = ObjectHandler.GetObject(objName, objType); if (obj == null) { return new object[, ] { { "Object not found." } } } ; FieldInfo[] keyList = obj.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance); foreach (var keyL in keyList) { if (key.ToUpper() == keyL.Name.ToUpper()) { try { if (typeof(IIMatrix).IsAssignableFrom(keyL.FieldType)) { return(((IIMatrix)keyL.GetValue(obj)).ObjInfo(column, row)); } return(new object[, ] { { keyL.GetValue(obj).ToString() } }); } catch (Exception e) { return(new object[, ] { { e.Message } }); } } } return(new object[, ] { { "Object found, key not found." } }); }