static ServiceType GetServiceType(SimpleAuth.Api api) { if (api is GoogleMusicApi) { return(ServiceType.Google); } if (api is CloudDriveApi) { return(ServiceType.Amazon); } if (api is YoutubeOauthApi) { return(ServiceType.YouTube); } if (api is SoundCloudApi) { return(ServiceType.SoundCloud); } if (api is OneDriveApi) { return(ServiceType.OneDrive); } App.ShowNotImplmented(new Dictionary <string, string> { { "Api type", api.GetType().ToString() } }); return(ServiceType.FileSystem); }
public void SaveApi(SimpleAuth.Api api) { var id = int.Parse(api.Identifier); var record = new ApiModel { Id = id, Service = GetServiceType(api), DeviceId = api.DeviceId, ExtraData = api.ExtraDataString, }; Settings.AddApiModel(record); }
public MusicProvider AddApi(SimpleAuth.Api api) { var provider = CreateProvider(api); if (provider == null) { return(null); } SaveApi(api); Collection.Add(api.Identifier, provider); return(provider); }
public MusicProvider CreateProvider(SimpleAuth.Api api) { try { var providerType = ApiProviderTypes[api.GetType()]; var provider = Activator.CreateInstance(providerType, api) as MusicProvider; return(provider); } catch (Exception ex) { LogManager.Shared.Report(ex); } App.ShowNotImplmented(new Dictionary <string, string> { { "Service Type", api.GetType().ToString() } }); return(null); }