FileAssociation/ProgramIcon.cs
/// <summary>
/// Parses string to create and instance of ProgramIcon.
/// </summary>
/// <param name="regString">String specifying file path. Icon can be included as well.</param>
/// <returns>ProgramIcon based on input string.</returns>
Parses string to create and instance of ProgramIcon.
Parses string to create and instance of ProgramIcon .
public static ProgramIcon Parse(string regString)
      {
         if (regString == string.Empty)
            return new ProgramIcon("");
         if (regString.StartsWith("\"") && regString.EndsWith("\""))
         {
            if (regString.Length > 3)
               regString = regString.Substring(1, regString.Length - 2);
         }
         string path;
         int index = 0;
         int commaPos = regString.IndexOf(",");
         if (commaPos == -1)
         {
            commaPos = regString.Length;
         }
         else
         {
            index = int.Parse(regString.Substring(commaPos + 1));
         }
         path = regString.Substring(0, commaPos);
         return new ProgramIcon(path, index);
      }
public static ProgramIcon Parse ( string regString ) { if ( regString == string . Empty ) return new ProgramIcon ( " " ) ; if ( regString . StartsWith ( " \" " ) && regString . EndsWith ( " \" " ) ) { if ( regString . Length > 3 ) regString = regString . Substring ( 1 , regString . Length - 2 ) ; } string path ; int index = 0 ; int commaPos = regString . IndexOf ( " " ) ; if ( commaPos == - 1 ) { commaPos = regString . Length ; } else { index = int . Parse ( regString . Substring ( commaPos + 1 ) ) ; } path = regString . Substring ( 0 , commaPos ) ; return new ProgramIcon ( path , index ) ; }
Parses string to create and instance of ProgramIcon.
Parses string to create and instance of ProgramIcon .
ProgramIcon based on input string.
ProgramIcon based on input string .
regString
string
String specifying file path. Icon can be included as well.
String specifying file path . Icon can be included as well .