public FixedMapImpl(MapImpl source) { _map = new MapImpl(); foreach (KeyAndValueImpl KV in source) { _map.Insert(KV.Key, KV.Value); } }
public IRuntimeContextInstance EnvironmentVariables() { var varsMap = new MapImpl(); var allVars = System.Environment.GetEnvironmentVariables(); foreach (DictionaryEntry item in allVars) { varsMap.Insert( ValueFactory.Create((string)item.Key), ValueFactory.Create((string)item.Value)); } return(varsMap); }
public MapImpl EnvironmentVariables() { SystemLogger.Write("WARNING! Deprecated method: 'SystemInfo.EnvironmentVariables' is deprecated, use 'EnvironmentVariables' from global context"); var varsMap = new MapImpl(); var allVars = System.Environment.GetEnvironmentVariables(); foreach (DictionaryEntry item in allVars) { varsMap.Insert( ValueFactory.Create((string)item.Key), ValueFactory.Create((string)item.Value)); } return(varsMap); }
public MapImpl EnvironmentVariables(EnvironmentVariableTargetEnum target = EnvironmentVariableTargetEnum.Process) { EnvironmentVariableTarget targetParam = GetSystemEnvVariableTarget(target); var varsMap = new MapImpl(); var allVars = System.Environment.GetEnvironmentVariables(targetParam); foreach (DictionaryEntry item in allVars) { varsMap.Insert( ValueFactory.Create((string)item.Key), ValueFactory.Create((string)item.Value)); } return(varsMap); }
public ProcessContext CreateProcess(string cmdLine, string currentDir = null, bool redirectOutput = false, bool redirectInput = false, IValue encoding = null, MapImpl env = null) { return(ProcessContext.Create(cmdLine, currentDir, redirectOutput, redirectInput, encoding, env)); }
public static IRuntimeContextInstance Constructor(IValue source) { MapImpl RawSource = source.GetRawValue() as MapImpl; return(new FixedMapImpl(RawSource)); }
public static ProcessContext Create(string cmdLine, string currentDir = null, bool redirectOutput = false, bool redirectInput = false, IValue encoding = null, MapImpl env = null) { var sInfo = PrepareProcessStartupInfo(cmdLine, currentDir); sInfo.UseShellExecute = false; if (redirectInput) { sInfo.RedirectStandardInput = true; } if (redirectOutput) { sInfo.RedirectStandardOutput = true; sInfo.RedirectStandardError = true; } if (encoding != null) { var enc = TextEncodingEnum.GetEncoding(encoding); sInfo.StandardOutputEncoding = enc; sInfo.StandardErrorEncoding = enc; } if (env != null) { var source = env.Select(x => new { Key = x.Key.AsString(), Value = x.Value.AsString() }).Where(x => !string.IsNullOrWhiteSpace(x.Key)); foreach (var kv in source) { sInfo.EnvironmentVariables[kv.Key] = kv.Value; } } var p = new System.Diagnostics.Process(); p.StartInfo = sInfo; return(new ProcessContext(p, encoding)); }
public static ProcessContext Create(string cmdLine, string currentDir = null, bool redirectOutput = false, bool redirectInput = false, IValue encoding = null, MapImpl env = null) { var sInfo = PrepareProcessStartupInfo(cmdLine, currentDir); sInfo.UseShellExecute = false; if (redirectInput) { sInfo.RedirectStandardInput = true; } if (redirectOutput) { sInfo.RedirectStandardOutput = true; sInfo.RedirectStandardError = true; } if (encoding != null) { var enc = TextEncodingEnum.GetEncoding(encoding); sInfo.StandardOutputEncoding = enc; sInfo.StandardErrorEncoding = enc; } if (env != null) { foreach (var kv in env) { sInfo.EnvironmentVariables.Remove(kv.Key.AsString()); sInfo.EnvironmentVariables[kv.Key.AsString()] = kv.Value.AsString(); } } var p = new System.Diagnostics.Process(); p.StartInfo = sInfo; return(new ProcessContext(p, encoding)); }