Example #1
0
        private static void moveForeMeta()
        {
            Regex regex = new Regex(@"^>>(.+?)\n", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant);
            //Regex regex = new Regex(@"^>>(.+?)$", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant);
            // some abstract contain only ">>(0,0)" and no "\n".

            string pkFilter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.GreaterThanOrEqual, "");

            TableQuery query = new TableQuery().Where(pkFilter).Select(new string[] { "flags2", "abstract" });

            int count = 0;

            foreach (DynamicTableEntity entity in Warehouse.DiscussionLoadTable.ExecuteQuery(query))
            {
                string flags = null;
                string ab    = LetterConverter.GetAbstract(entity);

                if (ab != null)
                {
                    ab = regex.Replace(ab, (Match match) =>
                    {
                        if (match.Groups[1].Value[0] == '(')
                        {
                            flags = entity.GetFlags();
                            flags = SandFlags.Add(flags, SandFlags.MT_COORDINATE, match.Groups[1].Value);
                        }
                        return(string.Empty);
                    });
                }

                if (flags != null)
                {
                    count++;

                    entity["flags2"]   = new EntityProperty(flags);
                    entity["abstract"] = new EntityProperty(ab);

                    Warehouse.DiscussionLoadTable.Execute(TableOperation.Merge(entity));

                    //if (count > 0)
                    //	break;
                }
            }
        }
Example #2
0
        private void addLetter(TextWriter writer, DynamicTableEntity entity)
        {
            LetterConverter.WriteForCrawler(writer, entity, false, null);

            Subtype subtype = LetterConverter.GetSubtype(entity);

            switch (subtype)
            {
            case Subtype.h:
                if (this.Heading == null)
                {
                    this.Heading = /*RemoveForeMeta*/ (LetterConverter.GetAbstract(entity));
                }
                break;

            case Subtype.s:
                // when subject is split to multiple segments, subtype s will be met multiple times.
                if (this.Description == null)
                {
                    this.Description = extractOgImage(LetterConverter.GetWholeWords(entity, false));
                }
                break;
            }
        }