public static void Setup() { String platform = Environment.Is64BitOperatingSystem ? "x64" : "Win32"; String configuration = "Debug"; String assemblyPath = new Uri(typeof(WindowsStartup).Assembly.CodeBase).LocalPath; String jni4csharpDllPath = Path.Combine(Path.GetDirectoryName(assemblyPath), "..", "..", "..", "..", platform, configuration); String jdkPath = Environment.Is64BitOperatingSystem ? @"C:\Program Files\Java\jdk-1.8.0_201\" : @"C:\Program Files (x86)\Java\jdk-1.8.0_201\"; WindowsStartup.Config(jdkPath, jni4csharpDllPath); }
public void TestResolveEnvironmentVariable() { var randomVariable = string.Format("TestVariable{0:yyyyMMddhhmmss}", DateTime.Now); string value = Utility.ResolveEnvironmentVariable(randomVariable); Assert.Null(value); Environment.SetEnvironmentVariable(randomVariable, randomVariable, EnvironmentVariableTarget.Machine); //By default, Utility.ResolveEnvironmentVariable use dotnet core GetEnvironmentVariable which resolves to process variable so this should not resolve value = Utility.ResolveEnvironmentVariable(randomVariable); Assert.Null(value); WindowsStartup.Start(); //This attach the Windows version of ResolveEnvironmentVariable value = Utility.ResolveEnvironmentVariable(randomVariable); Assert.NotEmpty(value); //Clean up Environment.SetEnvironmentVariable(randomVariable, null, EnvironmentVariableTarget.Machine); }
private void ChkStartApplicationWhenWindowsStarts_CheckedChanged(object sender, EventArgs e) { WindowsStartup.StartApplicationWhenWindowsStarts(chkStartApplicationWhenWindowsStarts.Checked); }