BlueGo / BlueGo / Boost.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace BlueGo
{
    enum eBoostVersion
    {
        Boost1_51_0,
        Boost1_52_0
    }

    class BoostInfo
    {
        BoostInfo(string filename, string downloadURL, eBoostVersion version)
        {
            this.zipFilename = filename;
            this.downloadURL = downloadURL;
            this.version = version;
        }

        public string DownloadURL
        {
            get { return downloadURL; }
            set { downloadURL = value; }
        }

        public string ZIPFilename
        {
            get { return zipFilename; }
            set { zipFilename = value; }
        }
        
        public string ExtractFolderName
        {
            get
            {
                return zipFilename.Substring(0, zipFilename.Length - 4);
            }
        }

        public BlueGo.eBoostVersion Version
        {
            get { return version; }
            set { version = value; }
        }

        string          zipFilename;
        string          downloadURL;
        eBoostVersion   version;
           
        public static BoostInfo GetBoostInfo(eBoostVersion version)
        {
            foreach (BoostInfo bi in CreateBoostInfoList())
            {
                if (bi.version == version)
                {
                    return new BoostInfo(bi.ZIPFilename, bi.downloadURL, bi.version); // hand back a copy
                }
            }

            throw new Exception("Unknown boost version");
        }

        public static List<BoostInfo> CreateBoostInfoList()
        {
            List<BoostInfo> list = new List<BoostInfo>();

            list.Add(new BoostInfo(
                "boost_1_51_0.zip",
                @"http://freefr.dl.sourceforge.net/project/boost/boost/1.51.0/boost_1_51_0.zip",
                eBoostVersion.Boost1_51_0
            ));

            list.Add(new BoostInfo(
                "boost_1_52_0.zip",
                @"http://garr.dl.sourceforge.net/project/boost/boost/1.52.0/boost_1_52_0.zip",
                eBoostVersion.Boost1_52_0
            ));

            return list;
        }
  
        public static string BoostVersionToString(eBoostVersion version)
        {
            switch (version)
            {
                case eBoostVersion.Boost1_51_0:
                    return "1.51.0";
                case eBoostVersion.Boost1_52_0:
                    return "1.52.0";
            }

            throw new Exception("Unknown boost version");
        }
        
        public static string GetBoostDownloadURL(eBoostVersion version)
        {
            foreach (BoostInfo bi in CreateBoostInfoList())
            {
                if(bi.version == version)
                {
                    return bi.DownloadURL;
                }
            }

            throw new Exception("Unknown boost version");
        }

        public static string GetBoostZipFileName(eBoostVersion version)
        {
            foreach (BoostInfo bi in CreateBoostInfoList())
            {
                if (bi.version == version)
                {
                    return bi.ZIPFilename;
                }
            }

            throw new Exception("Unknown boost version");
        }
    }    

    class Boost
    {

    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.