Source code for MSQuant: MSQuantConstants.cs, MSQlib1/src/MSQuantSpecific/MSQuantConstants.cs.

Table of contents page.

Home page for MSQuant.

/****************************************************************************
 * Copyright (C) 2008 Peter Mortensen and Matthias Mann                     *
 * This file is part of MSQuant.                                            *
 *                                                                          *
 * MSQuant is distributed under the terms of                                *
 * the GNU General Public License. See src/COPYING.TXT or                   *
 * <http://www.gnu.org/licenses/gpl.txt> for details.                       *
 *                                                                          *
 * MSQuant is free software; you can redistribute it                        *
 * and/or modify it under the terms of the GNU                              *
 * General Public License as published by the Free                          *
 * Software Foundation; either version 2 of the                             *
 * License, or (at your option) any later version.                          *
 *                                                                          *
 * MSQuant is distributed in the hope that it will be                       *
 * useful, but WITHOUT ANY WARRANTY; without even the                       *
 * implied warranty of MERCHANTABILITY or FITNESS FOR                       *
 * A PARTICULAR PURPOSE.  See the GNU General Public                        *
 * License for more details.                                                *
 *                                                                          *
 * You should have received a copy of the GNU General                       *
 * Public License along with MSQuant; if not, write to                      *
 * the Free Software Foundation, Inc., 59 Temple                            *
 * Place, Suite 330, Boston, MA  02111-1307  USA                            *
 *                                                                          *
 * Purpose: Holds (static) class AppConstants. See below                    *
 *                                                                          *
 ****************************************************************************/

/****************************************************************************
 *                               CEBI                                       *
 *                    Software Development Group                            *
 *                         Peter Mortensen                                  *
 *                E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk          *
 *                 WWW: http://www.cebi.sdu.dk/                             *
 *                                                                          *
 *  Program for post-processing of result from search in mass               *
 *    spectrometric data.                                                   *
 *                                                                          *
 *    FILENAME:   MSQuantConstants.cs                                       *
 *    TYPE:       CSHARP                                                    *
 *                                                                          *
 * CREATED: PM 2008-11-17   Vrs 1.0. Translated from class of the same      *
 *                          name, somewhere else.                           *
 * UPDATED: PM 2008-xx-xx                                                   *
 *                                                                          *
 *                                                                          *
 ****************************************************************************/

//Future:
// 1.
//
// 2.

using System.Diagnostics; //For Trace. And its Assert.


