SobaScript.Z.VS/BuildEnv/ProjectsMap.cs
/// <summary>
/// Detect projects from solution file.
/// </summary>
/// <param name="sln">Full path to solution</param>
/// <param name="flush">Resets prev. data if true.</param>
Detect projects from solution file.
Detect projects from solution file .
public void Detect(string sln, bool flush = false)
        {
            if(flush) {
                projects.Clear();
                order.Clear();
            }
            var map = new Dictionary<string, List<string>>();
            using(StreamReader reader = new StreamReader(sln, Encoding.Default))
            {
                string line;
                while((line = reader.ReadLine()) != null)
                {
                    Extract(reader, line.Trim(), ref map);
                }
            }
            bool _h(string id)
            {
                map[id].ForEach(dep => _h(dep));
                if(!order.Contains(id)) {
                    order.Add(id);
                }
                return true;
            }
            foreach(KeyValuePair<string, List<string>> project in map)
            {
                _h(project.Key);
                if(!order.Contains(project.Key)) {
                    order.Add(project.Key);
                }
            }
        }
public void Detect ( string sln , bool flush = false ) { if ( flush ) { projects . Clear ( ) ; order . Clear ( ) ; } var map = new Dictionary < string , List < string > > ( ) ; using ( StreamReader reader = new StreamReader ( sln , Encoding . Default ) ) { string line ; while ( ( line = reader . ReadLine ( ) ) != null ) { Extract ( reader , line . Trim ( ) , ref map ) ; } } bool _h ( string id ) { map [ id ] . ForEach ( dep => _h ( dep ) ) ; if ( ! order . Contains ( id ) ) { order . Add ( id ) ; } return true ; } foreach ( KeyValuePair < string , List < string > > project in map ) { _h ( project . Key ) ; if ( ! order . Contains ( project . Key ) ) { order . Add ( project . Key ) ; } } }
Detect projects from solution file.
Detect projects from solution file .
// Build order
sln
string
Full path to solution
Full path to solution
flush
bool
Resets prev. data if true.
Resets prev . data if true .