Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Changes proposed in this pull request

  • Fixed 3 XML exports using wrong ApplicationName enum values (IPNetworkInfo, SNTPLookupResultInfo, WiFiNetworkInfo)
  • Added RFC 4180-compliant CSV escaping via EscapeCsvValue() helper method
  • Applied proper CSV escaping to all 20 export managers, replacing hardcoded quotes and incorrect .Replace(",", "") hacks

Related issue(s)

Based on analysis requested in PRs #3290 and #3291

Copilot generated summary

Copilot summary

ApplicationName Corrections

  • IPNetworkInfo: ApplicationName.SNMPApplicationName.SubnetCalculator
  • SNTPLookupResultInfo: ApplicationName.SNMPApplicationName.SNTPLookup
  • WiFiNetworkInfo: ApplicationName.IPScannerApplicationName.WiFi

CSV Escaping Implementation

Added EscapeCsvValue() helper that wraps values in quotes when they contain commas, quotes, or newlines, and escapes internal quotes by doubling them:

internal static string EscapeCsvValue(string value)
{
    if (string.IsNullOrEmpty(value))
        return value;

    if (value.Contains(',') || value.Contains('"') || value.Contains('\n') || value.Contains('\r'))
    {
        return $"\"{value.Replace("\"", "\"\"")}\"";
    }

    return value;
}

Applied to all string fields across ConnectionInfo, DiscoveryProtocolPackageInfo, IPGeolocationInfo, TracerouteHopInfo, DNSLookupRecordInfo, HostsFileEntry, PingInfo, PortScannerInfo, OUIInfo, PortLookupInfo, IPScannerHostInfo, SNMPReceivedInfo, SNTPLookupResultInfo, NetworkInterface, and WiFiNetworkInfo export managers.

To-Do

Contributing

By submitting this pull request, I confirm the following:

Original prompt

/task based on this PR #3290 and #3291 can you anaylze the export logic https://github.com/BornToBeRoot/NETworkManager/tree/main/Source/NETworkManager.Models/Export and find potential bugs, or logic issues in the code. Fix them as needed.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 28, 2025 17:31
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze and fix export logic for potential issues Fix export logic: ApplicationName mismatches and CSV escaping Dec 28, 2025
Copilot AI requested a review from BornToBeRoot December 28, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants