Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the port optional #239

Closed

Conversation

smellilac
Copy link

Fixes #238

Copy link

sonarqubecloud bot commented Aug 6, 2024

@AppVeyorBot
Copy link

Copy link
Member

@ldilley ldilley left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution, @smellilac. Aside from my review questions, the only other issue I see is with indentation. Our code style uses 2 spaces.

I am also including @Ajoro to see if he has any additional suggestions.

CSharp/MineStat/MineStat.cs Show resolved Hide resolved
CSharp/MineStat/MineStat.cs Show resolved Hide resolved
#elif NET46
using ARSoft.Tools.Net;
using ARSoft.Tools.Net.Dns;
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Would we want to handle all other cases with an #else here?

Copy link
Author

Choose a reason for hiding this comment

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

I don't see how #else can be used logically here. The only thing that comes to mind is a construction like this:

#else
#error This target framework is not supported by this code. Please ensure the target is .NET Standard 2.0 or greater, or .NET Framework 4.6 or greater.

var srvRecord = srvRecords.First();
return (ushort)srvRecord.Port;
}
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Are there any conditions that should be covered under an #else?

Copy link
Author

Choose a reason for hiding this comment

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

In this case I would not use #else, as I already suggested adding it above. That way, if the wrong framework is used. The compiler will not even get to this code.

@ldilley ldilley requested a review from Ajoro August 20, 2024 02:41
@ldilley ldilley added enhancement Enhance an existing feature lang: C# Affects the C# version of minestat labels Aug 20, 2024
@smellilac smellilac requested a review from ldilley August 22, 2024 09:46
@ldilley
Copy link
Member

ldilley commented Dec 12, 2024

Closing due to lack of response from author.

@ldilley ldilley closed this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance an existing feature lang: C# Affects the C# version of minestat
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

C#: Add port autodetection and make port parameter optional
4 participants