Esempio n. 1
0
        /// <summary>
        /// Finds the first key in the sorted list that is >= val
        /// </summary>
        /// <param name="lst">Sorted list of values.</param>
        /// <param name="val">Key value to search for.</param>
        /// <returns>Returns the first index of an item with a key >= val. If none are found -1 is returned.</returns>
        private int FindFirst(System.Collections.SortedList lst, double val)
        {          // do a binary search to find the first key occurance that is >= val
            int    high   = lst.Count - 1;
            int    low    = 0;
            int    cur    = low;       // Initialize cur and curVal just in case there is only one value, which means low == high so the while loop will never execute.
            double curVal = (double)lst.GetKey(cur);

            while ((high - low > 2) && low != high)
            {
                cur    = (high + low) / 2;
                curVal = (double)lst.GetKey(cur);

                if (curVal == val)
                {
                    return(cur);
                }
                else if (curVal < val)
                {
                    low = cur;
                }
                else                 // (curVal > val)
                {
                    high = cur;
                }
            }

            return(low);
        }
Esempio n. 2
0
            /// <summary>
            /// Returns a portion of the list whose keys are greater that the lowerLimit parameter less than the upperLimit parameter.
            /// </summary>
            /// <param name="list">The list where the portion will be extracted.</param>
            /// <param name="lowerLimit">The start element of the portion to extract.</param>
            /// <param name="upperLimit">The end element of the portion to extract.</param>
            /// <returns>The portion of the collection.</returns>
            public static System.Collections.SortedList SubMap(System.Collections.SortedList list, object lowerLimit, object upperLimit)
            {
                System.Collections.Comparer   comparer = System.Collections.Comparer.Default;
                System.Collections.SortedList newList  = new System.Collections.SortedList();

                if (list != null)
                {
                    if ((list.Count > 0) && (!(lowerLimit.Equals(upperLimit))))
                    {
                        int index = 0;
                        while (comparer.Compare(list.GetKey(index), lowerLimit) < 0)
                        {
                            index++;
                        }

                        for (; index < list.Count; index++)
                        {
                            if (comparer.Compare(list.GetKey(index), upperLimit) >= 0)
                            {
                                break;
                            }

                            newList.Add(list.GetKey(index), list[list.GetKey(index)]);
                        }
                    }
                }

                return(newList);
            }
        private void AutoFitColumnEVEN()
        {
            distribution widthDist = new distribution();
            int          totalWidth = 0, totalFixWidth = 0;

            for (int idx = 0; idx < this.Columns.Count; idx++)
            {
                if (!this.Columns[idx].Visible)
                {
                    continue;
                }
                if (this.myFixedSizedColumns.Contains(this.Columns[idx].Name))
                {
                    totalFixWidth += this.Columns[idx].Width;
                    continue;
                }
                totalWidth += this.Columns[idx].Width;
                widthDist.Add(this.Columns[idx].Name, this.Columns[idx].Width);
            }
            totalWidth = this.Width - totalFixWidth - (this.RowHeadersVisible ? this.RowHeadersWidth : 2) - SystemInformation.VerticalScrollBarThumbHeight - 2 - totalWidth;
            if (!widthDist.Distribute(totalWidth, 0))
            {
                return;
            }
            System.Collections.SortedList disResult = widthDist.GetDistribution();
            int    value = 0;
            string tmp;

            for (int idx = 0; idx < disResult.Count; idx++)
            {
                tmp = disResult.GetKey(idx).ToString();
                int.TryParse(disResult[tmp].ToString(), out value);
                this.Columns[tmp].Width += value;
            }
        }
Esempio n. 4
0
        private void vGeraPersonalizavel()
        {
            System.Text.StringBuilder     strbPersonalizavel = new System.Text.StringBuilder();
            System.Collections.SortedList sortLstDSEPE       = new System.Collections.SortedList(new mdlComponentesColecoes.clsComparerNumbersTexts());
            // Ordenando
            for (int i = 0; i < m_typDatSetDSEsPEs.tbDSEsPEs.Rows.Count; i++)
            {
                mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow dtrwDSEPE = (mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow)m_typDatSetDSEsPEs.tbDSEsPEs.Rows[i];
                if ((dtrwDSEPE.RowState != System.Data.DataRowState.Deleted) && (dtrwDSEPE.nIdExportador == m_nIdExportador) && (dtrwDSEPE.strIdPE == m_strIdPe))
                {
                    sortLstDSEPE.Add(GetDSENumero(dtrwDSEPE.nIdDSE), dtrwDSEPE);
                }
            }

            // Inserindo
            for (int i = 0; i < sortLstDSEPE.Count; i++)
            {
                mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow dtrwDSEPE = (mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow)sortLstDSEPE.GetByIndex(i);
                if (strbPersonalizavel.ToString() != "")
                {
                    strbPersonalizavel.Append(" , ");
                }
                strbPersonalizavel.Append(sortLstDSEPE.GetKey(i).ToString());
            }
            m_strPersonalizavel = strbPersonalizavel.ToString();
            if (m_typDatSetPes.tbPEs.Rows.Count > 0)
            {
                mdlDataBaseAccess.Tabelas.XsdTbPes.tbPEsRow dtrwPE = (mdlDataBaseAccess.Tabelas.XsdTbPes.tbPEsRow)m_typDatSetPes.tbPEs.Rows[0];
                dtrwPE.mstrDSE = m_strPersonalizavel;
            }
        }
Esempio n. 5
0
        // Returns a list of data source names from the local machine.
        public System.Collections.SortedList GetAllDataSourceNames()
        {
            // Get the list of user DSN's first.
            System.Collections.SortedList dsnList = GetUserDataSourceNames();

            // Get list of System DSN's and add them to the first list.
            System.Collections.SortedList systemDsnList = GetSystemDataSourceNames();
            for (int i = 0; i < systemDsnList.Count; i++)
            {
                string         sName = systemDsnList.GetKey(i) as string;
                DataSourceType type  = (DataSourceType)systemDsnList.GetByIndex(i);
                try
                {
                    // This dsn to the master list
                    dsnList.Add(sName, type);
                }
                catch
                {
                    // An exception can be thrown if the key being added is a duplicate so
                    // we just catch it here and have to ignore it.
                }
            }

            return(dsnList);
        }
Esempio n. 6
0
        public InterpolatorColor(System.Collections.SortedList colorKeyFrames)
        {
            //_colors = a_colorKeyFrames;
            _interpolators = new List <Interpolator>();

            for (int i = 0; i < 4; i++)
            {
                Interpolator ip = new Interpolator();
                _interpolators.Add(ip);
                System.Collections.SortedList a = new System.Collections.SortedList();
                for (int nClrNum = 0; nClrNum < colorKeyFrames.Count; nClrNum++)
                {
                    Color  clr  = (Color)colorKeyFrames.GetByIndex(nClrNum);
                    double dVal = 0;
                    if (i == 0)
                    {
                        dVal = clr.A;
                    }
                    else if (i == 1)
                    {
                        dVal = clr.R;
                    }
                    else if (i == 2)
                    {
                        dVal = clr.G;
                    }
                    else if (i == 3)
                    {
                        dVal = clr.B;
                    }
                    a.Add(colorKeyFrames.GetKey(nClrNum), dVal);
                }
                ip.KeyFramesList = a;
            }
        }
Esempio n. 7
0
        private void AboutButtonClick(object sender, EventArgs e)
        {
            // Create a scrollable form.
            Form aboutBox = new Form();
            int  w = 700, h = 400;

            aboutBox.Size = new System.Drawing.Size(w, h);
            w             = aboutBox.ClientRectangle.Width;
            h             = aboutBox.ClientRectangle.Height;
            // Create the accept button.
            Button buttonOK = new Button();
            // Create the scrollable help text area.
            TextBox helptext = new TextBox();

            // Set the Multiline property to true.
            helptext.Multiline = true;
            // Add vertical scroll bars to the TextBox control.
            helptext.ScrollBars = ScrollBars.Vertical;
            // Allow the Return key to be entered in the TextBox control.
            helptext.AcceptsReturn = true;
            // Allow the TAB key to be entered in the TextBox control.
            helptext.AcceptsTab = true;
            // Set WordWrap to true to allow text to wrap to the next line.
            helptext.WordWrap = true;

            helptext.Size = new System.Drawing.Size(w, h - (20 + buttonOK.Height));
            helptext.Text = this.AboutButtonHelpText + "\r\n";
            for (int i = 0; i < this.sortedToolTips.Count; i++)
            {
                helptext.Text += ("\r\n" + sortedToolTips.GetKey(i) + ":\r\n" + sortedToolTips.GetByIndex(i) + "\r\n");
            }
            buttonOK.Text = "OK";
            // Set the position of the button on the form.
            buttonOK.Location = new Point((w - buttonOK.Width) / 2, h - (10 + buttonOK.Height));
            // Make button1's dialog result OK.
            buttonOK.DialogResult = DialogResult.OK;

            // Add OK button to the form.
            aboutBox.Controls.Add(buttonOK);
            // Add helptext to the form.
            aboutBox.Controls.Add(helptext);


            // Set the caption bar text of the form.
            aboutBox.Text = this.AboutButton.Text;

            // Define the border style of the form to a dialog box.
            aboutBox.FormBorderStyle = FormBorderStyle.FixedDialog;
            // Set the accept button of the form to button1.
            aboutBox.AcceptButton = buttonOK;
            // Set the start position of the form to the center of the screen.
            aboutBox.StartPosition = FormStartPosition.CenterScreen;


            // Display the form as a modal dialog box.
            aboutBox.ShowDialog();

            aboutBox.Dispose();
        }
