Exemplo n.º 1
0
        private void readFile(XmlTextReader xmlReader, TestDatabaseProduct product)
        {
            TestDatabaseFile file = new TestDatabaseFile();

            file.File           = new AtomFile(new StackHashBusinessObjects.StackHashFile(), "events link");
            file.File.ProductId = product.Product.Product.Id;

            while (xmlReader.Read())
            {
                if ((xmlReader.NodeType == XmlNodeType.EndElement) &&
                    (xmlReader.Name.ToUpperInvariant() == "FILE"))
                {
                    product.Files.Add(file);
                    return;
                }

                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    String elementName = xmlReader.Name.ToUpperInvariant();
                    xmlReader.Read();
                    String elementText = xmlReader.Value;

                    switch (elementName)
                    {
                    case "EVENT":
                        if (file.Events == null)
                        {
                            file.Events = new List <TestDatabaseEvent>();
                        }
                        readEvent(xmlReader, product, file);

                        break;

                    case "ID":
                        file.File.File.Id = Int32.Parse(elementText);
                        break;

                    case "DATECREATEDLOCAL":
                        file.File.File.DateCreatedLocal = DateTime.Parse(elementText);
                        break;

                    case "DATEMODIFIEDLOCAL":
                        file.File.File.DateModifiedLocal = DateTime.Parse(elementText);
                        break;

                    case "LINKDATELOCAL":
                        file.File.File.LinkDateLocal = DateTime.Parse(elementText);
                        break;

                    case "NAME":
                        file.File.File.Name = elementText;
                        break;

                    case "VERSION":
                        file.File.File.Version = elementText;
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void readCab(XmlTextReader xmlReader, TestDatabaseProduct product, TestDatabaseFile file, TestDatabaseEvent theEvent)
        {
            AtomCab cab = new AtomCab();

            cab.Cab = new StackHashCab();

            while (xmlReader.Read())
            {
                if ((xmlReader.NodeType == XmlNodeType.EndElement) &&
                    (xmlReader.Name.ToUpperInvariant() == "CAB"))
                {
                    theEvent.Cabs.Add(cab);
                    return;
                }

                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    String elementName = xmlReader.Name.ToUpperInvariant();
                    xmlReader.Read();
                    String elementText = xmlReader.Value;

                    switch (elementName)
                    {
                    case "DATECREATEDLOCAL":
                        cab.Cab.DateCreatedLocal = DateTime.Parse(elementText);
                        break;

                    case "DATEMODIFIEDLOCAL":
                        cab.Cab.DateModifiedLocal = DateTime.Parse(elementText);
                        break;

                    case "EVENTID":
                        cab.Cab.EventId = Int32.Parse(elementText);
                        break;

                    case "EVENTTYPENAME":
                        cab.Cab.EventTypeName = elementText;
                        break;

                    case "FILENAME":
                        cab.Cab.FileName = elementText;
                        break;

                    case "ID":
                        cab.Cab.Id = Int32.Parse(elementText);
                        break;

                    case "SIZEINBYTES":
                        cab.Cab.SizeInBytes = Int64.Parse(elementText);
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void readEventSignature(XmlTextReader xmlReader, TestDatabaseProduct product, TestDatabaseFile file, TestDatabaseEvent theEvent)
        {
            StackHashEventSignature signature = new StackHashEventSignature();

            signature.Parameters = new StackHashParameterCollection();

            while (xmlReader.Read())
            {
                if ((xmlReader.NodeType == XmlNodeType.EndElement) &&
                    (xmlReader.Name.ToUpperInvariant() == "SIGNATURE"))
                {
                    theEvent.TheEvent.Event.EventSignature = signature;
                    return;
                }

                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    String elementName = xmlReader.Name;
                    xmlReader.Read();
                    String elementText = xmlReader.Value;
                    signature.Parameters.Add(new StackHashParameter(elementName, elementText));
                }
            }
        }
Exemplo n.º 4
0
        private void readEventInfo(XmlTextReader xmlReader, TestDatabaseProduct product, TestDatabaseFile file, TestDatabaseEvent theEvent)
        {
            AtomEventInfo eventInfo = new AtomEventInfo();

            eventInfo.EventInfo = new StackHashEventInfo();

            while (xmlReader.Read())
            {
                if ((xmlReader.NodeType == XmlNodeType.EndElement) &&
                    (xmlReader.Name.ToUpperInvariant() == "EVENTINFO"))
                {
                    theEvent.EventInfos.Add(eventInfo);
                    return;
                }

                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    String elementName = xmlReader.Name.ToUpperInvariant();
                    xmlReader.Read();
                    String elementText = xmlReader.Value;

                    switch (elementName)
                    {
                    case "DATECREATEDLOCAL":
                        eventInfo.EventInfo.DateCreatedLocal = DateTime.Parse(elementText);
                        break;

                    case "DATEMODIFIEDLOCAL":
                        eventInfo.EventInfo.DateModifiedLocal = DateTime.Parse(elementText);
                        break;

                    case "HITDATELOCAL":
                        eventInfo.EventInfo.HitDateLocal = DateTime.Parse(elementText);
                        break;

                    case "LANGUAGE":
                        eventInfo.EventInfo.Language = elementText;
                        break;

                    case "LCID":
                        eventInfo.EventInfo.Lcid = Int32.Parse(elementText);
                        break;

                    case "LOCALE":
                        eventInfo.EventInfo.Locale = elementText;
                        break;

                    case "OPERATINGSYSTEMNAME":
                        eventInfo.EventInfo.OperatingSystemName = elementText;
                        break;

                    case "OPERATINGSYSTEMVERSION":
                        eventInfo.EventInfo.OperatingSystemVersion = elementText;
                        break;

                    case "TOTALHITS":
                        eventInfo.EventInfo.TotalHits = Int32.Parse(elementText);
                        break;
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void readProduct(XmlTextReader xmlReader)
        {
            TestDatabaseProduct product = new TestDatabaseProduct();

            product.Product = new AtomProduct(new StackHashBusinessObjects.StackHashProduct());

            while (xmlReader.Read())
            {
                if ((xmlReader.NodeType == XmlNodeType.EndElement) &&
                    (xmlReader.Name.ToUpperInvariant() == "PRODUCT"))
                {
                    m_Products.Add(product);
                    return;
                }

                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    String elementName = xmlReader.Name.ToUpperInvariant();
                    xmlReader.Read();
                    String elementText = xmlReader.Value;

                    switch (elementName)
                    {
                    case "FILE":
                        if (product.Files == null)
                        {
                            product.Files = new List <TestDatabaseFile>();
                        }
                        readFile(xmlReader, product);
                        break;

                    case "ID":
                        product.Product.Product.Id = Int32.Parse(elementText);
                        break;

                    case "DATECREATEDLOCAL":
                        product.Product.Product.DateCreatedLocal = DateTime.Parse(elementText);
                        break;

                    case "DATEMODIFIEDLOCAL":
                        product.Product.Product.DateModifiedLocal = DateTime.Parse(elementText);
                        break;

                    case "FILESLINK":
                        product.Product.Product.FilesLink = elementText;
                        break;

                    case "NAME":
                        product.Product.Product.Name = elementText;
                        break;

                    case "TOTALEVENTS":
                        product.Product.Product.TotalEvents = Int32.Parse(elementText);
                        break;

                    case "TOTALRESPONSES":
                        product.Product.Product.TotalResponses = Int32.Parse(elementText);
                        break;

                    case "VERSION":
                        product.Product.Product.Version = elementText;
                        break;
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void readEvent(XmlTextReader xmlReader, TestDatabaseProduct product, TestDatabaseFile file)
        {
            TestDatabaseEvent theEvent = new TestDatabaseEvent();

            theEvent.TheEvent           = new AtomEvent(new StackHashBusinessObjects.StackHashEvent(), "EventInfoLink", "CabLink");
            theEvent.TheEvent.ProductId = product.Product.Product.Id;
            theEvent.TheEvent.FileId    = file.File.File.Id;

            if (theEvent.EventInfos == null)
            {
                theEvent.EventInfos = new AtomEventInfoCollection();
            }
            if (theEvent.Cabs == null)
            {
                theEvent.Cabs = new AtomCabCollection();
            }
            if (theEvent.TheEvent.Event.EventSignature == null)
            {
                theEvent.TheEvent.Event.EventSignature = new StackHashEventSignature();
            }

            while (xmlReader.Read())
            {
                if ((xmlReader.NodeType == XmlNodeType.EndElement) &&
                    (xmlReader.Name.ToUpperInvariant() == "EVENT"))
                {
                    file.Events.Add(theEvent);
                    theEvent.TheEvent.Event.EventSignature.InterpretParameters();
                    return;
                }

                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    String elementName = xmlReader.Name.ToUpperInvariant();
                    xmlReader.Read();
                    String elementText = xmlReader.Value;

                    switch (elementName)
                    {
                    case "EVENTINFO":
                        readEventInfo(xmlReader, product, file, theEvent);
                        break;

                    case "CAB":
                        readCab(xmlReader, product, file, theEvent);
                        break;

                    case "SIGNATURE":
                        readEventSignature(xmlReader, product, file, theEvent);
                        break;

                    case "ID":
                        theEvent.TheEvent.Event.Id = Int32.Parse(elementText);
                        break;

                    case "DATECREATEDLOCAL":
                        theEvent.TheEvent.Event.DateCreatedLocal = DateTime.Parse(elementText);
                        break;

                    case "DATEMODIFIEDLOCAL":
                        theEvent.TheEvent.Event.DateModifiedLocal = DateTime.Parse(elementText);
                        break;

                    case "EVENTTYPENAME":
                        theEvent.TheEvent.Event.EventTypeName = elementText;
                        break;

                    case "TOTALHITS":
                        theEvent.TheEvent.Event.TotalHits = Int32.Parse(elementText);
                        break;
                    }
                }
            }
        }