<commit_before>﻿using MATechTaxWebSite.Models;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MATechTaxWebSite.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "MA Tech Tax";

            try
            {
                var faqSnapshots = GetFaqSnapshots();
                return View(faqSnapshots);
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.ToString() + " -- {BASE} -> (((" +
                        ex.GetBaseException().ToString() +
                        ")))"
                        ;
                return View(new List<BlobSnapshot>());
            }
        }

        private List<BlobSnapshot> GetFaqSnapshots()
        {
            var faqSnapshots = new List<BlobSnapshot>();
            var valetKeyUrl = ConfigurationManager.AppSettings["BlobValetKeyUrl"];
            var destinationUrl = ConfigurationManager.AppSettings["BlobDestinationUrl"];
            var blob = ValetKeyPattern.AzureStorage.BlobContainerValet.GetCloudBlockBlob(valetKeyUrl, new Uri(destinationUrl));

            FetchMeta(blob);

            var blobOptions = Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails.Snapshots; // | Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails.Metadata;
            foreach (CloudBlockBlob blobItem in blob.Container.ListBlobs(prefix: null, useFlatBlobListing: true, blobListingDetails: blobOptions))
            {
                var lastModified = String.Empty;
                var thumbprint = String.Empty;
                var hasLastModified = blob.Metadata.TryGetValue("LastModified", out lastModified);
                var hasThumbprint = blob.Metadata.TryGetValue("thumbprint", out thumbprint);
                faqSnapshots.Add(new BlobSnapshot()
                {
                    Thumbprint = thumbprint,
                    LastModified = hasLastModified ? lastModified : "<original post date not recorded>",
                    Url = blobItem.SnapshotQualifiedUri.AbsoluteUri,
                    Comment = blobItem.IsSnapshot ? blobItem.SnapshotTime.Value.ToString() : " (Current)"
                });
            }
            return faqSnapshots;
        }

        void FetchMeta(CloudBlockBlob blob)
        {<commit_msg>tweak text<commit_after>﻿using MATechTaxWebSite.Models;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MATechTaxWebSite.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "MA Tech Tax";

            try
            {
                var faqSnapshots = GetFaqSnapshots();
                return View(faqSnapshots);
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.ToString() + " -- {BASE} -> (((" +
                        ex.GetBaseException().ToString() +
                        ")))"
                        ;
                return View(new List<BlobSnapshot>());
            }
        }

        private List<BlobSnapshot> GetFaqSnapshots()
        {
            var faqSnapshots = new List<BlobSnapshot>();
            var valetKeyUrl = ConfigurationManager.AppSettings["BlobValetKeyUrl"];
            var destinationUrl = ConfigurationManager.AppSettings["BlobDestinationUrl"];
            var blob = ValetKeyPattern.AzureStorage.BlobContainerValet.GetCloudBlockBlob(valetKeyUrl, new Uri(destinationUrl));

            FetchMeta(blob);

            var blobOptions = Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails.Snapshots; // | Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails.Metadata;
            foreach (CloudBlockBlob blobItem in blob.Container.ListBlobs(prefix: null, useFlatBlobListing: true, blobListingDetails: blobOptions))
            {
                var lastModified = String.Empty;
                var thumbprint = String.Empty;
                var hasLastModified = blob.Metadata.TryGetValue("LastModified", out lastModified);
                var hasThumbprint = blob.Metadata.TryGetValue("thumbprint", out thumbprint);
                faqSnapshots.Add(new BlobSnapshot()
                {
                    Thumbprint = thumbprint,
                    LastModified = hasLastModified ? lastModified : "<original post date not captured>",
                    Url = blobItem.SnapshotQualifiedUri.AbsoluteUri,
                    Comment = blobItem.IsSnapshot ? blobItem.SnapshotTime.Value.ToString() : " (Current)"
                });
            }
            return faqSnapshots;
        }

        void FetchMeta(CloudBlockBlob blob)
        {
{'fraction_non_alphanumeric': 0.08854900382370698, 'fraction_numerical': 0.0, 'mean_word_length': 1.9939759036144578, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4229238', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1210, 'n_words': 239}