-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61f51bf
commit 4d72430
Showing
7 changed files
with
170 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!-- | ||
Copyright © 2021-2024 Hibi_10000 | ||
This file is part of HashCalculator program. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:sys="clr-namespace:System;assembly=mscorlib" | ||
xmlns:str="clr-namespace:Hash.Wpf.Strings"> | ||
<sys:String x:Key="AppName">HashCalculator</sys:String> | ||
<str:String x:Key="Version" Text="v0.7.0"/> | ||
<str:Strings x:Key="Title" Format="{}{0} {1}"> | ||
<str:StringResource ResourceKey="AppName"/> | ||
<str:StringResource ResourceKey="Version"/> | ||
</str:Strings> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright © 2021-2024 Hibi_10000 | ||
// | ||
// This file is part of HashCalculator program. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Windows.Markup; | ||
|
||
namespace Hash.Wpf.Strings; | ||
|
||
[ContentProperty("Text")] | ||
[MarkupExtensionReturnType(typeof(string))] | ||
public class StringExtension : MarkupExtension | ||
{ | ||
private string _string = string.Empty; | ||
|
||
[ConstructorArgument("text")] | ||
public string Text | ||
{ | ||
get => _string; | ||
set => _string = value; | ||
} | ||
|
||
public override object ProvideValue(IServiceProvider serviceProvider) | ||
{ | ||
return _string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright © 2021-2024 Hibi_10000 | ||
// | ||
// This file is part of HashCalculator program. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Windows; | ||
using System.Windows.Markup; | ||
|
||
namespace Hash.Wpf.Strings; | ||
|
||
[MarkupExtensionReturnType(typeof(object))] | ||
public class StringResourceExtension : StaticResourceExtension | ||
{ | ||
//public StringResourceExtension() {} | ||
//public StringResourceExtension(object resourceKey) : base(resourceKey) {} | ||
|
||
//public override object? ProvideValue(IServiceProvider serviceProvider) | ||
//{ | ||
// object? value = base.ProvideValue(serviceProvider); | ||
// if (value is MarkupExtension me) | ||
// { | ||
// return me.ProvideValue(serviceProvider); | ||
// } | ||
// return value; | ||
//} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright © 2021-2024 Hibi_10000 | ||
// | ||
// This file is part of HashCalculator program. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using System.Windows.Markup; | ||
|
||
namespace Hash.Wpf.Strings; | ||
|
||
[ContentProperty("Strings")] | ||
[MarkupExtensionReturnType(typeof(string))] | ||
public class StringsExtension : MarkupExtension | ||
{ | ||
private List<string> _strings = []; | ||
private string? _formatString; | ||
|
||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] | ||
public List<string> Strings | ||
{ | ||
get => _strings; | ||
set => _strings = value; | ||
} | ||
|
||
[StringSyntax("CompositeFormat")] | ||
public string? Format | ||
{ | ||
get => _formatString; | ||
set => _formatString = value; | ||
} | ||
|
||
public override object? ProvideValue(IServiceProvider serviceProvider) | ||
{ | ||
if (_formatString is not null) | ||
{ | ||
return string.Format(_formatString, _strings.ToArray<object>()); | ||
} | ||
return string.Concat(_strings); | ||
} | ||
} |