Esempio n. 8
0
            /// <summary>
            /// Returns a portion of the list whose keys are less than the limit object parameter.
            /// </summary>
            /// <param name="l">The list where the portion will be extracted.</param>
            /// <param name="limit">The end element of the portion to extract.</param>
            /// <returns>The portion of the collection whose elements are less than the limit object parameter.</returns>
            public static System.Collections.SortedList HeadMap(System.Collections.SortedList l, object limit)
            {
                System.Collections.Comparer   comparer = System.Collections.Comparer.Default;
                System.Collections.SortedList newList  = new System.Collections.SortedList();

                for (int i = 0; i < l.Count; i++)
                {
                    if (comparer.Compare(l.GetKey(i), limit) >= 0)
                    {
                        break;
                    }

                    newList.Add(l.GetKey(i), l[l.GetKey(i)]);
                }

                return(newList);
            }
Esempio n. 9
0
        public static void SortAllPages()
        {
            VisioHelper.DisplayInWatchWindow(string.Format("{0}()",
                                                           System.Reflection.MethodBase.GetCurrentMethod().Name));

            Visio.Application app = Globals.ThisAddIn.Application;

            Visio.Document doc = app.ActiveDocument;

            System.Collections.SortedList sortedPages = new System.Collections.SortedList();
            //SortedList<string, string> sortedPages = new SortedList<string, string>();
            int  index      = 0;
            bool hasTOCPage = false;

            VisioHelper.DisplayInWatchWindow(string.Format("Document({0})", doc.Name));

            try
            {
                foreach (Visio.Page page in doc.Pages)
                {
                    VisioHelper.DisplayInWatchWindow(string.Format("Page({0} IsBackground{1})", page.NameU, page.Background));

                    if (!page.NameU.Equals("Table of Contents"))
                    {
                        if (page.Background == 0)
                        {
                            sortedPages.Add(page.NameU, page.NameU);
                            index++;
                        }
                    }
                    else
                    {
                        hasTOCPage = true;
                    }

                    //sortedPages.Add(index++, page.NameU);
                }

                // If we found a TOC page, start pages off at postion 2, else, postion 1

                int offset = hasTOCPage ? 2 : 1;

                for (int i = 0; i < index; i++)
                {
                    VisioHelper.DisplayInWatchWindow(string.Format("Moving Page({0})", sortedPages.GetByIndex(i)));
                    doc.Pages.ItemU[sortedPages.GetKey(i)].Index = (short)(i + offset);
                    //Application.ActiveDocument.Pages.ItemU("Page-2").Index = 3
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, Common.LOG_CATEGORY);
            }
        }
Esempio n. 10
0
 private void GetODBCDriverList()
 {
     DevToolShed.OdbcDataSourceManager dsnManager = new DevToolShed.OdbcDataSourceManager();
     System.Collections.SortedList     dsnList    = dsnManager.GetAllDataSourceNames();
     for (int i = 0; i < dsnList.Count; i++)
     {
         string sName = (string)dsnList.GetKey(i);
         DevToolShed.DataSourceType type = (DevToolShed.DataSourceType)dsnList.GetByIndex(i);
         dropDownDriverList.Items.Add(sName);
     }
 }
        public object[] pop()
        {
            object[] ReturnValue = { null, null };
            if (PseudoQueue.Count > 0)
            {
                ReturnValue[0] = PseudoQueue.GetKey(0);
                ReturnValue[1] = PseudoQueue.GetByIndex(0);

                PseudoQueue.RemoveAt(0);
            }
            return(ReturnValue);
        }
Esempio n. 12
0
        /// <summary>
        /// Form constructor
        /// </summary>
        protected void ShowDSNs()
        {
            OdbcDataSourceManager dsnManager = new OdbcDataSourceManager();

            System.Collections.SortedList dsnList = dsnManager.GetAllDataSourceNames();
            for (int i = 0; i < dsnList.Count; i++)
            {
                string sName = (string)dsnList.GetKey(i);
                SQLAutoDoc.classes.DataSourceType type = (SQLAutoDoc.classes.DataSourceType)dsnList.GetByIndex(i);
                AddToListBox(sName + " - (" + type.ToString() + " DSN)");
            }
        }
Esempio n. 13
0
            /// <summary>
            /// Returns a portion of the list whose keys are greater than the limit object parameter.
            /// </summary>
            /// <param name="list">The list where the portion will be extracted.</param>
            /// <param name="limit">The start element of the portion to extract.</param>
            /// <returns>The portion of the collection whose elements are greater than the limit object parameter.</returns>
            public static System.Collections.SortedList TailMap(System.Collections.SortedList list, object limit)
            {
                System.Collections.Comparer   comparer = System.Collections.Comparer.Default;
                System.Collections.SortedList newList  = new System.Collections.SortedList();

                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        int index = 0;
                        while (comparer.Compare(list.GetKey(index), limit) < 0)
                        {
                            index++;
                        }

                        for (; index < list.Count; index++)
                        {
                            newList.Add(list.GetKey(index), list[list.GetKey(index)]);
                        }
                    }
                }

                return(newList);
            }
Esempio n. 14
0
        public static System.Collections.SortedList getAllDSNNames()
        {
            System.Collections.SortedList fullList = new System.Collections.SortedList();

            System.Collections.SortedList systemDsns = getSystemDSNNames();
            System.Collections.SortedList userDsns   = getUserDSNNames();

            for (int i = 0; i < systemDsns.Count; i++)
            {
                fullList.Add(systemDsns.GetKey(i), systemDsns.GetByIndex(i));
            }

            for (int i = 0; i < userDsns.Count; i++)
            {
                fullList.Add(userDsns.GetKey(i), userDsns.GetByIndex(i));
            }

            return(fullList);
        }
Esempio n. 15
0
        private void vRefreshPEsVinculados(int nIdDSE, ref mdlComponentesGraficos.ListView lvDSEsVinculados)
        {
            lvDSEsVinculados.Items.Clear();
            System.Collections.SortedList sortLstDSEPE = new System.Collections.SortedList(new mdlComponentesColecoes.clsComparerNumbersTexts());
            // Ordenando
            for (int i = 0; i < m_typDatSetDSEsPEs.tbDSEsPEs.Rows.Count; i++)
            {
                mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow dtrwDSEPE = (mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow)m_typDatSetDSEsPEs.tbDSEsPEs.Rows[i];
                if ((dtrwDSEPE.RowState != System.Data.DataRowState.Deleted) && (dtrwDSEPE.nIdExportador == m_nIdExportador) && (dtrwDSEPE.nIdDSE == nIdDSE))
                {
                    sortLstDSEPE.Add(dtrwDSEPE.strIdPE, dtrwDSEPE);
                }
            }

            // Inserindo
            System.Windows.Forms.ListViewItem lviInserir;
            for (int i = 0; i < sortLstDSEPE.Count; i++)
            {
                mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow dtrwDSEPE = (mdlDataBaseAccess.Tabelas.XsdTbDSEsPEs.tbDSEsPEsRow)sortLstDSEPE.GetByIndex(i);
                lviInserir     = lvDSEsVinculados.Items.Add(sortLstDSEPE.GetKey(i).ToString());
                lviInserir.Tag = dtrwDSEPE.nIdDSE;
            }
        }
