Skip to content

Conversation

@irsdl
Copy link
Owner

@irsdl irsdl commented Aug 1, 2025

Help & Readme Update

irsdl and others added 9 commits July 26, 2025 23:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
SharePoint plugin has been updated
Project has been restructured
Helpers for Gadgets and Plugins have been created to make the application cleaner
Tags have replaced GadgetTypes
Help & Readme Update
Copilot AI review requested due to automatic review settings August 1, 2025 21:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces helper classes for gadget and plugin management and implements comprehensive refactoring of the YSoNet tool to improve maintainability and functionality. The changes replace hardcoded gadget discovery with centralized helper classes and implement better help system functionality.

Key changes include:

  • Introduction of GadgetHelper and PluginHelper classes for centralized gadget/plugin discovery and management
  • Comprehensive refactoring of Program.cs to use new helper classes and implement gadget/plugin-specific help
  • Updates to gadget labels and naming patterns for consistency
  • Code organization improvements and import statement reordering

Reviewed Changes

Copilot reviewed 80 out of 86 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
ysonet/Helpers/GadgetHelper.cs New helper class for gadget discovery, validation, and instantiation
ysonet/Helpers/PluginHelper.cs New helper class for plugin discovery, validation, and instantiation
ysonet/Program.cs Major refactoring to use helper classes and implement specific help functionality
ysonet/Generators/Base/IGenerator.cs Updated gadget labels/tags with clearer naming
ysonet/Generators/Base/GenericGenerator.cs Implemented default Name() method using reflection
Various generator files Removed redundant Name() overrides and updated label references
Various plugin files Import statement reordering and minor cleanup



if (!consumer_gadget.Labels().Contains(GadgetTypes.BridgeAndDerived))
if (!consumer_gadget.Labels().Contains(GadgetTags.Bridged))
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label check has changed from GadgetTypes.BridgeAndDerived to GadgetTags.Bridged, but this may break existing functionality. Ensure that all gadgets that were previously marked as BridgeAndDerived are now properly marked as Bridged to maintain compatibility.

Copilot uses AI. Check for mistakes.
Comment on lines 22 to 28
string spoofedAssembly = "";

public override OptionSet Options()
{
OptionSet options = new OptionSet()
{
{"spoofedAssembly=", "The assembly name you want to use in the generated serialized object (example: 'mscorlib')", v => spoofedAssembly = v },
{"spoofedAssembly=", "The assembly name you want to use in the generated serialized object (example: 'mscorlib' or use 'default' for System.Data)", v => spoofedAssembly = v },
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for spoofedAssembly has changed from a specific assembly string to an empty string. This is a breaking change that could affect existing users who rely on the previous default behavior. Consider maintaining backward compatibility or clearly documenting this change.

Copilot uses AI. Check for mistakes.
}

string spoofedAssembly = "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
string spoofedAssembly = "";
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as in DataSetOldBehaviourGenerator - the default value for spoofedAssembly has changed from a specific assembly string to an empty string, which is a breaking change.

Suggested change
string spoofedAssembly = "";
string spoofedAssembly = "System.Data";

Copilot uses AI. Check for mistakes.
DataSetMarshal payloadDataSetMarshal = new DataSetMarshal(binaryFormatterPayload);

DataSetBinaryMarshal payloadDataSetMarshal = new DataSetBinaryMarshal(binaryFormatterPayload);
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name has changed from DataSetMarshal to DataSetBinaryMarshal. This is a breaking change that could affect code that directly references this class. Ensure all references are updated consistently throughout the codebase.

Copilot uses AI. Check for mistakes.
DataSetSpoofMarshal payloadDataSetMarshal = new DataSetSpoofMarshal(binaryFormatterPayload);

DataSetBinarySpoofMarshal payloadDataSetMarshal = new DataSetBinarySpoofMarshal(binaryFormatterPayload);
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name has changed from DataSetSpoofMarshal to DataSetBinarySpoofMarshal. This is a breaking change that could affect code that directly references this class.

Copilot uses AI. Check for mistakes.
Comment on lines 128 to 134
if (variant_number == 2)
{
obj = new TextFormattingRunPropertiesMarshal(xmlResourceDict);
}
else
{
obj = TypeConfuseDelegateGenerator.GetXamlGadget(xmlResourceDict);
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for variant selection has been inverted. Previously variant 1 used TypeConfuseDelegateGenerator.GetXamlGadget() and variant 2 used TextFormattingRunPropertiesMarshal. Now it's the opposite. This could break existing functionality for users relying on specific variant behaviors.

Copilot uses AI. Check for mistakes.
// 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: AssemblyMetadata("BuildTime", "$(DateTime.UtcNow)")]
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MSBuild property $(DateTime.UtcNow) will not be evaluated at compile time in this context. This will result in the literal string "$(DateTime.UtcNow)" being stored as metadata rather than the actual build time. Consider using a different approach for build time tracking.

Suggested change
[assembly: AssemblyMetadata("BuildTime", "$(DateTime.UtcNow)")]
[assembly: AssemblyMetadata("BuildTime", System.DateTime.UtcNow.ToString("o"))]

Copilot uses AI. Check for mistakes.
Comment on lines 21 to 22
// This is used to return the name of the gadget
// It must be overridden especially in cases where a gadget inherits from another gadget
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The default implementation uses reflection to derive the name from the class name. While this reduces code duplication, it creates a dependency on naming conventions. Consider documenting this convention clearly and ensuring it's consistently followed across all generators.

Suggested change
// This is used to return the name of the gadget
// It must be overridden especially in cases where a gadget inherits from another gadget
/// <summary>
/// Returns the name of the gadget by using the actual class name, removing "Generator" from the end if present.
///
/// <para>
/// <b>Naming convention:</b> All generator classes <b>must</b> have names ending with "Generator" for the default implementation to work correctly.
/// If a gadget inherits from another gadget or does not follow this convention, override this method to provide the correct name.
/// </para>
/// </summary>

Copilot uses AI. Check for mistakes.
@irsdl irsdl added documentation Improvements or additions to documentation major labels Aug 1, 2025
@irsdl irsdl merged commit 7858ff1 into master Aug 1, 2025
1 check passed
@irsdl irsdl deleted the test/required-check branch August 1, 2025 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation major

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants