public override bool ExtractFrom(string aLine, bool aForceExtractionOfThreadIdentifier)
        {
            // First pass identification stage
            string line    = aLine;
            bool   handled = (iPrefix.Length == 0);

            if (!handled)
            {
                // Check for prefix match
                handled = aLine.Contains(iPrefix);
                if (handled)
                {
                    // Check that it's not the start of a new data set
                    if (!aForceExtractionOfThreadIdentifier && aLine.Contains(KHeapDataDataSetStartMarker))     // "HEAP INFO FOR THREAD"
                    {
                        handled = false;
                    }
                    else
                    {
                        int pos = aLine.IndexOf(iPrefix);
                        line = aLine.Substring(pos + iPrefix.Length);
                    }
                }
            }

            // Data processing stage
            if (handled)
            {
                ExtractedData data = PrepareExtractedData(line, aLine);
                base.Interpreter.Interpret(data);
            }

            // Done
            return(handled);
        }
Beispiel #2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="ClangLibCpp"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public ClangLibCpp(Variable variable, object savedData)
            {
                data    = (ExtractedData)savedData;
                address = variable.GetPointerAddress();
                ulong stringAddress = data.Process.ReadPointer(address + (uint)data.PointerOffset);
                bool  localData     = stringAddress == 0;

                if (localData)
                {
                    stringAddress = address + (uint)data.BufferOffset;
                }
                bool bigEndian = true; // TODO:

                if (localData)
                {
                    length = data.ReadShortDataLength(address);
                    if (bigEndian)
                    {
                        length = length >> 1;
                    }
                }
                else
                {
                    length = data.ReadLongDataLength(address);
                }
                if (localData)
                {
                    reserved = data.BufferLength;
                }
                else
                {
                    reserved = data.ReadCapacity(address);
                }
                text = UserMember.Create(() => data.Process.ReadString(stringAddress, data.CharSize, length));
            }
Beispiel #3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="VisualStudio"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public VisualStudio(Variable variable, object savedData)
            {
                ExtractedData data    = (ExtractedData)savedData;
                ulong         address = variable.GetPointerAddress();

                list = UserMember.Create(() => new list <pair <TKey, TValue> >(Variable.Create(data.ListCodeType, address + (uint)data.ListOffset)));
            }
Beispiel #4
0
            /// <summary>
            /// Initializes a new instance of the <see cref="ArrayBase"/> class.
            /// </summary>
            /// <param name="variable">The value.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public ArrayBase(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong address = variable.GetPointerAddress();

                firstElementAddress = address + (uint)data.FirstElementOffset;
            }
Beispiel #5
0
            /// <summary>
            /// Initializes a new instance of the <see cref="ListBase"/> class.
            /// </summary>
            /// <param name="variable">The value.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public ListBase(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong address = variable.GetPointerAddress();

                length      = data.ReadLength(address);
                headAddress = data.Process.ReadPointer(address + (uint)data.HeadOffset);
            }
Beispiel #6
0
            /// <summary>
            /// Initializes a new instance of the <see cref="OptionalBase"/> class.
            /// </summary>
            /// <param name="variable">The value.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public OptionalBase(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong address = variable.GetPointerAddress();

                valueAddress = address + (uint)data.ValueOffset;
                HasValue     = data.Process.ReadByte(address + (uint)data.HasValueOffset) != 0;
            }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualStudio"/> class.
 /// </summary>
 /// <param name="variable">The variable.</param>
 /// <param name="savedData">Data returned from VerifyCodeType function.</param>
 public VisualStudio(Variable variable, object savedData)
 {
     data     = (ExtractedData)savedData;
     address  = variable.GetPointerAddress();
     length   = data.ReadSize(address);
     reserved = data.ReadReserved(address);
     text     = UserMember.Create(() => GetText());
 }
Beispiel #8
0
            /// <summary>
            /// Initializes a new instance of the <see cref="VectorBase"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public VectorBase(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong address = variable.GetPointerAddress();

                firstAddress = data.Process.ReadPointer(address + (uint)data.FirstOffset);
                lastAddress  = data.Process.ReadPointer(address + (uint)data.LastOffset);
                endAddress   = data.Process.ReadPointer(address + (uint)data.EndOffset);
            }
