/// <summary> /// Releases object for GCing /// </summary> /// <param name="obj">Object.</param> public void Release(object obj) { // send request var req = new CLRReleaseMessage(obj); CLRMessage.Write(_cout, req); }
/// <summary> /// Protects the given object from GCing /// </summary> /// <param name="obj">Object.</param> public void Protect(object obj) { // send request var req = new CLRProtectMessage(obj); CLRMessage.Write(_cout, req); }
/// <summary> /// Calls the named static method. /// </summary> /// <returns> /// The return of static method call /// </returns> /// <param name='classname'> /// class name. /// </param> /// <param name='method'> /// Method name. /// </param> /// <param name='parameters'> /// Parameters. /// </param> public object CallStaticMethodByName(string classname, string method, params object[] parameters) { // send request var req = new CLRCallStaticMethodMessage(classname, method, parameters); CLRMessage.Write(_cout, req); // get response return(CLRMessage.ReadValue(_cin)); }
// Operations /// <summary> /// Creates a new object of given classname /// </summary> /// <param name="classname">Classname.</param> /// <param name="parameters">Parameters.</param> public object Create(string classname, params object[] parameters) { // send request var req = new CLRCreateMessage(classname, parameters); CLRMessage.Write(_cout, req); // get response return(CLRMessage.ReadValue(_cin)); }
/// <summary> /// Sets the named property /// </summary> /// <param name='classname'> /// class name /// </param> /// <param name='name'> /// Name. /// </param> /// <param val='value'> /// property value /// </param> public void SetStaticProperty(string classname, string name, object val) { // send request var req = new CLRSetStaticPropertyMessage(classname, name, val); CLRMessage.Write(_cout, req); // get response (to make sure is not an exception) CLRMessage.ReadValue(_cin); }
/// <summary> /// Gets the named property /// </summary> /// <param name='classname'> /// class name /// </param> /// <param name='name'> /// Name. /// </param> public object GetStaticProperty(string classname, string name) { // send request var req = new CLRGetStaticPropertyMessage(classname, name); CLRMessage.Write(_cout, req); // get response return(CLRMessage.ReadValue(_cin)); }
/// <summary> /// Gets the ith element of collection /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='ith'> /// Index. /// </param> public object GetIndexed(object obj, int ith) { // send request var req = new CLRGetIndexedMessage(obj, ith); CLRMessage.Write(_cout, req); // get response return(CLRMessage.ReadValue(_cin)); }
/// <summary> /// Gets the named property /// </summary> /// <param name='type'> /// Type. /// </param> /// <param name='name'> /// Name. /// </param> public object GetProperty(object obj, string name) { // send request var req = new CLRGetPropertyMessage(obj, name); CLRMessage.Write(_cout, req); // get response return(CLRMessage.ReadValue(_cin)); }
/// <summary> /// Calls the named method, finding the one with the best match /// </summary> /// <returns> /// The return of static method call /// </returns> /// <param name='type'> /// Type. /// </param> /// <param name='name'> /// Name. /// </param> /// <param name='parameters'> /// Parameters. /// </param> public object CallMethod(object obj, string name, params object[] parameters) { // send request var req = new CLRCallMethodMessage(obj, name, parameters); CLRMessage.Write(_cout, req); // get response return(CLRMessage.ReadValue(_cin)); }
/// <summary> /// Handles the template request /// </summary> /// <param name="req">Req.</param> private void HandleTemplate(CLRTemplateReqMessage req) { try { var type = ReflectUtils.FindType(req.ClassName); CLRMessage.Write(_cout, new CLRTemplateReplyMessage(type)); } catch (Exception e) { CLRMessage.WriteValue(_cout, e); } }