System.Environment.SetEnvironmentVariable(string, string)

Here are the examples of the csharp api System.Environment.SetEnvironmentVariable(string, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

639 Examples 7

19 View Source File : AqualityServicesTests.cs
License : Apache License 2.0
Project Creator : aquality-automation

[TestCase(null)]
        [TestCase("--headless, --disable-infobars")]
        [TestCase("a")]
        public void Should_BeAbleGetBrowser_WithStartArguments(string startArguments)
        {
            var currentBrowser = AqualityServices.Get<IBrowserProfile>().BrowserName;
            Environment.SetEnvironmentVariable("isRemote", "false");
            Environment.SetEnvironmentVariable($"driverSettings.{currentBrowser.ToString().ToLowerInvariant()}.startArguments", startArguments);
            replacedert.DoesNotThrow(() => AqualityServices.Browser.WaitForPageToLoad());
        }

19 View Source File : DbContext.cs
License : MIT License
Project Creator : ARKlab

[BeforeTestRun(Order = int.MinValue)]
		public static void TestEnvironmentInitialization()
		{
			Environment.SetEnvironmentVariable("CODE_COVERAGE_SESSION_NAME", null);
			EmbeddedServer.Instance.StartServer(new ServerOptions
			{
				FrameworkVersion = "2.2.8",
				ServerUrl = DatabaseConnectionString,
			});

			DatabaseConnectionString = EmbeddedServer.Instance.GetServerUriAsync().GetAwaiter().GetResult().ToString();
			var store = EmbeddedServer.Instance.GetDoreplacedentStore(new DatabaseOptions(_databaseName));

			store.Maintenance.Server.Send(new DeleteDatabasesOperation(store.Database, hardDelete: true));

			string[] databaseNames;
			do
			{
				var operation = new GetDatabaseNamesOperation(0, 25);
				databaseNames = store.Maintenance.Server.Send(operation);
			} while (databaseNames.Contains(store.Database));

			store.EnsureDatabaseExists(_databaseName, configureRecord: r =>
			{
				r.Revisions = new RevisionsConfiguration()
				{
					Default = new RevisionsCollectionConfiguration
					{
						Disabled = false,
						PurgeOnDelete = false,
						MinimumRevisionsToKeep = null,
						MinimumRevisionAgeToKeep = null,
					},
					Collections = new System.Collections.Generic.Dictionary<string, RevisionsCollectionConfiguration>
					{
						{ "@Outbox", new RevisionsCollectionConfiguration { Disabled = true }}
					}
				};
			});

			_doreplacedentStore = store;


			//EmbeddedServer.Instance.StartServer(new ServerOptions
			//{
			//	ServerUrl = DatabaseConnectionString,
			//});

			//_doreplacedentStore = EmbeddedServer.Instance.GetDoreplacedentStore(new DatabaseOptions(_databaseName));

			//_doreplacedentStore.DeleteDatabaseWithName(_databaseName);
		}

19 View Source File : ProcessInvokerL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public async Task KeepExistingCIEnv()
        {
            using (TestHostContext hc = new TestHostContext(this))
            {
                var existingCI = Environment.GetEnvironmentVariable("CI");
                try
                {
                    // Clear out CI and make sure process invoker sets it.
                    Environment.SetEnvironmentVariable("CI", null);

                    Tracing trace = hc.GetTrace();

                    Int32 exitCode = -1;
                    var processInvoker = new ProcessInvokerWrapper();
                    processInvoker.Initialize(hc);
                    var stdout = new List<string>();
                    var stderr = new List<string>();
                    processInvoker.OutputDataReceived += (object sender, ProcessDataReceivedEventArgs e) =>
                    {
                        trace.Info(e.Data);
                        stdout.Add(e.Data);
                    };
                    processInvoker.ErrorDataReceived += (object sender, ProcessDataReceivedEventArgs e) =>
                    {
                        trace.Info(e.Data);
                        stderr.Add(e.Data);
                    };
#if OS_WINDOWS
                    exitCode = await processInvoker.ExecuteAsync("", "cmd.exe", "/c \"echo %CI%\"", new Dictionary<string, string>() { { "CI", "false" } }, CancellationToken.None);
#else
                    exitCode = await processInvoker.ExecuteAsync("", "bash", "-c \"echo $CI\"", new Dictionary<string, string>() { { "CI", "false" } }, CancellationToken.None);
#endif

                    trace.Info("Exit Code: {0}", exitCode);
                    replacedert.Equal(0, exitCode);

                    replacedert.Equal("false", stdout.First(x => !string.IsNullOrWhiteSpace(x)));
                }
                finally
                {
                    Environment.SetEnvironmentVariable("CI", existingCI);
                }
            }
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : anydream

static void Main(string[] args)
		{
			// 添加 clang 目录到环境变量
			string envPath = Environment.GetEnvironmentVariable("PATH");
			string clangPath = Path.GetFullPath("../../../tools/clang/bin");
			envPath = clangPath + ';' + envPath;
			Environment.SetEnvironmentVariable("PATH", envPath);

			try
			{
				Helper.RunCommand("clang", "-v", null, null, null);
				Helper.RunCommand("llvm-link", "--help", null, null, null);
			}
			catch (System.ComponentModel.Win32Exception)
			{
				Console.Error.Write("error: Cannot find clang toolchain!");
				try
				{
					Console.ReadKey();
				}
				catch
				{
				}
				return;
			}

			if (args.Length > 0)
			{
				var srcFiles = ParseArgs(args);

				var make = new Maker(".", "output");
				make.OptLevel = OptLevel;
				make.GenOptCount = GenOptCount;
				make.FinalOptCount = FinalOptCount;
				make.AddCFlags = AddCFlags;
				make.Invoke(new HashSet<string>(srcFiles));
			}
			else
			{
				Console.Error.WriteLine("error: Please run 'build.cmd' to compile");
				Console.ReadKey();
			}
		}

19 View Source File : FirestoreTestFixture.cs
License : Apache License 2.0
Project Creator : Aguafrommars

public static FirestoreDb CreateFirestoreDb(IServiceProvider provider)
        {
            var authOptions = provider.GetRequiredService<IOptions<OAuthServiceAccountKey>>();

            var path = Path.GetTempFileName();

            var json = JsonConvert.SerializeObject(authOptions.Value);
            using var writer = File.CreateText(path);
            writer.Write(json);
            writer.Flush();
            writer.Close();
            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);

            var client = FirestoreClient.Create();
            return FirestoreDb.Create(authOptions.Value.project_id, client: client);
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesNoProxy()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://user1:preplaced1%[email protected]:8888");
                Environment.SetEnvironmentVariable("https_proxy", "http://user2:preplaced2%[email protected]:9999");
                Environment.SetEnvironmentVariable("no_proxy", "github.com, .google.com, example.com:444, 192.168.0.123:123, 192.168.1.123");
                var proxy = new RunnerWebProxy();

                replacedert.False(proxy.IsBypreplaceded(new Uri("https://actions.com")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("https://ggithub.com")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("https://github.comm")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("https://google.com")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("https://example.com")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("http://example.com:333")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("http://192.168.0.123:123")));
                replacedert.False(proxy.IsBypreplaceded(new Uri("http://192.168.1.123/home")));

                replacedert.True(proxy.IsBypreplaceded(new Uri("https://github.com")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://GITHUB.COM")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://github.com/owner/repo")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://actions.github.com")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://mails.google.com")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://MAILS.GOOGLE.com")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://mails.v2.google.com")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("http://mails.v2.v3.google.com/inbox")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("https://example.com:444")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("http://example.com:444")));
                replacedert.True(proxy.IsBypreplaceded(new Uri("http://example.COM:444")));
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : AzureFunctionsDatabricksProject.cs
License : MIT License
Project Creator : arcus-azure

protected override void Disposing(bool disposing)
        {
            base.Disposing(disposing);
            Environment.SetEnvironmentVariable(ApplicationInsightsMetricNameVariable, null);
            Environment.SetEnvironmentVariable(DatabricksUrlVariable, null);
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariables()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://127.0.0.1:8888");
                Environment.SetEnvironmentVariable("https_proxy", "http://user:[email protected]:9999");
                Environment.SetEnvironmentVariable("no_proxy", "github.com, google.com,");
                var proxy = new RunnerWebProxy();

                replacedert.Equal("http://127.0.0.1:8888", proxy.HttpProxyAddress);
                replacedert.Null(proxy.HttpProxyUsername);
                replacedert.Null(proxy.HttpProxyPreplacedword);

                replacedert.Equal("http://user:[email protected]:9999", proxy.HttpsProxyAddress);
                replacedert.Equal("user", proxy.HttpsProxyUsername);
                replacedert.Equal("preplaced", proxy.HttpsProxyPreplacedword);

                replacedert.Equal(2, proxy.NoProxyList.Count);
                replacedert.Equal("github.com", proxy.NoProxyList[0].Host);
                replacedert.Equal("google.com", proxy.NoProxyList[1].Host);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : EnvironmentVariableTests.cs
License : Apache License 2.0
Project Creator : atata-framework

[SetUp]
        public void SetUp()
        {
            Environment.SetEnvironmentVariable(Variable1Name, null);
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesInvalidString()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "127.0.0.1:7777");
                Environment.SetEnvironmentVariable("https_proxy", "127.0.0.1");
                var proxy = new RunnerWebProxy();

                replacedert.Null(proxy.HttpProxyAddress);
                replacedert.Null(proxy.HttpProxyUsername);
                replacedert.Null(proxy.HttpProxyPreplacedword);

                replacedert.Null(proxy.HttpsProxyAddress);
                replacedert.Null(proxy.HttpsProxyUsername);
                replacedert.Null(proxy.HttpsProxyPreplacedword);

                replacedert.Equal(0, proxy.NoProxyList.Count);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : anastasios-stamoulis

static void Main(string[] args) {
      // make sure that the hard-coded values have been set up correctly
      if ( System.IO.Directory.Exists(PYTHON_HOME_)==false ) {
        throw new NotSupportedException("Please set PYTHON_HOME_ properly");
      }
      if ( System.IO.File.Exists(PYTHONNET_DLL_)==false ) {
        throw new NotSupportedException("Probably you have not pip-installed pythonnet");
      }
      if ( System.IO.Directory.Exists(KERAS_PORTED_CODE_)==false ) {
        throw new NotSupportedException("Need to initialize KERAS_PORTED_CODE_");
      }
      System.Console.replacedle = "Ch_08_Deep_Dream";

      // set model_path, and image_path
      var vgg16_model_path = DeepLearningWithCNTK.VGG16.download_model_if_needed();
      var image_path = DeepLearningWithCNTK.Util.get_the_path_of_the_elephant_image();

      // modify the environment variables
      var to_be_added_to_path = PYTHON_HOME_ + ";" + KERAS_PORTED_CODE_;
      var path = Environment.GetEnvironmentVariable("PATH");
      path = to_be_added_to_path + ";" + path;
      Environment.SetEnvironmentVariable("PATH", path);
      Environment.SetEnvironmentVariable("PYTHONPATH", path);

      // load the Python.NET dll, and start the (embedded) Python engine
      var dll = System.Reflection.replacedembly.LoadFile(PYTHONNET_DLL_);
      var PythonEngine = dll.GetType("Python.Runtime.PythonEngine");

      // to be on the safe side, update the PythonPath of the local engine
      var PythonPathProperty = PythonEngine.GetProperty("PythonPath");
      var pythonPath = (string)PythonPathProperty.GetValue(null);
      pythonPath += ";" + KERAS_PORTED_CODE_;
      pythonPath += ";" + PYTHON_HOME_ + "\\Lib\\site-packages";
      PythonPathProperty.SetValue(null, pythonPath);

      // let's start executing some python code
      dynamic Py = dll.GetType("Python.Runtime.Py");
      dynamic GIL = Py.GetMethod("GIL").Invoke(null, null);

      // import "ch8-2.py"
      dynamic ch8_2 = Py.GetMethod("Import").Invoke(null, new object[] { "ch8-2" });

      // response = ch8_2.get_response("Hi From C#")
      var response = ch8_2.get_response("Hi From C#");
      Console.WriteLine("C# received: "+response);
      Console.WriteLine("\n\n");

      // let's call the run_cntk function from the Python script
      var img = ch8_2.run_cntk(image_path, vgg16_model_path);

      // convert the python numpy array to byte[]
      byte[] img_data = convert_uint8_numpy_array_to_byte_array(img);

      // display the image with OpenCV
      var mat = new OpenCvSharp.Mat(224, 224, OpenCvSharp.MatType.CV_8UC3, img_data, 3 * 224);
      OpenCvSharp.Cv2.ImShow("The Dream", mat);

      // Show also the original image
      OpenCvSharp.Cv2.ImShow("Original", OpenCvSharp.Cv2.ImRead(image_path).Resize(new OpenCvSharp.Size(224, 224)));

      OpenCvSharp.Cv2.WaitKey(0);

      GIL.Dispose();
    }

19 View Source File : IdentityBuilderExtensionsTest.cs
License : Apache License 2.0
Project Creator : Aguafrommars

[Fact]
        public void AddFirebaseStores_with_project_id_Test()
        {
            var builder = new ConfigurationBuilder();
            var configuration = builder
                .AddEnvironmentVariables()
                .AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "../../../../idenreplacedyfirestore.json"))
                .Build();

            var authOptions = configuration.GetSection("FirestoreAuthTokenOptions").Get<OAuthServiceAccountKey>();
            if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS")))
            {
                var path = Path.GetTempFileName();

                var json = JsonConvert.SerializeObject(authOptions);
                using var writer = File.CreateText(path);
                writer.Write(json);
                writer.Flush();
                writer.Close();
                Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);
            }

            var services = new ServiceCollection();
            services
                .AddIdenreplacedy<IdenreplacedyUser, IdenreplacedyRole>()
                .AddFirestoreStores(authOptions.project_id);

            var provider = services.BuildServiceProvider();

            replacedert.NotNull(provider.GetService<IUserStore<IdenreplacedyUser>>());
            replacedert.NotNull(provider.GetService<IRoleStore<IdenreplacedyRole>>());
        }

19 View Source File : HostContextL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void SecretMaskerForProxy()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://user:[email protected]:8888");

                // Arrange.
                Setup();

                // replacedert.
                var logFile = Path.Combine(Path.GetDirectoryName(replacedembly.GetEntryreplacedembly().Location), $"trace_{nameof(HostContextL0)}_{nameof(SecretMaskerForProxy)}.log");
                var tempFile = Path.GetTempFileName();
                File.Delete(tempFile);
                File.Copy(logFile, tempFile);
                var content = File.ReadAllText(tempFile);
                replacedert.DoesNotContain("preplacedword123", content);
                replacedert.Contains("http://user:***@127.0.0.1:8888", content);
            }
            finally
            {
                Environment.SetEnvironmentVariable("http_proxy", null);
                // Cleanup.
                Teardown();
            }
        }