Beispiel #9
0
            /// <summary>
            /// Initializes a new instance of the <see cref="SharedPtrBase"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public SharedPtrBase(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong address = variable.GetPointerAddress();

                pointerAddress          = data.Process.ReadPointer(address + (uint)data.PointerOffset);
                referenceCountAddress   = data.Process.ReadPointer(address + (uint)data.ReferenceCountPointerOffset);
                isCreatedWithMakeShared = UserMember.Create(() => data.TestCreatedWithMakeShared(Variable.Create(data.ReferenceCountCodeType, referenceCountAddress).DowncastInterface().GetCodeType()));
            }
Beispiel #10
0
            /// <summary>
            /// Initializes a new instance of the <see cref="VisualStudioBool" /> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public VisualStudioBool(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong    address        = variable.GetPointerAddress();
                Variable vectorVariable = Variable.Create(data.CompressedVectorCodeType, address + (uint)data.CompressedVectorOffset);

                compressedVector = new vector <uint>(vectorVariable);
                Count            = data.ReadLength(address);
            }
Beispiel #11
0
            /// <summary>
            /// Initializes a new instance of the <see cref="LibStdCpp6_NoAbi"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public LibStdCpp6_NoAbi(Variable variable, object savedData)
            {
                data    = (ExtractedData)savedData;
                address = variable.GetPointerAddress();
                ulong stringAddress = data.Process.ReadPointer(address + (uint)data.PointerOffset);

                length   = data.ReadLength(stringAddress);
                reserved = data.ReadCapacity(stringAddress);
                text     = UserMember.Create(() => data.Process.ReadString(stringAddress, data.CharSize, length));
            }
Beispiel #12
0
 // ConvertBack method is from Target to Source
 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     try
     {
         return(ExtractedData.ParseTime((string)value));
     }
     catch
     {
         return(null);
     }
 }
        private ExtractedData PrepareExtractedData(string aLine, string aOriginalLine)
        {
            ExtractedData ret = null;

            // We need the heap base address before we are able to start
            // extracting binary data.
            DataSource ds = Interpreter.DataSource;

            Elements.MetaData      metaData = ds.MetaData;
            Elements.Groups.GpHeap heapInfo = metaData.Heap;
            uint baseAddress = heapInfo.HeapBaseAddress;

            if (baseAddress != 0)
            {
                // We can now work out the next expected address
                uint nextExpectedAddress = baseAddress + (uint)metaData.HeapData.Count;

                // Build our regex string that will match the binary heap data.
                string prefix = string.Format("{0:x8}: ", nextExpectedAddress);
                int    pos    = aLine.IndexOf(prefix);
                if (pos >= 0)
                {
                    Match m = KHeapDataRegEx.Match(aLine);
                    if (m.Success)
                    {
                        List <byte> bytes = new List <byte>();
                        //
                        CaptureCollection data = m.Groups["Data"].Captures;
                        foreach (Capture dataItem in data)
                        {
                            string hexValue = dataItem.Value.Trim();
                            uint   byteVal  = System.Convert.ToUInt32(hexValue, KBaseHex);
                            bytes.Add((byte)byteVal);
                        }
                        //
                        ret = ExtractedData.NewBinaryData(bytes.ToArray(), aOriginalLine);
                    }
                }
                //
                if (ret == null)
                {
                    ret = ExtractedData.NewText(aLine, aOriginalLine);
                }
            }
            else
            {
                ret = ExtractedData.NewText(aLine, aOriginalLine);
            }
            //
            return(ret);
        }
Beispiel #14
0
            /// <summary>
            /// Initializes a new instance of the <see cref="ClangLibCpp"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public ClangLibCpp(Variable variable, object savedData)
            {
                data    = (ExtractedData)savedData;
                address = variable.GetPointerAddress();
                ulong managerAddress = data.Process.ReadPointer(address + (uint)data.ManagerPointerOffset);

                if (managerAddress != 0)
                {
                    Tuple <string, ulong> nameAndOffset = Context.SymbolProvider.GetSymbolNameByAddress(data.Process, managerAddress);

                    if (nameAndOffset != null)
                    {
                        managerName = nameAndOffset.Item1;
                    }
                }
                if (HasValue)
                {
                    string codeTypeName;
                    string handlerCodeTypeName;

                    if (IsSmall)
                    {
                        string moduleName = managerName.Substring(0, managerName.IndexOf('!') + 1);

                        codeTypeName        = moduleName + managerName.Substring(moduleName.Length + SmallHandlerNameStart.Length, managerName.Length - moduleName.Length - SmallHandlerNameStart.Length - SmallHandlerNameEnd.Length);
                        handlerCodeTypeName = $"{moduleName}std::__1::__any_imp::_SmallHandler<{codeTypeName.Substring(moduleName.Length)}>";
                    }
                    else if (IsLarge)
                    {
                        string moduleName = managerName.Substring(0, managerName.IndexOf('!') + 1);

                        codeTypeName        = moduleName + managerName.Substring(moduleName.Length + LargeHandlerNameStart.Length, managerName.Length - moduleName.Length - LargeHandlerNameStart.Length - LargeHandlerNameEnd.Length);
                        handlerCodeTypeName = $"{moduleName}std::__1::__any_imp::_LargeHandler<{codeTypeName.Substring(moduleName.Length)}>";
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }

                    CodeType handlerCodeType = CodeType.Create(handlerCodeTypeName);

                    valueCodeType = handlerCodeType.TemplateArguments[0] as CodeType ?? CodeType.Create(codeTypeName.Trim());
                }
            }
