Add LineParser and basic dictionaries.
This commit is contained in:
		
							
								
								
									
										5
									
								
								zaaReloaded2/Defaults/parameters.txt
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								zaaReloaded2/Defaults/parameters.txt
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
# LAURIS-NAME                      "KANONISCHER NAME"   KATEGORIE          "IMMER REFERENZBEREICH"
 | 
			
		||||
# ===========                      ==================   =========          =======================
 | 
			
		||||
"Lactat Dehydrogenase"             LDH                  Klinische Chemie
 | 
			
		||||
"Cystatin C"                       ---                  Nierenfunktion     X
 | 
			
		||||
"glomerul.  Filtrationsr. CKD-EP"  "eGFR (CKD-EPI)"     Nierenfunktion 
 | 
			
		||||
							
								
								
									
										3
									
								
								zaaReloaded2/Defaults/units.txt
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								zaaReloaded2/Defaults/units.txt
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
# LAURIS-EINHEIT    "KANONISCHE EINHEIT"
 | 
			
		||||
# ==============    ====================
 | 
			
		||||
"ml/min/ 1,73qm"    "ml/min/1,73 m²"
 | 
			
		||||
							
								
								
									
										33
									
								
								zaaReloaded2/Dictionaries/DictionaryBase.cs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								zaaReloaded2/Dictionaries/DictionaryBase.cs
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
/* DictionaryBase.cs
 | 
			
		||||
 * part of zaaReloaded2
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright 2015 Daniel Kraus
 | 
			
		||||
 * 
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * 
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 * 
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace zaaReloaded2.Dictionaries
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Base class for the <see cref="ParameterDictionary"/>
 | 
			
		||||
    /// and the <see cref="UnitDictionary"/>; implements methods
 | 
			
		||||
    /// to read configuration files.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    abstract class DictionaryBase
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										81
									
								
								zaaReloaded2/Dictionaries/LineParser.cs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										81
									
								
								zaaReloaded2/Dictionaries/LineParser.cs
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
/* LineParser.cs
 | 
			
		||||
 * part of zaaReloaded2
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright 2015 Daniel Kraus
 | 
			
		||||
 * 
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * 
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 * 
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
using System;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
 | 
			
		||||
namespace zaaReloaded2.Dictionaries
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Simple parser that separates a line from a text file into
 | 
			
		||||
    /// space-separated fields; field values that contain spaces must
 | 
			
		||||
    /// be enclosed by double quotation marks.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <remarks>
 | 
			
		||||
    /// Everything after a hash (#) will be ignored.
 | 
			
		||||
    /// </remarks>
 | 
			
		||||
    public class LineParser
 | 
			
		||||
    {
 | 
			
		||||
        #region Public properties
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the line being parsed.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Line
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return _line;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                _line = value;
 | 
			
		||||
                ParseLine();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets an array of fields in the line.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string[] Fields { get; private set; }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Private methods
 | 
			
		||||
 | 
			
		||||
        void ParseLine()
 | 
			
		||||
        {
 | 
			
		||||
            string s = Line.Split('#')[0];
 | 
			
		||||
            Fields = _parser
 | 
			
		||||
                .Matches(s)
 | 
			
		||||
                .Cast<Match>()
 | 
			
		||||
                .Select(m => m.Groups["match"].Value)
 | 
			
		||||
                .ToArray<string>();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Fields
 | 
			
		||||
 | 
			
		||||
        // Regex modified after http://stackoverflow.com/a/554068/270712
 | 
			
		||||
        static readonly Regex _parser = new Regex(@"(?<match>[^\s""]+)|\""(?<match>[^""]*)""");
 | 
			
		||||
        string _line;
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								zaaReloaded2/Dictionaries/ParameterDictionary.cs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								zaaReloaded2/Dictionaries/ParameterDictionary.cs
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
/* ParameterDictionary.cs
 | 
			
		||||
 * part of zaaReloaded2
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright 2015 Daniel Kraus
 | 
			
		||||
 * 
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * 
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 * 
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace zaaReloaded2.Dictionaries
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Dictionary that is used to convert Lauris parameter names to
 | 
			
		||||
    /// canonical parameter names, and to assign categories and determine
 | 
			
		||||
    /// which parameters always require the output of reference intervals.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    class ParameterDictionary : DictionaryBase
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								zaaReloaded2/Dictionaries/UnitDictionary.cs
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								zaaReloaded2/Dictionaries/UnitDictionary.cs
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
/* UnitDictionary.cs
 | 
			
		||||
 * part of zaaReloaded2
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright 2015 Daniel Kraus
 | 
			
		||||
 * 
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * 
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 * 
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace zaaReloaded2.Dictionaries
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Dictionary that is used to convert Lauris units to canonical
 | 
			
		||||
    /// zaaReloaded2 units.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    class UnitDictionary : DictionaryBase
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -160,6 +160,10 @@
 | 
			
		||||
    can be found.
 | 
			
		||||
  -->
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="Dictionaries\DictionaryBase.cs" />
 | 
			
		||||
    <Compile Include="Dictionaries\LineParser.cs" />
 | 
			
		||||
    <Compile Include="Dictionaries\ParameterDictionary.cs" />
 | 
			
		||||
    <Compile Include="Dictionaries\UnitDictionary.cs" />
 | 
			
		||||
    <Compile Include="Models\LabItem.cs" />
 | 
			
		||||
    <Compile Include="Properties\AssemblyInfo.cs">
 | 
			
		||||
      <SubType>Code</SubType>
 | 
			
		||||
@@ -193,9 +197,10 @@
 | 
			
		||||
    <AppDesigner Include="Properties\" />
 | 
			
		||||
    <None Include="zaaReloaded2.licenseheader" />
 | 
			
		||||
    <None Include="zaaReloaded2.pfx" />
 | 
			
		||||
    <None Include="zaaReloaded2.snk" />
 | 
			
		||||
    <None Include="zaaReloaded2.snk.pfx" />
 | 
			
		||||
    <None Include="zaaReloaded2_TemporaryKey.pfx" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Content Include="Defaults\parameters.txt" />
 | 
			
		||||
    <Content Include="Defaults\units.txt" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user