<commit_before>﻿<Page
    x:Class="CodeHub.Views.FileContentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CodeHub.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:CodeHub.Controls"
    xmlns:converters="using:CodeHub.Converters"
    mc:Ignorable="d">
    <Page.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" x:Name="BooleanToVisibilityConverter"/>
        <converters:ReverseBooleanToVisibilityConverter x:Key="ReverseBooleanToVisibilityConverter" x:Name="ReverseBooleanToVisibilityConverter"/>
    </Page.Resources>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--Header-->
        <controls:AutoHideGrid Background="#FF171717"
                               Height="48"
                               x:Name="Header"
                               VerticalAlignment="Top">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"
                                      MaxWidth="140"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <!--Branch-->
                <Viewbox Height="16"
                         Width="16"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
                         Margin="12,0,0,0">
                    <Path Data="{StaticResource RepoForkIcon}"
                          Fill="{ThemeResource ApplicationForegroundThemeBrush}"
                          StrokeThickness="0.0"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Center"/>
                </Viewbox>
                <TextBlock Text="{x:Bind ViewModel.SelectedBranch,Mode=OneWay, FallbackValue=master}"
                           Margin="8,0,0,0"
                           FontSize="14"
                           Grid.Column="1"
                           TextTrimming="CharacterEllipsis"
                           MaxLines="1"
                           TextWrapping="NoWrap"
                           VerticalAlignment="Center"/>

                <!--Current path-->
                <TextBlock FontFamily="Segoe MDL2 Assets"
                           Text="&#xE211;"
                           VerticalAlignment="Center"
                           Grid.Column="2"
                           FontSize="16"
                           Foreground="{StaticResource AppPrimaryColorBrush}"
                           Margin="12,2,0,0"/>
                <TextBlock Text="{x:Bind ViewModel.Path, Mode=OneWay, FallbackValue=/}"
                           Margin="8,0,0,0"
                           FontSize="14"
                           Grid.Column="3"
                           TextTrimming="CharacterEllipsis"
                           MaxLines="1"
                           TextWrapping="NoWrap"
                           VerticalAlignment="Center"/>
            </Grid>
        </controls:AutoHideGrid>

        <ScrollViewer Grid.Row="1"
                      x:Name="Scroller"
                      VerticalScrollMode="Enabled"
                      HorizontalScrollMode="Enabled"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Auto"
                      Visibility="{x:Bind ViewModel.IsSupportedFile,Converter={StaticResource BooleanToVisibilityConverter},Mode=OneWay}">
            <Grid>

                <WebView controls:HtmlToRtfConverter.HtmlString="{x:Bind ViewModel.HTMLContent,Mode=OneWay}"
                         NavigationCompleted="WebView_NavigationCompleted"
                         DefaultBackgroundColor="{x:Bind ViewModel.HTMLBackgroundColor, Mode=OneWay}"
                         Visibility="{x:Bind ViewModel.IsImage,Converter={StaticResource ReverseBooleanToVisibilityConverter},Mode=OneWay}"
                         Margin="-8,-8,-12,-8"/>

                <Image HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Source="{x:Bind ViewModel.ImageFile,Mode=OneWay}"
                        Visibility="{x:Bind ViewModel.IsImage,Converter={StaticResource BooleanToVisibilityConverter},Mode=OneWay}"/>
            </Grid>

        </ScrollViewer>

        <TextBlock Grid.Row="1" Text="File type not supported"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   Foreground="Gray"
                   Visibility="{x:Bind ViewModel.IsSupportedFile,Converter={StaticResource ReverseBooleanToVisibilityConverter},Mode=OneWay}"/>

        <ProgressRing Grid.Row="1"
                      Width="40"
                      Height="40"
                      IsActive="{x:Bind ViewModel.isLoading,Mode=OneWay}"/>
    </Grid>

