Exemple #1
0
        public ApolloResult ReadUdpData(out byte[] buffer, out int realLength)
        {
            buffer     = null;
            realLength = 0;
            if (!this.Connected)
            {
            }
            if (this.tempReadBuffer == null)
            {
                this.tempReadBuffer = new byte[ApolloCommon.ApolloInfo.MaxMessageBufferSize];
            }
            int          num          = this.tempReadBuffer.Length;
            ApolloResult apolloResult = ApolloConnector.apollo_connector_readUdpData(base.ObjectId, this.tempReadBuffer, ref num);

            if (apolloResult == ApolloResult.Success)
            {
                if (num == 0)
                {
                    ADebug.LogError("ReadUdpData empty len==0");
                    return(ApolloResult.Empty);
                }
                buffer     = this.tempReadBuffer;
                realLength = num;
            }
            return(apolloResult);
        }
Exemple #2
0
 public override void DestroyApolloConnector(IApolloConnector connector)
 {
     ADebug.Log("DestroyApolloConnector");
     if (connector != null)
     {
         ApolloConnector connector2 = connector as ApolloConnector;
         if (connector2 != null)
         {
             connector2.Destroy();
         }
     }
 }
Exemple #3
0
 public ApolloResult WriteUdpData(byte[] data, int len = -1)
 {
     if (!this.Connected)
     {
         return(ApolloResult.NoConnection);
     }
     if (len == -1)
     {
         len = data.Length;
     }
     return(ApolloConnector.apollo_connector_writeUdpData(base.ObjectId, data, len));
 }
Exemple #4
0
 public ApolloResult SetSecurityInfo(ApolloEncryptMethod encyptMethod, ApolloKeyMaking keyMakingMethod, string dhp)
 {
     ADebug.Log(string.Concat(new object[]
     {
         "SetSecurityInfo encyptMethod:",
         encyptMethod,
         " keyMakingMethod:",
         keyMakingMethod,
         " dh:",
         dhp
     }));
     return(ApolloConnector.apollo_connector_setSecurityInfo(base.ObjectId, encyptMethod, keyMakingMethod, dhp));
 }
Exemple #5
0
        public override void DestroyApolloConnector(IApolloConnector connector)
        {
            ADebug.Log("DestroyApolloConnector");
            if (connector == null)
            {
                return;
            }
            ApolloConnector apolloConnector = connector as ApolloConnector;

            if (apolloConnector != null)
            {
                apolloConnector.Destroy();
            }
        }
Exemple #6
0
 public ApolloResult Initialize(ApolloPlatform platform, uint permission, string url)
 {
     ADebug.Log(string.Concat(new object[]
     {
         "Connector Initialize:",
         platform,
         " url:",
         url
     }));
     if (platform == ApolloPlatform.WTLogin)
     {
     }
     return((ApolloResult)ApolloConnector.apollo_connector_Initialize(base.ObjectId, platform, permission, url));
 }
Exemple #7
0
 public ApolloResult SetRouteInfo(ApolloRouteInfoBase routeInfo)
 {
     if (routeInfo == null)
     {
         return(ApolloResult.InvalidArgument);
     }
     byte[] array;
     routeInfo.Encode(out array);
     if (array == null)
     {
         ADebug.LogError("WriteData Encode error!");
         return(ApolloResult.InnerError);
     }
     return(ApolloConnector.apollo_connector_setRouteInfo(base.ObjectId, array, array.Length));
 }
Exemple #8
0
        public override IApolloConnector CreateApolloConnection(ApolloPlatform platform, uint permission, string url)
        {
            ADebug.Log("CreateApolloConnection");
            if (string.IsNullOrEmpty(url))
            {
                throw new Exception("Argument Error: url can not be null or empty");
            }
            if (ApolloCommon.ApolloInfo == null)
            {
                throw new Exception("IApollo.Instance.Initialize must be called first!");
            }
            if (platform == ApolloPlatform.None)
            {
            }
            ApolloConnector apolloConnector = new ApolloConnector();
            ApolloResult    apolloResult    = apolloConnector.Initialize(platform, permission, url);

            if (apolloResult != ApolloResult.Success)
            {
                throw new Exception("connector Initialize Error:" + apolloResult);
            }
            return(apolloConnector);
        }
Exemple #9
0
 public ApolloResult WriteData(byte[] data, int len, ApolloRouteInfoBase routeInfo, bool allowLost = false)
 {
     if (routeInfo == null)
     {
         return(ApolloResult.InvalidArgument);
     }
     if (!this.Connected)
     {
         return(ApolloResult.NoConnection);
     }
     if (len == -1)
     {
         len = data.Length;
     }
     byte[] array;
     routeInfo.Encode(out array);
     if (array == null)
     {
         ADebug.LogError("WriteData Encode error!");
         return(ApolloResult.InnerError);
     }
     return(ApolloConnector.apollo_connector_writeData_with_route_info(base.ObjectId, data, len, array, array.Length, allowLost));
 }
Exemple #10
0
 public void SetProtocolVersion(int headVersion, int bodyVersion)
 {
     ApolloConnector.apollo_connector_set_protocol_version(base.ObjectId, headVersion, bodyVersion);
 }
Exemple #11
0
 public void SetClientType(ClientType type)
 {
     ApolloConnector.apollo_connector_set_clientType(base.ObjectId, type);
 }
Exemple #12
0
 public ApolloResult ReportAccessToken(string accessToken, ulong expire)
 {
     return(ApolloConnector.apollo_connector_report_accesstoken(base.ObjectId, accessToken, (uint)expire));
 }
Exemple #13
0
 public ApolloResult GetSessionStopReason(ref int result, ref int reason, ref int excode)
 {
     return(ApolloConnector.apollo_connector_getstopreason(base.ObjectId, ref result, ref reason, ref excode));
 }
Exemple #14
0
 public ApolloResult Disconnect()
 {
     ADebug.Log("Disconnect");
     return(ApolloConnector.apollo_connector_disconnect(base.ObjectId));
 }
Exemple #15
0
 public ApolloResult Reconnect(uint timeout)
 {
     ADebug.Log("Reconnect");
     return(ApolloConnector.apollo_connector_reconnect(base.ObjectId, timeout));
 }