Esempio n. 16
0
    /// <summary>
    /// Analyzes the first <code>nLines</code> of the ascii stream.
    /// </summary>
    /// <param name="nLines">The number of lines to analyze. It is no error if the stream contains a less number of lines than provided here.</param>
    /// <param name="defaultImportOptions">The default import options.</param>
    /// <returns>Import options that can be used in a following step to read in the ascii stream. Null is returned if the stream contains no data.</returns>
    public AsciiImportOptions Analyze(int nLines, AsciiImportOptions defaultImportOptions)
    {

      string sLine;

      stream.Position = 0;
      System.IO.StreamReader sr = new System.IO.StreamReader(stream,System.Text.Encoding.Default,true);
      System.Collections.ArrayList result = new System.Collections.ArrayList();
    
      for(int i=0;i<nLines;i++)
      {
        sLine = sr.ReadLine();
        if(null==sLine)
          break;
        result.Add(new AsciiLineAnalyzer(i,sLine));
      }
    
      if(result.Count==0)
        return null; // there is nothing to analyze

      // now view the results
      // calc the frequency o
      System.Collections.SortedList sl= new System.Collections.SortedList();
      int nItems;
      // first the tabs

      /*
      sl.Clear();
      for(int i=0;i<result.Count;i++)
      {
        nItems = ((AsciiLineAnalyzer)result[i]).nNumberOfTabs;
        if(0!=nItems)
        {
          if(null==sl[nItems])
            sl.Add(nItems,1);
          else 
            sl[nItems] = 1+(int)sl[nItems];
        }
      }
      // get the tab count with the topmost frequency
      int nMaxNumberOfSameTabs = 0;
      int nMaxTabsOfSameNumber = 0;
      for(int i=0;i<sl.Count;i++)
      {
        if(nMaxNumberOfSameTabs<(int)sl.GetByIndex(i))
        {
          nMaxNumberOfSameTabs = (int)sl.GetByIndex(i);
          nMaxTabsOfSameNumber = (int)sl.GetKey(i);
        }
      }
*/
      
      
      // Count the commas
      sl.Clear();
      for(int i=0;i<result.Count;i++)
      {
        nItems = ((AsciiLineAnalyzer)result[i]).nNumberOfCommas;
        if(0!=nItems)
        {
          if(null==sl[nItems])
            sl.Add(nItems,1);
          else 
            sl[nItems] = 1+(int)sl[nItems];
        }
      }
      // get the comma count with the topmost frequency
      int nMaxNumberOfSameCommas = 0;
      int nMaxCommasOfSameNumber = 0;
      for(int i=0;i<sl.Count;i++)
      {
        if(nMaxNumberOfSameCommas<(int)sl.GetByIndex(i))
        {
          nMaxNumberOfSameCommas = (int)sl.GetByIndex(i);
          nMaxCommasOfSameNumber = (int)sl.GetKey(i);
        }
      }

      // Count the semicolons
      sl.Clear();
      for(int i=0;i<result.Count;i++)
      {
        nItems = ((AsciiLineAnalyzer)result[i]).nNumberOfSemicolons;
        if(0!=nItems)
        {
          if(null==sl[nItems])
            sl.Add(nItems,1);
          else 
            sl[nItems] = 1+(int)sl[nItems];
        }
      }
      // get the tab count with the topmost frequency
      int nMaxNumberOfSameSemicolons = 0;
      int nMaxSemicolonsOfSameNumber = 0;
      for(int i=0;i<sl.Count;i++)
      {
        if(nMaxNumberOfSameSemicolons<(int)sl.GetByIndex(i))
        {
          nMaxNumberOfSameSemicolons = (int)sl.GetByIndex(i);
          nMaxSemicolonsOfSameNumber = (int)sl.GetKey(i);
        }
      }

    
      NumberAndStructure[] st = new NumberAndStructure[3];

      for(int i=0;i<3;i++)
      {
        st[i].nLines = GetPriorityOf(result,(AsciiLineAnalyzer.Separation)i,ref st[i].structure);
      }

      // look for the top index
    
      int nMaxLines = int.MinValue;
      double maxprtylines=0;
      int nBestSeparator = int.MinValue;
      for(int i=0;i<3;i++)
      {
        double prtylines = (double)st[i].nLines * st[i].structure.Priority;
        if(prtylines==maxprtylines)
        {
          if(st[i].nLines > nMaxLines)
          {
            nMaxLines = st[i].nLines;
            nBestSeparator = i;
          }
        }
        else if(prtylines>maxprtylines)
        {
          maxprtylines = prtylines;
          nBestSeparator = i;
          nMaxLines=st[i].nLines;
        }
      }

      AsciiImportOptions opt = defaultImportOptions.Clone();
      
      opt.bDelimited = true;
      opt.cDelimiter = nBestSeparator==0 ? '\t' : (nBestSeparator==1 ? ',' : ';');
      opt.recognizedStructure = st[nBestSeparator].structure;


      // look how many header lines are in the file by comparing the structure of the first lines  with the recognized structure
      for(int i=0;i<result.Count;i++)
      {
        opt.nMainHeaderLines=i;
        if(((AsciiLineAnalyzer)result[i]).structure[nBestSeparator].IsCompatibleWith(opt.recognizedStructure))
          break;
      }


      // calculate the total statistics of decimal separators
      opt.m_DecimalSeparatorCommaCount=0;
      opt.m_DecimalSeparatorDotCount=0;
      for(int i=0;i<result.Count;i++)
      {
        opt.m_DecimalSeparatorDotCount += ((AsciiLineAnalyzer)result[i]).structure[nBestSeparator].DecimalSeparatorDotCount;
        opt.m_DecimalSeparatorCommaCount += ((AsciiLineAnalyzer)result[i]).structure[nBestSeparator].DecimalSeparatorCommaCount;
      }



      return opt;

    }
