public static getTimeZone ( java arg0 ) : global::java.util.TimeZone | ||
arg0 | java | |
Résultat | global::java.util.TimeZone |
/// <summary> /// Converts a Java Date value to a UTC DateTime value /// </summary> /// <param name="utcDateTime">The UTC DateTime value</param> /// <returns>A UTC Java Date value</returns> private static Date ToJavaDateUtc(DateTime utcDateTime) { var cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, utcDateTime.Year); cal.set(Calendar.MONTH, utcDateTime.Month - 1); cal.set(Calendar.DAY_OF_MONTH, utcDateTime.Day); cal.set(Calendar.HOUR_OF_DAY, utcDateTime.Hour); cal.set(Calendar.MINUTE, utcDateTime.Minute); cal.set(Calendar.SECOND, utcDateTime.Second); return(cal.getTime()); }
/// <summary> /// Converts a Java Date value to a UTC DateTime value /// </summary> /// <param name="javaDate">The Java date</param> /// <returns>A UTC DateTime value</returns> private static DateTime FromJavaDateUtc(Date javaDate) { var cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.setTime(javaDate); // note that the Month component of java.util.Date // from 0-11 (i.e. Jan == 0) return(new DateTime(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND))); }
private void View_ChangedTimezoneEvent() { string selected = View.SelectedTimezone; string[] ids = TimeZone.getAvailableIDs(); foreach (string id in ids) { TimeZone tz; if ((tz = TimeZone.getTimeZone(id)).getID().Equals(selected)) { _host.setTimezone(tz); break; } } ItemChanged(); }
private void InitTimezones() { List <string> timezones = new List <string> { UTC.getID() }; string[] allTimezones = TimeZone.getAvailableIDs(); Array.Sort(allTimezones); foreach (string timezone in allTimezones) { if (Regex.IsMatch(timezone, TimezoneIdPrefixes)) { timezones.Add(TimeZone.getTimeZone(timezone).getID()); } } View.PopulateTimezones(timezones); }
protected virtual void Update() { View.WindowTitle = BookmarkNameProvider.toString(_host); View.Hostname = _host.getHostname(); View.HostFieldEnabled = _host.getProtocol().isHostnameConfigurable(); View.Nickname = BookmarkNameProvider.toString(_host); View.DownloadFolder = new DownloadDirectoryFinder().find(_host).getAbsolute(); View.URL = new HostUrlProvider(true, true).get(_host); View.Port = _host.getPort().ToString(); View.PortFieldEnabled = _host.getProtocol().isPortConfigurable(); View.PathFieldEnabled = _host.getProtocol().isPathConfigurable(); View.Path = _host.getDefaultPath(); View.Username = _host.getCredentials().getUsername(); View.UsernameEnabled = _options.user() && !_host.getCredentials().isAnonymousLogin(); View.UsernameLabel = $"{_host.getProtocol().getUsernamePlaceholder()}:"; View.Password = _host.getCredentials().getPassword(); View.PasswordLabel = $"{_options.getPasswordPlaceholder()}:"; View.PasswordEnabled = _options.password() && !_host.getCredentials().isAnonymousLogin(); View.AnonymousEnabled = _options.anonymous(); View.AnonymousChecked = _host.getCredentials().isAnonymousLogin(); View.SelectedProtocol = _host.getProtocol(); View.SelectedTransferMode = _host.getTransferType(); View.SelectedEncoding = _host.getEncoding() == null ? Default : _host.getEncoding(); View.EncodingFieldEnabled = _host.getProtocol().isEncodingConfigurable(); View.ConnectModeFieldEnabled = _host.getProtocol().getType() == Protocol.Type.ftp; View.SelectedConnectMode = _host.getFTPConnectMode(); View.PrivateKeyFieldEnabled = _options.publickey(); if (_host.getCredentials().isPublicKeyAuthentication()) { String key = _host.getCredentials().getIdentity().getAbsolute(); if (!_keys.Contains(key)) { _keys.Add(key); View.PopulatePrivateKeys(_keys); } View.SelectedPrivateKey = key; } else { View.SelectedPrivateKey = LocaleFactory.localizedString("None"); } View.ClientCertificateFieldEnabled = _options.certificate(); List <string> keys = new List <string> { LocaleFactory.localizedString("None") }; if (_options.certificate()) { foreach (String certificate in SystemCertificateStore.ListAliases()) { keys.Add(certificate); } } View.PopulateClientCertificates(keys); if (_host.getCredentials().isCertificateAuthentication()) { View.SelectedClientCertificate = _host.getCredentials().getCertificate(); } else { View.SelectedClientCertificate = LocaleFactory.localizedString("None"); } View.WebUrlButtonToolTip = new WebUrlProvider(_host).toUrl().getUrl(); View.WebURL = _host.getWebURL(); View.Notes = _host.getComment(); View.TimezoneFieldEnabled = !_host.getProtocol().isUTCTimezone(); if (null == _host.getTimezone()) { if (_host.getProtocol().isUTCTimezone()) { View.SelectedTimezone = UTC.getID(); } else { View.SelectedTimezone = TimeZone.getTimeZone(PreferencesFactory.get().getProperty("ftp.timezone.default")).getID(); } } else { View.SelectedTimezone = _host.getTimezone().getID(); } }