GHWizard.UserInputForm.GetLocation C# (CSharp) Method

GetLocation() private static method

private static GetLocation ( string userName, string fileName, string startAt, string &location ) : bool
userName string
fileName string
startAt string
location string
return bool
        private static bool GetLocation(string userName, string fileName, string startAt, out string location)
        {
            using (var ofd = new OpenFileDialog())
              {
            ofd.Title = string.Format("Find {0}", userName);
            if (Directory.Exists(startAt))
              ofd.InitialDirectory = startAt;
            else if(File.Exists(startAt))
              ofd.InitialDirectory = Path.GetDirectoryName(startAt);
            ofd.Filter = string.Format("{0} ({1})|{1}",
              userName, fileName);
            if (ofd.ShowDialog() == DialogResult.OK)
            {
              location = ofd.FileName;
              return true;
            }
              }
              location = string.Empty;
              return false;
        }