<commit_before>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using NLog;

namespace AppCompatCache
{
    public class VistaWin2k3Win2k8 : IAppCompatCache
    {
        public VistaWin2k3Win2k8(byte[] rawBytes, bool is32Bit, int controlSet)
        {
            Entries = new List<CacheEntry>();

            var index = 4;
            ControlSet = controlSet;

            EntryCount = BitConverter.ToInt32(rawBytes, index);

            index = 8;

            var position = 0;

            if (EntryCount == 0)
            {
                return; ;
            }

            if (is32Bit)
            {
                while (index < rawBytes.Length)
                {
                    try
                    {
                        var ce = new CacheEntry();

                        ce.PathSize = BitConverter.ToUInt16(rawBytes, index);
                        index += 2;

                        var maxPathSize = BitConverter.ToUInt16(rawBytes, index);
                        index += 2;


                        var pathOffset = BitConverter.ToInt32(rawBytes, index);
                        index += 4;

                        ce.LastModifiedTimeUTC =
                            DateTimeOffset.FromFileTime(BitConverter.ToInt64(rawBytes, index)).ToUniversalTime();
                        index += 8;

                        // skip 4 unknown (insertion flags?)
                        ce.InsertFlags = (AppCompatCache.InsertFlag)BitConverter.ToInt32(rawBytes, index);
                        index += 4;

                        // skip 4 unknown (shim flags?)
                        index += 4;
//
//                        var ceDataSize = BitConverter.ToUInt32(rawBytes, index);
//                        index += 4;
//
//                        var dataOffset = BitConverter.ToUInt32(rawBytes, index);
//                        index += 4;

                        ce.Path = Encoding.Unicode.GetString(rawBytes, pathOffset, ce.PathSize).Replace(@"\??\", "");

                        if ((ce.InsertFlags & AppCompatCache.InsertFlag.Executed) == AppCompatCache.InsertFlag.Executed)
                        {
                            ce.Executed = AppCompatCache.Execute.Yes;
                        }
                        else
                        {
                            ce.Executed = AppCompatCache.Execute.No;
                        }

                        ce.Executed = AppCompatCache.Execute.NA;

                        ce.CacheEntryPosition = position;
                        ce.ControlSet = controlSet;<commit_msg>remove commented out code<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using NLog;

namespace AppCompatCache
{
    public class VistaWin2k3Win2k8 : IAppCompatCache
    {
        public VistaWin2k3Win2k8(byte[] rawBytes, bool is32Bit, int controlSet)
        {
            Entries = new List<CacheEntry>();

            var index = 4;
            ControlSet = controlSet;

            EntryCount = BitConverter.ToInt32(rawBytes, index);

            index = 8;

            var position = 0;

            if (EntryCount == 0)
            {
                return; ;
            }

            if (is32Bit)
            {
                while (index < rawBytes.Length)
                {
                    try
                    {
                        var ce = new CacheEntry();

                        ce.PathSize = BitConverter.ToUInt16(rawBytes, index);
                        index += 2;

                        var maxPathSize = BitConverter.ToUInt16(rawBytes, index);
                        index += 2;


                        var pathOffset = BitConverter.ToInt32(rawBytes, index);
                        index += 4;

                        ce.LastModifiedTimeUTC =
                            DateTimeOffset.FromFileTime(BitConverter.ToInt64(rawBytes, index)).ToUniversalTime();
                        index += 8;

                        // skip 4 unknown (insertion flags?)
                        ce.InsertFlags = (AppCompatCache.InsertFlag)BitConverter.ToInt32(rawBytes, index);
                        index += 4;

                        // skip 4 unknown (shim flags?)
                        index += 4;

                        ce.Path = Encoding.Unicode.GetString(rawBytes, pathOffset, ce.PathSize).Replace(@"\??\", "");

//                        if ((ce.InsertFlags & AppCompatCache.InsertFlag.Executed) == AppCompatCache.InsertFlag.Executed)
//                        {
//                            ce.Executed = AppCompatCache.Execute.Yes;
//                        }
//                        else
//                        {
//                            ce.Executed = AppCompatCache.Execute.No;
//                        }

                        ce.Executed = AppCompatCache.Execute.NA;

                        ce.CacheEntryPosition = position;
                        ce.ControlSet = controlSet;
{'fraction_non_alphanumeric': 0.08648864089278598, 'fraction_numerical': 0.015544041450777202, 'mean_word_length': 1.1, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6627416', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1134, 'n_words': 236}