コード例 #1
0
        private void IndexContent(string content, Clue clue)
        {
            if (string.IsNullOrEmpty(content))
            {
                return;
            }

            try
            {
                using (var tempFile = new TemporaryFile("item.html"))
                {
                    byte[] bytes = new byte[content.Length * sizeof(char)];
                    Buffer.BlockCopy(content.ToCharArray(), 0, bytes, 0, bytes.Length);

                    using (var stream = new MemoryStream(bytes))
                        using (var fileStream = File.Create(tempFile.FilePath))
                        {
                            stream.Seek(0, SeekOrigin.Begin);
                            stream.CopyTo(fileStream);
                        }

                    FileCrawlingUtility.ExtractContents(tempFile, clue.Data, clue, this.state, this.appContext);
                }
            }
            catch (Exception exception)
            {
                this.state.Log.Error(() => "Error Indexing Content", exception);
            }
        }