public static void ConnectApp(AppSecret appSecret, AppPlatform platform) { if (!appSecret.IsValid) { throw new InvalidArgumentException("appSecret"); } Config instance = FindOrCreateInstance(); switch (platform) { case AppPlatform.Windows32: instance._linkedWindows32AppSecret = appSecret.Value; break; case AppPlatform.Windows64: instance._linkedWindows64AppSecret = appSecret.Value; break; case AppPlatform.Linux32: instance._linkedLinux32AppSecret = appSecret.Value; break; case AppPlatform.Linux64: instance._linkedLinux64AppSecret = appSecret.Value; break; case AppPlatform.Mac64: instance._linkedMac64AppSecret = appSecret.Value; break; default: throw new ArgumentOutOfRangeException( "platform", platform, null); } EditorUtility.SetDirty(instance); AssetDatabase.SaveAssets(); }
public static App GetAppInfoCached(AppSecret secret) { if (!secret.IsValid) { throw new InvalidArgumentException("secret"); } ApiKey apiKey = GetApiKey(); if (_cachedApps != null && _cachedApps.ApiKey.Equals(apiKey)) { int i = _cachedApps.List.FindIndex(a => a.secret == secret.Value); if (i != -1) { return(_cachedApps.List[i]); } } return(GetAppInfo(secret)); }
public static App GetAppInfo(AppSecret secret) { if (!secret.IsValid) { throw new InvalidArgumentException("secret"); } ApiKey apiKey = GetApiKey(); App app = ApiConnection.GetApplicationInfo(secret.Value); if (_cachedApps == null || !_cachedApps.ApiKey.Equals(apiKey)) { _cachedApps = new CachedApps(apiKey); } _cachedApps.List.RemoveAll(x => x.secret == app.secret); _cachedApps.List.Add(app); return(app); }