1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DocLinks.cs" company="Exit Games GmbH">
// Part of: Pun demos
// </copyright>
// <author>developer@exitgames.com</author>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
namespace Photon.Pun.Demo.Shared
{
/// <summary>
/// Document links.
/// </summary>
public static class DocLinks {
/// <summary>
/// Document types
/// </summary>
public enum DocTypes {Doc,Api};
/// <summary>
/// The various supported languages
/// </summary>
public enum Products {OnPremise,Realtime,Pun,Chat,Voice,Bolt,Quantum};
/// <summary>
/// The various version of the documentation that exists. Current will be either V1 or V2 or possibly a beta version or branched version.
/// </summary>
public enum Versions {Current,V1,V2};
/// <summary>
/// The various supported languages
/// </summary>
public enum Languages {English,Japanese,Korean,Chinese};
/// <summary>
/// The version to generate links for
/// </summary>
public static Versions Version = Versions.Current;
/// <summary>
/// The language to generate links with
/// </summary>
public static Languages Language = Languages.English;
/// <summary>
/// The product to generate links for
/// </summary>
public static Products Product = Products.Pun;
/// <summary>
/// The API URL format.
/// 0 is the Language
/// 1 is the Product
/// 2 is the Version
/// 3 is the custom part passed to generate the link with
/// </summary>
public static string ApiUrlRoot = "https://doc-api.photonengine.com/{0}/{1}/{2}/{3}";
/// <summary>
/// The Doc URL format.
/// 0 is the Language
/// 1 is the Product
/// 2 is the Version
/// 3 is the custom part passed to generate the link with
/// </summary>
public static string DocUrlFormat = "https://doc.photonengine.com/{0}/{1}/{2}/{3}";
/// <summary>
/// LookUp dictionnary for doc versions to avoid parsing this every link request
/// </summary>
static Dictionary<Products,string> ProductsFolders = new Dictionary<Products, string>
{
{Products.Bolt, "bolt"},
{Products.Chat, "chat"},
{Products.OnPremise, "onpremise"},
{Products.Pun, "pun"},
{Products.Quantum, "quantum"},
{Products.Realtime, "realtime"},
{Products.Voice, "voice"}
};
/// <summary>
/// LookUp dictionnary for api languages to avoid parsing this every link request
/// </summary>
static Dictionary<Languages,string> ApiLanguagesFolder = new Dictionary<Languages, string>
{
{Languages.English, "en"},
{Languages.Japanese, "ja-jp"},
{Languages.Korean, "ko-kr"},
{Languages.Chinese, "zh-tw"}
};
/// <summary>
/// LookUp dictionnary for doc languages to avoid parsing this every link request
/// </summary>
static Dictionary<Languages,string> DocLanguagesFolder = new Dictionary<Languages, string>
{
{Languages.English, "en-us"},
{Languages.Japanese, "ja-jp"},
{Languages.Korean, "ko-kr"},
{Languages.Chinese, "en"} // fallback to english
};
/// <summary>
/// LookUp dictionnary for doc versions to avoid parsing this every link request
/// </summary>
static Dictionary<Versions,string> VersionsFolder = new Dictionary<Versions, string>
{
{Versions.Current, "current"},
{Versions.V1, "v1"},
{Versions.V2, "v2"}
};
/// <summary>
/// Gets a documentation link given a reference
/// </summary>
/// <returns>The link.</returns>
/// <param name="type">Type.</param>
/// <param name="reference">Reference.</param>
public static string GetLink(DocTypes type,string reference)
{
if (type == DocTypes.Api) {
return GetApiLink (reference);
}
if (type == DocTypes.Doc) {
return GetDocLink (reference);
}
return "https://doc.photonengine.com";
}
/// <summary>
/// Gets the API link given a reference
/// </summary>
/// <returns>The API link.</returns>
/// <param name="reference">Reference.</param>
public static string GetApiLink(string reference)
{
return string.Format(ApiUrlRoot, ApiLanguagesFolder[Language],ProductsFolders[Product], VersionsFolder[Version], reference);
}
/// <summary>
/// Gets the Doc link given a reference
/// </summary>
/// <returns>The document link.</returns>
/// <param name="reference">Reference.</param>
public static string GetDocLink(string reference)
{
return string.Format(DocUrlFormat, DocLanguagesFolder[Language],ProductsFolders[Product], VersionsFolder[Version], reference);
}
}
}
|