/// <summary>
    /// pdf/font_mapping/test-embedded.pdf : bc31582e,f892ac0d,
    /// MERGE INTO TESTCASE_CHECKSUMS_VIEW using dual on (TGUID=? AND PID=? AND PAGE_NO=?)
    /// WHEN NOT matched THEN INSERT (TGUID,PID,PAGE_NO,CHECKSUM) VALUES (?,?,?,?)
    /// WHEN matched then UPDATE SET CHECKSUM=?"
    /// </summary>
    /// <param name="PID"></param>
    /// <param name="stream"></param>
    /// <returns></returns>
    public bool update_checksums(string user_id, int PID, string location, StreamReader stream)
    {
        string line;
        string table_name = this.TableName;
        string testcase   = string.Empty;

        try
        {
            this.TableName = "TESTCASE_CHECKSUMS";

            do
            {
                line = stream.ReadLine();
                if (line == null)
                {
                    continue;
                }

                try
                {
                    line = line.Trim();
                    if (line.StartsWith("#"))
                    {
                        Console.WriteLine("{0}\n", line);
                        continue;
                    }

                    String[] splitString = Regex.Split(line, @"\s*[: ]\s*");
                    if (0 < splitString.Length)
                    {
                        testcase = location + splitString[0];
                        string checksums = splitString[1];
                        string tguid     = TESTCASE.lookup_tguid(testcase);

                        TESTCASE_CHECKSUMS_VIEW.Row rec = NewRow();
                        rec.TGUID = tguid;

                        // rec.TNAME = match.Index + 1;
                        rec.MODIFIED_BY = user_id;
                        rec.PID         = PID;
                        rec.CHECKSUMS   = checksums;

                        merge(rec);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(testcase + " ERROR: " + e.StackTrace);
                }
            } while (line != null);
        }
        finally
        {
            this.TableName = table_name;
        }

        return(true);
    }
Exemple #2
0
    /// <summary>
    /// pdf/font_mapping/test-embedded.pdf : bc31582e,f892ac0d,
    /// MERGE INTO TESTCASE_CHECKSUM using dual on (TGUID=? AND PID=? AND PAGE_NO=?)
    /// WHEN NOT matched THEN INSERT (TGUID,PID,PAGE_NO,CHECKSUM) VALUES (?,?,?,?)
    /// WHEN matched then UPDATE SET CHECKSUM=?"
    /// </summary>
    /// <param name="PID"></param>
    /// <param name="stream"></param>
    /// <returns></returns>
    public bool update_checksums(int PID, string location, StreamReader stream)
    {
        string pattern = @"([a-z\d]+)";
        string line;

        do
        {
            line = stream.ReadLine();
            if (line != null)
            {
                line = line.Trim();
                if (line.StartsWith("#"))
                {
                    Console.WriteLine("{0}\n", line);
                    continue;
                }

                String[] splitString = Regex.Split(line, @"\s*:\s*");
                if (2 == splitString.Length)
                {
                    string testcase  = location + splitString[0];
                    string checksums = splitString[1];
                    string tguid     = TESTCASE.lookup_tguid(testcase);

                    MatchCollection matches = Regex.Matches(checksums, pattern);
                    foreach (Match match in matches)
                    {
                        TESTCASE_CHECKSUM.Row rec = NewRow();
                        rec.TGUID    = tguid;
                        rec.PAGE_NO  = match.Index + 1;
                        rec.PID      = PID;
                        rec.CHECKSUM = match.Value;

                        merge(rec);
                    }
                }
            }
        } while (line != null);

        return(true);
    }