Пример #1
0
        public void AssemblyScanTestMethod()
        {
            Scanner scaner = new Scanner();

            scaner.AssemblyLoad("D:\\Bsuir\\SPP\\CCP_Lab_1_Tracer\\CCP_Lab_1_Tracer\\bin\\Debug\\netcoreapp3.1\\CCP_Lab_1_Tracer.dll");
            var inf     = scaner.AssemblyScan();
            var infoCel = new InfoCell();

            Assert.AreEqual(infoCel.GetType(), inf.GetType());
        }
Пример #2
0
        private void btnOpenFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            DataSet        ds             = new DataSet();

            if (openFileDialog.ShowDialog() == true)
            {
                scanner.AssemblyLoad(openFileDialog.FileName);
            }
            info = scanner.AssemblyScan();
            var nodes = new List <InfoCell>();

            nodes.Add(info);
            assembly_info.ItemsSource = nodes;
        }
Пример #3
0
        private static void SetSummarizeField(Range cell, InfoCell infoCell, int index)
        {
            var sumInfoCell = new InfoCell(cell.Worksheet.Index, infoCell.ColNumber + index - 1, infoCell.RowNumber - 1, "=SUM(${0}${1}:${2}{3})", false);

            cell.Value2 = string.Empty;

            cell.Formula = string.Format(sumInfoCell.Value, sumInfoCell.ColString, sumInfoCell.RowNumber, sumInfoCell.ColString, sumInfoCell.RowNumber);

            cell.Calculate();
        }
Пример #4
0
        private static object GetValue(Range cell, Domain domain, InfoCell infoCell)
        {
            var childDomain = domain.GetChildDomain(infoCell.DomainId);

            if (childDomain != null)
            {
                SetFormat(cell, childDomain);

                if (childDomain.Value != null)
                {
                    if (childDomain is EntityDomain)
                    {
                        return childDomain.ObjectValue.ToString();
                    }
                    if (childDomain.Type.IsEnum)
                    {
                        return childDomain.Value.ToString();
                    }
                    if (childDomain.IsNumeric && childDomain.Format != null && childDomain.Value != null)
                        return string.Format(string.Concat("{0:", childDomain.Format.GetFirstExpressionFormat(childDomain), "}"), childDomain.Value);

                    return childDomain.Value;
                }
                if (childDomain.Format != null)
                {
                    var arrayList = new System.Collections.ArrayList(childDomain.Format.GetEvaluatedParameters(childDomain));
                    arrayList.Insert(0, !(childDomain is EntityDomain) ? childDomain.Value : string.Empty);
                    return string.Format(childDomain.Format.Expression, arrayList.ToArray());
                }
            }

            return string.Empty;
        }
Пример #5
0
        private static void FormatRange(Worksheet worksheet, InfoCell firstInfo, InfoCell lastInfo, int rowCount)
        {
            if (rowCount > 1)
            {
                var sourceRange = worksheet.Range[worksheet.Cells[firstInfo.RowNumber, firstInfo.ColNumber], worksheet.Cells[lastInfo.RowNumber, lastInfo.ColNumber]];
                var destinationRange = worksheet.Range[worksheet.Cells[firstInfo.RowNumber + 1, firstInfo.ColNumber], worksheet.Cells[lastInfo.RowNumber + rowCount - 1, lastInfo.ColNumber]];

                sourceRange.Copy(destinationRange);

                destinationRange.RowHeight = sourceRange.Resize.RowHeight;
            }
        }