// --------------------------------------------------------------------------------------------------------------------
//
// Part of: Pun demos
//
// developer@exitgames.com
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
namespace Photon.Pun.Demo.Shared
{
///
/// Document links.
///
public static class DocLinks {
///
/// Document types
///
public enum DocTypes {Doc,Api};
///
/// The various supported languages
///
public enum Products {OnPremise,Realtime,Pun,Chat,Voice,Bolt,Quantum};
///
/// The various version of the documentation that exists. Current will be either V1 or V2 or possibly a beta version or branched version.
///
public enum Versions {Current,V1,V2};
///
/// The various supported languages
///
public enum Languages {English,Japanese,Korean,Chinese};
///
/// The version to generate links for
///
public static Versions Version = Versions.Current;
///
/// The language to generate links with
///
public static Languages Language = Languages.English;
///
/// The product to generate links for
///
public static Products Product = Products.Pun;
///
/// 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
///
public static string ApiUrlRoot = "https://doc-api.photonengine.com/{0}/{1}/{2}/{3}";
///
/// 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
///
public static string DocUrlFormat = "https://doc.photonengine.com/{0}/{1}/{2}/{3}";
///
/// LookUp dictionnary for doc versions to avoid parsing this every link request
///
static Dictionary ProductsFolders = new Dictionary
{
{Products.Bolt, "bolt"},
{Products.Chat, "chat"},
{Products.OnPremise, "onpremise"},
{Products.Pun, "pun"},
{Products.Quantum, "quantum"},
{Products.Realtime, "realtime"},
{Products.Voice, "voice"}
};
///
/// LookUp dictionnary for api languages to avoid parsing this every link request
///
static Dictionary ApiLanguagesFolder = new Dictionary
{
{Languages.English, "en"},
{Languages.Japanese, "ja-jp"},
{Languages.Korean, "ko-kr"},
{Languages.Chinese, "zh-tw"}
};
///
/// LookUp dictionnary for doc languages to avoid parsing this every link request
///
static Dictionary DocLanguagesFolder = new Dictionary
{
{Languages.English, "en-us"},
{Languages.Japanese, "ja-jp"},
{Languages.Korean, "ko-kr"},
{Languages.Chinese, "en"} // fallback to english
};
///
/// LookUp dictionnary for doc versions to avoid parsing this every link request
///
static Dictionary VersionsFolder = new Dictionary
{
{Versions.Current, "current"},
{Versions.V1, "v1"},
{Versions.V2, "v2"}
};
///
/// Gets a documentation link given a reference
///
/// The link.
/// Type.
/// Reference.
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";
}
///
/// Gets the API link given a reference
///
/// The API link.
/// Reference.
public static string GetApiLink(string reference)
{
return string.Format(ApiUrlRoot, ApiLanguagesFolder[Language],ProductsFolders[Product], VersionsFolder[Version], reference);
}
///
/// Gets the Doc link given a reference
///
/// The document link.
/// Reference.
public static string GetDocLink(string reference)
{
return string.Format(DocUrlFormat, DocLanguagesFolder[Language],ProductsFolders[Product], VersionsFolder[Version], reference);
}
}
}