Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
heku committed Mar 18, 2023
1 parent 94570a2 commit ec4c3e9
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 29 deletions.
18 changes: 12 additions & 6 deletions Kool.VsDiff.2019/Kool.VsDiff.2019.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Kool.VsDiff.Linked\VSPackage.Designer.cs" Link="VSPackage.Designer.cs">
<Compile Include="..\Kool.VsDiff.Linked\I18n.Designer.cs" Link="I18n.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>VSPackage.tt</DependentUpon>
<DependentUpon>I18n.tt</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest" />
<None Include="..\Kool.VsDiff.Linked\Menus.vsct" Link="Menus.vsct" />
<None Include="..\Kool.VsDiff.Linked\VSPackage.tt" Link="VSPackage.tt">
<None Include="..\Kool.VsDiff.Linked\I18n.tt" Link="I18n.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
<LastGenOutput>I18n.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
Expand All @@ -79,18 +79,24 @@
<ItemGroup>
<VSCTCompile Include="..\Kool.VsDiff.Linked\Menus.en.vsct" Link="Menus.en.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
<DependentUpon>Menus.vsct</DependentUpon>
</VSCTCompile>
<VSCTCompile Include="..\Kool.VsDiff.Linked\Menus.zh-Hans.vsct" Link="Menus.zh-Hans.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
<DependentUpon>Menus.vsct</DependentUpon>
</VSCTCompile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Kool.VsDiff.Linked\VSPackage.en.resx" Link="VSPackage.en.resx">
<EmbeddedResource Include="..\Kool.VsDiff.Linked\I18n.en.resx" Link="I18n.en.resx">
<MergeWithCTO>true</MergeWithCTO>
<LogicalName>VSPackage.en.resources</LogicalName>
<DependentUpon>I18n.tt</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\Kool.VsDiff.Linked\VSPackage.zh-Hans.resx" Link="VSPackage.zh-Hans.resx">
<EmbeddedResource Include="..\Kool.VsDiff.Linked\I18n.zh-Hans.resx" Link="I18n.zh-Hans.resx">
<MergeWithCTO>true</MergeWithCTO>
<LogicalName>VSPackage.zh-Hans.resources</LogicalName>
<DependentUpon>I18n.tt</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
Expand Down
18 changes: 12 additions & 6 deletions Kool.VsDiff.2022/Kool.VsDiff.2022.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Kool.VsDiff.Linked\VSPackage.Designer.cs" Link="VSPackage.Designer.cs">
<Compile Include="..\Kool.VsDiff.Linked\I18n.Designer.cs" Link="I18n.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>VSPackage.tt</DependentUpon>
<DependentUpon>I18n.tt</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest" />
<None Include="..\Kool.VsDiff.Linked\Menus.vsct" Link="Menus.vsct" />
<None Include="..\Kool.VsDiff.Linked\VSPackage.tt" Link="VSPackage.tt">
<None Include="..\Kool.VsDiff.Linked\I18n.tt" Link="I18n.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
<LastGenOutput>I18n.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
Expand All @@ -79,18 +79,24 @@
<ItemGroup>
<VSCTCompile Include="..\Kool.VsDiff.Linked\Menus.en.vsct" Link="Menus.en.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
<DependentUpon>Menus.vsct</DependentUpon>
</VSCTCompile>
<VSCTCompile Include="..\Kool.VsDiff.Linked\Menus.zh-Hans.vsct" Link="Menus.zh-Hans.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
<DependentUpon>Menus.vsct</DependentUpon>
</VSCTCompile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Kool.VsDiff.Linked\VSPackage.en.resx" Link="VSPackage.en.resx">
<EmbeddedResource Include="..\Kool.VsDiff.Linked\I18n.en.resx" Link="I18n.en.resx">
<MergeWithCTO>true</MergeWithCTO>
<LogicalName>VSPackage.en.resources</LogicalName>
<DependentUpon>I18n.tt</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="..\Kool.VsDiff.Linked\VSPackage.zh-Hans.resx" Link="VSPackage.zh-Hans.resx">
<EmbeddedResource Include="..\Kool.VsDiff.Linked\I18n.zh-Hans.resx" Link="I18n.zh-Hans.resx">
<MergeWithCTO>true</MergeWithCTO>
<LogicalName>VSPackage.zh-Hans.resources</LogicalName>
<DependentUpon>I18n.tt</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const string BenchmarkLanguage = "en";

var resourceNameWithoutCulture = Path.GetFileNameWithoutExtension(Host.TemplateFile);
var resourceNamespace = Host.ResolveParameterValue("directiveId", "namespaceDirectiveProcessor", "namespaceHint") ?? string.Empty;
var resourceFullNameWithoutCulture = resourceNamespace + "." + resourceNameWithoutCulture;
#>

