public static SubtitleServerSession Create(SubtitleServerType serverType, string serverUrl, string userName, string password, CultureInfo culture = null) { SubtitleServerSession session = null; try { switch (serverType) { case SubtitleServerType.BSP_V1: session = new BspV1Session(serverUrl, userName, password, culture); break; case SubtitleServerType.NuSoap: session = new NuSoapSession(serverUrl, userName, password, culture); break; case SubtitleServerType.Osdb: default: session = new OsdbSession(serverUrl, userName, password, culture); break; } } catch(Exception ex) { Logger.LogException(ex); } return session; }
public static SubtitleServerSession Create(SubtitleServerType serverType, string serverUrl, string userName, string password, CultureInfo culture = null) { SubtitleServerSession session = null; try { switch (serverType) { case SubtitleServerType.BSP_V1: session = new BspV1Session(serverUrl, userName, password, culture); break; case SubtitleServerType.NuSoap: session = new NuSoapSession(serverUrl, userName, password, culture); break; case SubtitleServerType.Osdb: default: session = new OsdbSession(serverUrl, userName, password, culture); break; } } catch (Exception ex) { Logger.LogException(ex); } return(session); }
public SubtitleDownloader(SubtitleServerType serverType, string serverUrl, string userName, string password) { _serverType = serverType; _serverUrl = serverUrl; _userName = userName; _password = password; }
public static SubtitleDownloader FromDownloadURI(string downloadURI) { string serverUrl = string.Empty, serverTypeStr = string.Empty, userName = string.Empty, password = string.Empty; bool active = false; string[] fields = StringUtils.ToStringArray(downloadURI, ';'); if (fields != null && fields.Length > 0) { int i = 0; serverTypeStr = fields[i++]; if (fields.Length > i) { serverUrl = fields[i++]; } if (fields.Length > i) { active = (fields[i++] == "1"); } if (fields.Length > i) { userName = fields[i++]; } if (fields.Length > i) { password = fields[i++]; } } SubtitleServerType serverType = SubtitleServerType.Osdb; try { serverType = (SubtitleServerType)Enum.Parse(typeof(SubtitleServerType), serverTypeStr); } catch { serverType = SubtitleServerType.Osdb; } SubtitleDownloader sd = new SubtitleDownloader(serverType, serverUrl, userName, password); sd.IsActive = active; return(sd); }