Beispiel #15
0
        public static void WriteFile(ExtractedData item, string path)
        {
            StreamWriter sw = File.AppendText(path);

            try
            {
                sw.WriteLine(item.VIN + "|" + item.Engine + "||" + item.Customer.Remove(0, 3) + "|" + item.Colour + "|8185|" + item.Folio + "|" +
                             item.BillingDate.ToShortDateString() + "|" + item.Pedimento.Remove(0, 34) + "|" +
                             item.PedimentoDate + "||");
                sw.Close();
                count += 1;
            }
            catch (Exception ex)
            {
                sw.Close();
                Logger.WriteLog("Error: " + ex.Message + "\nPila de llamadas: " + ex.StackTrace);
                Console.WriteLine("Error: " + ex.Message + "\nPila de llamadas: " + ex.StackTrace);
            }
        }
Beispiel #16
0
                /// <summary>
                /// Initializes a new instance of the <see cref="item"/> class.
                /// </summary>
                /// <param name="address">The address of item.</param>
                /// <param name="data">Data returned from VerifyCodeType function.</param>
                public item(ulong address, ExtractedData data)
                {
                    isnil = UserMember.Create(() => data.ReadItemIsNil != null && data.ReadItemIsNil(address) != 0);
                    left  = UserMember.Create(() =>
                    {
                        ulong leftAddress = data.Process.ReadPointer(address + (uint)data.ItemLeftOffset);

                        if (leftAddress == 0)
                        {
                            return(null);
                        }
                        return(new item(leftAddress, data));
                    });
                    right = UserMember.Create(() =>
                    {
                        ulong rightAddress = data.Process.ReadPointer(address + (uint)data.ItemRightOffset);

                        if (rightAddress == 0)
                        {
                            return(null);
                        }
                        return(new item(rightAddress, data));
                    });
                    parent = UserMember.Create(() =>
                    {
                        ulong parentAddress = data.Process.ReadPointer(address + (uint)data.ItemParentOffset);

                        if (parentAddress == 0)
                        {
                            return(null);
                        }
                        return(new item(parentAddress, data));
                    });
                    pair = UserMember.Create(() =>
                    {
                        ulong pairAddress     = address + (uint)data.ItemValueOffset;
                        Variable pairVariable = Variable.Create(data.ItemValueCodeType, pairAddress);

                        return(new pair <TKey, TValue>(pairVariable));
                    });
                }
Beispiel #17
0
                /// <summary>
                /// Initializes a new instance of the <see cref="item"/> class.
                /// </summary>
                /// <param name="address">The address of item.</param>
                /// <param name="data">Data returned from VerifyCodeType function.</param>
                public item(ulong address, ExtractedData data)
                {
                    next = UserMember.Create(() =>
                    {
                        ulong nextAddress = data.Process.ReadPointer(address + (uint)data.ItemNextOffset);

                        return(new item(nextAddress, data));
                    });
                    previous = UserMember.Create(() =>
                    {
                        ulong previousAddress = data.Process.ReadPointer(address + (uint)data.ItemPreviousOffset);

                        return(new item(previousAddress, data));
                    });
                    value = UserMember.Create(() =>
                    {
                        ulong valueAddress = address + (uint)data.ItemValueOffset;

                        return(Variable.Create(data.ItemValueCodeType, valueAddress).CastAs <T>());
                    });
                }
