ApplicationId









How do I use Application Id
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: LoadbalancingPeer.cs Copy
35         public virtual bool OpGetRegions(string appId)
36         {
37             Dictionary parameters = new Dictionary();
38             parameters[(byte)ParameterCode.ApplicationId] = appId;
39
40             return this.OpCustom(OperationCode.GetRegions, parameters, true, 0, true);
41         }
File name: LoadbalancingPeer.cs Copy
358         public virtual bool OpAuthenticate(string appId, string appVersion, string userId, AuthenticationValues authValues, string regionCode)
359         {
360             if (this.DebugOut >= DebugLevel.INFO)
361             {
362                 this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticate()");
363             }
364
365             Dictionary opParameters = new Dictionary();
366             if (authValues != null && authValues.Secret != null)
367             {
368                 opParameters[ParameterCode.Secret] = authValues.Secret;
369                 return this.OpCustom(OperationCode.Authenticate, opParameters, true, (byte)0, false);
370             }
371
372             opParameters[ParameterCode.AppVersion] = appVersion;
373             opParameters[ParameterCode.ApplicationId] = appId;
374
375             if (!string.IsNullOrEmpty(regionCode))
376             {
377                 opParameters[ParameterCode.Region] = regionCode;
378             }
379
380             if (!string.IsNullOrEmpty(userId))
381             {
382                 opParameters[ParameterCode.UserId] = userId;
383             }
384
385
386             if (authValues != null && authValues.AuthType != CustomAuthenticationType.None)
387             {
388                 if (!this.IsEncryptionAvailable)
389                 {
390                     this.Listener.DebugReturn(DebugLevel.ERROR, "OpAuthenticate() failed. When you want Custom Authentication encryption is mandatory.");
391                     return false;
392                 }
393
394                 opParameters[ParameterCode.ClientAuthenticationType] = (byte)authValues.AuthType;
395                 if (!string.IsNullOrEmpty(authValues.Secret))
396                 {
397                     opParameters[ParameterCode.Secret] = authValues.Secret;
398                 }
399                 //else
400                 //{
401                     if (!string.IsNullOrEmpty(authValues.AuthParameters))
402                     {
403                         opParameters[ParameterCode.ClientAuthenticationParams] = authValues.AuthParameters;
404                     }
405                     if (authValues.AuthPostData != null)
406                     {
407                         opParameters[ParameterCode.ClientAuthenticationData] = authValues.AuthPostData;
408                     }
409                 //}
410             }
411
412             bool sent = this.OpCustom(OperationCode.Authenticate, opParameters, true, (byte)0, this.IsEncryptionAvailable);
413             if (!sent)
414             {
415                 this.Listener.DebugReturn(DebugLevel.ERROR, "Error calling OpAuthenticate! Did not work. Check log output, CustomAuthenticationValues and if you're connected.");
416             }
417             return sent;
418         }
File name: ChatPeer.cs Copy
31         public bool AuthenticateOnNameServer(string appId, string appVersion, string region, string userId, AuthenticationValues authValues)
32         {
33             if (this.DebugOut >= DebugLevel.INFO)
34             {
35                 this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticate()");
36             }
37
38             var opParameters = new Dictionary();
39
40             opParameters[ParameterCode.AppVersion] = appVersion;
41             opParameters[ParameterCode.ApplicationId] = appId;
42             opParameters[ParameterCode.Region] = region;
43
44             if (!string.IsNullOrEmpty(userId))
45             {
46                 opParameters[ParameterCode.UserId] = userId;
47             }
48
49             if (authValues != null && authValues.AuthType != CustomAuthenticationType.None)
50             {
51                 opParameters[ParameterCode.ClientAuthenticationType] = (byte)authValues.AuthType;
52                 if (!string.IsNullOrEmpty(authValues.Secret))
53                 {
54                     opParameters[ParameterCode.Secret] = authValues.Secret;
55                 }
56                 else
57                 {
58                     if (!string.IsNullOrEmpty(authValues.AuthParameters))
59                     {
60                         opParameters[ParameterCode.ClientAuthenticationParams] = authValues.AuthParameters;
61                     }
62                     if (authValues.AuthPostData != null)
63                     {
64                         opParameters[ParameterCode.ClientAuthenticationData] = authValues.AuthPostData;
65                     }
66                 }
67             }
68
69             return this.OpCustom((byte)ChatOperationCode.Authenticate, opParameters, true, (byte)0, this.IsEncryptionAvailable);
70         }

ApplicationId 126 lượt xem

Gõ tìm kiếm nhanh...