示例#1
0
 public static void SaveRoms(string path)
 {
     using (FileStream file = new FileStream(path, FileMode.Open))
     {
         using (ZipArchive archive = new ZipArchive(file, ZipArchiveMode.Update))
         {
             var simm   = ArchiveType(archive);
             var buffer = new byte[0x800000];
             Ten.Save(archive, simm, buffer);
             Twenty.Save(archive, simm, buffer);
             Thirty.Save(archive, simm);
             ThirtyOne.Save(archive, simm);
             Forty.Save(archive, simm);
             FortyOne.Save(archive, simm);
             Fifty.Save(archive, simm);
             FiftyOne.Save(archive, simm);
         }
     }
 }
 public static void ReportPool(FiftyOne.Foundation.Mobile.Detection.Entities.Stream.DataSet dataSet)
 {
     Console.WriteLine("Readers in queue '{0}'", dataSet.ReadersQueued);
     Console.WriteLine("Readers created '{0}'", dataSet.ReadersCreated);
 }
        private void BuildModelsForResult(XmlWriter writer,
            FiftyOne.Foundation.Mobile.Detection.Match result)
        {
            writer.WriteStartElement("h1");
            writer.WriteString(_matchCaption);
            writer.WriteEndElement();

            writer.WriteStartElement("table");
            writer.WriteAttributeString("class", MatchCssClass);

            // Write the first row of the results.
            writer.WriteStartElement("tr");
            writer.WriteStartElement("th");
            writer.WriteString("Found");
            writer.WriteEndElement();

            writer.WriteStartElement("td");
            foreach (var profile in result.Profiles.Where(i =>
                i.Properties.Any(p => p.DisplayOrder > 0)))
            {
                writer.WriteStartElement("a");
                writer.WriteAttributeString("href", String.Format("#{0}", profile.ProfileId));
                writer.WriteAttributeString("title", profile.ToString());
                writer.WriteString(profile.ToString());
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteEndElement();

            // Add the target User-Agent provided.
            BuildRowForResultFormatted(writer, "Target UserAgent", result.TargetUserAgent);

            // Add the signature found.
            if (result.UserAgent != null)
            {
                BuildRowForResultFormatted(writer, "Closest Sub Strings", result.UserAgent);
            }
            else
            {
                // Add the nodes found.
                BuildRowForResultFormatted(writer, "Relevant Sub Strings", result.ToString());
            }

            // Display the found signatures rank.
            if (result.Signature != null)
            {
                BuildRowForResult(writer, "Rank", result.Signature.Rank.ToString());
            }

            // Add the confidence of the match.
            BuildRowForResult(writer, "Difference", result.Difference.ToString());

            // Add the method used for the match.
            BuildRowForResult(writer, "Method", result.Method.ToString());

            #if DEBUG
            // Add a header to indicate diagnostics information follows.
            writer.WriteStartElement("tr");
            writer.WriteStartElement("th");
            writer.WriteAttributeString("colspan", "2");
            writer.WriteString("Diagnostics Information");
            writer.WriteEndElement();
            writer.WriteEndElement();

            BuildRowForResult(writer, "Root Nodes Evaluated", result.RootNodesEvaluated.ToString());
            BuildRowForResult(writer, "Nodes Evaluated", result.NodesEvaluated.ToString());
            BuildRowForResult(writer, "Strings Read", result.StringsRead.ToString());
            BuildRowForResult(writer, "Signatures Read", result.SignaturesRead.ToString());
            BuildRowForResult(writer, "Signatures Compared", result.SignaturesCompared.ToString());
            BuildRowForResult(writer, "Closest Signatures", result.ClosestSignatures.ToString());
            BuildRowForResult(writer, "Elapsed Detection Time",
                String.Format("{0:0.000}ms", result.Elapsed.TotalMilliseconds));
            BuildRowForResultFormatted(writer, "Relevant Sub Strings", result.ToString());
            #endif
            writer.WriteEndElement();
        }