Tuesday, February 17, 2009

Getting 'The Settlers 6: Rise of an Empire' to work on Windows 7 (Tages problem)

  1. Install Settlers 6 from the game DVD
  2. Install the Patch The Settlers: Rise of an Empire v1.6 link
  3. Settlers will not run due to the Tages driver being incompatible.
  4. Download and install this Tages driver from here (choose 32 or 64 bit) link
  5. Make sure the game DVD is NOT in the drive
  6. Start Settlers 6, it will ask if you want to activate.
  7. Activate the game with your key from your manual.
  8. Setters 6 should now work fine! (You might not even need the DVD in the drive to play)

Wednesday, February 11, 2009

.NET How to merge FileInfo arrays with Linq

using System;

using System.IO;

using System.Linq;

 

[assembly: CLSCompliant(true)]

namespace SuperFastSearch

{

    internal class FileSearch : IFileSearch

    {

        #region IFileSearch Members

 

        public string _Path { get; set; }

        public string _SearchPattern { get; set; }

        public bool _Recursive { get; set; }

 

        public FileInfo[] Search()

        {

            //List lSearchResults = new List();

            FileInfo[] fiResults = null;

            DirectoryInfo[] diResults = null;

 

            SearchOption so = new SearchOption();

 

            if (_Recursive)

            {

                so = SearchOption.AllDirectories;

            }

            else

            {

                so = SearchOption.TopDirectoryOnly;

            }

 

            //check that the class variables have been set up

            if (string.IsNullOrEmpty(_Path) || string.IsNullOrEmpty(_SearchPattern))

            {

                //do not perform the search as the nessescary params have not been supplied

            }

            else

            {

                //perform the search

                DirectoryInfo di = new DirectoryInfo(_Path);

 

                //check if we are searching the 'root' directory

                if (_Path.Length == 3)

                {

                    //_Path is like "C:\" or 'root'

                    //build a list of the root directories to use later when collating file info

                    diResults = di.GetDirectories(_SearchPattern, SearchOption.TopDirectoryOnly);

                   

                    //create a temp array for use in the loop below

                    FileInfo[] tempFi = null;

                   

                    foreach (DirectoryInfo dirInfo in diResults)

                    {

                        //ignore the system volume information directory as we

                        //will get an UnauthorizsedAccessException if we try

                        if (dirInfo.Name != ("System Volume Information"))

                        {

                            tempFi = dirInfo.GetFiles(_SearchPattern, so);

 

                            //check if we have some files before adding them to the array

                            if (tempFi.Length > 0)

                            {

                                if (fiResults != null)

                                {

                                    fiResults = fiResults.Concat(tempFi).ToArray();

                                }

                                else

                                {

                                    fiResults = tempFi;

                                }

                            }

                        }

                    }

 

                }

                else

                {

                    fiResults = di.GetFiles(_SearchPattern, so);

                }

            }

 

            return fiResults;

        }

 

        #endregion

    }

}