//Changed PM_REFACTOR 2008-11-17. Translated to C# and moved to this file.
//Changed PM_REFACTOR 2004-11-23
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public class AppConstants
{
    //Changed PM_REFACTOR 2008-12-12
    public const string SHORT_APP = "MSQ";
    public const string LONG_APP  = "MSQuant";
    public const string APP_HOMEPAGE = "http://msquant.sourceforge.net/";


    //Changed PM_MODMATCH_BEGINNING_BUG 2008-12-01
    ////Changed PM_REFACTOR 2008-12-01. Was in two places.
    //public const string MODMATCH_PREFIX = @"\s*(\d*)\s*";
    //public const string MODMATCH_PREFIX = @"\s*(\d*)\D*?.*?"; //Match
    //  forward until the specified match string (from the XML file)
    //  takes over.
    //public const string MODMATCH_PREFIX = @"\s*(\d*)\s*.*?";
    //public const string MODMATCH_PREFIX = @"\s*(\d*).*?";
    //public const string MODMATCH_PREFIX = @"\s*(\d*)\s*";
    public const string MODMATCH_PREFIX = @"\s*(\d*)\s*\w*";

    public const string OLD_QUANTMODES_FILENAME =
      SHORT_APP + "_quantitationModes.xml";

    public const string NEW_QUANTMODES_FILENAME = 
        "new_" + OLD_QUANTMODES_FILENAME;

    //Changed PM_WEAKLY_TYPED_SPECTRUMCLASSIFICATION 2006-02-15
    public const string OLD_SPECCLASSIFICATION_FILENAME = 
        "spectrumClassification.xml";
    public const string NEW_SPECCLASSIFICATION_FILENAME = 
        "new_" + OLD_SPECCLASSIFICATION_FILENAME;

    //Changed PM_REFACTOR 2006-06-21
    public const string OLD_MISCOPTIONS_FILENAME = 
        "MiscOptions.xml";
    public const string NEW_MISCOPTIONS_FILENAME2 = 
        "new_" + OLD_MISCOPTIONS_FILENAME;


    //Changed PM_LCPEAKDETECTION_OPTIONS 2006-06-21
    public const string OLD_CORRSETTINGS_FILENAME = 
        "MascotParserCorrelationSettings.xml";
    public const string NEW_CORRSETTINGS_FILENAME =
        "new_" + SHORT_APP + "_correlationSettings.xml";

    //Changed PM_COMVERSIONS 2007-07-24
    public const string OLD_PARSER_SETTINGS_FILENAME = 
        "MascotParserOptions.xml";

    public const string NEW_PARSER_SETTINGS_FILENAME =
        "new_" + SHORT_APP + "_options.xml";


    //Changed PM_REFACTOR 2008-08-21
    public const string HELPER_APPLICATIONS_TOPFOLDER = 
        "helper applications";

    //Changed PM_HIGHER_LEVEL_PROCESSING 2008-09-02
    public const string EXPERIMENT_SETTINGS_FILENAME = 
        "experimentSettings.xml";


    //Older file formats:
    // bi9
    // bs7
    // bs8
    // bs9
    // mb1
    // mb3: as from 2006-12-30
    // mb4: as from 2008-11-12


    //Use enum for these for better type safety?
    //
    //Changed PM_MB4_VERSIONING 2008-11-12
    public const int SAVEDFILEVERSION_MB3 = 300;
    //Public Const SAVEDFILE_FILEEXTENSION_MB3 As String = "mb3"

    //Temp... Remove at any time and replace uses with "SAVEDFILEVERSION_MB4".
    public const int SAVEDFILEVERSION_MB4TEMP2 = 400;
    //Public Const SAVEDFILE_FILEEXTENSION_MB4 As String = "mb4"

    public const int SAVEDFILEVERSION_MB4 = 405;
    //Public Const SAVEDFILE_FILEEXTENSION_MB4 As String = "mb4"

    //Changed PM_SAVE_ALLRECALIB_MB4 2008-11-21
    //public const int CURRENT_SAVEDFILEVERSION = SAVEDFILEVERSION_MB4TEMP;
    public const int CURRENT_SAVEDFILEVERSION = SAVEDFILEVERSION_MB4;

    //Public Const CURRENT_SAVEDFILE_FILEEXTENSION As String = _
    // SAVEDFILE_FILEEXTENSION_MB4
    //
    //Public Const DIALOGXYZ As String = _
    // CURRENT_SAVEDFILE_FILEEXTENSION

    //Note: instead of const. By could we use shared variables??? (and 
    // end up only call this function once instead of everytime
    // the MB string stuff is needed).
    //
    // See <http://stackoverflow.com/questions/185384/order-of-static-constructorsinitializers-in-c>
    //
    //
    //Right place?? 
    public struct savedMBfilesInfoStruct
    {
        public string fileExtension;
        //E.g. "mb4"
        public string fileExtensionWithDot;
        //E.g. ".mb4"

        public string dialogFilter;
        //E.g. "(*.mb4)|*.mb4"

        public string fullDialogFilterSingular;
        //E.g. "Binary file (*.mb4)|*.mb4"
        public string fullDialogFilterPlural;
        //E.g. "Binary files (*.mb4)|*.mb4"
    } //savedMBfilesInfoStruct


    //Right place?? 
    public static savedMBfilesInfoStruct currentConstantsForSavingMB()
    {
        return constantsForSavingMB(CURRENT_SAVEDFILEVERSION);
    } //currentSavedMBfilesInfo()


    //Right place?? Or how about a small helper class to handle
    //bookkeeping related to MBx files, e.g. associated strings?
    public static savedMBfilesInfoStruct constantsForSavingMB(
      int aMBfileVersion)
    {
        savedMBfilesInfoStruct toReturn = default(savedMBfilesInfoStruct);

        toReturn.fileExtension = null; //Keep compiler happy.
        toReturn.fileExtensionWithDot = null; //Keep compiler happy.
        toReturn.dialogFilter = null; //Keep compiler happy.
        toReturn.fullDialogFilterSingular = null; //Keep compiler happy.
        toReturn.fullDialogFilterPlural = null; //Keep compiler happy.

        switch (aMBfileVersion)
        {
            case SAVEDFILEVERSION_MB3:
                toReturn.fileExtension = "mb3";
                break;
            case SAVEDFILEVERSION_MB4TEMP2:
                toReturn.fileExtension = "mb4temp1";
                break;
            case SAVEDFILEVERSION_MB4:
                toReturn.fileExtension = "mb4";
                break;
            default:
                Trace.Assert(
                    false, "PIL ASSERT. Select Case never fall-through");
                break;
        }

        toReturn.fileExtensionWithDot = "." + toReturn.fileExtension;

        //E.g. "(*.mb4)|*.mb4"
        toReturn.dialogFilter = 
            "(*" + toReturn.fileExtensionWithDot + ")|*" + 
            toReturn.fileExtensionWithDot + "";

        toReturn.fullDialogFilterSingular = 
            "Binary file " + toReturn.dialogFilter;
        toReturn.fullDialogFilterPlural = 
            "Binary files " + toReturn.dialogFilter;

        return toReturn;
    } //savedMBConstants()


} //class AppConstants


    

    

Generated by script codePublish.pl at 2009-01-05T15:20:59.