private getProperty ( global par0 ) : global::java.lang.String | ||
par0 | global | |
return | global::java.lang.String |
private void ApplyGlobalConfig() { var config = Path.Combine(SupportDirectoryFinderFactory.get().find().getAbsolute(), "default.properties"); if (File.Exists(config)) { try { var properties = new java.util.Properties(); properties.load(new FileInputStream(config)); foreach (var key in Utils.ConvertFromJavaList <String>(properties.keySet())) { setDefault(key, properties.getProperty(key)); } } catch (Exception e) { Log.warn($"Failure while reading {config}", e); } } }
public static void appendProperty(Properties properties, string name, string separator, params string[] values) { if (values == null || values.Length == 0) return; string str1 = ""; string[] strArray = values; int length = strArray.Length; for (int index = 0; index < length; ++index) { string str2 = strArray[index]; if (str2 != null && String.instancehelper_length(str2) != 0) { if (String.instancehelper_length(str1) > 0 && !String.instancehelper_endsWith(str1, separator)) str1 = new StringBuilder().append(str1).append(separator).toString(); str1 = new StringBuilder().append(str1).append(str2).toString(); } } string property = properties.getProperty(name, ""); if (String.instancehelper_length(property) > 0) str1 = new StringBuilder().append(str1).append(separator).toString(); properties.setProperty(name, new StringBuilder().append(str1).append(property).toString()); }
private static AppDomain createServletDomain(ServletConfig config) { string rootPath = J2EEUtils.GetApplicationRealPath(config.getServletContext ()); AppDomainSetup domainSetup = new AppDomainSetup(); string name = config.getServletName();//.getServletContextName(); if (name == null) name = "GH Application"; domainSetup.ApplicationName = name; domainSetup.ConfigurationFile = Path.Combine (rootPath, "Web.config"); domainSetup.PrivateBinPath = Path.Combine (rootPath, "WEB-INF/lib"); AppDomain servletDomain = AppDomain.CreateDomain(name, null, domainSetup); //servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR, J2EEUtils.GetApplicationPhysicalPath(config)); //servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath); servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR, J2EEUtils.GetApplicationPhysicalPath(config.getServletContext ())); servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath); servletDomain.SetData(IAppDomainConfig.SERVLET_CONFIG, config); //Set DataDirectory substitution string (http://blogs.msdn.com/dataaccess/archive/2005/10/28/486273.aspx) string dataDirectory = config.getServletContext ().getInitParameter ("DataDirectory"); if (dataDirectory == null) dataDirectory = "App_Data"; if (!Path.IsPathRooted (dataDirectory)) { java.io.InputStream inputStream = config.getServletContext ().getResourceAsStream ("/WEB-INF/classes/appData.properties"); string root; if (inputStream != null) { try { Properties props = new Properties (); props.load (inputStream); root = props.getProperty ("root.folder"); } finally { inputStream.close (); } } else root = config.getServletContext ().getRealPath ("/"); if (root == null) root = String.Empty; dataDirectory = Path.Combine (root, dataDirectory); } if (dataDirectory [dataDirectory.Length - 1] != Path.DirectorySeparatorChar) dataDirectory += Path.DirectorySeparatorChar; servletDomain.SetData ("DataDirectory", dataDirectory); if (config.getServletContext ().getRealPath ("/") == null) servletDomain.SetData(".appStartTime", DateTime.UtcNow); // The BaseDir is the full path to the physical dir of the app // and allows the application to modify files in the case of // open deployment. string webApp_baseDir = config.getServletContext().getRealPath(""); if (webApp_baseDir == null || webApp_baseDir == "") webApp_baseDir = rootPath; servletDomain.SetData(IAppDomainConfig.APP_BASE_DIR , webApp_baseDir); Debug.WriteLine("Initialization of webapp " + webApp_baseDir); //servletDomain.SetData(".hostingVirtualPath", "/"); //servletDomain.SetData(".hostingInstallDir", "/"); return servletDomain; }
protected override void setDefaults() { base.setDefaults(); this.setDefault("application.name", Application.ProductName); this.setDefault("application.datafolder.name", Application.ProductName); this.setDefault("oauth.handler.scheme", String.Format("x-{0}-action", StringUtils.deleteWhitespace(Application.ProductName.ToLower()))); this.setDefault("application.version", ApplicationVersion); this.setDefault("application.revision", ApplicationRevision); this.setDefault("application.language", GetDefaultLanguage()); this.setDefault("application.language.custom", false.ToString()); this.setDefault("application.localization.enable", true.ToString()); this.setDefault("update.feed.release", "https://version.cyberduck.io/windows/changelog.rss"); this.setDefault("update.feed.beta", "https://version.cyberduck.io/windows/beta/changelog.rss"); this.setDefault("update.feed.nightly", "https://version.cyberduck.io/windows/nightly/changelog.rss"); // Importers this.setDefault("bookmark.import.winscp.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WinSCP.ini")); this.setDefault("bookmark.import.filezilla.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FileZilla", "sitemanager.xml")); this.setDefault("bookmark.import.smartftp.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SmartFTP", "Client 2.0", "Favorites")); this.setDefault("bookmark.import.totalcommander.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "GHISLER", "wcx_ftp.ini")); this.setDefault("bookmark.import.flashfxp3.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlashFXP", "3", "Sites.dat")); this.setDefault("bookmark.import.flashfxp4.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlashFXP", "4", "Sites.dat")); this.setDefault("bookmark.import.flashfxp4.common.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "FlashFXP", "4", "Sites.dat")); this.setDefault("bookmark.import.wsftp.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ipswitch", "WS_FTP", "Sites")); this.setDefault("bookmark.import.fireftp.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Mozilla", "Firefox", "Profiles")); this.setDefault("bookmark.import.s3browser.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "S3Browser", "settings.ini")); this.setDefault("bookmark.import.crossftp.location", Path.Combine(HomeFolder, ".crossftp", "sites.xml")); this.setDefault("bookmark.import.cloudberry.s3.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CloudBerry S3 Explorer for Amazon S3", "settings.list")); this.setDefault("bookmark.import.cloudberry.google.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CloudBerry Explorer for Google Storage", "settings.list")); this.setDefault("bookmark.import.cloudberry.azure.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CloudBerry Explorer for Azure Blob Storage", "settings.list")); this.setDefault("bookmark.import.expandrive3.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ExpanDrive", "favorites.js")); this.setDefault("bookmark.import.expandrive4.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ExpanDrive", "expandrive4.favorites.js")); this.setDefault("bookmark.import.expandrive5.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ExpanDrive", "expandrive5.favorites.js")); this.setDefault("bookmark.import.expandrive6.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ExpanDrive", "expandrive6.favorites.js")); this.setDefault("bookmark.import.netdrive2.location", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "NetDrive2", "drives.dat")); //disable reminder for protocol handler registration this.setDefault("defaulthandler.reminder", false.ToString()); this.setDefault("update.check.last", "0"); this.setDefault("update.check.privilege", true.ToString()); this.setDefault("queue.download.folder", DefaultDownloadPath); this.setDefault("queue.upload.permissions.default", true.ToString()); this.setDefault("queue.dock.badge", true.ToString()); this.setDefault("ssh.knownhosts", Path.Combine(new RoamingSupportDirectoryFinder().find().getAbsolute(), "known_hosts")); this.setDefault("browser.enterkey.rename", false.ToString()); this.setDefault("terminal.openssh.enable", true.ToString()); this.setDefault("terminal.windowssubsystemlinux.enable", true.ToString()); this.setDefault("terminal.command.ssh", Path.Combine(HomeFolder, "putty.exe")); this.setDefault("terminal.command.ssh.args", "-ssh {0} {1}@{2} -t -P {3} -m \"{4}\""); this.setDefault("terminal.command.openssh.args", "{1} {0}@{2} -t -p {3} \"cd '{4}'; $SHELL\""); this.setDefault("editor.bundleIdentifier", new SystemWatchEditorFactory.Notepad().getIdentifier()); this.setDefault("notifications.timeout.milliseconds", "300"); //default browser toolbar set this.setDefault("browser.toolbar", true.ToString()); this.setDefault("browser.toolbar.openconnection", true.ToString()); this.setDefault("browser.toolbar.quickconnect", true.ToString()); this.setDefault("browser.toolbar.action", true.ToString()); this.setDefault("browser.toolbar.info", true.ToString()); this.setDefault("browser.toolbar.refresh", true.ToString()); this.setDefault("browser.toolbar.edit", true.ToString()); this.setDefault("browser.toolbar.openinbrowser", false.ToString()); this.setDefault("browser.toolbar.openinterminal", false.ToString()); this.setDefault("browser.toolbar.newfolder", false.ToString()); this.setDefault("browser.toolbar.delete", false.ToString()); this.setDefault("browser.toolbar.download", false.ToString()); this.setDefault("browser.toolbar.upload", true.ToString()); this.setDefault("browser.toolbar.transfers", true.ToString()); //default transfer toolbar set this.setDefault("transfer.toolbar.resume", true.ToString()); this.setDefault("transfer.toolbar.reload", true.ToString()); this.setDefault("transfer.toolbar.stop", true.ToString()); this.setDefault("transfer.toolbar.remove", true.ToString()); this.setDefault("transfer.toolbar.cleanup", false.ToString()); this.setDefault("transfer.toolbar.log", false.ToString()); this.setDefault("transfer.toolbar.open", true.ToString()); this.setDefault("transfer.toolbar.show", true.ToString()); // Resolve symbolic links downloading target file instead. Cannot create symbolic links on FAT. this.setDefault("path.symboliclink.resolve", true.ToString()); // Resolve local links uploading target file instead. Currently not supporting shortcuts on Windows. this.setDefault("local.symboliclink.resolve", true.ToString()); this.setDefault("local.user.home", HomeFolder); this.setDefault("local.delimiter", "\\"); this.setDefault("local.normalize.tilde", false.ToString()); // SSL Keystore // Add mscapi security provider Security.addProvider(new SunMSCAPI()); this.setDefault("connection.ssl.keystore.type", "Windows-MY"); this.setDefault("connection.ssl.keystore.provider", "SunMSCAPI"); // Override secure random strong algorithm. Outputs bytes from the Windows CryptGenRandom() API this.setDefault("connection.ssl.securerandom.algorithm", "Windows-PRNG"); this.setDefault("connection.ssl.securerandom.provider", "SunMSCAPI"); // Enable Integrated Windows Authentication this.setDefault("connection.proxy.windows.authentication.enable", true.ToString()); this.setDefault("webdav.ntlm.environment", true.ToString()); if (getBoolean("webdav.ntlm.environment")) { // NTLM Windows Domain try { // Gets the network domain name associated with the current user this.setDefault("webdav.ntlm.domain", Environment.UserDomainName); } catch (PlatformNotSupportedException e) { // The operating system does not support retrieving the network domain name. } catch (InvalidOperationException e) { // The network domain name cannot be retrieved. } try { this.setDefault("webdav.ntlm.workstation", Environment.MachineName); } catch (InvalidOperationException e) { // The name of this computer cannot be obtained. } } if (Utils.IsRunningAsUWP) { // Running from Windows Store this.setDefault("update.check", $"{false}"); this.setDefault("tmp.dir", ApplicationData.Current.TemporaryFolder.Path); } // Apply global configuration var config = Path.Combine(new RoamingSupportDirectoryFinder().find().getAbsolute(), "default.properties"); if (File.Exists(config)) { try { var properties = new java.util.Properties(); properties.load(new FileInputStream(config)); foreach (var key in Utils.ConvertFromJavaList <String>(properties.keySet())) { setDefault(key, properties.getProperty(key)); } } catch (Exception e) { Log.warn($"Failure while reading {config}", e); } } }
public static void appendProperties(Properties properties, Class cls) { string property1 = properties.getProperty("platform.name"); Properties properties1 = (Properties) cls.getAnnotation((Class) ClassLiteral<Properties>.Value); Platform[] platformArray1; if (properties1 == null) { Platform platform1 = (Platform) cls.getAnnotation((Class) ClassLiteral<Platform>.Value); if (platform1 == null) return; Platform[] platformArray2 = new Platform[1]; int index = 0; Platform platform2 = platform1; platformArray2[index] = platform2; platformArray1 = platformArray2; } else platformArray1 = properties1.value(); string[] strArray1 = new string[0]; string[] strArray2 = new string[0]; string[] strArray3 = new string[0]; string[] strArray4 = new string[0]; string[] strArray5 = new string[0]; string[] strArray6 = new string[0]; string[] strArray7 = new string[0]; string[] strArray8 = new string[0]; string[] strArray9 = new string[0]; Platform[] platformArray3 = platformArray1; int length1 = platformArray3.Length; for (int index1 = 0; index1 < length1; ++index1) { Platform platform = platformArray3[index1]; string[][] strArray10 = new string[2][]; int index2 = 0; string[] strArray11 = platform.value(); strArray10[index2] = strArray11; int index3 = 1; string[] strArray12 = platform.not(); strArray10[index3] = strArray12; string[][] strArray13 = strArray10; bool[] flagArray1 = new bool[2]; int index4 = 0; int num1 = 0; flagArray1[index4] = num1 != 0; int index5 = 1; int num2 = 0; flagArray1[index5] = num2 != 0; bool[] flagArray2 = flagArray1; for (int index6 = 0; index6 < strArray13.Length; ++index6) { string[] strArray14 = strArray13[index6]; int length2 = strArray14.Length; for (int index7 = 0; index7 < length2; ++index7) { string str = strArray14[index7]; if (String.instancehelper_startsWith(property1, str)) { flagArray2[index6] = true; break; } } } if ((strArray13[0].Length == 0 || flagArray2[0]) && (strArray13[1].Length == 0 || !flagArray2[1])) { if (platform.define().Length > 0) strArray1 = platform.define(); if (platform.include().Length > 0) strArray2 = platform.include(); if (platform.cinclude().Length > 0) strArray3 = platform.cinclude(); if (platform.includepath().Length > 0) strArray4 = platform.includepath(); if (platform.options().Length > 0) strArray5 = platform.options(); if (platform.linkpath().Length > 0) strArray6 = platform.linkpath(); if (platform.link().Length > 0) strArray7 = platform.link(); if (platform.preloadpath().Length > 0) strArray8 = platform.preloadpath(); if (platform.preload().Length > 0) strArray9 = platform.preload(); } } string property2 = properties.getProperty("path.separator"); Loader.appendProperty(properties, "generator.define", "\0", strArray1); Loader.appendProperty(properties, "generator.include", "\0", strArray2); Loader.appendProperty(properties, "generator.cinclude", "\0", strArray3); Loader.appendProperty(properties, "compiler.includepath", property2, strArray4); if (strArray5.Length > 0) { string property3 = properties.getProperty("compiler.options"); properties.setProperty("compiler.options", ""); for (int index1 = 0; index1 < strArray5.Length; ++index1) { string str1 = property3; if (String.instancehelper_length(strArray5[index1]) > 0) str1 = properties.getProperty(new StringBuilder().append("compiler.options.").append(strArray5[index1]).toString()); Properties properties2 = properties; string name = "compiler.options"; string separator = " "; string[] strArray10 = new string[1]; int index2 = 0; string str2 = str1; strArray10[index2] = str2; Loader.appendProperty(properties2, name, separator, strArray10); } } Loader.appendProperty(properties, "compiler.linkpath", property2, strArray6); Loader.appendProperty(properties, "compiler.link", property2, strArray7); Loader.appendProperty(properties, "loader.preloadpath", property2, strArray6); Loader.appendProperty(properties, "loader.preloadpath", property2, strArray8); Loader.appendProperty(properties, "loader.preload", property2, strArray7); Loader.appendProperty(properties, "loader.preload", property2, strArray9); }