Beispiel #18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="extractionRequest"></param>
        /// <param name="parent"></param>
        public PlotWindowViewModel(ExtractionRequestModel extractionRequest, MainWindowViewModel parent)
        {
            model         = new ExtractedData(extractionRequest);
            startDateTime = model.DateTimes[0];
            endDateTime   = model.DateTimes[model.pointCount - 1];
            resolution    = extractionRequest.Resolution;
            UpdatePoints();
            cursor1Values = new float[model.Tags.Length];
            plotRanges.Add(new PlotRange(startDateTime, endDateTime, yMin, yMax));
            currentZoomIndex = 0;

            if (parent != null)
            {
                // Subscribe the plotwindow to the plotRangeChanged event transmitted by the main window
                WeakEventManager <MainWindowViewModel, PlotRangeChangedEventArgs> .AddHandler(parent, "TransmitPlotRangeChanged", OnPlotWindowRangeChanged);
            }

            view         = new PlotWindowView(this);
            view.Closed += (object source, EventArgs args) => PlotWindowClosed(this, args);
            view.Show();
        }
Beispiel #19
0
            /// <summary>
            /// Initializes a new instance of the <see cref="VisualStudio"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public VisualStudio(Variable variable, object savedData)
            {
                data     = (ExtractedData)savedData;
                address  = variable.GetPointerAddress();
                typeData = data.Process.ReadPointer(address + (uint)data.TypeDataOffset);
                if (HasValue)
                {
                    Tuple <string, ulong> nameAndOffset = Context.SymbolProvider.GetSymbolNameByAddress(data.Process, TypeInfoAddress);

                    if (nameAndOffset != null)
                    {
                        string name = nameAndOffset.Item1;

                        if (name.EndsWith(rttiSignature))
                        {
                            name          = name.Substring(0, name.Length - rttiSignature.Length);
                            valueCodeType = CodeType.Create(name);
                        }
                    }
                }
            }
Beispiel #20
0
            /// <summary>
            /// Initializes a new instance of the <see cref="VectorBoolBase" /> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public VectorBoolBase(Variable variable, object savedData)
            {
                data = (ExtractedData)savedData;
                ulong    address          = variable.GetPointerAddress();
                ulong    bufferAddress    = data.Process.ReadPointer(address + (uint)data.CompressedBufferOffset);
                Variable vectorVariable   = Variable.CreatePointer(data.CompressedElementCodeType.PointerToType, bufferAddress);
                int      compressedLength = data.ReadCompressedLength(address);

                if (data.CompressedElementCodeType.Size == 4)
                {
                    compressedBuffer32 = new CodeArray <uint>(vectorVariable, compressedLength);
                }
                else if (data.CompressedElementCodeType.Size == 8)
                {
                    compressedBuffer64 = new CodeArray <ulong>(vectorVariable, compressedLength);
                }
                else
                {
                    throw new NotImplementedException();
                }
                Count = data.ReadLength(address);
            }
