コード例 #1
0
        //bool can_submit_scan = false;

        public void writeScanInfo(IInfoContainer junk)
        {
            object oo = null;
            string ss = null;
            MsScanInformationSource ii = MsScanInformationSource.Unknown;

            foreach (string name in junk.Names)
            {
                if (junk.TryGetValue(name, out ss, ref ii))
                {
                    if (junk.TryGetRawValue(name, out oo, ref ii))
                    {
                        if (oo.GetType() == typeof(string))
                        {
                            Console.WriteLine("\t{0}: type={1}, text='{2}', raw='{3}",
                                              name, ii, ss, oo);
                        }
                        else if (oo is System.Double[])
                        {
                            Console.WriteLine("\t{0}:", name);
                            foreach (var item in (oo as System.Double[]))
                            {
                                Console.WriteLine("\t\t{0}", item.ToString());
                            }
                            Console.WriteLine("\t{0} Done.", name);
                        }
                        else
                        {
                            Console.WriteLine("\t{0}: Not rendering {1} {2}.", name, oo.GetType().ToString(), oo.ToString());
                        }
                    }
                }
            }
        }
コード例 #2
0
        private bool TryGetValue(IInfoContainer container, String name, out String value)
        {
            value = null;
            MsScanInformationSource i = MsScanInformationSource.Unknown;

            return(container.TryGetValue(name, out value, ref i));
        }
コード例 #3
0
        /// <summary>
        /// Dump all scan variables belonging to a specific container in a scan.
        /// </summary>
        /// <param name="container">container to dump all contained variables for</param>
        private void DumpVars(IInfoContainer container)
        {
            StringBuilder sb = new StringBuilder();

            foreach (string s in container.Names)
            {
                DumpVar(container, s, sb);
            }
        }
コード例 #4
0
        /// <summary>
        /// Dump all scan variables belonging to a specific container in a scan.
        /// </summary>
        /// <param name="container">container to dump all contained variables for</param>
        private void DumpVars(IInfoContainer container)
        {
            if (container == null)
            {
                return;
            }

            foreach (string s in container.Names)
            {
                DumpVar(container, s);
            }
        }
コード例 #5
0
        /// <summary>
        /// Dump the content of a single variable to the console after testing the consistency.
        /// </summary>
        /// <param name="container">container that variable belongs to</param>
        /// <param name="name">name of the variable</param>
        private void DumpVar(IInfoContainer container, string name)
        {
            object o = null;
            string s = null;
            MsScanInformationSource i = MsScanInformationSource.Unknown;

            if (container.TryGetValue(name, out s, ref i))
            {
                // i should have a reasonable value now
                if (container.TryGetRawValue(name, out o, ref i))
                {
                    outputln("  {0}: type={1}, text='{2}', raw='{3}'",
                             name, i, s, o);
                    infoTable.Add(name, s);
                }
            }
        }
コード例 #6
0
 private void Dump(string title, IInfoContainer container)
 {
     Console.WriteLine(title);
     foreach (string key in container.Names)
     {
         string value;
         // the source has to be "Unknown" to match all sources. Otherwise, the source has to match.
         // Sources can address values appearing in Tune files, general settings, but also values from
         // status log or additional values to a scan.
         MsScanInformationSource source = MsScanInformationSource.Unknown;                   // show everything
         try
         {
             if (container.TryGetValue(key, out value, ref source))
             {
                 string descr = source.ToString();
                 descr = descr.Substring(0, Math.Min(11, descr.Length));
                 Console.WriteLine("   {0,-11} {1,-35} = {2}", descr, key, value);
             }
         }
         catch { /* up to and including 2.8SP1 there is a bug displaying items which are null and if Foundation 3.1SP4 is used with CommonCore */ }
     }
 }
コード例 #7
0
        /// <summary>
        /// Dump the content of a single variable to the console after testing the consistency.
        /// </summary>
        /// <param name="container">container that variable belongs to</param>
        /// <param name="name">name of the variable</param>
        /// <param name="sb">buffer to be reused for speed</param>
        private void DumpVar(IInfoContainer container, string name, StringBuilder sb)
        {
            sb.Length = 0;

            // NOTE: The whole try block performs the consistency check except that
            // part that is marked. You can ignore it savely.

            try
            {
                object o0 = null, o1, o2, o3;
                string s0 = null, s1, s2, s3;
                MsScanInformationSource i0 = MsScanInformationSource.Unknown, i1, i2;
                i1 = MsScanInformationSource.Unknown;
                if (!container.TryGetValue(name, out s1, ref i1))
                {
                    sb.Append("NO TEXT(Unk) ");
                }
                else
                {
                    i0 = i1;
                    s0 = s1;
                    if (!container.TryGetValue(name, out s2, ref i1))
                    {
                        sb.Append("NO TEXT(" + i0 + ") ");
                    }
                    else if (s1 != s2)
                    {
                        sb.Append("TEXT DIFF1 ");
                    }
                }

                if (!container.TryGetValue(name, out s3))
                {
                    sb.Append("NO PLAIN TEXT ");
                }
                else if (s0 != s3)
                {
                    sb.Append("TEXT DIFF2 ");
                    s0 = s3;
                }
                if (i0 != MsScanInformationSource.Unknown)
                {
                    for (MsScanInformationSource ss = MsScanInformationSource.Common; ss <= MsScanInformationSource.AcquisitionFixed; ss++)
                    {
                        if (ss == i0)
                        {
                            continue;
                        }
                        i2 = ss;
                        if (container.TryGetValue(name, out s2, ref i2))
                        {
                            sb.Append("TEXT DOUBLETTE ");
                        }
                    }
                }

                i2 = MsScanInformationSource.Unknown;
                if (!container.TryGetRawValue(name, out o1, ref i2))
                {
                    sb.Append("NO DATA(Unk) ");
                    i0 = MsScanInformationSource.Unknown;
                }
                else
                {
                    if (i2 != i0)
                    {
                        sb.Append("SRC DIFF ");
                        i0 = i2;
                    }
                    i1 = i0;
                    o0 = o1;
                    if (!container.TryGetRawValue(name, out o2, ref i1))
                    {
                        sb.Append("NO TEXT(" + i0 + ") ");
                    }
                    else if (!o1.Equals(o2))
                    {
                        sb.Append("DATA DIFF1 ");
                    }
                }

                if (!container.TryGetRawValue(name, out o3))
                {
                    sb.Append("NO PLAIN Data ");
                }
                else if (!o0.Equals(o3))
                {
                    sb.Append("DATA DIFF2 ");
                    o0 = o3;
                }
                if (i0 != MsScanInformationSource.Unknown)
                {
                    for (MsScanInformationSource ss = MsScanInformationSource.Common; ss <= MsScanInformationSource.AcquisitionFixed; ss++)
                    {
                        if (ss == i0)
                        {
                            continue;
                        }
                        i2 = ss;
                        if (container.TryGetRawValue(name, out o2, ref i2))
                        {
                            sb.Append("DATA DOUBLETTE ");
                        }
                    }
                }

                // ADD THE REAL INFORMATION
                sb.Append("type=" + i0);
                sb.Append(", text='" + s0);
                sb.Append("', raw='" + o0);
                sb.Append("'");
                if (sb.ToString().Equals("NO TEXT(Unk) NO PLAIN TEXT NO DATA(Unk) NO PLAIN Data type=Unknown, text='', raw=''"))
                {
                    sb.Length = 0;
                    sb.Append("NO ACCESS");
                }
            }
            finally
            {
                sb.Insert(0, "  " + name + ": ");
                Console.WriteLine(sb.ToString());
            }
        }