// ------------------------------------------------------------------------------
Expand All @@ -29,7 +28,7 @@ namespace <#= resourceNamespace#>
/// </summary>
static class <#= resourceNameWithoutCulture#>
{
static readonly ResourceManager Resx = new ResourceManager("<#= resourceFullNameWithoutCulture#>", typeof(<#= resourceNameWithoutCulture#>).Assembly);
static readonly ResourceManager Resx = new ResourceManager("VSPackage", typeof(<#= resourceNameWithoutCulture#>).Assembly);

<#
var resx = Path.ChangeExtension(Host.TemplateFile , BenchmarkLanguage + ".resx");
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Kool.VsDiff.Shared/Commands/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static void OnBaseCommandEventHandler(object sender, EventArgs e)
}
catch (Exception ex)
{
MessageBox.Error(VSPackage.ErrorMessageTitle, ex.Message);
MessageBox.Error(I18n.ErrorMessageTitle, ex.Message);
}
}

Expand Down
16 changes: 8 additions & 8 deletions Kool.VsDiff.Shared/Pages/VsDiffOptionsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<StackPanel>
<GroupBox Padding="0,5">
<GroupBox.Header>
<CheckBox IsChecked="{Binding UseCustomDiffTool}" Content="{x:Static kv:VSPackage.OptionsPage_UseCustomDiffTool}" />
<CheckBox IsChecked="{Binding UseCustomDiffTool}" Content="{x:Static kv:I18n.OptionsPage_UseCustomDiffTool}" />
</GroupBox.Header>
<StackPanel IsEnabled="{Binding UseCustomDiffTool, Mode=OneWay}">
<TextBlock Text="{x:Static kv:VSPackage.OptionsPage_DiffToolPath}" />
<TextBlock Text="{x:Static kv:I18n.OptionsPage_DiffToolPath}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
Expand All @@ -27,20 +27,20 @@
<TextBox Name="CustomDiffToolPath" VerticalContentAlignment="Center" Text="{Binding CustomDiffToolPath, UpdateSourceTrigger=PropertyChanged}" />
<Button Grid.Column="1" Width="40" Height="25" Content="..." Click="OnBrowseButtonClicked" />
</Grid>
<TextBlock Margin="0,5,0,0" Text="{x:Static kv:VSPackage.OptionsPage_Arguments}" />
<TextBlock Margin="0,5,0,0" Text="{x:Static kv:I18n.OptionsPage_Arguments}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<TextBox VerticalContentAlignment="Center" Text="{Binding CustomDiffToolArgs, UpdateSourceTrigger=PropertyChanged}" />
<Button Grid.Column="1" Width="40" Height="25" Content="{x:Static kv:VSPackage.OptionsPage_TestButtonContent}" Click="OnTestButtonClicked" />
<Button Grid.Column="1" Width="40" Height="25" Content="{x:Static kv:I18n.OptionsPage_TestButtonContent}" Click="OnTestButtonClicked" />
</Grid>
</StackPanel>
</GroupBox>
<CheckBox Margin="0,5,0,0" IsChecked="{Binding DiffClipboardWithCodeEnabled}" Content="{x:Static kv:VSPackage.OptionsPage_EnableDiffClipboardWithCode}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding DiffClipboardWithFileEnabled}" Content="{x:Static kv:VSPackage.OptionsPage_EnableDiffClipboardWithFile}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding DiffClipboardWithDocumentEnabled}" Content="{x:Static kv:VSPackage.OptionsPage_EnableDiffClipboardWithDocument}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding PreferToUsePreviewWindow}" Content="{x:Static kv:VSPackage.OptionsPage_PreferToUsePreviewWindow}" IsEnabled="{Binding UseCustomDiffTool, Mode=OneWay, Converter={StaticResource InverseBooleanConverter}}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding DiffClipboardWithCodeEnabled}" Content="{x:Static kv:I18n.OptionsPage_EnableDiffClipboardWithCode}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding DiffClipboardWithFileEnabled}" Content="{x:Static kv:I18n.OptionsPage_EnableDiffClipboardWithFile}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding DiffClipboardWithDocumentEnabled}" Content="{x:Static kv:I18n.OptionsPage_EnableDiffClipboardWithDocument}" />
<CheckBox Margin="0,5,0,0" IsChecked="{Binding PreferToUsePreviewWindow}" Content="{x:Static kv:I18n.OptionsPage_PreferToUsePreviewWindow}" IsEnabled="{Binding UseCustomDiffTool, Mode=OneWay, Converter={StaticResource InverseBooleanConverter}}" />
</StackPanel>
</UserControl>
2 changes: 1 addition & 1 deletion Kool.VsDiff.Shared/Pages/VsDiffOptionsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void OnTestButtonClicked(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
VS.MessageBox.Error(VSPackage.ErrorMessageTitle, ex.Message);
VS.MessageBox.Error(I18n.ErrorMessageTitle, ex.Message);
}
}
}

0 comments on commit ec4c3e9

Please sign in to comment.