19 View Source File : Init.cs
License : Apache License 2.0
Project Creator : apache

public async Task<Run> HandleRequest(HttpContext httpContext)
        {
            await _initSemapreplacedSlim.WaitAsync();
            try
            {
                if (Initialized)
                {
                    await httpContext.Response.WriteError("Cannot initialize the action more than once.");
                    Console.Error.WriteLine("Cannot initialize the action more than once.");
                    return (new Run(Type, Method, Constructor, AwaitableMethod));
                }

                string body = await new StreamReader(httpContext.Request.Body).ReadToEndAsync();
                JObject inputObject = JObject.Parse(body);
                if (!inputObject.ContainsKey("value"))
                {
                    await httpContext.Response.WriteError("Missing main/no code to execute.");
                    return (null);
                }

                JToken message = inputObject["value"];

                if (message["main"] == null || message["binary"] == null || message["code"] == null)
                {
                    await httpContext.Response.WriteError("Missing main/no code to execute.");
                    return (null);
                }

                string main = message["main"].ToString();

                bool binary = message["binary"].ToObject<bool>();

                if (!binary)
                {
                    await httpContext.Response.WriteError("code must be binary (zip file).");
                    return (null);
                }

                string[] mainParts = main.Split("::");
                if (mainParts.Length != 3)
                {
                    await httpContext.Response.WriteError("main required format is \"replacedembly::Type::Function\".");
                    return (null);
                }

                string tempPath = Path.Combine(Environment.CurrentDirectory, Guid.NewGuid().ToString());
                string base64Zip = message["code"].ToString();
                try
                {
                    using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(base64Zip)))
                    {
                        using (ZipArchive archive = new ZipArchive(stream))
                        {
                            archive.ExtractToDirectory(tempPath);
                        }
                    }
                }
                catch (Exception)
                {
                    await httpContext.Response.WriteError("Unable to decompress package.");
                    return (null);
                }

                Environment.CurrentDirectory = tempPath;

                string replacedemblyFile = $"{mainParts[0]}.dll";

                string replacedemblyPath = Path.Combine(tempPath, replacedemblyFile);

                if (!File.Exists(replacedemblyPath))
                {
                    await httpContext.Response.WriteError($"Unable to locate requested replacedembly (\"{replacedemblyFile}\").");
                    return (null);
                }

                try
                {
                    // Export init arguments as environment variables
                    if (message["env"] != null && message["env"].HasValues)
                    {
                        Dictionary<string, string> dictEnv = message["env"].ToObject<Dictionary<string, string>>();
                        foreach (KeyValuePair<string, string> entry in dictEnv) {
                            // See https://docs.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable
                            // If entry.Value is null or the empty string, the variable is not set
                            Environment.SetEnvironmentVariable(entry.Key, entry.Value);
                        }
                    }

                    replacedembly replacedembly = replacedembly.LoadFrom(replacedemblyPath);
                    Type = replacedembly.GetType(mainParts[1]);
                    if (Type == null)
                    {
                        await httpContext.Response.WriteError($"Unable to locate requested type (\"{mainParts[1]}\").");
                        return (null);
                    }
                    Method = Type.GetMethod(mainParts[2]);
                    Constructor = Type.GetConstructor(Type.EmptyTypes);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex.ToString());
                    await httpContext.Response.WriteError(ex.Message
#if DEBUG
                                                          + ", " + ex.StackTrace
#endif
                    );
                    return (null);
                }

                if (Method == null)
                {
                    await httpContext.Response.WriteError($"Unable to locate requested method (\"{mainParts[2]}\").");
                    return (null);
                }

                if (Constructor == null)
                {
                    await httpContext.Response.WriteError($"Unable to locate appropriate constructor for (\"{mainParts[1]}\").");
                    return (null);
                }

                Initialized = true;

                AwaitableMethod = (Method.ReturnType.GetMethod(nameof(Task.GetAwaiter)) != null);

                return (new Run(Type, Method, Constructor, AwaitableMethod));
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.StackTrace);
                await httpContext.Response.WriteError(ex.Message
#if DEBUG
                                                  + ", " + ex.StackTrace
#endif
                );
                Startup.WriteLogMarkers();
                return (null);
            }
            finally
            {
                _initSemapreplacedSlim.Release();
            }
        }

