Example #1
0
        public List <GOSTLine> getLineLyFor(string baseElement, string element, bool isAnalit, bool isComp)
        {
            List <GOSTLine> ret = new List <GOSTLine>();

            for (int g = 0; g < GOSTList.Count; g++)
            {
                GOST gost = GOSTList[g];
                if (baseElement != null && gost.BaseElement.Equals(baseElement) == false)
                {
                    continue;
                }
                for (int l = 0; l < gost.LineInfo.Count; l++)
                {
                    GOSTLine line = gost.LineInfo[l];
                    if (isAnalit == true && line.IsComp == true)
                    {
                        continue;
                    }
                    if (isComp == true && line.IsComp == false)
                    {
                        continue;
                    }
                    if (element != null && line.Element.Equals(element) == false)
                    {
                        continue;
                    }
                    ret.Add(line);
                }
            }
            return(ret);
        }
Example #2
0
 private void listboxGOST_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         selectedLine = null;
         listboxLines.Items.Clear();
         int selected = listboxGOST.SelectedIndex;
         lineList.Clear();
         if (selected < 0)
         {
             selectedGost = null;
             return;
         }
         selectedGost = GOSTList[selected];
         for (int l = 0; l < selectedGost.LineInfo.Count; l++)
         {
             GOSTLine line = selectedGost.LineInfo[l];
             if (isAnalit == true && line.IsComp == true)
             {
                 continue;
             }
             if (isComp == true && line.IsComp == false)
             {
                 continue;
             }
             if (element != null && element.Equals(line.Element) == false)
             {
                 continue;
             }
             if (line.Ly < 0)
             {
                 continue;
             }
             string strLine;
             if (line.IsComp)
             {
                 strLine = "  Compare: " + line.Ly;
             }
             else
             {
                 strLine = "Analit: " + line.Ly;
             }
             listboxLines.Items.Add(strLine);
             lineList.Add(line);
         }
     }
     catch (Exception ex)
     {
         Log.OutNoMsg(ex);
     }
 }
Example #3
0
 private void listboxLines_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         selectedLine = null;
         int selected = listboxLines.SelectedIndices.Count;// .SelectedIndex;
         if (selected == 0 || selectedGost == null)
         {
             lbSelectedLineInfo.Text = "-";
             btnSelect.Enabled       = false;
             return;
         }
         selected = listboxLines.SelectedIndices[0];
         GOSTLine line = lineList[selected];
         lbSelectedLineInfo.Text = line.getFullDescrition();
         btnSelect.Enabled       = true;
         dataShotSetView1.update(Method, element, Formula, line.Ly, false, false);
     }
     catch (Exception ex)
     {
         btnSelect.Enabled = false;
         Log.Out(ex);
     }
 }
Example #4
0
        public GOST(String fileName)
        {
            StreamReader fs = new StreamReader(fileName);

            try
            {
                String   text   = fs.ReadToEnd();
                String[] lines  = text.Split('\n');
                String[] fields = lines[1].Split(';');
                try
                {
                    GOSTIndex   = fields[0];
                    BaseElement = fields[1];
                    Description = fields[2];
                }
                catch (Exception ex)
                {
                    Log.OutNoMsg(ex);
                    throw ex;
                }
                String element = null;
                for (int i = 2; i < lines.Length; i++)
                {
                    ParseErrorCandidate = "File: " + fileName + " Line [" + lines[i] + "]";
                    fields = lines[i].Split(';');
                    String cand = fields[0].Replace(':', ' ').Trim();
                    if (cand.Length <= 2 && cand.Length > 0 && Char.IsLetter(cand[0]))
                    {
                        if (ElementTable.FindIndex(cand) < 0)
                        {
                            throw new Exception("Wrong name of element " + cand);
                        }
                        element = cand;
                    }
                    else
                    {
                        //for (; i < lines.Length; i++)
                        try
                        {
                            string[] lfields = lines[i].Split(';');
                            GOSTLine li;
                            if (lfields[0].Trim().Length > 0)
                            {
                                li = new GOSTLine(element, lfields, true, BaseElement);
                                LineInfo.Add(li);
                            }
                            //string[] lfields = lines[i].Split(';');
                            if (lfields[2].Trim().Length > 0)
                            {
                                li = new GOSTLine(element, lfields, false, BaseElement);
                                LineInfo.Add(li);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.OutNoMsg(ex);
                        }
                    }
                }
            }
            finally
            {
                fs.Close();
            }
        }