</Page>
<commit_msg>Added ImageEx control for viewing Image files<commit_after>﻿<Page
    x:Class="CodeHub.Views.FileContentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CodeHub.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:control="using:Microsoft.Toolkit.Uwp.UI.Controls"
    xmlns:controls="using:CodeHub.Controls"
    xmlns:converters="using:CodeHub.Converters"
    mc:Ignorable="d">
    <Page.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" x:Name="BooleanToVisibilityConverter"/>
        <converters:ReverseBooleanToVisibilityConverter x:Key="ReverseBooleanToVisibilityConverter" x:Name="ReverseBooleanToVisibilityConverter"/>
    </Page.Resources>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--Header-->
        <controls:AutoHideGrid Background="#FF171717"
                               Height="48"
                               x:Name="Header"
                               VerticalAlignment="Top">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"
                                      MaxWidth="140"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <!--Branch-->
                <Viewbox Height="16"
                         Width="16"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
                         Margin="12,0,0,0">
                    <Path Data="{StaticResource RepoForkIcon}"
                          Fill="{ThemeResource ApplicationForegroundThemeBrush}"
                          StrokeThickness="0.0"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Center"/>
                </Viewbox>
                <TextBlock Text="{x:Bind ViewModel.SelectedBranch,Mode=OneWay, FallbackValue=master}"
                           Margin="8,0,0,0"
                           FontSize="14"
                           Grid.Column="1"
                           TextTrimming="CharacterEllipsis"
                           MaxLines="1"
                           TextWrapping="NoWrap"
                           VerticalAlignment="Center"/>

                <!--Current path-->
                <TextBlock FontFamily="Segoe MDL2 Assets"
                           Text="&#xE211;"
                           VerticalAlignment="Center"
                           Grid.Column="2"
                           FontSize="16"
                           Foreground="{StaticResource AppPrimaryColorBrush}"
                           Margin="12,2,0,0"/>
                <TextBlock Text="{x:Bind ViewModel.Path, Mode=OneWay, FallbackValue=/}"
                           Margin="8,0,0,0"
                           FontSize="14"
                           Grid.Column="3"
                           TextTrimming="CharacterEllipsis"
                           MaxLines="1"
                           TextWrapping="NoWrap"
                           VerticalAlignment="Center"/>
            </Grid>
        </controls:AutoHideGrid>

        <ScrollViewer Grid.Row="1"
                      x:Name="Scroller"
                      VerticalScrollMode="Enabled"
                      HorizontalScrollMode="Enabled"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Auto"
                      Visibility="{x:Bind ViewModel.IsSupportedFile,Converter={StaticResource BooleanToVisibilityConverter},Mode=OneWay}">
            <Grid>

                <WebView controls:HtmlToRtfConverter.HtmlString="{x:Bind ViewModel.HTMLContent,Mode=OneWay}"
                         NavigationCompleted="WebView_NavigationCompleted"
                         DefaultBackgroundColor="{x:Bind ViewModel.HTMLBackgroundColor, Mode=OneWay}"
                         Visibility="{x:Bind ViewModel.IsImage,Converter={StaticResource ReverseBooleanToVisibilityConverter},Mode=OneWay}"
                         Margin="-8,-8,-12,-8"/>

                <control:ImageEx HorizontalAlignment="Center"
                                 VerticalAlignment="Center"
                                 Source="{x:Bind ViewModel.ImageFile,Mode=OneWay}"
                                 Visibility="{x:Bind ViewModel.IsImage,Converter={StaticResource BooleanToVisibilityConverter},Mode=OneWay}"/>
            </Grid>

        </ScrollViewer>

        <TextBlock Grid.Row="1" Text="File type not supported"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   Foreground="Gray"
                   Visibility="{x:Bind ViewModel.IsSupportedFile,Converter={StaticResource ReverseBooleanToVisibilityConverter},Mode=OneWay}"/>

        <ProgressRing Grid.Row="1"
                      Width="40"
                      Height="40"
                      IsActive="{x:Bind ViewModel.isLoading,Mode=OneWay}"/>
    </Grid>

</Page>

{'fraction_non_alphanumeric': 0.10507816113218019, 'fraction_numerical': 0.01442974747941911, 'mean_word_length': 1.5835125448028673, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 17}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2627777', 'n_tokens_mistral': 2752, 'n_tokens_neox': 2438, 'n_words': 309}