Beispiel #21
0
            /// <summary>
            /// Initializes a new instance of the <see cref="LibStdCpp7"/> class.
            /// </summary>
            /// <param name="variable">The variable.</param>
            /// <param name="savedData">Data returned from VerifyCodeType function.</param>
            public LibStdCpp7(Variable variable, object savedData)
            {
                data    = (ExtractedData)savedData;
                address = variable.GetPointerAddress();
                ulong managerAddress = data.Process.ReadPointer(address + (uint)data.ManagerPointerOffset);

                if (managerAddress != 0)
                {
                    Tuple <string, ulong> nameAndOffset = Context.SymbolProvider.GetSymbolNameByAddress(data.Process, managerAddress);

                    if (nameAndOffset != null)
                    {
                        managerName = nameAndOffset.Item1;
                    }
                }
                if (HasValue)
                {
                    string codeTypeName;

                    if (IsInternal)
                    {
                        string moduleName = managerName.Substring(0, managerName.IndexOf('!') + 1);

                        codeTypeName = moduleName + managerName.Substring(moduleName.Length + InternalManagerNameStart.Length, managerName.Length - moduleName.Length - InternalManagerNameStart.Length - InternalManagerNameEnd.Length);
                    }
                    else if (IsExternal)
                    {
                        string moduleName = managerName.Substring(0, managerName.IndexOf('!') + 1);

                        codeTypeName = moduleName + managerName.Substring(moduleName.Length + ExternalManagerNameStart.Length, managerName.Length - moduleName.Length - ExternalManagerNameStart.Length - ExternalManagerNameEnd.Length);
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                    valueCodeType = CodeType.Create(codeTypeName.Trim());
                }
            }
        public override void Interpret(ExtractedData aItem)
        {
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - HEAP INFO FOR THREAD 'EComServer::!ecomserver'
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - ==============================================
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - HeapInfo - heapBaseAddress:     0x00700074
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - HeapInfo - heapSize:                745352
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - HeapInfo - heapChunkSize:           745472
            // ...
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - 00700084: 00 00 00 00 03 03 03 03 03 03 03 03 03 03 03 03 ................
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - 00700094: 03 03 03 03 03 03 03 03 28 00 00 00 ec 47 28 80 ........(....G(.
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - 007000a4: d8 0c 70 00 58 0d 70 00 f8 0c 70 00 03 03 03 03 ..p.X.p...p.....
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - 007000b4: 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 ................
            // [15:21:32.719] xti2:MCU_ASCII_PRINTF; channel:0xE0; msg:HeapData - EComServer::!ecomserver - 007000c4: 48 00 00 00 e8 2b 30 80 00 2c 30 80 ec 02 70 00 H....+0..,0...p.
            //
            // or
            //
            // HEAP INFO FOR THREAD 'ecomserver::!ecomserver'
            // ==============================================
            // HeapInfo - heapBaseAddress:     0x0f8c0074
            // HeapInfo - heapSize:                262028

            // Save the line - we must do this in order to be able to write a zip file
            // containing the original source data for this data source.
            DataSource.AddLine(aItem.OriginalLine);

            if (aItem.Type == ExtractedData.TType.EBinaryData)
            {
                DataSource.MetaData.HeapData.Add(aItem.BinaryData);
            }
            else if (aItem.Type == ExtractedData.TType.EText)
            {
                if (CheckForKnownElement(aItem.Text))
                {
                }
            }
        }
Beispiel #23
0
 public abstract void Interpret(ExtractedData aItem);
Beispiel #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MapBase"/> class.
 /// </summary>
 /// <param name="variable">The variable.</param>
 /// <param name="savedData">Data returned from VerifyCodeType function.</param>
 public MapBase(Variable variable, object savedData)
 {
     data    = (ExtractedData)savedData;
     address = variable.GetPointerAddress();
     size    = data.ReadSize(address);
 }
Beispiel #25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void moveDataNotSameInstanceAppendProjects() throws Exception
        private void moveDataNotSameInstanceAppendProjects()
        {
            this.progress.Indeterminate = true;
            initialize();
            try
            {
                createMappingTable();
                System.Collections.IList list1 = this.helper.listEntities();
                System.Collections.IList list2 = this.helper.listEntitiesWithForeignKeys();
                this.progress.Indeterminate = false;
                this.progress.TotalTimes    = list1.Count * 3 + list2.Count;
                logger.trace("SOURCE ID: " + this.source.ProjectUrlId + " DEST ID: " + this.dest.ProjectUrlId);
                foreach (ProjectEntityMetadataKeeper projectEntityMetadataKeeper in list1)
                {
                    if (projectEntityMetadataKeeper.TableName.Equals("PROJECTWBS") || projectEntityMetadataKeeper.TableName.Equals("PROJECTWBS2"))
                    {
                        continue;
                    }
                    try
                    {
                        executeUpdateQuery(this.destConnection, projectEntityMetadataKeeper.getAlterIdRefColumnStatement(this.dest));
                    }
                    catch (Exception)
                    {
                        logger.trace("COULD NOT EXECUTE ALTER: " + projectEntityMetadataKeeper.getAlterIdRefColumnStatement(this.dest));
                    }
                    if (projectEntityMetadataKeeper.TableName.Equals("PRJPROP", StringComparison.OrdinalIgnoreCase) || projectEntityMetadataKeeper.TableName.Equals("PRJUSERPROP", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    setProgress(this.progress, "Selecting [" + projectEntityMetadataKeeper.TableName + "]");
                    ResultSet resultSet = executeSelectQuery(this.sourceConnection, projectEntityMetadataKeeper.SelectEverythingStatementAppendProjects);
                    long      l         = executeCountQuery(this.sourceConnection, projectEntityMetadataKeeper.CountStatement);
                    resultSet.FetchSize = 2000;
                    sbyte         b1         = 0;
                    List <object> arrayList1 = new List <object>(2000);
                    List <object> arrayList2 = projectEntityMetadataKeeper.hasForeignKeys() ? new List <object>(2000) : null;
                    string        str1       = projectEntityMetadataKeeper.getInsertDataStatementAppendProjects(this.dest);
                    string        str2       = projectEntityMetadataKeeper.getInsertForeignKeysToMappingTableStatement(this.dest);
                    setProgress(this.progress, "INSERT [" + projectEntityMetadataKeeper.TableName + "] ");
                    this.progress.incrementProgress(1);
                    sbyte b2 = 0;
                    while (resultSet.next())
                    {
                        ExtractedData extractedData = projectEntityMetadataKeeper.extractRow(this.dest, resultSet);
                        arrayList1.Add(extractedData.DataValues);
                        if (projectEntityMetadataKeeper.hasForeignKeys())
                        {
                            ExtractedData.ExtractedFKData[] arrayOfExtractedFKData = extractedData.FkValues;
                            foreach (ExtractedData.ExtractedFKData extractedFKData in arrayOfExtractedFKData)
                            {
                                arrayList2.Add(extractedFKData.DataValues);
                            }
                        }
                        b1++;
                        b2++;
                        if (b1 % 'ߐ' == '\x0000')
                        {
                            setProgress(this.progress, "INSERT DATA [" + projectEntityMetadataKeeper.TableName + "] " + b2);
                            executeInsertStatement(this.destConnection, str1, arrayList1);
                            arrayList1.Clear();
                            if (projectEntityMetadataKeeper.hasForeignKeys())
                            {
                                setProgress(this.progress, "INSERT FOREIGN KEYS [" + projectEntityMetadataKeeper.TableName + "] " + b2);
                                logger.trace("FK STATEMENT: " + str2);
                                executeInsertStatement(this.destConnection, str2, arrayList2);
                                arrayList2.Clear();
                            }
                            b1 = 0;
                        }
                    }
                    if (b1 != 0)
                    {
                        setProgress(this.progress, "INSERT DATA [" + projectEntityMetadataKeeper.TableName + "] " + b2);
                        executeInsertStatement(this.destConnection, str1, arrayList1);
                        arrayList1.Clear();
                        if (projectEntityMetadataKeeper.hasForeignKeys())
                        {
                            setProgress(this.progress, "INSERT FOREIGN KEYS [" + projectEntityMetadataKeeper.TableName + "] " + b2);
                            logger.trace("FK STATEMENT: " + str2);
                            executeInsertStatement(this.destConnection, str2, arrayList2);
                            arrayList2.Clear();
                        }
                    }
                    resultSet.close();
                    this.progress.incrementProgress(1);
                }
                foreach (ProjectEntityMetadataKeeper projectEntityMetadataKeeper in list2)
                {
                    logger.trace("\nFK UPDATE: " + projectEntityMetadataKeeper.getUpdateBySelectForeignKeysMappingTableStatement(this.dest));
                    setProgress(this.progress, "UPDATE FOREIGN KEYS [" + projectEntityMetadataKeeper.TableName + "]");
                    executeUpdateQuery(this.destConnection, projectEntityMetadataKeeper.getUpdateBySelectForeignKeysMappingTableStatement(this.dest));
                    this.progress.incrementProgress(1);
                }
                this.progress.Indeterminate = true;
                setProgress(this.progress, "CLEANING UP");
                updateFixedReferences(this.destConnection);
                dropMappingTable();
            }
            catch (Exception exception)
            {
                logger.error("An error occured while doing stuff", exception);
                cleanUp();
                throw exception;
            }
            cleanUp();
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private System.Nullable<long> moveModelsToCEP() throws Exception
        private long?moveModelsToCEP()
        {
            this.progress.Indeterminate = true;
            long?long = null;

            try
            {
                createMappingTable();
                System.Collections.IList list1 = this.helper.listEntities();
                System.Collections.IList list2 = this.helper.listEntitiesWithForeignKeys();
                this.progress.Indeterminate = false;
                this.progress.TotalTimes    = list1.Count * 3 + list2.Count;
                foreach (BaseEntityMetadataKeeper baseEntityMetadataKeeper in list1)
                {
                    string str1 = baseEntityMetadataKeeper.TableName;
                    try
                    {
                        long?long1 = Convert.ToInt64(executeCountQuery(this.destConnection, baseEntityMetadataKeeper.getIdRefColumnExistsStatement(this.destDbms)));
                        if (long1.Value == 0L)
                        {
                            executeUpdateQuery(this.destConnection, baseEntityMetadataKeeper.getAlterIdRefColumnStatement(this.destDbms));
                            long?long2 = Convert.ToInt64(executeCountQuery(this.destConnection, baseEntityMetadataKeeper.getIdRefColumnIndexExistsStatement(this.destDbms, true)));
                            if (long2.Value == 0L)
                            {
                                executeUpdateQuery(this.destConnection, baseEntityMetadataKeeper.getIdRefColumnIndexCreateStatement(this.destDbms, true));
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        logger.error("COULD NOT EXECUTE ALTER: " + baseEntityMetadataKeeper.getAlterIdRefColumnStatement(this.destDbms), exception);
                    }
                    if (str1.Equals("BC_MODEL", StringComparison.OrdinalIgnoreCase))
                    {
                        ResultSet resultSet1 = executeSelectQuery(this.sourceConnection, baseEntityMetadataKeeper.SelectEverythingStatement);
                        resultSet1.next();
                        ExtractedData extractedData = baseEntityMetadataKeeper.extractRow(null, resultSet1);
                        string        str           = baseEntityMetadataKeeper.getInsertDataStatement(this.destDbms);
                        long = executeInsertStatement(this.destConnection, str, extractedData.DataValues);
                        continue;
                    }
                    setProgress(this.progress, "Selecting [" + str1 + "]");
                    ResultSet resultSet = executeSelectQuery(this.sourceConnection, baseEntityMetadataKeeper.SelectEverythingStatement);
                    long      l         = executeCountQuery(this.sourceConnection, baseEntityMetadataKeeper.CountStatement);
                    resultSet.FetchSize = 2000;
                    sbyte         b1         = 0;
                    List <object> arrayList1 = new List <object>(2000);
                    List <object> arrayList2 = baseEntityMetadataKeeper.hasForeignKeys() ? new List <object>(2000) : null;
                    string        str2       = baseEntityMetadataKeeper.getInsertDataStatement(this.destDbms);
                    string        str3       = baseEntityMetadataKeeper.getInsertForeignKeysToMappingTableStatement(Convert.ToInt32(this.destDbms));
                    setProgress(this.progress, "INSERT [" + str1 + "] ");
                    this.progress.incrementProgress(1);
                    sbyte b2 = 0;
                    while (resultSet.next())
                    {
                        ExtractedData extractedData = baseEntityMetadataKeeper.extractRow(long, resultSet);
                        arrayList1.Add(extractedData.DataValues);
                        if (baseEntityMetadataKeeper.hasForeignKeys())
                        {
                            ExtractedData.ExtractedFKData[] arrayOfExtractedFKData = extractedData.FkValues;
                            foreach (ExtractedData.ExtractedFKData extractedFKData in arrayOfExtractedFKData)
                            {
                                arrayList2.Add(extractedFKData.DataValues);
                            }
                        }
                        b1++;
                        b2++;
                        if (b1 % 'ߐ' == '\x0000')
                        {
                            setProgress(this.progress, "INSERT DATA [" + str1 + "] " + b2);
                            executeInsertStatement(this.destConnection, str2, arrayList1);
                            arrayList1.Clear();
                            if (baseEntityMetadataKeeper.hasForeignKeys())
                            {
                                setProgress(this.progress, "INSERT FOREIGN KEYS [" + str1 + "] " + b2);
                                logger.debug("FK STATEMENT: " + str3);
                                executeInsertStatement(this.destConnection, str3, arrayList2);
                                arrayList2.Clear();
                            }
                            b1 = 0;
                        }
                    }
                    if (b1 != 0)
                    {
                        setProgress(this.progress, "INSERT DATA [" + str1 + "] " + b2);
                        executeInsertStatement(this.destConnection, str2, arrayList1);
                        arrayList1.Clear();
                        if (baseEntityMetadataKeeper.hasForeignKeys())
                        {
                            setProgress(this.progress, "INSERT FOREIGN KEYS [" + str1 + "] " + b2);
                            logger.debug("FK STATEMENT: " + str3);
                            executeInsertStatement(this.destConnection, str3, arrayList2);
                            arrayList2.Clear();
                        }
                    }
                    resultSet.close();
                    save(this.destSession);
                    this.progress.incrementProgress(1);
                }
                foreach (BaseEntityMetadataKeeper baseEntityMetadataKeeper in list2)
                {
                    string str = baseEntityMetadataKeeper.getUpdateBySelectForeignKeysMappingTableStatement(Convert.ToInt32(this.destDbms), long);
                    if (string.ReferenceEquals(str, null))
                    {
                        continue;
                    }
                    logger.debug("\nFK UPDATE: " + str);
                    setProgress(this.progress, "UPDATE FOREIGN KEYS [" + baseEntityMetadataKeeper.TableName + "]");
                    executeUpdateQuery(this.destConnection, str);
                    this.progress.incrementProgress(1);
                }
                this.progress.Indeterminate = true;
                setProgress(this.progress, "CLEANING UP");
                BimDataMoverUtils.fixSerializedData(this.destConnection, long);
            }
            catch (Exception exception)
            {
                logger.error("An error occured while doing stuff", exception);
                throw exception;
            }
            return(long);
        }
Beispiel #27
0
        public override void ExtractData(int NumSearch)
        {
            var maxmin = new TireDataMaxmin();

            ExtractedData.Clear();
            NotExtractedData.Clear();
            IndexHolder.Clear();
            IndexHolder.Add(0);
            for (int i = 0; i < IndexHolderParent.Count - 1; ++i)
            {
                if (NumSearch > 0 && i >= NumSearch)
                {
                    break;
                }
                var  list = SplitedTransientTable(i);
                bool add  = true;
                foreach (var data in list)
                {
                    foreach (TireDataColumn column in Enum.GetValues(typeof(TireDataColumn)))
                    {
                        if (column == TireDataColumn.NT)
                        {
                            continue;
                        }
                        bool remove = false;
                        foreach (var constrain in Constrains[column])
                        {
                            if (!constrain.Not)
                            {
                                continue;
                            }
                            if (!constrain.Evaluate(data))
                            {
                                remove = true;
                                break;
                            }
                        }
                        if (remove == true)
                        {
                            add = false;
                            break;
                        }
                        if (!remove)
                        {
                            remove = true;
                            int counttemp = 0;

                            if (column == TireDataColumn.NT)
                            {
                                continue;
                            }
                            foreach (var constrain in Constrains[column])
                            {
                                if (constrain.Not)
                                {
                                    continue;
                                }
                                ++counttemp;
                                if (constrain.Evaluate(data))
                                {
                                    remove = false;
                                    break;
                                }
                                else
                                {
                                }
                            }

                            if (counttemp == 0)
                            {
                                remove = false;
                            }
                        }
                        add = add && !remove;
                    }
                }


                if (add)
                {
                    ExtractedData.AddRange(list);
                    IndexHolder.Add(ExtractedData.Count);
                }
                else
                {
                    NotExtractedData.AddRange(list);
                }
            }


            State = TireDataSelectorState.Changed;
            ExtractedDataMaxmin = StaticFunctions.GetLimitData(ExtractedData);
        }
Beispiel #28
0
        public static ExtractedData Extract(string html, Uri domain, string pattern)
        {
            var customRegexUsed       = !string.IsNullOrEmpty(pattern);
            var primedPattern         = customRegexUsed ? "|" + pattern : "";
            var combinedRegexPatterns = linkRegex + primedPattern;

            var regex   = new Regex(combinedRegexPatterns);
            var matches = regex.Matches(html);
            var data    = new ExtractedData();

            foreach (Match m in matches)
            {
                if (m.Success)
                {
                    var link = m.Groups[LINK_REGEX_GROUP_NAME];

                    if (link != null)
                    {
                        var value = link.Value;

                        // false links go here
                        if (value.Contains("#") || value.Contains("javascript:void(0)"))
                        {
                            continue;
                        }

                        // full URLs sometimes hide behind "//"
                        if (value.StartsWith("//"))
                        {
                            value = value.Substring(2);
                        }

                        // add the link if:
                        // it starts with the whole domain
                        // it starts with the domain (without the host)
                        if (value.StartsWith(domain.OriginalString))
                        {
                            data.Links.Add(new Uri(value));
                        }
                        else if (value.StartsWith(domain.AbsolutePath))
                        {
                            data.Links.Add(new Uri($"{domain.Scheme}://" + domain.Host + value));
                        }
                    }

                    // try to add data if the user has set a regex
                    if (customRegexUsed)
                    {
                        foreach (var groupName in regex.GetGroupNames())
                        {
                            // don't add the yaclinks to the data and group 0 is the entire string (expect the custom regex has a capture group)
                            if (groupName == LINK_REGEX_GROUP_NAME || groupName == "0")
                            {
                                continue;
                            }

                            var value = m.Groups[groupName];

                            if (value.Success)
                            {
                                data.Data.Add(new Tuple <string, string>(groupName, value.Value));
                            }
                        }
                    }
                }
            }

            return(data);
        }
Beispiel #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VariantBase"/> class.
 /// </summary>
 /// <param name="variable">The variable.</param>
 /// <param name="savedData">Data returned from VerifyCodeType function.</param>
 public VariantBase(Variable variable, object savedData)
 {
     data    = (ExtractedData)savedData;
     address = variable.GetPointerAddress();
     Index   = data.ReadIndex(address);
 }
Beispiel #30
0
 private void PlotButton_Click(object sender, RoutedEventArgs e)
 {
     ExtractedData extractedData = new ExtractedData(StartDateTime, EndDateTime, SelectedTags, SelectedFiles);
 }