Esempio n. 17
0
        /// <summary>
        /// 导出数据行
        /// </summary>
        /// <param name="dtSource"></param>
        /// <param name="drSource"></param>
        /// <param name="currentExcelRow"></param>
        /// <param name="excelSheet"></param>
        /// <param name="excelWorkBook"></param>
        protected static void InsertCell(DataTable dtSource, DataRow drSource, HSSFRow currentExcelRow, HSSFSheet excelSheet, HSSFWorkbook excelWorkBook)
        {
            for (int cellIndex = 0; cellIndex < ListColumnsName.Count; cellIndex++)
            {
                //列名称
                string      columnsName = ListColumnsName.GetKey(cellIndex).ToString();
                HSSFCell    newCell     = null;
                System.Type rowType     = drSource[columnsName].GetType();
                string      drValue     = drSource[columnsName].ToString().Trim();
                switch (rowType.ToString())
                {
                case "System.String":    //字符串类型
                    drValue = drValue.Replace("&", "&");
                    drValue = drValue.Replace(">", ">");
                    drValue = drValue.Replace("<", "<");
                    newCell = currentExcelRow.CreateCell(cellIndex);
                    newCell.SetCellValue(drValue);
                    break;

                case "System.DateTime":    //日期类型
                    DateTime dateV;
                    DateTime.TryParse(drValue, out dateV);
                    newCell = currentExcelRow.CreateCell(cellIndex);
                    newCell.SetCellValue(dateV);

                    //格式化显示
                    HSSFCellStyle  cellStyle = excelWorkBook.CreateCellStyle();
                    HSSFDataFormat format    = excelWorkBook.CreateDataFormat();
                    cellStyle.DataFormat = format.GetFormat("yyyy-mm-dd hh:mm:ss");
                    newCell.CellStyle    = cellStyle;

                    break;

                case "System.Boolean":    //布尔型
                    bool boolV = false;
                    bool.TryParse(drValue, out boolV);
                    newCell = currentExcelRow.CreateCell(cellIndex);
                    newCell.SetCellValue(boolV);
                    break;

                case "System.Int16":    //整型
                case "System.Int32":
                case "System.Int64":
                case "System.Byte":
                    int intV = 0;
                    int.TryParse(drValue, out intV);
                    newCell = currentExcelRow.CreateCell(cellIndex);
                    newCell.SetCellValue(intV.ToString());
                    break;

                case "System.Decimal":    //浮点型
                case "System.Double":
                    double doubV = 0;
                    double.TryParse(drValue, out doubV);
                    newCell = currentExcelRow.CreateCell(cellIndex);
                    newCell.SetCellValue(doubV);
                    break;

                case "System.DBNull":    //空值处理
                    newCell = currentExcelRow.CreateCell(cellIndex);
                    newCell.SetCellValue("");
                    break;

                default:
                    throw (new Exception(rowType.ToString() + ":类型数据无法处理!"));
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Retrieve OID name by OID string.
        /// </summary>
        /// <param name="inOidStr">source OID string.</param>
        /// <returns>OID name.</returns>
        public string GetOidName(string inOidStr)
        {
            if (oidDictionary == null) //Initialize oidDictionary:
            {
                oidDictionary = new StringDictionary();
                string path = Application.ExecutablePath;
                string oidFile = System.IO.Path.GetDirectoryName(path) + "\\OID.txt";
                string oidBackupFile = System.IO.Path.GetDirectoryName(path) + "\\OID.Backup.txt";
                string oidStr = "";
                string oidDesc = "";
                bool loadOidError = false;
                int dbCounter = 0;
                try
                {
                    using (StreamReader sr = new StreamReader(oidFile))
                    {
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            string[] strs = line.Split(',');
                            if (strs.Length < 2) continue;
                            oidStr = strs[0].Trim();
                            oidDesc = strs[1].Trim();
                            try
                            {
                                oidDictionary.Add(oidStr, oidDesc);
                            }
                            catch(Exception ex)
                            {
                                loadOidError = true;
                                string msg = ex.Message;
                                dbCounter ++;
                            }
                        }
                    }
                    if (loadOidError)
                    {
                        using (StreamWriter sw = new StreamWriter(oidBackupFile))
                        {

                            using (StreamReader sr = new StreamReader(oidFile))
                            {
                                string line;
                                while ((line = sr.ReadLine()) != null)
                                {
                                    sw.Write(line+"\r\n");
                                }
                            }
                        }

                        System.Collections.SortedList sList = new System.Collections.SortedList();
                        using (StreamWriter sw = new StreamWriter(oidFile))
                        {
                            string val = "";
                            foreach ( System.Collections.DictionaryEntry de in oidDictionary )
                            {
                                if (!sList.ContainsKey(de.Key))
                                    sList.Add(de.Key, de.Value);
                            }
                            for(int i=0; i<sList.Count; i++)
                            {
                                val = String.Format("{0}, {1}\r\n", sList.GetKey(i), sList.GetByIndex(i));
                                sw.Write(val);
                            }
                        }
                        MessageBox.Show(String.Format("Duplicated OIDs were found in the OID table: {0}.\r\n" +
                            "The duplicate has been removed; the table is sorted.\r\n" +
                            "The original OID file is copied as: {1}\r\n", oidFile, oidBackupFile));
                    }
                }
                catch(Exception ex)
                {
                    MessageBox.Show("Failed to read OID values from file." + ex.Message);
                }
            }
            return oidDictionary[inOidStr];
        }
Esempio n. 19
0
	/// <summary/>
		public void ResetSortedList(ref System.Collections.SortedList list, string[] saContents)
		{
			list = new System.Collections.SortedList();
			foreach (string s in saContents)
				if (s != null && !list.ContainsKey(s))
					list.Add(s, s);

#if TestingOnly
			Console.WriteLine("sorted list contains:");
			for ( int i = 0; i < list.Count; i++ )
			{
				Console.WriteLine( "  {0}:{1}", list.GetKey(i), list.GetByIndex(i) );
			}
#endif
		}
Esempio n. 20
0
        /// <summary>
        /// Заполнить объект данных.
        /// </summary>
        /// <param name="dobject">Объект данных.</param>
        /// <param name="values">Значения для заполнения.</param>
        /// <param name="storageStruct">Метаданные структуры хранения.</param>
        /// <param name="customizationStruct">Настройка выборки данных.</param>
        /// <param name="typesByKeys">Служебная структура, увязывающая типы мастеров и их ключи.</param>
        /// <param name="advCols">Дополнительные колонки.</param>
        /// <param name="dataObjectCache">Кэш объектов данных.</param>
        /// <param name="securityManager">Менеджер полномочий.</param>
        public static void FillRowSetToDataObject(DataObject dobject, object[] values, StorageStructForView storageStruct, LoadingCustomizationStruct customizationStruct, System.Collections.SortedList typesByKeys, AdvansedColumn[] advCols, DataObjectCache dataObjectCache, ISecurityManager securityManager)
        {
            Type dobjectType = dobject.GetType();

            /* access type */

            if (!securityManager.AccessObjectCheck(dobjectType, tTypeAccess.Full, false))
            {
                securityManager.AccessObjectCheck(dobjectType, tTypeAccess.Read, true);
            }

            /* access type */

            // Заливаем данные в объект данных.
            int customizationStructViewPropertiesLength = customizationStruct.View.Properties.Length;
            int advColsLength = advCols.Length;

            Information.SetPropValueByName(dobject, "__PrimaryKey", values[customizationStructViewPropertiesLength + advColsLength]);

            // 1. создаем структуру мастеров(свойств-объектов данных).
            System.Collections.SortedList assList = new System.Collections.SortedList();
            int index = customizationStructViewPropertiesLength + 1 + advColsLength;

            CreateMastersStruct(dobject, values, ref index, 0, storageStruct.sources, assList, typesByKeys, dataObjectCache);
            assList.Add(storageStruct.sources, new object[] { dobject, 0 });

            // 2. заливаем данные.
            System.Collections.ArrayList properiesValues = new System.Collections.ArrayList();
            StringCollection             allAdvCols      = new StringCollection();

            int masterPosition = index;

            for (int i = 0; i < advColsLength; i++)
            {
                object value = values[i + customizationStructViewPropertiesLength];
                if (value == DBNull.Value)
                {
                    value = null;
                }

                properiesValues.Add(new[] { advCols[i].Name, value, dobject });
                allAdvCols.Add(advCols[i].Name);
                dobject.DynamicProperties.Add(advCols[i].Name, null);
            }

            for (int i = 0; i < customizationStructViewPropertiesLength; i++)
            {
                StorageStructForView.PropStorage prop = storageStruct.props[i];
                if (Information.IsStoredProperty(dobjectType, prop.Name) || prop.Expression != null)
                {
                    if (prop.MastersTypes == null)
                    {
                        object[] tmp = (object[])assList[prop.source];
                        object   value;
                        if (customizationStruct.ColumnsOrder != null && customizationStruct.ColumnsOrder.Length >= customizationStructViewPropertiesLength)
                        {
                            value = values[Array.IndexOf(customizationStruct.ColumnsOrder, prop.Name)];
                        }
                        else
                        {
                            value = values[i];
                        }

                        if (value == DBNull.Value)
                        {
                            value = null;
                        }

                        if (tmp != null)
                        {
                            properiesValues.Add(
                                new[] { prop.simpleName, value, tmp[0] });
                        }
                    }
                    else
                    {
                        object[] tmp = (object[])assList[prop.source];
                        if (tmp != null)
                        {
                            // Ищем позицию.
                            int tmp1 = (int)tmp[1];
                            int curMasterPosition = masterPosition;
                            for (int j = 0; j < tmp1; j++)
                            {
                                curMasterPosition += prop.MastersTypes[j].Length;
                            }

                            int    k     = 0;
                            object value = values[curMasterPosition];
                            if (value == DBNull.Value)
                            {
                                value = null;
                            }

                            while (k < prop.MastersTypes[tmp1].Length - 1 && value == null)
                            {
                                k++;
                                value = values[curMasterPosition + k];
                                if (value == DBNull.Value)
                                {
                                    value = null;
                                }
                            }

                            object tmp0 = tmp[0];
                            if (value != null)
                            {
                                if (Information.GetPropValueByName((DataObject)tmp0, prop.simpleName) == null)
                                {
                                    DataObject no = dataObjectCache.CreateDataObject(prop.MastersTypes[tmp1][k], value);
                                    if (no.GetStatus(false) == ObjectStatus.Created)
                                    {
                                        no.SetStatus(ObjectStatus.UnAltered);
                                        no.SetLoadingState(LoadingState.LightLoaded);
                                        no.InitDataCopy(dataObjectCache);
                                    }

                                    value = no;
                                    properiesValues.Add(new[] { prop.simpleName, value, tmp0 });
                                }
                                else
                                {
                                    // changed by fat
                                    properiesValues.Add(new[] { prop.simpleName, Information.GetPropValueByName((DataObject)tmp0, prop.simpleName), tmp0 });
                                }
                            }
                            else
                            {
                                properiesValues.Add(new[] { prop.simpleName, null, tmp0 });
                            }
                        }

                        masterPosition += prop.MastersTypesCount;
                    }
                }
            }

            // 2.2 Записываем в объекты.
            System.Collections.SortedList curObjProperiesValues = new System.Collections.SortedList();
            while (properiesValues.Count > 0)
            {
                // a. Выбираем для текущего объекта все свойства.
                object[]   tmp    = (object[])properiesValues[0];
                DataObject curobj = (DataObject)tmp[2];
                dobjectType = curobj.GetType();
                curObjProperiesValues.Clear();

                List <string> loadedPropsColl = curobj.GetLoadedPropertiesList();

                for (int i = properiesValues.Count - 1; i >= 0; i--)
                {
                    tmp = (object[])properiesValues[i];
                    if (tmp[2] == curobj)
                    {
                        object tmp0 = tmp[0];
                        if (!curObjProperiesValues.ContainsKey(tmp0))
                        {
                            curObjProperiesValues.Add(tmp0, tmp[1]);
                            if (!loadedPropsColl.Contains((string)tmp0))
                            {
                                loadedPropsColl.Add((string)tmp0);
                            }
                        }

                        properiesValues.RemoveAt(i);
                    }
                }

                // b. Раскидываем согласно LoadOrder;
                string[] loadOrder       = Information.GetLoadingOrder(dobjectType);
                int      loadOrderLength = loadOrder.Length;
                for (int i = 0; i < loadOrderLength; i++)
                {
                    string propName = loadOrder[i];
                    if (curObjProperiesValues.ContainsKey(propName))
                    {
                        Information.SetPropValueByName(curobj, propName, curObjProperiesValues[propName]);
                        curObjProperiesValues.Remove(propName);
                    }
                }

                int curObjPropertiesValuesCount = curObjProperiesValues.Count;
                for (int i = 0; i < curObjPropertiesValuesCount; i++)
                {
                    Information.SetPropValueByName(curobj, (string)curObjProperiesValues.GetKey(i), curObjProperiesValues.GetByIndex(i));
                }

                if (loadedPropsColl.Count >= Information.GetAllPropertyNames(dobjectType).Length)
                {
                    curobj.SetLoadingState(LoadingState.Loaded);
                }
                else
                {
                    curobj.SetLoadingState(LoadingState.LightLoaded);
                    curobj.AddLoadedProperties(loadedPropsColl);
                }

                curobj.SetStatus(ObjectStatus.UnAltered);
            }
        }
        protected void vRefreshNormas(ref mdlComponentesGraficos.ListView lvNormas)
        {
            try
            {
                System.Windows.Forms.ListViewItem lviNorma;
                lvNormas.Items.Clear();

                // Normas Ordenando | Filtrando
                System.Collections.SortedList sortListNormas = new System.Collections.SortedList();
                foreach (mdlDataBaseAccess.Tabelas.XsdTbCertificadosOrigemNormas.tbCertificadosOrigemNormasRow dtrwNormaResource in m_typDatSetTbCertificadosOrigemNormasResource.tbCertificadosOrigemNormas.Rows)
                {
                    string strDescricao = dtrwNormaResource.mstrNome;
                    mdlDataBaseAccess.Tabelas.XsdTbCertificadosOrigemNormas.tbCertificadosOrigemNormasRow dtrwNormaDataBase = m_typDatSetTbCertificadosOrigemNormasDataBase.tbCertificadosOrigemNormas.FindBynIdTipoCOnIdNorma(m_nIdTipoCO, dtrwNormaResource.nIdNorma);
                    if ((dtrwNormaDataBase != null) && (dtrwNormaDataBase.RowState != System.Data.DataRowState.Deleted) && (!dtrwNormaDataBase.IsmstrNomeNull()) && (dtrwNormaDataBase.mstrNome.Trim() != ""))
                    {
                        strDescricao = dtrwNormaDataBase.mstrNome;
                    }
                    if (dtrwNormaResource.IsdtInicioNull())
                    {
                        if (dtrwNormaResource.IsdtFimNull())
                        {
                            sortListNormas.Add(strDescricao, dtrwNormaResource.nIdNorma);
                        }
                        else
                        {
                            if (dtrwNormaResource.dtFim > m_dtEmissaoCertificado)
                            {
                                sortListNormas.Add(strDescricao, dtrwNormaResource.nIdNorma);
                            }
                        }
                    }
                    else
                    {
                        if (dtrwNormaResource.IsdtFimNull())
                        {
                            if (dtrwNormaResource.dtInicio < m_dtEmissaoCertificado)
                            {
                                sortListNormas.Add(strDescricao, dtrwNormaResource.nIdNorma);
                            }
                        }
                        else
                        {
                            if ((dtrwNormaResource.dtInicio < m_dtEmissaoCertificado) && (dtrwNormaResource.dtFim > m_dtEmissaoCertificado))
                            {
                                sortListNormas.Add(strDescricao, dtrwNormaResource.nIdNorma);
                            }
                        }
                    }
                }

                // Normas Inserindo
                for (int i = 0; i < sortListNormas.Count; i++)
                {
                    lviNorma     = lvNormas.Items.Add(sortListNormas.GetKey(i).ToString());
                    lviNorma.Tag = sortListNormas.GetByIndex(i);
                    if (bNormaUtilizadaCertificado(Int32.Parse(sortListNormas.GetByIndex(i).ToString())))
                    {
                        lviNorma.ForeColor = m_clrUsed;
                    }
                }
            }
            catch (Exception err)
            {
                Object erro = err;
                m_cls_ter_tratadorErro.trataErro(ref erro);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Retrieve OID name by OID string.
        /// </summary>
        /// <param name="inOidStr">source OID string.</param>
        /// <returns>OID name.</returns>
        public string GetOidName(string inOidStr)
        {
            if (oidDictionary == null) //Initialize oidDictionary:
            {
                oidDictionary = new StringDictionary();
                string path          = Application.ExecutablePath;
                string oidFile       = System.IO.Path.GetDirectoryName(path) + "\\OID.txt";
                string oidBackupFile = System.IO.Path.GetDirectoryName(path) + "\\OID.Backup.txt";
                string oidStr        = "";
                string oidDesc       = "";
                bool   loadOidError  = false;
                int    dbCounter     = 0;
                try
                {
                    using (StreamReader sr = new StreamReader(oidFile))
                    {
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            string[] strs = line.Split(',');
                            if (strs.Length < 2)
                            {
                                continue;
                            }
                            oidStr  = strs[0].Trim();
                            oidDesc = strs[1].Trim();
                            try
                            {
                                oidDictionary.Add(oidStr, oidDesc);
                            }
                            catch (Exception ex)
                            {
                                loadOidError = true;
                                string msg = ex.Message;
                                dbCounter++;
                            }
                        }
                    }
                    if (loadOidError)
                    {
                        using (StreamWriter sw = new StreamWriter(oidBackupFile))
                        {
                            using (StreamReader sr = new StreamReader(oidFile))
                            {
                                string line;
                                while ((line = sr.ReadLine()) != null)
                                {
                                    sw.Write(line + "\r\n");
                                }
                            }
                        }

                        System.Collections.SortedList sList = new System.Collections.SortedList();
                        using (StreamWriter sw = new StreamWriter(oidFile))
                        {
                            string val = "";
                            foreach (System.Collections.DictionaryEntry de in oidDictionary)
                            {
                                if (!sList.ContainsKey(de.Key))
                                {
                                    sList.Add(de.Key, de.Value);
                                }
                            }
                            for (int i = 0; i < sList.Count; i++)
                            {
                                val = String.Format("{0}, {1}\r\n", sList.GetKey(i), sList.GetByIndex(i));
                                sw.Write(val);
                            }
                        }
                        MessageBox.Show(String.Format("Duplicated OIDs were found in the OID table: {0}.\r\n" +
                                                      "The duplicate has been removed; the table is sorted.\r\n" +
                                                      "The original OID file is copied as: {1}\r\n", oidFile, oidBackupFile));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to read OID values from file." + ex.Message);
                }
            }
            return(oidDictionary[inOidStr]);
        }
Esempio n. 23
0
        /// <summary>
        /// Analyzes the first <code>nLines</code> of the ascii stream.
        /// </summary>
        /// <param name="nLines">The number of lines to analyze. It is no error if the stream contains a less number of lines than provided here.</param>
        /// <param name="defaultImportOptions">The default import options.</param>
        /// <returns>Import options that can be used in a following step to read in the ascii stream. Null is returned if the stream contains no data.</returns>
        public AsciiImportOptions Analyze(int nLines, AsciiImportOptions defaultImportOptions)
        {
            string sLine;

            stream.Position = 0;
            System.IO.StreamReader       sr     = new System.IO.StreamReader(stream, System.Text.Encoding.Default, true);
            System.Collections.ArrayList result = new System.Collections.ArrayList();

            for (int i = 0; i < nLines; i++)
            {
                sLine = sr.ReadLine();
                if (null == sLine)
                {
                    break;
                }
                result.Add(new AsciiLineAnalyzer(i, sLine));
            }

            if (result.Count == 0)
            {
                return(null); // there is nothing to analyze
            }
            // now view the results
            // calc the frequency o
            System.Collections.SortedList sl = new System.Collections.SortedList();
            int nItems;

            // first the tabs

            /*
             * sl.Clear();
             * for(int i=0;i<result.Count;i++)
             * {
             * nItems = ((AsciiLineAnalyzer)result[i]).nNumberOfTabs;
             * if(0!=nItems)
             * {
             *  if(null==sl[nItems])
             *    sl.Add(nItems,1);
             *  else
             *    sl[nItems] = 1+(int)sl[nItems];
             * }
             * }
             * // get the tab count with the topmost frequency
             * int nMaxNumberOfSameTabs = 0;
             * int nMaxTabsOfSameNumber = 0;
             * for(int i=0;i<sl.Count;i++)
             * {
             * if(nMaxNumberOfSameTabs<(int)sl.GetByIndex(i))
             * {
             *  nMaxNumberOfSameTabs = (int)sl.GetByIndex(i);
             *  nMaxTabsOfSameNumber = (int)sl.GetKey(i);
             * }
             * }
             */


            // Count the commas
            sl.Clear();
            for (int i = 0; i < result.Count; i++)
            {
                nItems = ((AsciiLineAnalyzer)result[i]).nNumberOfCommas;
                if (0 != nItems)
                {
                    if (null == sl[nItems])
                    {
                        sl.Add(nItems, 1);
                    }
                    else
                    {
                        sl[nItems] = 1 + (int)sl[nItems];
                    }
                }
            }
            // get the comma count with the topmost frequency
            int nMaxNumberOfSameCommas = 0;
            int nMaxCommasOfSameNumber = 0;

            for (int i = 0; i < sl.Count; i++)
            {
                if (nMaxNumberOfSameCommas < (int)sl.GetByIndex(i))
                {
                    nMaxNumberOfSameCommas = (int)sl.GetByIndex(i);
                    nMaxCommasOfSameNumber = (int)sl.GetKey(i);
                }
            }

            // Count the semicolons
            sl.Clear();
            for (int i = 0; i < result.Count; i++)
            {
                nItems = ((AsciiLineAnalyzer)result[i]).nNumberOfSemicolons;
                if (0 != nItems)
                {
                    if (null == sl[nItems])
                    {
                        sl.Add(nItems, 1);
                    }
                    else
                    {
                        sl[nItems] = 1 + (int)sl[nItems];
                    }
                }
            }
            // get the tab count with the topmost frequency
            int nMaxNumberOfSameSemicolons = 0;
            int nMaxSemicolonsOfSameNumber = 0;

            for (int i = 0; i < sl.Count; i++)
            {
                if (nMaxNumberOfSameSemicolons < (int)sl.GetByIndex(i))
                {
                    nMaxNumberOfSameSemicolons = (int)sl.GetByIndex(i);
                    nMaxSemicolonsOfSameNumber = (int)sl.GetKey(i);
                }
            }


            NumberAndStructure[] st = new NumberAndStructure[3];

            for (int i = 0; i < 3; i++)
            {
                st[i].nLines = GetPriorityOf(result, (AsciiLineAnalyzer.Separation)i, ref st[i].structure);
            }

            // look for the top index

            int    nMaxLines      = int.MinValue;
            double maxprtylines   = 0;
            int    nBestSeparator = int.MinValue;

            for (int i = 0; i < 3; i++)
            {
                double prtylines = (double)st[i].nLines * st[i].structure.Priority;
                if (prtylines == maxprtylines)
                {
                    if (st[i].nLines > nMaxLines)
                    {
                        nMaxLines      = st[i].nLines;
                        nBestSeparator = i;
                    }
                }
                else if (prtylines > maxprtylines)
                {
                    maxprtylines   = prtylines;
                    nBestSeparator = i;
                    nMaxLines      = st[i].nLines;
                }
            }

            AsciiImportOptions opt = defaultImportOptions.Clone();

            opt.bDelimited          = true;
            opt.cDelimiter          = nBestSeparator == 0 ? '\t' : (nBestSeparator == 1 ? ',' : ';');
            opt.recognizedStructure = st[nBestSeparator].structure;


            // look how many header lines are in the file by comparing the structure of the first lines  with the recognized structure
            for (int i = 0; i < result.Count; i++)
            {
                opt.nMainHeaderLines = i;
                if (((AsciiLineAnalyzer)result[i]).structure[nBestSeparator].IsCompatibleWith(opt.recognizedStructure))
                {
                    break;
                }
            }


            // calculate the total statistics of decimal separators
            opt.m_DecimalSeparatorCommaCount = 0;
            opt.m_DecimalSeparatorDotCount   = 0;
            for (int i = 0; i < result.Count; i++)
            {
                opt.m_DecimalSeparatorDotCount   += ((AsciiLineAnalyzer)result[i]).structure[nBestSeparator].DecimalSeparatorDotCount;
                opt.m_DecimalSeparatorCommaCount += ((AsciiLineAnalyzer)result[i]).structure[nBestSeparator].DecimalSeparatorCommaCount;
            }



            return(opt);
        }
Esempio n. 24
0
        CCallStack AnalyzeMap(string bugtrapfile, string mapfile)
        {
            CCallStack callstack = new CCallStack();

            System.Collections.SortedList address_list      = new System.Collections.SortedList();
            System.Collections.SortedList find_address_list = new System.Collections.SortedList();

            System.IO.StreamReader reader = new System.IO.StreamReader(bugtrapfile);
            string xmlstring = reader.ReadToEnd();

            reader.Close();

            System.Xml.XmlDocument document = new System.Xml.XmlDocument();
            document.LoadXml(xmlstring);

            System.Xml.XPath.XPathNavigator    nav = document.CreateNavigator();
            System.Xml.XPath.XPathNodeIterator i;

            string what   = System.Convert.ToString(nav.SelectSingleNode("/report/error/what/text()"));
            string module = System.IO.Path.GetFileName(System.Convert.ToString(nav.SelectSingleNode("/report/error/module/text()")));
            string tmp    = System.Convert.ToString(nav.SelectSingleNode("/report/error/address/text()"));

            if (tmp == "" || tmp.Trim().Length < 1)
            {
                return(null);
            }

            UInt32 address = System.Convert.ToUInt32(tmp.Substring(tmp.Length - 8), 16);

            i = nav.Select("/report/threads/thread/status[text()='interrupted']/../stack/frame");

            System.Collections.ArrayList frame_list = new System.Collections.ArrayList();
            while (i.MoveNext() == true)
            {
                Frame frame = new Frame();

                frame.module = System.IO.Path.GetFileName(System.Convert.ToString(i.Current.SelectSingleNode("module/text()")));
                string frame_address = System.Convert.ToString(i.Current.SelectSingleNode("address/text()"));

                string function_name   = null;
                string function_offset = null;

                if (i.Current.SelectSingleNode("function/name/text()") != null)
                {
                    function_name = System.Convert.ToString(i.Current.SelectSingleNode("function/name/text()"));
                }

                if (i.Current.SelectSingleNode("function/offset/text()") != null)
                {
                    function_offset = System.Convert.ToString(i.Current.SelectSingleNode("function/offset/text()"));
                }

                frame.address = System.Convert.ToUInt32(frame_address.Substring(frame_address.Length - 8), 16);

                if (address_list.Contains(frame.address) == false &&
                    find_address_list.Contains(frame.address) == false)
                {
                    if (function_name == null)
                    {
                        address_list.Add(frame.address, null);
                    }
                    else
                    {
                        if (function_offset == null)
                        {
                            find_address_list.Add(frame.address, function_name);
                        }
                        else
                        {
                            find_address_list.Add(frame.address, string.Format("{0}+0x{1:x}", function_name, function_offset));
                        }
                    }
                }

                frame_list.Add(frame);
            }

            if (address_list.Contains(address) == false &&
                find_address_list.Contains(address) == false)
            {
                address_list.Add(address, null);
            }

            UInt32 baseaddress = 0;

            reader = new System.IO.StreamReader(mapfile);

            while (reader.EndOfStream == false)
            {
                string   line = reader.ReadLine();
                string[] e    = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (e.Length >= 5 && e[0] == "Preferred")
                {
                    baseaddress = System.Convert.ToUInt32(e[4], 16);
                    break;
                }
            }

            while (reader.EndOfStream == false)
            {
                string   line = reader.ReadLine();
                string[] e    = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (e.Length >= 5 && e[0] == "Address")
                {
                    break;
                }
            }

            string old_name    = "";
            UInt32 old_address = 0;

            while (reader.EndOfStream == false && address_list.Count > 0)
            {
                string   line = reader.ReadLine();
                string[] e    = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                UInt32 map_address  = System.Convert.ToUInt32(e[2], 16);
                UInt32 list_address = (UInt32)address_list.GetKey(0);
                if (list_address <= map_address)
                {
                    address_list.RemoveAt(0);
                    e[1] = ConvertUname(old_name);
                    find_address_list.Add(list_address, string.Format("{0}+0x{1:x}", e[1], list_address - old_address));
                }

                old_name    = e[1];
                old_address = map_address;
            }
            reader.Close();

            if (find_address_list.Contains(address) == true)
            {
                string fcs = find_address_list[address].ToString();
                int    pi  = fcs.IndexOf("+");
                if (pi > 0)
                {
                    callstack.FinalCallstack = String.Format("{0}!{1}", module.ToLower(), fcs.Substring(0, pi));
                }
                else
                {
                    callstack.FinalCallstack = String.Format("{0}!{1}", module.ToLower(), fcs);
                }
            }
            else
            {
                callstack.FinalCallstack = "Unknown Address";
            }


            foreach (Frame frame in frame_list)
            {
                if (find_address_list.Contains(frame.address) == true)
                {
                    callstack.CallStack += string.Format("{0:x8} {1} {2}\n", frame.address, frame.module.ToLower(), find_address_list[frame.address]);
                }
                else
                {
                    callstack.CallStack += string.Format("{0:x8} {1}\n", frame.address, frame.module.ToLower());
                }
            }

            return(callstack);
        }
Esempio n. 25
0
		/// <summary>
		/// Creates a matrix from three selected columns. This must be a x-column, a y-column, and a value column.
		/// </summary>
		/// <param name="xcol">Column of x-values.</param>
		/// <param name="ycol">Column of y-values.</param>
		/// <param name="vcol">Column of v-values.</param>
		/// <param name="originalTable">The source table. This is only needed to get the names of the columns.</param>
		/// <param name="newtable">On return, contains the newly created table matrix.</param>
		/// <returns>Null if no error occurs, or an error message.</returns>
		public static string XYVToMatrix(DataColumn xcol, DataColumn ycol, DataColumn vcol, DataTable originalTable, out DataTable newtable)
		{
			newtable = null;
			System.Collections.SortedList xx = new System.Collections.SortedList();
			System.Collections.SortedList yy = new System.Collections.SortedList();
			int len = xcol.Count;
			len = Math.Min(len, ycol.Count);
			len = Math.Min(len, vcol.Count);

			// Fill the xx and yy lists
			for (int i = 0; i < len; ++i)
			{
				if (!xx.Contains(xcol[i]))
					xx.Add(xcol[i], null);

				if (!yy.Contains(ycol[i]))
					yy.Add(ycol[i], null);
			}

			DataColumn xnew = (DataColumn)Activator.CreateInstance(xcol.GetType());
			DataColumn ynew = (DataColumn)Activator.CreateInstance(ycol.GetType());
			xnew.Clear();
			ynew.Clear();

			for (int i = xx.Count - 1; i >= 0; --i)
			{
				xnew[i] = (AltaxoVariant)xx.GetKey(i);
				xx[xx.GetKey(i)] = i;
			}

			for (int i = yy.Count - 1; i >= 0; --i)
			{
				ynew[1 + i] = (AltaxoVariant)yy.GetKey(i); // 1 + is because the table will get an additional x-column
				yy[yy.GetKey(i)] = i;
			}

			DataColumn vtemplate = (DataColumn)Activator.CreateInstance(vcol.GetType());

			// make a new table with yy.Count number of columns
			DataColumn[] vcols = new DataColumn[yy.Count];
			for (int i = yy.Count - 1; i >= 0; --i)
			{
				vcols[i] = (DataColumn)vtemplate.Clone();
			}

			// now fill the columns
			for (int i = 0; i < len; ++i)
			{
				int xidx = (int)xx[xcol[i]];
				int yidx = (int)yy[ycol[i]];

				vcols[yidx][xidx] = vcol[i];
			}

			// assemble all columns together in a table
			newtable = new DataTable();

			// add the x-column to the data collection
			string xname = null;
			if (null != originalTable)
				xname = originalTable.DataColumns.GetNameOfChildObject(xcol);
			if (string.IsNullOrEmpty(xname))
				xname = "X";
			newtable.DataColumns.Add(xnew, xname, ColumnKind.X, 0);

			// add the y-column to the property collection
			string yname = null;
			if (null != originalTable)
				yname = originalTable.DataColumns.GetNameOfChildObject(ycol);
			if (string.IsNullOrEmpty(yname))
				yname = "Y";
			newtable.PropertyColumns.Add(ynew, yname, ColumnKind.Y, 0);

			// add the v-columns to the data collection
			string vname = null;
			if (null != originalTable)
				vname = originalTable.DataColumns.GetNameOfChildObject(vcol);
			if (string.IsNullOrEmpty(vname))
				vname = "V";
			for (int i = 0; i < vcols.Length; ++i)
				newtable.DataColumns.Add(vcols[i], vname + i.ToString(), ColumnKind.V, 0);

			return null;
		}
        protected override void vRefreshProdutosAssociados(ref mdlComponentesGraficos.TreeView tvProdutosAssociados)
        {
            tvProdutosAssociados.Nodes.Clear();
            System.Windows.Forms.TreeNode tvnClassificacao;
            System.Windows.Forms.TreeNode tvnProduto;

            // Produtos Certificado
            System.Collections.ArrayList arlProdutosCertificado = arlProdutosCertificadoOrigem();

            // Classificacao - Ordenamento
            System.Collections.SortedList sortListClassificacao = new System.Collections.SortedList();
            for (int j = 0; j < arlProdutosCertificado.Count; j++)
            {
                mdlDataBaseAccess.Tabelas.XsdTbProdutosCertificadoOrigem.tbProdutosCertificadoOrigemRow dtrwProdutoCertificado = (mdlDataBaseAccess.Tabelas.XsdTbProdutosCertificadoOrigem.tbProdutosCertificadoOrigemRow)arlProdutosCertificado[j];
                if (dtrwProdutoCertificado.RowState != System.Data.DataRowState.Deleted)
                {
                    // Classificacao
                    string strClassificacao = strRetornaClassificacao(dtrwProdutoCertificado.idOrdemProduto);

                    // Denominacao
                    string strDenominacao = "";
                    if (!dtrwProdutoCertificado.IsmstrDenominacaoNull())
                    {
                        strDenominacao = dtrwProdutoCertificado.mstrDenominacao;
                    }
                    else
                    {
                        strDenominacao = strRetornaDenominacao(dtrwProdutoCertificado.idOrdemProduto);
                    }
                    if (!sortListClassificacao.ContainsKey(strClassificacao + strDenominacao))
                    {
                        sortListClassificacao.Add(strClassificacao + strDenominacao, strClassificacao);
                    }
                }
            }

            // Classificacao - Insercao
            for (int j = 0; j < sortListClassificacao.Count; j++)
            {
                string strClassificacaoDenominacao = sortListClassificacao.GetKey(j).ToString();
                string strClassificacao            = sortListClassificacao.GetByIndex(j).ToString();
                string strDenominacao = strClassificacaoDenominacao.Substring(strClassificacao.Length);
                tvnClassificacao     = tvProdutosAssociados.Nodes.Add(strClassificacao + " : " + strDenominacao);
                tvnClassificacao.Tag = strClassificacao;

                // Produtos - Ordenamento
                System.Collections.SortedList sortListProdutos = new System.Collections.SortedList();
                for (int k = 0; k < arlProdutosCertificado.Count; k++)
                {
                    mdlDataBaseAccess.Tabelas.XsdTbProdutosCertificadoOrigem.tbProdutosCertificadoOrigemRow dtrwProdutoCertificado = (mdlDataBaseAccess.Tabelas.XsdTbProdutosCertificadoOrigem.tbProdutosCertificadoOrigemRow)arlProdutosCertificado[k];
                    if (dtrwProdutoCertificado.RowState != System.Data.DataRowState.Deleted)
                    {
                        string strClassificacaoProduto = strRetornaClassificacao(dtrwProdutoCertificado.idOrdemProduto);
                        if (strClassificacaoProduto == strClassificacao)
                        {
                            string strDescricao = "";
                            if (!dtrwProdutoCertificado.IsmstrDescricaoNull())
                            {
                                strDescricao = dtrwProdutoCertificado.mstrDescricao;
                            }
                            else
                            {
                                strDescricao = strRetornaDescricaoProduto(dtrwProdutoCertificado.idOrdemProduto);
                            }
                            if (strDescricao != "")
                            {
                                if (!sortListProdutos.ContainsKey(strDescricao))
                                {
                                    sortListProdutos.Add(strDescricao, dtrwProdutoCertificado.idOrdemProduto);
                                }
                            }
                        }
                    }
                }

                // Produtos - Insercao
                for (int k = 0; k < sortListProdutos.Count; k++)
                {
                    string strDescricaoProduto = sortListProdutos.GetKey(k).ToString();
                    tvnProduto     = tvnClassificacao.Nodes.Add(strDescricaoProduto);
                    tvnProduto.Tag = sortListProdutos.GetByIndex(k).ToString();
                }
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Creates a matrix from three selected columns. This must be a x-column, a y-column, and a value column.
        /// </summary>
        /// <param name="xcol">Column of x-values.</param>
        /// <param name="ycol">Column of y-values.</param>
        /// <param name="vcol">Column of v-values.</param>
        /// <param name="newtable">On return, contains the newly created table matrix.</param>
        /// <returns>Null if no error occurs, or an error message.</returns>
        public static string XYVToMatrix(DataColumn xcol, DataColumn ycol, DataColumn vcol, out DataTable newtable)
        {
            newtable = null;
            System.Collections.SortedList xx = new System.Collections.SortedList();
            System.Collections.SortedList yy = new System.Collections.SortedList();
            int len = xcol.Count;

            len = Math.Min(len, ycol.Count);
            len = Math.Min(len, vcol.Count);

            // Fill the xx and yy lists
            for (int i = 0; i < len; ++i)
            {
                if (!xx.Contains(xcol[i]))
                {
                    xx.Add(xcol[i], null);
                }

                if (!yy.Contains(ycol[i]))
                {
                    yy.Add(ycol[i], null);
                }
            }

            DataColumn xnew = (DataColumn)Activator.CreateInstance(xcol.GetType());
            DataColumn ynew = (DataColumn)Activator.CreateInstance(ycol.GetType());

            xnew.Clear();
            ynew.Clear();

            for (int i = xx.Count - 1; i >= 0; --i)
            {
                xnew[i]          = (AltaxoVariant)xx.GetKey(i);
                xx[xx.GetKey(i)] = i;
            }

            for (int i = yy.Count - 1; i >= 0; --i)
            {
                ynew[1 + i]      = (AltaxoVariant)yy.GetKey(i); // 1 + is because the table will get an additional x-column
                yy[yy.GetKey(i)] = i;
            }

            DataColumn vtemplate = (DataColumn)Activator.CreateInstance(vcol.GetType());

            // make a new table with yy.Count number of columns
            DataColumn[] vcols = new DataColumn[yy.Count];
            for (int i = yy.Count - 1; i >= 0; --i)
            {
                vcols[i] = (DataColumn)vtemplate.Clone();
            }

            // now fill the columns
            for (int i = 0; i < len; ++i)
            {
                int xidx = (int)xx[xcol[i]];
                int yidx = (int)yy[ycol[i]];

                vcols[yidx][xidx] = vcol[i];
            }

            // assemble all columns together in a table
            newtable = new DataTable();
            newtable.DataColumns.Add(xnew, "X", ColumnKind.X, 0);
            newtable.PropertyColumns.Add(ynew, "Y", ColumnKind.Y, 0);

            for (int i = 0; i < vcols.Length; ++i)
            {
                newtable.DataColumns.Add(vcols[i], "V" + i.ToString(), ColumnKind.V, 0);
            }

            return(null);
        }
Esempio n. 28
0
        /// <summary>
        /// Finds the nearest point to the requested location that is within the tolerance radius.
        /// </summary>
        /// <param name="ProjectedRadius">The tolerance radius in projected units used to search for the nearest point that can be snapped to. </param>
        /// <param name="x">x coordinate in projected map units</param>
        /// <param name="y">y coordinate in projected map units</param>
        /// <param name="BestPoint">A PointD class with the location of the nearest point to snap to if there is are any within the tolerance, null if no points are found.</param>
        /// <returns>Returns true if there is a point to snap to.</returns>
        public bool CanSnap(double ProjectedRadius, double x, double y, ref System.Collections.ArrayList BestPoints)
        {
            PointD BestPoint = null;

            System.Collections.IDictionaryEnumerator ie = m_lists.GetEnumerator();

            while (ie.MoveNext())
            {
                int snaplayeridx = (int)ie.Key;

                if (((System.Collections.SortedList)m_lists[snaplayeridx]).Count == 0)
                {
                    continue;
                }

                try
                {
                    double val = (x - ProjectedRadius);
                    int    first = FindFirst(((System.Collections.SortedList)m_lists[snaplayeridx]), val);
                    double bestX = x + ProjectedRadius, bestY = y + ProjectedRadius;
                    double curX;

                    if (first == -1)
                    {
                        System.Diagnostics.Debug.WriteLine("Could not find any points to snap to");
                        return(false);
                    }

                    curX = (double)((System.Collections.SortedList)m_lists[snaplayeridx]).GetKey(first);

                    while (curX < (x + ProjectedRadius))
                    {
                        if (Math.Abs(curX - x) < Math.Abs(bestX - x))
                        {       // the current x is closer to the x value than the previous best
                            // now we think we have a new best x, try to find a better y value
                            System.Collections.SortedList tList = (System.Collections.SortedList)((System.Collections.SortedList)m_lists[snaplayeridx]).GetByIndex(first);
                            for (int j = 0; j < tList.Count; j++)
                            {
                                double curY = (double)tList.GetKey(j);

                                if (Math.Abs(curY - y) < Math.Abs(bestY - y))
                                {       // the current y is closer to the y value than the previous best
                                    BestPoint = new PointD(curX, curY);
                                    if (BestPoints == null)
                                    {
                                        BestPoints = new System.Collections.ArrayList();
                                    }
                                    BestPoints.AddRange((System.Collections.ArrayList)tList.GetByIndex(j));

                                    // only reset the bestX and bestY when both are better than the previous.
                                    bestX = curX;
                                    bestY = curY;
                                }
                            }
                        }
                        first++;
                        if (first < ((System.Collections.SortedList)m_lists[snaplayeridx]).Count)
                        {
                            curX = (double)((System.Collections.SortedList)m_lists[snaplayeridx]).GetKey(first);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    errCnt++;
                    System.Diagnostics.Debug.WriteLine(errCnt + " " + ex.Message);
                }
            }

            if (BestPoints == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private void vRefreshProdutos(ref mdlComponentesGraficos.TreeView tvProdutos)
        {
            tvProdutos.Nodes.Clear();
            System.Collections.ArrayList arlProdutosNaoAssociados = arlProdutosFaturaNaoAssociadosCertificados();

            // Classificacao Ordenando
            string strClassificacao = "";
            string strDenominacao   = "";

            System.Collections.SortedList sortLstClassificacao = new System.Collections.SortedList();
            for (int i = 0; i < arlProdutosNaoAssociados.Count; i++)
            {
                mdlDataBaseAccess.Tabelas.XsdTbProdutosFaturaComercial.tbProdutosFaturaComercialRow dtrwProdutoFatura = (mdlDataBaseAccess.Tabelas.XsdTbProdutosFaturaComercial.tbProdutosFaturaComercialRow)arlProdutosNaoAssociados[i];
                mdlDataBaseAccess.Tabelas.XsdTbProdutos.tbProdutosRow dtrwProduto = m_typDatSetTbProdutos.tbProdutos.FindByidExportadoridProduto(m_nIdExportador, dtrwProdutoFatura.idProduto);
                if ((dtrwProdutoFatura != null) && (dtrwProdutoFatura.IsnIdOrdemProdutoParentNull() || dtrwProdutoFatura.nIdOrdemProdutoParent == 0) && (dtrwProduto != null))
                {
                    switch (m_enumClassificacao)
                    {
                    case Classificacao.Ncm:
                        if (!dtrwProdutoFatura.IsstrNcmNull())
                        {
                            strClassificacao = dtrwProdutoFatura.strNcm;
                        }
                        else if (!dtrwProduto.IsstrNcmNull())
                        {
                            strClassificacao = dtrwProduto.strNcm;
                        }
                        else
                        {
                            strClassificacao = "";
                        }
                        if (!dtrwProdutoFatura.IsmstrNcmDenominacaoNull())
                        {
                            strDenominacao = dtrwProdutoFatura.mstrNcmDenominacao;
                        }
                        else
                        {
                            mdlDataBaseAccess.Tabelas.XsdTbProdutosNcm.tbProdutosNcmRow dtrwNcm = m_typDatSetTbProdutosNcm.tbProdutosNcm.FindBynIdExportadorstrNcm(m_nIdExportador, strClassificacao);
                            if (dtrwNcm != null)
                            {
                                strDenominacao = dtrwNcm.mstrDenominacao;
                            }
                            else
                            {
                                strDenominacao = "";
                            }
                        }
                        if (strClassificacao != "")
                        {
                            if (!sortLstClassificacao.ContainsKey(strClassificacao + strDenominacao))
                            {
                                sortLstClassificacao.Add(strClassificacao + strDenominacao, strClassificacao);
                            }
                        }
                        break;

                    case Classificacao.Naladi:
                        if (!dtrwProdutoFatura.IsstrNaladiNull())
                        {
                            strClassificacao = dtrwProdutoFatura.strNaladi;
                        }
                        else if (!dtrwProduto.IsstrNaladiNull())
                        {
                            strClassificacao = dtrwProduto.strNaladi;
                        }
                        else
                        {
                            strClassificacao = "";
                        }
                        if (!dtrwProdutoFatura.IsmstrNaladiDenominacaoNull())
                        {
                            strDenominacao = dtrwProdutoFatura.mstrNaladiDenominacao;
                        }
                        else
                        {
                            mdlDataBaseAccess.Tabelas.XsdTbProdutosNaladi.tbProdutosNaladiRow dtrwNaladi = m_typDatSetTbProdutosNaladi.tbProdutosNaladi.FindBynIdExportadorstrNaladi(m_nIdExportador, strClassificacao);
                            if (dtrwNaladi != null)
                            {
                                strDenominacao = dtrwNaladi.mstrDenominacao;
                            }
                            else
                            {
                                strDenominacao = "";
                            }
                        }
                        if (strClassificacao != "")
                        {
                            if (!sortLstClassificacao.ContainsKey(strClassificacao + strDenominacao))
                            {
                                sortLstClassificacao.Add(strClassificacao + strDenominacao, strClassificacao);
                            }
                        }
                        break;
                    }
                }
            }

            // Classificacao Inserindo
            string strClassificacaoProduto, strDenominacaoProduto;

            for (int i = 0; i < sortLstClassificacao.Count; i++)
            {
                string strClassificacaoDenominacao = sortLstClassificacao.GetKey(i).ToString();
                strClassificacao = sortLstClassificacao.GetByIndex(i).ToString();
                strDenominacao   = strClassificacaoDenominacao.Substring(strClassificacao.Length);

                System.Windows.Forms.TreeNode tvnClassificacao = tvProdutos.Nodes.Add(strClassificacao + " " + strDenominacao);
                System.Windows.Forms.TreeNode tvnProduto       = null;
                tvnClassificacao.Tag = strClassificacao;

                // Produtos Inserindo
                for (int j = 0; j < arlProdutosNaoAssociados.Count; j++)
                {
                    mdlDataBaseAccess.Tabelas.XsdTbProdutosFaturaComercial.tbProdutosFaturaComercialRow dtrwProdutoFatura = (mdlDataBaseAccess.Tabelas.XsdTbProdutosFaturaComercial.tbProdutosFaturaComercialRow)arlProdutosNaoAssociados[j];
                    mdlDataBaseAccess.Tabelas.XsdTbProdutos.tbProdutosRow dtrwProduto = m_typDatSetTbProdutos.tbProdutos.FindByidExportadoridProduto(m_nIdExportador, dtrwProdutoFatura.idProduto);
                    if (dtrwProduto != null)
                    {
                        switch (m_enumClassificacao)
                        {
                        case Classificacao.Ncm:
                            if (!dtrwProdutoFatura.IsstrNcmNull())
                            {
                                strClassificacaoProduto = dtrwProdutoFatura.strNcm;
                            }
                            else if (!dtrwProduto.IsstrNcmNull())
                            {
                                strClassificacaoProduto = dtrwProduto.strNcm;
                            }
                            else
                            {
                                strClassificacaoProduto = "";
                            }
                            if (!dtrwProdutoFatura.IsmstrNcmDenominacaoNull())
                            {
                                strDenominacaoProduto = dtrwProdutoFatura.mstrNcmDenominacao;
                            }
                            else
                            {
                                mdlDataBaseAccess.Tabelas.XsdTbProdutosNcm.tbProdutosNcmRow dtrwNcm = m_typDatSetTbProdutosNcm.tbProdutosNcm.FindBynIdExportadorstrNcm(m_nIdExportador, strClassificacaoProduto);
                                if (dtrwNcm != null)
                                {
                                    strDenominacaoProduto = dtrwNcm.mstrDenominacao;
                                }
                                else
                                {
                                    strDenominacaoProduto = "";
                                }
                            }
                            if (strClassificacaoDenominacao == strClassificacaoProduto + strDenominacaoProduto)
                            {
                                tvnProduto     = tvnClassificacao.Nodes.Add(dtrwProduto.mstrDescricao);
                                tvnProduto.Tag = dtrwProdutoFatura.idOrdem;
                            }
                            break;

                        case Classificacao.Naladi:
                            if (!dtrwProdutoFatura.IsstrNaladiNull())
                            {
                                strClassificacaoProduto = dtrwProdutoFatura.strNaladi;
                            }
                            else if (!dtrwProduto.IsstrNaladiNull())
                            {
                                strClassificacaoProduto = dtrwProduto.strNaladi;
                            }
                            else
                            {
                                strClassificacaoProduto = "";
                            }
                            if (!dtrwProdutoFatura.IsmstrNaladiDenominacaoNull())
                            {
                                strDenominacaoProduto = dtrwProdutoFatura.mstrNaladiDenominacao;
                            }
                            else
                            {
                                mdlDataBaseAccess.Tabelas.XsdTbProdutosNaladi.tbProdutosNaladiRow dtrwNaladi = m_typDatSetTbProdutosNaladi.tbProdutosNaladi.FindBynIdExportadorstrNaladi(m_nIdExportador, strClassificacao);
                                if (dtrwNaladi != null)
                                {
                                    strDenominacaoProduto = dtrwNaladi.mstrDenominacao;
                                }
                                else
                                {
                                    strDenominacaoProduto = "";
                                }
                            }
                            if (strClassificacaoDenominacao == strClassificacaoProduto + strDenominacaoProduto)
                            {
                                tvnProduto     = tvnClassificacao.Nodes.Add(dtrwProduto.mstrDescricao);
                                tvnProduto.Tag = dtrwProdutoFatura.idOrdem;
                            }
                            break;
                        }
                    }
                }
            }
        }