示例#1
0
        public void DeserializeData(byte[] data, ref int offset)
        {
            RPCCommand.DeserializeString(data, ref offset, ref FullNameIn);
            RPCCommand.DeserializeString(data, ref offset, ref FullNameOut);
            RPCCommand.DeserializeString(data, ref offset, ref Name);
            RPCCommand.DeserializeString(data, ref offset, ref Value);
            int typeVal = 0;

            RPCCommand.DeserializeInteger(data, ref offset, ref typeVal);
            Type = (LuaTypes)typeVal;
            RPCCommand.DeserializeInteger(data, ref offset, ref Index);
        }
示例#2
0
 /// <summary>
 /// Send a RPC to the VRCMod Network dispatcher.
 /// <para>Only works with RPCs of type: CLIENT_TO_SERVER, SERVER_TO_ALL_CLIENTS, CLIENT_TO_CLIENTROOM</para>
 /// </summary>
 public static void SendRPCNoLog(string rpcId, string rpcData = "", Action onSuccess = null, Action <string> onError = null)
 {
     if (rpcData.Contains("\n") || rpcData.Contains("\r"))
     {
         throw new ArgumentException("Invalid rpcData. It have to be a one-line rpc");
     }
     else
     {
         RPCCommand rpccommand = CommandManager.CreateInstance("RPC", client, false) as RPCCommand;
         rpccommand.SendCommand(rpcId, rpcData, onSuccess, onError);
     }
 }
示例#3
0
        public int GetSerializedDataSize()
        {
            int totalSize = 0;

            totalSize += RPCCommand.GetStringDataSize(FileName);
            totalSize += RPCCommand.GetIntegerDataSize();
            totalSize += RPCCommand.GetStringDataSize(Condition);
            totalSize += RPCCommand.GetIntegerDataSize();
            totalSize += RPCCommand.GetIntegerDataSize();
            totalSize += RPCCommand.GetBooleanDataSize();
            return(totalSize);
        }
示例#4
0
        public int GetSerializedDataSize()
        {
            int totalSize = 0;

            totalSize += RPCCommand.GetStringDataSize(FullNameIn);
            totalSize += RPCCommand.GetStringDataSize(FullNameOut);
            totalSize += RPCCommand.GetStringDataSize(Name);
            totalSize += RPCCommand.GetStringDataSize(Value);
            totalSize += RPCCommand.GetIntegerDataSize();
            totalSize += RPCCommand.GetIntegerDataSize();
            return(totalSize);
        }
示例#5
0
        public int GetSerializedDataSize()
        {
            int totalSize = 0;

            totalSize += RPCCommand.GetStringDataSize(FileName);
            totalSize += RPCCommand.GetStringDataSize(FunctionName);
            totalSize += RPCCommand.GetIntegerDataSize();
            totalSize += RPCCommand.GetStringDataSize(FunctionSource);
            totalSize += RPCCommand.GetStringDataSize(ParamString);
            totalSize += RPCCommand.GetIntegerDataSize();
            totalSize += RPCCommand.GetBooleanDataSize();
            return(totalSize);
        }
示例#6
0
        public static FaultResponse GetFromXml(XElement element)
        {
            XElement changedParamsMessageElement = new XElement(element);

            changedParamsMessageElement.Descendants("int").ToList().ForEach(localElement => localElement.Name = "i4");
            FaultResponseEventArgsContainer result = new FaultResponseEventArgsContainer();
            List <XElement> paramElements          = new List <XElement> {
                changedParamsMessageElement
            };
            List <RPCParamInfo> parameters = RPCParamInfo.GetFromType(typeof(FaultResponseEventArgsContainer), RPCParamInfo.RevtrievalMode.OnlyWithIndexes);

            RPCCommand.GetParameterElementInstance(parameters, 0, paramElements[0], result);
            return(result.Fault);
        }
示例#7
0
        public void DeserializeData(byte[] data, ref int offset)
        {
            RPCCommand.DeserializeString(data, ref offset, ref FileName);
            RPCCommand.DeserializeInteger(data, ref offset, ref Line);
            RPCCommand.DeserializeString(data, ref offset, ref Condition);
            RPCCommand.DeserializeInteger(data, ref offset, ref HitCount);

            int hitCountCondition = (int)HitCountCondition;

            RPCCommand.DeserializeInteger(data, ref offset, ref hitCountCondition);
            HitCountCondition = (HitCountConditions)hitCountCondition;

            RPCCommand.DeserializeBoolean(data, ref offset, ref IsEnabled);
        }
示例#8
0
        public static T Parse(XElement messageElement, Guid callGuid)
        {
            T result;

            XElement faultElement = messageElement.Element("fault");

            if (faultElement != null)
            {
                result       = (T)Activator.CreateInstance(typeof(T));
                result.Fault = FaultResponseEventArgs.GetFromXml(faultElement);
            }
            else
            {
                result = RPCCommand.GetInstance <T>(messageElement.Element("params"));
            }

            return(result);
        }
示例#9
0
        public static T Parse(XElement messageElement)
        {
            T result;

            XElement faultElement = messageElement.Element("fault");

            if (faultElement != null)
            {
                result       = (T)Activator.CreateInstance(typeof(T));
                result.Fault = FaultResponse.GetFromXml(faultElement);
                CoreLogger.UniqueInstance.Debug(string.Format(" Fault element detected: \nFaultMessage: {0}\nFaultCode: {1}\nRawXML: {2}\nStackTrace:\n{3}", result.Fault.FaultMessage, result.Fault.FaultCode, messageElement, StackTraceHelper.GetCurrentStackTrace()));
            }
            else
            {
                result = RPCCommand.GetInstance <T>(messageElement.Element("params"));
            }

            return(result);
        }
示例#10
0
 public void SerializeData(ref byte[] data, ref int offset)
 {
     RPCCommand.SerializeInteger(ref data, ref offset, ThreadID);
     RPCCommand.SerializeComplexData(ref data, ref offset, CallStackTopCall);
 }
示例#11
0
 /// <summary>
 /// Serializes the the deserialized data
 /// </summary>
 public void SerializeData(ref byte[] data, ref int offset)
 {
     RPCCommand.SerializeInteger(ref data, ref offset, (int)_startAction);
     RPCCommand.SerializeString(ref data, ref offset, _remotePath);
 }