19 View Source File : OutputManagerL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Worker")]
        public async void MatcherFile()
        {
            Environment.SetEnvironmentVariable("RUNNER_TEST_GET_REPOSITORY_PATH_FAILSAFE", "2");
            var matchers = new IssueMatchersConfig
            {
                Matchers =
                {
                    new IssueMatcherConfig
                    {
                        Owner = "my-matcher-1",
                        Patterns = new[]
                        {
                            new IssuePatternConfig
                            {
                                Pattern = @"(.+): (.+)",
                                File = 1,
                                Message = 2,
                            },
                        },
                    },
                },
            };
            using (var hostContext = Setup(matchers: matchers))
            using (_outputManager)
            {
                // Setup github.workspace, github.repository
                var workDirectory = hostContext.GetDirectory(WellKnownDirectory.Work);
                ArgUtil.NotNullOrEmpty(workDirectory, nameof(workDirectory));
                Directory.CreateDirectory(workDirectory);
                var workspaceDirectory = Path.Combine(workDirectory, "workspace");
                Directory.CreateDirectory(workspaceDirectory);
                _executionContext.Setup(x => x.GetGitHubContext("workspace")).Returns(workspaceDirectory);
                _executionContext.Setup(x => x.GetGitHubContext("repository")).Returns("my-org/workflow-repo");

                // Setup some git repositories
                // <WORKSPACE>/workflow-repo
                // <WORKSPACE>/workflow-repo/nested-other-repo
                // <WORKSPACE>/other-repo
                // <WORKSPACE>/other-repo/nested-workflow-repo
                // <WORKSPACE>/workflow-repo-using-ssh
                var workflowRepository = Path.Combine(workspaceDirectory, "workflow-repo");
                var nestedOtherRepository = Path.Combine(workspaceDirectory, "workflow-repo", "nested-other-repo");
                var otherRepository = Path.Combine(workspaceDirectory, workflowRepository, "nested-other-repo");
                var nestedWorkflowRepository = Path.Combine(workspaceDirectory, "other-repo", "nested-workflow-repo");
                var workflowRepositoryUsingSsh = Path.Combine(workspaceDirectory, "workflow-repo-using-ssh");
                await CreateRepository(hostContext, workflowRepository, "https://github.com/my-org/workflow-repo");
                await CreateRepository(hostContext, nestedOtherRepository, "https://github.com/my-org/other-repo");
                await CreateRepository(hostContext, otherRepository, "https://github.com/my-org/other-repo");
                await CreateRepository(hostContext, nestedWorkflowRepository, "https://github.com/my-org/workflow-repo");
                await CreateRepository(hostContext, workflowRepositoryUsingSsh, "[email protected]:my-org/workflow-repo.git");

                // Create test files
                var file_noRepository = Path.Combine(workspaceDirectory, "no-repo.txt");
                var file_workflowRepository = Path.Combine(workflowRepository, "workflow-repo.txt");
                var file_workflowRepository_nestedDirectory = Path.Combine(workflowRepository, "subdir", "subdir2", "workflow-repo-nested-dir.txt");
                var file_workflowRepository_failsafe = Path.Combine(workflowRepository, "failsafe-subdir", "failsafe-subdir2", "failsafe-subdir3", "workflow-repo-failsafe.txt");
                var file_nestedOtherRepository = Path.Combine(nestedOtherRepository, "nested-other-repo");
                var file_otherRepository = Path.Combine(otherRepository, "other-repo.txt");
                var file_nestedWorkflowRepository = Path.Combine(nestedWorkflowRepository, "nested-workflow-repo.txt");
                var file_workflowRepositoryUsingSsh = Path.Combine(workflowRepositoryUsingSsh, "workflow-repo-using-ssh.txt");
                foreach (var file in new[] { file_noRepository, file_workflowRepository, file_workflowRepository_nestedDirectory, file_workflowRepository_failsafe, file_nestedOtherRepository, file_otherRepository, file_nestedWorkflowRepository, file_workflowRepositoryUsingSsh })
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(file));
                    File.WriteAllText(file, "");
                }

                // Process
                Process($"{file_noRepository}: some error 1");
                Process($"{file_workflowRepository}: some error 2");
                Process($"{file_workflowRepository.Substring(workspaceDirectory.Length + 1)}: some error 3"); // Relative path from workspace dir
                Process($"{file_workflowRepository_nestedDirectory}: some error 4");
                Process($"{file_workflowRepository_failsafe}: some error 5");
                Process($"{file_nestedOtherRepository}: some error 6");
                Process($"{file_otherRepository}: some error 7");
                Process($"{file_nestedWorkflowRepository}: some error 8");
                Process($"{file_workflowRepositoryUsingSsh}: some error 9");

                replacedert.Equal(9, _issues.Count);

                replacedert.Equal("some error 1", _issues[0].Item1.Message);
                replacedert.False(_issues[0].Item1.Data.ContainsKey("file"));

                replacedert.Equal("some error 2", _issues[1].Item1.Message);
                replacedert.Equal(file_workflowRepository.Substring(workflowRepository.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[1].Item1.Data["file"]);

                replacedert.Equal("some error 3", _issues[2].Item1.Message);
                replacedert.Equal(file_workflowRepository.Substring(workflowRepository.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[2].Item1.Data["file"]);

                replacedert.Equal("some error 4", _issues[3].Item1.Message);
                replacedert.Equal(file_workflowRepository_nestedDirectory.Substring(workflowRepository.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[3].Item1.Data["file"]);

                replacedert.Equal("some error 5", _issues[4].Item1.Message);
                replacedert.False(_issues[4].Item1.Data.ContainsKey("file"));

                replacedert.Equal("some error 6", _issues[5].Item1.Message);
                replacedert.False(_issues[5].Item1.Data.ContainsKey("file"));

                replacedert.Equal("some error 7", _issues[6].Item1.Message);
                replacedert.False(_issues[6].Item1.Data.ContainsKey("file"));

                replacedert.Equal("some error 8", _issues[7].Item1.Message);
                replacedert.Equal(file_nestedWorkflowRepository.Substring(nestedWorkflowRepository.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[7].Item1.Data["file"]);

                replacedert.Equal("some error 9", _issues[8].Item1.Message);
                replacedert.Equal(file_workflowRepositoryUsingSsh.Substring(workflowRepositoryUsingSsh.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[8].Item1.Data["file"]);
            }

            Environment.SetEnvironmentVariable("RUNNER_TEST_GET_REPOSITORY_PATH_FAILSAFE", "");
        }

19 View Source File : TemporaryEnvironmentVariable.cs
License : MIT License
Project Creator : arcus-azure

public static TemporaryEnvironmentVariable Create(string name, string value)
        {
            Guard.NotNull(name, nameof(name));
            Environment.SetEnvironmentVariable(name, value);

            return new TemporaryEnvironmentVariable(name);
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesWithPort80()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://127.0.0.1:80");
                Environment.SetEnvironmentVariable("https_proxy", "http://user:[email protected]:80");
                Environment.SetEnvironmentVariable("no_proxy", "github.com, google.com,");
                var proxy = new RunnerWebProxy();

                replacedert.Equal("http://127.0.0.1:80", Environment.GetEnvironmentVariable("http_proxy"));
                replacedert.Null(proxy.HttpProxyUsername);
                replacedert.Null(proxy.HttpProxyPreplacedword);

                replacedert.Equal("http://user:[email protected]:80", Environment.GetEnvironmentVariable("https_proxy"));
                replacedert.Equal("user", proxy.HttpsProxyUsername);
                replacedert.Equal("preplaced", proxy.HttpsProxyPreplacedword);

                replacedert.Equal(2, proxy.NoProxyList.Count);
                replacedert.Equal("github.com", proxy.NoProxyList[0].Host);
                replacedert.Equal("google.com", proxy.NoProxyList[1].Host);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : Entrypoint.cs
License : MIT License
Project Creator : Arkhist

public static void Bootstrap()
        {
            AppDomain.CurrentDomain.replacedemblyResolve += ResolveBepreplacedembly;
            if (Type.GetType("Mono.Runtime") != null)
                AppDomain.CurrentDomain.replacedemblyResolve += ResolveGACreplacedembly;

            Environment.SetEnvironmentVariable("MONOMOD_DMD_TYPE", "dynamicmethod");

            LoadBepInEx.Load();
        }

19 View Source File : CommandSettingsL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", nameof(CommandSettings))]
        public void GetsArgSecretFromEnvVar()
        {
            using (TestHostContext hc = CreateTestContext())
            {
                try
                {
                    // Arrange.
                    Environment.SetEnvironmentVariable("ACTIONS_RUNNER_INPUT_TOKEN", "some secret token value");
                    var command = new CommandSettings(hc, args: new string[0]);

                    // Act.
                    string actual = command.GetToken();

                    // replacedert.
                    replacedert.Equal("some secret token value", actual);
                    replacedert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_TOKEN") ?? string.Empty); // Should remove.
                    replacedert.Equal("***", hc.SecretMasker.MaskSecrets("some secret token value"));
                }
                finally
                {
                    Environment.SetEnvironmentVariable("ACTIONS_RUNNER_INPUT_TOKEN", null);
                }
            }
        }

19 View Source File : TestServerFixture.cs
License : MIT License
Project Creator : armutcom

protected override IHostBuilder CreateHostBuilder()
        {
            Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Testing");
            //Environment.SetEnvironmentVariable("ASPNETCORE_URLS", "https://localhost:5001;http://localhost:5000");

            var hostBuilder = base.CreateHostBuilder()
                .UseEnvironment("Testing")
                .ConfigureAppConfiguration(builder =>
                {
                    var configPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json");
                    builder.AddJsonFile(configPath);
                })
                .ConfigureServices((context, collection)  =>
                {
                    ServiceProvider serviceProvider = collection.BuildServiceProvider();

                    var hostEnvironment = serviceProvider.GetRequiredService<IHostEnvironment>();
                    bool isTest = hostEnvironment.IsEnvironment("Testing");

                    if (!isTest)
                    {
                        throw new Exception("Incorrect config loaded.");
                    }

                    using IServiceScope scope = serviceProvider.CreateScope();
                    IServiceProvider scopeServiceProvider = scope.ServiceProvider;
                    var armutContext = scopeServiceProvider.GetRequiredService<ArmutContext>();
                    var amazonS3Client = scopeServiceProvider.GetRequiredService<IAmazonS3>();

                    armutContext.Database.EnsureCreated();
                    Seeder.Seed(armutContext);

                    CreateS3BucketAsync(amazonS3Client, Constants.ProfilePictureBucket)
                        .GetAwaiter()
                        .GetResult();
                });

            return hostBuilder;
        }

19 View Source File : GitHubJwtFactoryTests.cs
License : MIT License
Project Creator : adriangodong

[TestMethod]
        public void CreateEncodedJwtToken_FromEnvVar_ShouldNotFail()
        {
            // Arrange
            var privateKeyName = Guid.NewGuid().ToString("N");
            var privateKeySource = new EnvironmentVariablePrivateKeySource(privateKeyName);
            var options = new GitHubJwtFactoryOptions
            {
                AppIntegrationId = 6837,
                ExpirationSeconds = 600 // 10 minutes maximum
            };
            var factory = new GitHubJwtFactory(privateKeySource, options);

            using (new EnvironmentVariableScope(privateKeyName))
            {
                Environment.SetEnvironmentVariable(privateKeyName, File.ReadAllText("envvar.pem"));

                // Act
                var token = factory.CreateEncodedJwtToken();

                // replacedert
                replacedert.IsNotNull(token);
                Console.WriteLine(token);
            }
        }

19 View Source File : IdentityBuilderExtensions.cs
License : Apache License 2.0
Project Creator : Aguafrommars

private static IOptions<OAuthServiceAccountKey> StoreAuthFile(IServiceProvider provider, string authFilePath)
        {
            var authOptions = provider.GetRequiredService<IOptions<OAuthServiceAccountKey>>();
            var json = JsonConvert.SerializeObject(authOptions.Value);
            using (var writer = File.CreateText(authFilePath))
            {
                writer.Write(json);
                writer.Flush();
                writer.Close();
            }
            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", authFilePath);
            return authOptions;
        }

19 View Source File : CommandSettingsL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", nameof(CommandSettings))]
        public void GetsFlagUnattendedFromEnvVar()
        {
            using (TestHostContext hc = CreateTestContext())
            {
                try
                {
                    // Arrange.
                    Environment.SetEnvironmentVariable("ACTIONS_RUNNER_INPUT_UNATTENDED", "true");
                    var command = new CommandSettings(hc, args: new string[0]);

                    // Act.
                    bool actual = command.Unattended;

                    // replacedert.
                    replacedert.True(actual);
                    replacedert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_UNATTENDED") ?? string.Empty); // Should remove.
                }
                finally
                {
                    Environment.SetEnvironmentVariable("ACTIONS_RUNNER_INPUT_UNATTENDED", null);
                }
            }
        }

19 View Source File : UserStoreTest.cs
License : Apache License 2.0
Project Creator : Aguafrommars

private static void CreateAuthFile(IServiceProvider provider, out IOptions<OAuthServiceAccountKey> authOptions)
        {
            authOptions = provider.GetRequiredService<IOptions<OAuthServiceAccountKey>>();
            var json = JsonConvert.SerializeObject(authOptions.Value);
            var path = Path.GetTempFileName();
            using var writer = File.CreateText(path);
            writer.Write(json);
            writer.Flush();
            writer.Close();
            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesProxyCredentials()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://[email protected]:8888");
                Environment.SetEnvironmentVariable("https_proxy", "http://user2:[email protected]:9999");
                Environment.SetEnvironmentVariable("no_proxy", "github.com, google.com,");
                var proxy = new RunnerWebProxy();

                replacedert.Equal("http://[email protected]:8888", proxy.HttpProxyAddress);
                replacedert.Equal("user1", proxy.HttpProxyUsername);
                replacedert.Null(proxy.HttpProxyPreplacedword);

                var cred = proxy.Credentials.GetCredential(new Uri("http://[email protected]:8888"), "Basic");
                replacedert.Equal("user1", cred.UserName);
                replacedert.Equal(string.Empty, cred.Preplacedword);

                replacedert.Equal("http://user2:[email protected]:9999", proxy.HttpsProxyAddress);
                replacedert.Equal("user2", proxy.HttpsProxyUsername);
                replacedert.Equal("preplaced", proxy.HttpsProxyPreplacedword);

                cred = proxy.Credentials.GetCredential(new Uri("http://user2:[email protected]:9999"), "Basic");
                replacedert.Equal("user2", cred.UserName);
                replacedert.Equal("preplaced", cred.Preplacedword);

                replacedert.Equal(2, proxy.NoProxyList.Count);
                replacedert.Equal("github.com", proxy.NoProxyList[0].Host);
                replacedert.Equal("google.com", proxy.NoProxyList[1].Host);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : Program.cs
License : GNU Lesser General Public License v3.0
Project Creator : Alois-xx

private static void AddProcessStartDirectoryToPath()
        {
            string path = Environment.GetEnvironmentVariable("PATH");
            path += ";" + Path.GetDirectoryName(replacedembly.GetEntryreplacedembly().Location);
            Environment.SetEnvironmentVariable("PATH", path);
            DebugPrinter.Write($"Set Path={path}");
        }

19 View Source File : Environment.cs
License : Apache License 2.0
Project Creator : Algoryx

public static bool RemoveFromPath( string dir )
    {
      var pathList = System.Environment.GetEnvironmentVariable( "PATH" ).Split( ';' ).ToList();
      if ( !pathList.Remove( dir ) )
        return false;
      System.Environment.SetEnvironmentVariable( "PATH",
                                                 string.Join( ";", pathList ) );
      return true;
    }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

private void CleanProxyEnv()
        {
            Environment.SetEnvironmentVariable("http_proxy", null);
            Environment.SetEnvironmentVariable("https_proxy", null);
            Environment.SetEnvironmentVariable("HTTP_PROXY", null);
            Environment.SetEnvironmentVariable("HTTPS_PROXY", null);
            Environment.SetEnvironmentVariable("no_proxy", null);
            Environment.SetEnvironmentVariable("NO_PROXY", null);
        }

19 View Source File : Host.cs
License : MIT License
Project Creator : ancientproject

public static int Main(string[] c_args)
        {
            if (Environment.GetEnvironmentVariable("WT_SESSION") == null && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Environment.SetEnvironmentVariable($"RUNE_EMOJI_USE", "0");
                Environment.SetEnvironmentVariable($"RUNE_COLOR_USE", "0");
                Environment.SetEnvironmentVariable($"RUNE_NIER_USE", "0");
                Environment.SetEnvironmentVariable($"NO_COLOR", "true");
                ForegroundColor = ConsoleColor.Gray;
                WriteLine($"no windows-terminal: coloring, emoji and nier has disabled.");
                ForegroundColor = ConsoleColor.White;
            }

            AppDomain.CurrentDomain.ProcessExit += (sender, eventArgs) => { ConsoleExtensions.Disable(); };
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            var raw = new FluentCommandLineParser<Args>();
            raw.Setup(x => x.sourceFiles)
                .As('s', "source")
                .WithDescription("Source files.")
                .SetDefault(new List<string>());
            raw.Setup(x => x.OutFile)
                .As('o', "out")
                .WithDescription("Out file.");
            raw.Setup(x => x.extension)
                .As('e', "ext")
                .WithDescription("Extension of file.")
                .SetDefault("dlx");
            raw.Parse(c_args);
            var args = raw.Object;

            var ver = FileVersionInfo.GetVersionInfo(typeof(Host).replacedembly.Location).ProductVersion;
            
            WriteLine($"Ancient replacedembler compiler version {ver}".Pastel(Color.Gray));
            WriteLine($"Copyright (C) 2020 Yuuki Wesp.\n\n".Pastel(Color.Gray));
            
            if (!args.sourceFiles.Any())
            {
                Warn(Warning.NoSource, "No source files specified.");
                return 1;
            }
            if (string.IsNullOrEmpty(args.OutFile))
            {
                Error(Warning.OutFileNotSpecified, "Outputs without source must have the --out option specified.");
                return 1;
            }

            if (!args.sourceFiles.Select(x => new FileInfo(x).Exists).All(x => x))
            {
                Error(Warning.SourceFileNotFound, "One source file not found.");
                return 1;
            }



            var source = File.ReadAllText(args.sourceFiles.First()).Replace("\r", "");
            
            try
            {
                var e = Evolve(source);
                var c = Compile(e, args);

                File.WriteAllBytes($"{args.OutFile}.{args.extension}", c.data);
                File.WriteAllBytes($"{args.OutFile}.pdb", c.map);
                return 0;
            }
            catch (AncientCompileException)
            { }
            catch (AncientEvolveException)
            { }
            catch (Exception e)
            {
                WriteLine(e);
            }

            return 1;
        }

19 View Source File : VssUtilL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void VerifyOverwriteVssConnectionSetting()
        {
            using (TestHostContext hc = new TestHostContext(this))
            {
                Tracing trace = hc.GetTrace();

                // Act.
                try
                {
                    trace.Info("Set httpretry to 10.");
                    Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_RETRY", "10");
                    trace.Info("Set httptimeout to 360.");
                    Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_TIMEOUT", "360");

                    var connect = VssUtil.CreateConnection(new Uri("https://github.com/actions/runner"), new VssCredentials());

                    // replacedert.
                    replacedert.Equal("10", connect.Settings.MaxRetryRequest.ToString());
                    replacedert.Equal("360", connect.Settings.SendTimeout.TotalSeconds.ToString());

                    trace.Info("Set httpretry to 100.");
                    Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_RETRY", "100");
                    trace.Info("Set httptimeout to 3600.");
                    Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_TIMEOUT", "3600");

                    connect = VssUtil.CreateConnection(new Uri("https://github.com/actions/runner"), new VssCredentials());

                    // replacedert.
                    replacedert.Equal("10", connect.Settings.MaxRetryRequest.ToString());
                    replacedert.Equal("1200", connect.Settings.SendTimeout.TotalSeconds.ToString());
                }
                finally
                {
                    Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_RETRY", "");
                    Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_HTTP_TIMEOUT", "");
                }
            }
        }

19 View Source File : Run.cs
License : Apache License 2.0
Project Creator : apache

public async Task HandleRequest(HttpContext httpContext)
        {
            if (_type == null || _method == null || _constructor == null)
            {
                await httpContext.Response.WriteError("Cannot invoke an uninitialized action.");
                return;
            }

            try
            {
                string body = await new StreamReader(httpContext.Request.Body).ReadToEndAsync();

                JObject inputObject = string.IsNullOrEmpty(body) ? null : JObject.Parse(body);

                JObject valObject = null;

                if (inputObject != null)
                {
                    valObject = inputObject["value"] as JObject;
                    foreach (JToken token in inputObject.Children())
                    {
                        try
                        {
                            if (token.Path.Equals("value", StringComparison.InvariantCultureIgnoreCase))
                                continue;
                            string envKey = $"__OW_{token.Path.ToUpperInvariant()}";
                            string envVal = token.First.ToString();
                            Environment.SetEnvironmentVariable(envKey, envVal);
                            //Console.WriteLine($"Set environment variable \"{envKey}\" to \"{envVal}\".");
                        }
                        catch (Exception)
                        {
                            await Console.Error.WriteLineAsync(
                                $"Unable to set environment variable for the \"{token.Path}\" token.");
                        }
                    }
                }

                object owObject = _constructor.Invoke(new object[] { });

                try
                {
                    JObject output;

                    if(_awaitableMethod) {
                        output = (JObject) await (dynamic) _method.Invoke(owObject, new object[] {valObject});
                    }
                    else {
                        output = (JObject) _method.Invoke(owObject, new object[] {valObject});
                    }

                    if (output == null)
                    {
                        await httpContext.Response.WriteError("The action returned null");
                        Console.Error.WriteLine("The action returned null");
                        return;
                    }

                    await httpContext.Response.WriteResponse(200, output.ToString());
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex.StackTrace);
                    await httpContext.Response.WriteError(ex.Message
#if DEBUG
                                                          + ", " + ex.StackTrace
#endif
                    );
                }
            }
            finally
            {
                Startup.WriteLogMarkers();
            }
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesProxyCredentialsEncoding()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://user1:preplaced1%[email protected]:8888");
                Environment.SetEnvironmentVariable("https_proxy", "http://user2:preplaced2%[email protected]:9999");
                Environment.SetEnvironmentVariable("no_proxy", "github.com, google.com,");
                var proxy = new RunnerWebProxy();

                replacedert.Equal("http://user1:preplaced1%[email protected]:8888", proxy.HttpProxyAddress);
                replacedert.Equal("user1", proxy.HttpProxyUsername);
                replacedert.Equal("[email protected]", proxy.HttpProxyPreplacedword);

                var cred = proxy.Credentials.GetCredential(new Uri("http://user1:preplaced1%[email protected]:8888"), "Basic");
                replacedert.Equal("user1", cred.UserName);
                replacedert.Equal("[email protected]", cred.Preplacedword);

                replacedert.Equal("http://user2:preplaced2%[email protected]:9999", proxy.HttpsProxyAddress);
                replacedert.Equal("user2", proxy.HttpsProxyUsername);
                replacedert.Equal("[email protected]", proxy.HttpsProxyPreplacedword);

                cred = proxy.Credentials.GetCredential(new Uri("http://user2:preplaced2%[email protected]:9999"), "Basic");
                replacedert.Equal("user2", cred.UserName);
                replacedert.Equal("[email protected]", cred.Preplacedword);

                replacedert.Equal(2, proxy.NoProxyList.Count);
                replacedert.Equal("github.com", proxy.NoProxyList[0].Host);
                replacedert.Equal("google.com", proxy.NoProxyList[1].Host);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : LinkTests.cs
License : GNU Lesser General Public License v3.0
Project Creator : Apollo3zehn

[Theory]
        [InlineData("absolute", "", "")] // direct access
        [InlineData("relative", "single", "")] // use environment variable
        //[InlineData("relative", "multiple", "")] // this test will fail on Windows because of colon in path
        [InlineData("relative", "", "yes")] // use link access property list
        [InlineData("relative", "", "")] // file sits next to calling file
        [InlineData("relativecd", "", "")] // file sits next to current directory
        public void CanFollowExternalLink(string externalFilePath, string environment, string prefix)
        {
            // Arrange
            if (externalFilePath == "absolute")
            {
                externalFilePath = Path.GetTempFileName();
            }

            var filePath = TestUtils.PrepareTestFile(H5F.libver_t.LATEST, fileId => TestUtils.AddExternalFileLink(fileId, externalFilePath));

            if (externalFilePath == "relative")
                externalFilePath = Path.Combine(Path.GetTempPath(), externalFilePath);
            else if (externalFilePath == "relativecd")
                externalFilePath = Path.Combine(Environment.CurrentDirectory, externalFilePath);

            if (environment == "single")
            {
                environment = Path.GetDirectoryName(externalFilePath);
                Environment.SetEnvironmentVariable("HDF5_EXT_PREFIX", environment);
            }
            else if (environment == "multiple")
            {
                // Why did HDF Group choose a colon as prefix separator? This test must fail.
                environment = $"::C:\\temp:{Path.GetDirectoryName(externalFilePath)}";
                Environment.SetEnvironmentVariable("HDF5_EXT_PREFIX", environment);
            }

            if (prefix == "yes")
                prefix = Path.GetDirectoryName(externalFilePath);

            long res;

            var externalFileId = H5F.create(externalFilePath, H5F.ACC_TRUNC);
            var externalGroupId1 = H5G.create(externalFileId, "external");
            var externalGroupId2 = H5G.create(externalGroupId1, "group");

            var spaceId = H5S.create_simple(1, new ulong[] { 1 }, new ulong[] { 1 });
            var datasetId = H5D.create(externalGroupId2, "Hello from external file =)", H5T.NATIVE_UINT, spaceId);

            res = H5S.close(spaceId);
            res = H5D.close(datasetId);
            res = H5G.close(externalGroupId2);
            res = H5G.close(externalGroupId1);
            res = H5F.close(externalFileId);

            // Act
            using var root = H5File.OpenReadCore(filePath, deleteOnClose: true);

            var linkAccess = string.IsNullOrWhiteSpace(prefix) 
                ? new H5LinkAccess()
                : new H5LinkAccess() { ExternalLinkPrefix = prefix };

            var dataset = root.Dataset("/links/external_link/Hello from external file =)", linkAccess);
        }

19 View Source File : CommandSettingsL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", nameof(CommandSettings))]
        public void GetsNameArgFromEnvVar()
        {
            using (TestHostContext hc = CreateTestContext())
            {
                try
                {
                    // Arrange.
                    Environment.SetEnvironmentVariable("ACTIONS_RUNNER_INPUT_NAME", "some runner");
                    var command = new CommandSettings(hc, args: new string[0]);

                    // Act.
                    string actual = command.GetRunnerName();

                    // replacedert.
                    replacedert.Equal("some runner", actual);
                    replacedert.Equal(string.Empty, Environment.GetEnvironmentVariable("ACTIONS_RUNNER_INPUT_NAME") ?? string.Empty); // Should remove.
                    replacedert.Equal("some runner", hc.SecretMasker.MaskSecrets("some runner"));
                }
                finally
                {
                    Environment.SetEnvironmentVariable("ACTIONS_RUNNER_INPUT_NAME", null);
                }
            }
        }

19 View Source File : AqualityServicesTests.cs
License : Apache License 2.0
Project Creator : aquality-automation

[Ignore("Not all browsers are supported in Azure CICD pipeline")]
        [TestCase(BrowserName.IExplorer)]
        [TestCase(BrowserName.Firefox)]
        [TestCase(BrowserName.Chrome)]
        [TestCase(BrowserName.Edge)]
        public void Should_BeAbleToCreateLocalBrowser(BrowserName browserName)
        {
            Environment.SetEnvironmentVariable("browserName", browserName.ToString());
            Environment.SetEnvironmentVariable("isRemote", "false");
            replacedert.DoesNotThrow(() => AqualityServices.Browser.WaitForPageToLoad());
            replacedert.AreEqual(AqualityServices.Browser.BrowserName, browserName);
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesGetProxy()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://user1:preplaced1%[email protected]:8888");
                Environment.SetEnvironmentVariable("https_proxy", "http://user2:preplaced2%[email protected]:9999");
                Environment.SetEnvironmentVariable("no_proxy", "github.com, .google.com, example.com:444");
                var proxy = new RunnerWebProxy();

                replacedert.Null(proxy.GetProxy(new Uri("http://github.com")));
                replacedert.Null(proxy.GetProxy(new Uri("https://github.com/owner/repo")));
                replacedert.Null(proxy.GetProxy(new Uri("https://mails.google.com")));
                replacedert.Null(proxy.GetProxy(new Uri("http://example.com:444")));


                replacedert.Equal("http://user1:preplaced1%[email protected]:8888/", proxy.GetProxy(new Uri("http://something.com")).AbsoluteUri);
                replacedert.Equal("http://user1:preplaced1%[email protected]:8888/", proxy.GetProxy(new Uri("http://www.something2.com")).AbsoluteUri);

                replacedert.Equal("http://user2:preplaced2%[email protected]:9999/", proxy.GetProxy(new Uri("https://something.com")).AbsoluteUri);
                replacedert.Equal("http://user2:preplaced2%[email protected]:9999/", proxy.GetProxy(new Uri("https://www.something2.com")).AbsoluteUri);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : TemporaryEnvironmentVariable.cs
License : MIT License
Project Creator : arcus-azure

public void Dispose()
        {
            // To delete environment variable, 'value' must be set to 'null'.
            Environment.SetEnvironmentVariable(_name, value: null);
        }

19 View Source File : ProcessInvokerL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public async Task SetCIEnv()
        {
            using (TestHostContext hc = new TestHostContext(this))
            {
                var existingCI = Environment.GetEnvironmentVariable("CI");
                try
                {
                    // Clear out CI and make sure process invoker sets it.
                    Environment.SetEnvironmentVariable("CI", null);

                    Tracing trace = hc.GetTrace();

                    Int32 exitCode = -1;
                    var processInvoker = new ProcessInvokerWrapper();
                    processInvoker.Initialize(hc);
                    var stdout = new List<string>();
                    var stderr = new List<string>();
                    processInvoker.OutputDataReceived += (object sender, ProcessDataReceivedEventArgs e) =>
                    {
                        trace.Info(e.Data);
                        stdout.Add(e.Data);
                    };
                    processInvoker.ErrorDataReceived += (object sender, ProcessDataReceivedEventArgs e) =>
                    {
                        trace.Info(e.Data);
                        stderr.Add(e.Data);
                    };
#if OS_WINDOWS
                    exitCode = await processInvoker.ExecuteAsync("", "cmd.exe", "/c \"echo %CI%\"", null, CancellationToken.None);
#else
                    exitCode = await processInvoker.ExecuteAsync("", "bash", "-c \"echo $CI\"", null, CancellationToken.None);
#endif

                    trace.Info("Exit Code: {0}", exitCode);
                    replacedert.Equal(0, exitCode);

                    replacedert.Equal("true", stdout.First(x => !string.IsNullOrWhiteSpace(x)));
                }
                finally
                {
                    Environment.SetEnvironmentVariable("CI", existingCI);
                }
            }
        }

19 View Source File : AzureFunctionsProject.cs
License : MIT License
Project Creator : arcus-azure

protected override void Disposing(bool disposing)
        {
            Environment.SetEnvironmentVariable(ApplicationInsightsInstrumentationKeyVariable, null);
        }

19 View Source File : OutputManagerL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Worker")]
        public void MatcherTimeout()
        {
            Environment.SetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_ISSUE_MATCHER_TIMEOUT", "0:0:0.01");
            var matchers = new IssueMatchersConfig
            {
                Matchers =
                {
                    new IssueMatcherConfig
                    {
                        Owner = "email",
                        Patterns = new[]
                        {
                            new IssuePatternConfig
                            {
                                Pattern = @"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$",
                                Message = 0,
                            },
                        },
                    },
                    new IssueMatcherConfig
                    {
                        Owner = "err",
                        Patterns = new[]
                        {
                            new IssuePatternConfig
                            {
                                Pattern = @"ERR: (.+)",
                                Message = 1,
                            },
                        },
                    },
                },
            };
            using (Setup(matchers: matchers))
            using (_outputManager)
            {
                Process("[email protected]");
                Process("[email protected]t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.c%20");
                Process("[email protected]");
                Process("ERR: this error");
                replacedert.Equal(3, _issues.Count);
                replacedert.Equal("[email protected]", _issues[0].Item1.Message);
                replacedert.Contains("Removing issue matcher 'email'", _issues[1].Item1.Message);
                replacedert.Equal("this error", _issues[2].Item1.Message);
                replacedert.Equal(0, _commands.Count);
                replacedert.Equal(2, _messages.Where(x => x.StartsWith("##[debug]Timeout processing issue matcher")).Count());
                replacedert.Equal(1, _messages.Where(x => x.Equals("[email protected]t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.c%20")).Count());
                replacedert.Equal(1, _messages.Where(x => x.StartsWith("[email protected]")).Count());
            }
        }

19 View Source File : TestHost.cs
License : MIT License
Project Creator : ARKlab

[BeforeTestRun]
		public static void BeforeTests()
		{
			Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "SpecFlow");
			Program.InitStatic(new string[] {

			});

			var builder = Program.GetHostBuilder(new string[] { })
				.ConfigureWebHost(wh =>
				{
					wh.UseTestServer();
				});

			_server = builder.Start();
			_factory = new ClientFactory(_server.GetTestServer());



			//var builder = Program.GetWebHostBuilder(new string[] { })
			//.UseEnvironment("SpecFlow")
			//.UseStartup<Startup>()
			//.ConfigureServices(services =>
			//{

			//});
			//;

			//var server = new TestServer(builder)
			//{
			//	BaseAddress = new Uri(_baseUri)
			//};

			//_server = server;
			//_factory = new ClientFactory(_server);

			//var configuration = new ConfigurationBuilder()
			//	//.SetBasePath(Directory.GetCurrentDirectory())
			//	.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
			//	.AddJsonFile($"appsettings.SpecFlow.json", optional: true)
			//	.AddEnvironmentVariables()
			//	.Build();

			//SqlConnection = configuration.GetConnectionString("NavisionMW.Database");
		}

19 View Source File : ContextIsolatedTask.cs
License : Microsoft Public License
Project Creator : AArnott

public sealed override bool Execute()
        {
            try
            {
                // We have to hook our own AppDomain so that the TransparentProxy works properly.
                AppDomain.CurrentDomain.replacedemblyResolve += this.CurrentDomain_replacedemblyResolve;

                // On .NET Framework (on Windows), we find native binaries by adding them to our PATH.
                if (this.UnmanagedDllDirectory != null)
                {
                    string pathEnvVar = Environment.GetEnvironmentVariable("PATH");
                    string[] searchPaths = pathEnvVar.Split(Path.PathSeparator);
                    if (!searchPaths.Contains(this.UnmanagedDllDirectory, StringComparer.OrdinalIgnoreCase))
                    {
                        pathEnvVar += Path.PathSeparator + this.UnmanagedDllDirectory;
                        Environment.SetEnvironmentVariable("PATH", pathEnvVar);
                    }
                }

                // Run under our own AppDomain so we can apply the .config file of the MSBuild Task we're hosting.
                // This gives the owner the control over binding redirects to be applied.
                var appDomainSetup = new AppDomainSetup();
                string pathToTaskreplacedembly = this.GetType().replacedembly.Location;
                appDomainSetup.ApplicationBase = Path.GetDirectoryName(pathToTaskreplacedembly);
                appDomainSetup.ConfigurationFile = pathToTaskreplacedembly + ".config";
                var appDomain = AppDomain.CreateDomain("ContextIsolatedTask: " + this.GetType().Name, AppDomain.CurrentDomain.Evidence, appDomainSetup);
                string taskreplacedemblyFullName = this.GetType().replacedembly.GetName().FullName;
                string taskFullName = this.GetType().FullName;
                var isolatedTask = (ContextIsolatedTask)appDomain.CreateInstanceAndUnwrap(taskreplacedemblyFullName, taskFullName);

                return this.ExecuteInnerTask(isolatedTask, this.GetType());
            }
            catch (OperationCanceledException)
            {
                this.Log.LogMessage(MessageImportance.High, "Canceled.");
                return false;
            }
            finally
            {
                AppDomain.CurrentDomain.replacedemblyResolve -= this.CurrentDomain_replacedemblyResolve;
            }
        }

19 View Source File : TestHost.cs
License : MIT License
Project Creator : ARKlab

[BeforeTestRun]
		public static void BeforeTests()
		{
			Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "SpecFlow");
			Program.InitStatic(new string[] {

			});

			//_smtp = SimpleSmtpServer.Start();

			var builder = Program.GetHostBuilder(new string[] { })
				.ConfigureWebHost(wh =>
				{
					wh.UseTestServer();
				});

			_server = builder.Start();
			_factory = new ClientFactory(_server.GetTestServer());
		}

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesGetProxyEmptyHttpsProxy()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://user1:preplaced1%[email protected]:8888");
                var proxy = new RunnerWebProxy();

                replacedert.Null(proxy.GetProxy(new Uri("https://github.com/owner/repo")));
                replacedert.Null(proxy.GetProxy(new Uri("https://mails.google.com")));

                replacedert.Equal("http://user1:preplaced1%[email protected]:8888/", proxy.GetProxy(new Uri("http://something.com")).AbsoluteUri);
                replacedert.Equal("http://user1:preplaced1%[email protected]:8888/", proxy.GetProxy(new Uri("http://www.something2.com")).AbsoluteUri);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesPreferLowerCase()
        {
            try
            {
                Environment.SetEnvironmentVariable("http_proxy", "http://127.0.0.1:7777");
                Environment.SetEnvironmentVariable("HTTP_PROXY", "http://127.0.0.1:8888");
                Environment.SetEnvironmentVariable("https_proxy", "http://user:[email protected]:8888");
                Environment.SetEnvironmentVariable("HTTPS_PROXY", "http://user:[email protected]:9999");
                Environment.SetEnvironmentVariable("no_proxy", "github.com,  github.com  ");
                Environment.SetEnvironmentVariable("NO_PROXY", "github.com, google.com,");
                var proxy = new RunnerWebProxy();

                replacedert.Equal("http://127.0.0.1:7777", proxy.HttpProxyAddress);
                replacedert.Null(proxy.HttpProxyUsername);
                replacedert.Null(proxy.HttpProxyPreplacedword);

                replacedert.Equal("http://user:[email protected]:8888", proxy.HttpsProxyAddress);
                replacedert.Equal("user", proxy.HttpsProxyUsername);
                replacedert.Equal("preplaced", proxy.HttpsProxyPreplacedword);

                replacedert.Equal(1, proxy.NoProxyList.Count);
                replacedert.Equal("github.com", proxy.NoProxyList[0].Host);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : MainActivity.cs
License : Microsoft Public License
Project Creator : 0x0ade

protected override void OnStart()
		{
			base.OnStart();
			Instance = this;
			ActionBar.Hide();

			// Load stub Steamworks.NET
			Steamworks.SteamAPI.Init();

			GamePath = null;
			foreach (Java.IO.File root in GetExternalFilesDirs(null))
			{
				string path = Path.Combine(root.AbsolutePath, Game);
				if (!File.Exists(path))
					continue;
				GamePath = path;
				break;
			}

			if (!string.IsNullOrEmpty(GamePath))
			{
				System.Environment.CurrentDirectory = Path.GetDirectoryName(GamePath);
			}
			System.Environment.SetEnvironmentVariable("FNADROID", "1");

			// Load our copy of FNA before the game gets a chance to run its copy.
			RuntimeHelpers.RunClreplacedConstructor(typeof(Game).TypeHandle);
		}

19 View Source File : Program.cs
License : MIT License
Project Creator : actions

private static void LoadAndSetEnv()
        {
            var binDir = Path.GetDirectoryName(replacedembly.GetEntryreplacedembly().Location);
            var rootDir = new DirectoryInfo(binDir).Parent.FullName;
            string envFile = Path.Combine(rootDir, ".env");
            if (File.Exists(envFile))
            {
                var envContents = File.ReadAllLines(envFile);
                foreach (var env in envContents)
                {
                    if (!string.IsNullOrEmpty(env))
                    {
                        var separatorIndex = env.IndexOf('=');
                        if (separatorIndex > 0)
                        {
                            string envKey = env.Substring(0, separatorIndex);
                            string envValue = null;
                            if (env.Length > separatorIndex + 1)
                            {
                                envValue = env.Substring(separatorIndex + 1);
                            }

                            Environment.SetEnvironmentVariable(envKey, envValue);
                        }
                    }
                }
            }
        }

19 View Source File : IOUtilL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void ValidateExecutePermission_ExceedsFailsafe()
        {
            using (TestHostContext hc = new TestHostContext(this))
            {
                Tracing trace = hc.GetTrace();

                // Arrange: Create a deep directory.
                string directory = Path.Combine(hc.GetDirectory(WellKnownDirectory.Bin), Path.GetRandomFileName(), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
                try
                {
                    Directory.CreateDirectory(directory);
                    Environment.SetEnvironmentVariable("AGENT_TEST_VALIDATE_EXECUTE_PERMISSIONS_FAILSAFE", "20");

                    try
                    {
                        // Act: Call "ValidateExecutePermission". The method should throw since
                        // it exceeds the failsafe recursion depth.
                        IOUtil.ValidateExecutePermission(directory);

                        // replacedert.
                        throw new Exception("Should have thrown not supported exception.");
                    }
                    catch (NotSupportedException)
                    {
                    }
                }
                finally
                {
                    // Cleanup.
                    if (Directory.Exists(directory))
                    {
                        Directory.Delete(directory, recursive: true);
                    }
                }
            }
        }

19 View Source File : RunnerWebProxyL0.cs
License : MIT License
Project Creator : actions

[Fact]
        [Trait("Level", "L0")]
        [Trait("Category", "Common")]
        public void WebProxyFromEnvironmentVariablesGetProxyEmptyHttpProxy()
        {
            try
            {
                Environment.SetEnvironmentVariable("https_proxy", "http://user2:preplaced2%[email protected]:9999");
                var proxy = new RunnerWebProxy();

                replacedert.Null(proxy.GetProxy(new Uri("http://github.com")));
                replacedert.Null(proxy.GetProxy(new Uri("http://example.com:444")));

                replacedert.Equal("http://user2:preplaced2%[email protected]:9999/", proxy.GetProxy(new Uri("https://something.com")).AbsoluteUri);
                replacedert.Equal("http://user2:preplaced2%[email protected]:9999/", proxy.GetProxy(new Uri("https://www.something2.com")).AbsoluteUri);
            }
            finally
            {
                CleanProxyEnv();
            }
        }

19 View Source File : Program.cs
License : GNU Lesser General Public License v3.0
Project Creator : Alois-xx

private bool Parse()
        {
            Queue<string> args = new Queue<string>(Args);
            if( args.Count == 0)
            {
                Help("Error: You need to specify a dump file or live process to replacedyze.");
                return false;
            }

            bool lret = true;
            try
            {
                while (args.Count > 0)
                {
                    string param = args.Dequeue();
                    switch (param.ToLower())
                    {
                        case "-f":
                            SetDefaultActionIfNotSet();
                            TargetInformation.DumpFileName1 = NotAnArg(args.Dequeue());
                            break;
                        case "-f2":
                            TargetInformation.DumpFileName2 = NotAnArg(args.Dequeue());
                            break;
                        case "-pid":
                            SetDefaultActionIfNotSet();
                            TargetInformation.Pid1 = int.Parse(NotAnArg(args.Dequeue()));
                            break;
                        case "-child":
                            IsChild = true;
                            break;
                        case "-pid2":
                            TargetInformation.Pid2 = int.Parse(NotAnArg(args.Dequeue()));
                            break;
                        case "-silent":
                            IsSilent = true;
                            break;
                        case "-unit":
                            string next = args.Dequeue();
                            if ( Enum.TryParse(NotAnArg(next), true, out DisplayUnit tmpUnit) )
                            {
                                DisplayUnit = tmpUnit;
                            }
                            else
                            {
                                Console.WriteLine($"Warning: DisplayUnit {next} is not a valid value. Using default: {DisplayUnit}");
                            }
                            break;
                        case "-vmmap":
                            GetVMMapData = true;
                            break;
                        case "-procdump":
                            Action = Actions.ProcDump;
                            // give remaining args to procdump and to not try to parse them by ourself
                            ProcDumpArgs = args.ToArray();
                            args.Clear();
                            break;
                        case "-verifydump":
                            VerifyDump = true;
                            break;
                        case "-renameproc":
                            ProcessRenameFile = NotAnArg(args.Dequeue());
                            break;
                        case "-debug":
                            IsDebug = true;
                            break;
                        case "-noexcelsep":
                            DisableExcelCSVSep = true;
                            break;
                        case "-sep":
                            string sep = NotAnArg(args.Dequeue());
                            sep = sep.Trim(new char[] { '"', '\'' });
                            sep = sep == "\\t" ? "\t" : sep;
                            if( sep.Length != 1)
                            {
                                Console.WriteLine($"Warning CSV separator character \"{sep}\" was not recognized. Using default \t");
                            }
                            else
                            {
                                OutputStringWriter.SeparatorChar = sep[0];
                            }
                            break;
                        case "-dts":
                            Action = Actions.DumpTypesBySize;
                            if ( args.Count > 0 && NotAnArg(args.Peek(),false) != null)
                            {
                                ParseTopNQuery(args.Dequeue(), out int n, out int MinCount);
                                TopN = n > 0 ? n : TopN;
                            }
                            break;
                        case "-dtn":
                            Action = Actions.DumpTypesByCount;
                            if (args.Count > 0 && NotAnArg(args.Peek(),false) != null)
                            {
                                ParseTopNQuery(args.Dequeue(), out int n, out MinCount);
                                TopN =  n > 0 ? n : TopN;
                            }
                            break;
                        case "-live":
                            LiveOnly = true;
                            break;
                        case "-dacdir":
                            DacDir = NotAnArg(args.Dequeue());
                            // quoted mscordacwks file paths are not correctly treated so far. 
                            Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", DacDir.Trim(new char[] { '"' }));
                            break;
                        case "-process":
                            ProcessNameFilter = NotAnArg(args.Dequeue());
                            break;
                        case "-dstrings":
                            Action = Actions.DumpStrings;
                            if (args.Count > 0 && NotAnArg(args.Peek(), false) != null)
                            {
                                TopN = int.Parse(args.Dequeue());
                            }
                            break;
                        case "-showaddress":
                            ShowAddress = true;
                            break;
                        case "-o":
                            OutFile = NotAnArg(args.Dequeue());
                            TopN = 20 * 1000; // if output is dumped to file pipe all types to output
                                              // if later -dts/-dstrings/-dtn is specified one can still override this behavior.
                            break;
                        case "-overwrite":
                            OverWriteOutFile = true;
                            break;
                        case "-timefmt":
                            TimeFormat = NotAnArg(args.Dequeue());
                            break;
                        case "-time":
                            TargetInformation.ExternalTime = NotAnArg(args.Dequeue());
                            break;
                        case "-context":
                            Context = NotAnArg(args.Dequeue());
                            break;
                        default:
                            throw new ArgNotExpectedException(param);
                    }
                    
                }
            }
            catch(ArgNotExpectedException ex)
            {
                Help("Unexpected command line argument: {0}", ex.Message);
                lret = false;
            }

            return lret;
        }

See More Examples