Exemple #1
0
 public EnvVarEnumerator(EnvVarList list)
 {
     _list  = list;
     _index = -1;
 }
Exemple #2
0
 public void Dispose()
 {
     _list = null;
 }
Exemple #3
0
        public EnvVarList CreateMergedVarList(ProbeAppSettings app)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }

            // Create the base list of environment vars
            var mergedVars = new EnvVarList();

            mergedVars.LoadFromEnvironment();

            mergedVars["pcurrentapp"] = app.AppName;

            var appEnv = app as PROBEENVSRVRLib.IProbeEnvPlatform;

            if (appEnv != null)
            {
                _platformFolder = appEnv.Folder;
                mergedVars["WbdkFrameworkVersion"] = appEnv.Version;
            }
            else
            {
                _platformFolder = null;
            }


            // Add Exe paths
            var path = new List <string>();
            var excludeExeSubDirs = new string[] { "ccdll", "ctdef", "ctdll", "ncdll", "rtdll", "scdll", "st", "stdef", "stdll", "stn" };

            foreach (var exePath in app.ExeDirs)
            {
                if (!Directory.Exists(exePath))
                {
                    continue;
                }

                var helpPath = Path.Combine(exePath, "help");
                if (Directory.Exists(helpPath))
                {
                    path.Add(helpPath);
                }

                path.Add(exePath);

                AddSubDirs(path, exePath, excludeExeSubDirs);
            }

            // Add development studio exe paths
            AddDevelopmentExePaths(path);

            // Append the current environment variable data
            path.AddRange(mergedVars.GetDirectoryList("path"));
            RemoveDuplicatePaths(path);
            mergedVars.SetDirectoryList("path", path, 2048);


            // Include paths
            var includes = new List <string>();

            foreach (var includePath in app.IncludeDirs)
            {
                if (!Directory.Exists(includePath))
                {
                    continue;
                }

                includes.Add(includePath);
            }

            AddDevelopmentIncludePaths(includes);
            includes.AddRange(mergedVars.GetDirectoryList("include"));
            RemoveDuplicatePaths(includes);
            mergedVars.SetDirectoryList("include", includes);


            // Lib paths
            var libs = new List <string>();

            foreach (var libPath in app.LibDirs)
            {
                if (!Directory.Exists(libPath))
                {
                    continue;
                }

                libs.Add(libPath);
            }

            AddDevelopmentLibPaths(libs);
            libs.AddRange(mergedVars.GetDirectoryList("lib"));
            RemoveDuplicatePaths(libs);
            mergedVars.SetDirectoryList("lib", libs);


            mergedVars.Sort();
            return(mergedVars);
        }