Beispiel #1
0
        /// <summary>
        /// This override of ToString returns only the relevant
        /// Filter strings
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static String ToString(params SpectrumType[] types)
        {
            //Declare a string to return
            String rtn = String.Empty;

            //Iterate through the parameter list and
            //add up the Filters
            foreach (SpectrumType type in types)
            {
                //Get the Filters
                List <String> refExt    = new List <String>();
                List <String> refFilter = new List <String>();
                SpectrumExtension.TranslateType(type, ref refExt, ref refFilter);

                //Add the Filters if anything matched
                foreach (String currFilter in refFilter)
                {
                    //If there are any filters applied yet, add the separator
                    if (rtn != String.Empty)
                    {
                        rtn += "|";
                    }

                    //Add the current Filter
                    rtn += currFilter;
                }
            }

            //Return the result
            return(rtn);
        }
Beispiel #2
0
        /// <summary>
        /// ToExtension changes the SpectrumType into a file extension.
        /// </summary>
        /// <param name="type">The SpectrumType of the file</param>
        /// <returns>String Extension of the desired file</returns>
        public static String ToExtension(SpectrumType type)
        {
            //Declare a variable to return
            String rtn = String.Empty;

            //Get the Filter
            List <String> refExt    = new List <String>();
            List <String> refFilter = new List <String>();

            SpectrumExtension.TranslateType(type, ref refExt, ref refFilter);

            //Return the result if anything matched
            if (refExt.Count > 0)
            {
                rtn = refExt[0];
            }

            //Return the result
            return(rtn);
        }
Beispiel #3
0
 /// <summary>
 /// The default ToString returns the complete list of File Types
 /// and Extensions.
 /// </summary>
 /// <returns>FileDialog Filter String</returns>
 public static new String ToString()
 {
     //Format a string with all of the Extensions
     return(SpectrumExtension.ToString(SpectrumType.CSV3D, SpectrumType.TAB3D));
 }
Beispiel #4
0
 /// <summary>
 /// ToType translates from a File Extension to a SpectrumType.
 /// </summary>
 /// <param name="fileExt">The Extension to translate</param>
 /// <returns>The SpectrumType of the Extension</returns>
 public static SpectrumType ToType(String fileExt)
 {
     return(SpectrumExtension.TranslateExtFilter(fileExt, String.Empty));
 }