Documentation for the Unity C# Library
Loading...
Searching...
No Matches
PlatformEnums.cs
Go to the documentation of this file.
1using System;
2
3namespace PixoVR.Apex
4{
5 [System.AttributeUsage(System.AttributeTargets.Property |
6 System.AttributeTargets.Field)]
7 public class EndpointAttribute : System.Attribute
8 {
9 public string Display;
10 public string Url;
11
12 public EndpointAttribute(string display, string url)
13 {
14 Display = display;
15 Url = url;
16 }
17 }
18
19 public enum PlatformServer : int
20 {
21 [Endpoint("North America - Production", PlatformEndpoints.NorthAmerica_ProductionEnvironment)]
22 NA_PRODUCTION = 0,
23 [Endpoint("North America - Staging", PlatformEndpoints.NorthAmerica_StagingEnvironment)]
25 [Endpoint("North America - Development", PlatformEndpoints.NorthAmerica_DevelopmentEnvironment)]
26 NA_DEV,
27 [Endpoint("Saudi - Production", PlatformEndpoints.Saudi_ProductionEnvironment)]
29 }
30
31 // TODO: Move to new plugin
32 public enum WebPlatformServer : int
33 {
34 [Endpoint("North America - Production", WebPlatformEndpoints.NorthAmerica_ProductionEnvironment)]
35 NA_PRODUCTION = 0,
36 [Endpoint("North America - Staging", WebPlatformEndpoints.NorthAmerica_StagingEnvironment)]
38 [Endpoint("North America - Development", WebPlatformEndpoints.NorthAmerica_DevelopmentEnvironment)]
39 NA_DEV,
40 [Endpoint("Saudi - Production", WebPlatformEndpoints.Saudi_ProductionEnvironment)]
42 }
43
44 public enum APIPlatformServer : int
45 {
46 [Endpoint("North America - Production", APIPlatformEndpoints.NorthAmerica_ProductionEnvironment)]
47 NA_PRODUCTION = 0,
48 [Endpoint("North America - Staging", APIPlatformEndpoints.NorthAmerica_StagingEnvironment)]
50 [Endpoint("North America - Development", APIPlatformEndpoints.NorthAmerica_DevelopmentEnvironment)]
51 NA_DEV,
52 [Endpoint("Saudi - Production", APIPlatformEndpoints.Saudi_ProductionEnvironment)]
54 }
55
56 public static class PPlatformEnumExtensions
57 {
58 public static string ToDisplayString(this Enum value)
59 {
60 EndpointAttribute[] attributes = (EndpointAttribute[])value
61 .GetType()
62 .GetField(value.ToString())
63 .GetCustomAttributes(typeof(EndpointAttribute), false);
64 return attributes.Length > 0 ? attributes[0].Display : string.Empty;
65 }
66
67 public static string ToUrlString(this Enum value)
68 {
69 EndpointAttribute[] attributes = (EndpointAttribute[])value
70 .GetType()
71 .GetField(value.ToString())
72 .GetCustomAttributes(typeof(EndpointAttribute), false);
73 return attributes.Length > 0 ? attributes[0].Url : string.Empty;
74 }
75 }
76}
const string NorthAmerica_DevelopmentEnvironment
const string NorthAmerica_ProductionEnvironment
EndpointAttribute(string display, string url)
static string ToDisplayString(this Enum value)
static string ToUrlString(this Enum value)
const string NorthAmerica_StagingEnvironment
const string Saudi_ProductionEnvironment
const string NorthAmerica_ProductionEnvironment
const string NorthAmerica_DevelopmentEnvironment
const string NorthAmerica_DevelopmentEnvironment
const string NorthAmerica_ProductionEnvironment