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 [Endpoint("Local Development", PlatformEndpoints.Local_DevelopmentEnvironment)]
31 }
32
33 // TODO: Move to new plugin
34 public enum WebPlatformServer : int
35 {
36 [Endpoint("North America - Production", WebPlatformEndpoints.NorthAmerica_ProductionEnvironment)]
37 NA_PRODUCTION = 0,
38 [Endpoint("North America - Staging", WebPlatformEndpoints.NorthAmerica_StagingEnvironment)]
40 [Endpoint("North America - Development", WebPlatformEndpoints.NorthAmerica_DevelopmentEnvironment)]
41 NA_DEV,
42 [Endpoint("Saudi - Production", WebPlatformEndpoints.Saudi_ProductionEnvironment)]
44 [Endpoint("Local Development", PlatformEndpoints.Local_DevelopmentEnvironment)]
46 }
47
48 public enum APIPlatformServer : int
49 {
50 [Endpoint("North America - Production", APIPlatformEndpoints.NorthAmerica_ProductionEnvironment)]
51 NA_PRODUCTION = 0,
52 [Endpoint("North America - Staging", APIPlatformEndpoints.NorthAmerica_StagingEnvironment)]
54 [Endpoint("North America - Development", APIPlatformEndpoints.NorthAmerica_DevelopmentEnvironment)]
55 NA_DEV,
56 [Endpoint("Saudi - Production", APIPlatformEndpoints.Saudi_ProductionEnvironment)]
58 [Endpoint("Local Development", APIPlatformEndpoints.Local_DevelopmentEnvironment)]
60 }
61
62 public static class PPlatformEnumExtensions
63 {
64 public static string ToDisplayString(this Enum value)
65 {
66 EndpointAttribute[] attributes = (EndpointAttribute[])value
67 .GetType()
68 .GetField(value.ToString())
69 .GetCustomAttributes(typeof(EndpointAttribute), false);
70 return attributes.Length > 0 ? attributes[0].Display : string.Empty;
71 }
72
73 public static string ToUrlString(this Enum value)
74 {
75 EndpointAttribute[] attributes = (EndpointAttribute[])value
76 .GetType()
77 .GetField(value.ToString())
78 .GetCustomAttributes(typeof(EndpointAttribute), false);
79 return attributes.Length > 0 ? attributes[0].Url : string.Empty;
80 }
81 }
82}
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 Local_DevelopmentEnvironment
const string NorthAmerica_DevelopmentEnvironment
const string NorthAmerica_DevelopmentEnvironment
const string NorthAmerica_ProductionEnvironment