Skip to content

Commit

Permalink
Merge branch 'Development' into pages
Browse files Browse the repository at this point in the history
  • Loading branch information
koszeggy committed Jan 19, 2024
2 parents 0d3d057 + 9aeb3d2 commit a2b681c
Show file tree
Hide file tree
Showing 300 changed files with 5,837 additions and 2,100 deletions.
8 changes: 7 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
Expand All @@ -223,4 +224,9 @@ dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_prefer_collection_expression = true:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
46 changes: 46 additions & 0 deletions DebuggerVisualizers/Core/DebuggerVisualizers/CoreDebuggerHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#region Copyright

///////////////////////////////////////////////////////////////////////////////
// File: GdiPlusDebuggerHelper.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2024 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////

#endregion

#region Usings

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

using KGySoft.Reflection;

#endregion

namespace KGySoft.Drawing.DebuggerVisualizers.Core
{
/// <summary>
/// A helper class to access the debugger visualizers of this assembly.
/// </summary>
public static class CoreDebuggerHelper
{
#region Methods

/// <summary>
/// Gets the debugger visualizers of this assembly.
/// </summary>
/// <returns>The debugger visualizers of this assembly.</returns>
public static Dictionary<Type, DebuggerVisualizerAttribute> GetDebuggerVisualizers()
=> Attribute.GetCustomAttributes(typeof(CoreDebuggerHelper).Assembly, typeof(DebuggerVisualizerAttribute))
.Cast<DebuggerVisualizerAttribute>().ToDictionary(a => a.Target ?? Reflector.ResolveType(a.TargetTypeName!, ResolveTypeOptions.AllowPartialAssemblyMatch)!);

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#region Copyright

///////////////////////////////////////////////////////////////////////////////
// File: ColorDebuggerVisualizer.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2024 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////

#endregion

#region Usings

using KGySoft.Drawing.DebuggerVisualizers.Core.Serialization;

using Microsoft.VisualStudio.DebuggerVisualizers;

#endregion

namespace KGySoft.Drawing.DebuggerVisualizers.Core.DebuggerVisualizers
{
internal sealed class ColorDebuggerVisualizer : DialogDebuggerVisualizer
{
#region Methods

protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
=> DebuggerHelper.DebugCustomColor(SerializationHelper.DeserializeCustomColorInfo(objectProvider.GetData()));

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#region Copyright

///////////////////////////////////////////////////////////////////////////////
// File: PaletteDebuggerVisualizer.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2024 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////

#endregion

#region Usings

using KGySoft.Drawing.DebuggerVisualizers.Core.Serialization;

using Microsoft.VisualStudio.DebuggerVisualizers;

#endregion

namespace KGySoft.Drawing.DebuggerVisualizers.Core.DebuggerVisualizers
{
internal sealed class PaletteDebuggerVisualizer : DialogDebuggerVisualizer
{
#region Methods

protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
=> DebuggerHelper.DebugCustomPalette(SerializationHelper.DeserializeCustomPaletteInfo(objectProvider.GetData()));

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#region Copyright

///////////////////////////////////////////////////////////////////////////////
// File: ReadableBitmapDataDebuggerVisualizer.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2024 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////

#endregion

#region Usings

using KGySoft.Drawing.DebuggerVisualizers.Core.Serialization;
using KGySoft.Drawing.ImagingTools.Model;

using Microsoft.VisualStudio.DebuggerVisualizers;

#endregion

namespace KGySoft.Drawing.DebuggerVisualizers.Core.DebuggerVisualizers
{
internal class ReadableBitmapDataDebuggerVisualizer : DialogDebuggerVisualizer
{
#region Methods

protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
{
using CustomBitmapInfo bitmapInfo = SerializationHelper.DeserializeCustomBitmapInfo(objectProvider.GetData());
DebuggerHelper.DebugCustomBitmap(bitmapInfo);
}

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net40;net45;net462;net6.0-windows</TargetFrameworks>
<!--<TargetFrameworks>net462</TargetFrameworks>-->
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>KGySoft.Drawing.DebuggerVisualizers.Core</RootNamespace>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\KGySoft.snk</AssemblyOriginatorKeyFile>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageLicenseFile>..\..\..\LICENSE</PackageLicenseFile>
<Authors>György Kőszeg</Authors>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Common NuGet references -->
<ItemGroup>
<!--<PackageReference Include="KGySoft.Drawing" Version="8.0.0" />-->
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- .NET Framework only references -->
<ItemGroup Condition="'$(TargetFramework)'=='net35' OR '$(TargetFramework)'=='net40' OR '$(TargetFramework)'=='net45' OR '$(TargetFramework)'=='net462'">
<!--Note: VSSDK.DebuggerVisualizers does not work in VS2022 anymore if VSIX is also installed, because it causes
"Unable to cast object [...] to type DialogDebuggerVisualizer"-->
<PackageReference Include="Microsoft.VisualStudio.DebuggerVisualizers" Version="17.0.1061105" />
</ItemGroup>

<!-- .NET only references (note: doesn't really make sense but allows testing from KGySoft.Drawing.DebuggerVisualizers.Core.Test) -->
<ItemGroup Condition="'$(TargetFramework)'=='net6.0-windows'">
<Reference Include="Microsoft.VisualStudio.DebuggerVisualizers">
<HintPath>..\..\_ref\Microsoft.VisualStudio.DebuggerVisualizers.dll</HintPath>
</Reference>
</ItemGroup>

<!-- Project references -->
<ItemGroup>
<ProjectReference Include="..\..\_Common\KGySoft.Drawing.DebuggerVisualizers.csproj" />
<ProjectReference Include="..\..\..\KGySoft.Drawing.ImagingTools\KGySoft.Drawing.ImagingTools.csproj" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy bin\$(ConfigurationName)\$(TargetFramework)\$(TargetFileName) ..\..\..\KGySoft.Drawing.ImagingTools\bin\$(ConfigurationName)\$(TargetFramework)\ /Y" />
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#region Copyright

///////////////////////////////////////////////////////////////////////////////
// File: AssemblyInfo.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2024 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////

#endregion

#region Usings

using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Runtime.InteropServices;

using KGySoft.Drawing.DebuggerVisualizers.Core.DebuggerVisualizers;
using KGySoft.Drawing.DebuggerVisualizers.Core.Serialization;
using KGySoft.Drawing.Imaging;

#endregion

#region Assembly Attributes

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KGySoft.Drawing.DebuggerVisualizers.Core")]
[assembly: AssemblyDescription("KGy SOFT Drawing Core Debugger Visualizers")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("KGy SOFT")]
[assembly: AssemblyProduct("KGy SOFT Debugger Visualizers")]
[assembly: AssemblyCopyright("Copyright © KGy SOFT. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fed0273c-6328-4cff-a1b0-2d115dca686e")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.0")]
[assembly: AssemblyInformationalVersion("4.0.0")]

// BitmapData
[assembly: DebuggerVisualizer(typeof(ReadableBitmapDataDebuggerVisualizer), typeof(ReadableBitmapDataSerializer),
TargetTypeName = "KGySoft.Drawing.Imaging.BitmapDataBase, KGySoft.Drawing.Core",
Description = "KGy SOFT BitmapDataBase Debugger Visualizer")]

// Palette
[assembly: DebuggerVisualizer(typeof(PaletteDebuggerVisualizer), typeof(PaletteSerializer),
Target = typeof(Palette),
Description = "KGy SOFT Palette Debugger Visualizer")]

// Color32
[assembly: DebuggerVisualizer(typeof(ColorDebuggerVisualizer), typeof(Color32Serializer),
Target = typeof(Color32),
Description = "KGy SOFT Color32 Debugger Visualizer")]

// PColor32
[assembly: DebuggerVisualizer(typeof(ColorDebuggerVisualizer), typeof(PColor32Serializer),
Target = typeof(PColor32),
Description = "KGy SOFT PColor32 Debugger Visualizer")]

// Color64
[assembly: DebuggerVisualizer(typeof(ColorDebuggerVisualizer), typeof(Color64Serializer),
Target = typeof(Color64),
Description = "KGy SOFT Color64 Debugger Visualizer")]

// PColor64
[assembly: DebuggerVisualizer(typeof(ColorDebuggerVisualizer), typeof(PColor64Serializer),
Target = typeof(PColor64),
Description = "KGy SOFT PColor64 Debugger Visualizer")]

// ColorF
[assembly: DebuggerVisualizer(typeof(ColorDebuggerVisualizer), typeof(ColorFSerializer),
Target = typeof(ColorF),
Description = "KGy SOFT ColorF Debugger Visualizer")]

// PColorF
[assembly: DebuggerVisualizer(typeof(ColorDebuggerVisualizer), typeof(PColorFSerializer),
Target = typeof(PColorF),
Description = "KGy SOFT PColorF Debugger Visualizer")]

#endregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#region Copyright

///////////////////////////////////////////////////////////////////////////////
// File: Color32Serializer.cs
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) KGy SOFT, 2005-2024 - All Rights Reserved
//
// You should have received a copy of the LICENSE file at the top-level
// directory of this distribution.
//
// Please refer to the LICENSE file if you want to use this source code.
///////////////////////////////////////////////////////////////////////////////

#endregion

#region Usings

using System.IO;

using KGySoft.Drawing.Imaging;

using Microsoft.VisualStudio.DebuggerVisualizers;

#endregion

namespace KGySoft.Drawing.DebuggerVisualizers.Core.Serialization
{
internal sealed class Color32Serializer : VisualizerObjectSource
{
#region Methods

public override void GetData(object target, Stream outgoingData) => SerializationHelper.SerializeCustomColorInfo((Color32)target, outgoingData);

#endregion
}
}
Loading

0 comments on commit a2b681c

Please sign in to comment.