Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions libEDSsharp/eds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,15 @@
/// </summary>
public partial class InfoSection
{
protected Dictionary<string, string> section;

Check warning on line 336 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.section'

protected string infoheader;

Check warning on line 338 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.infoheader'
protected string edssection;

Check warning on line 339 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.edssection'

public enum Filetype

Check warning on line 341 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.Filetype'
{
File_EDS,

Check warning on line 343 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.Filetype.File_EDS'
File_DCF

Check warning on line 344 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

Missing XML comment for publicly visible type or member 'InfoSection.Filetype.File_DCF'
}

public bool GetField(string name, string varname)
Expand Down Expand Up @@ -1281,7 +1281,32 @@
break;
}
}
/// <summary>
/// Incremement number at end of string by given increment
/// </summary>
/// <param input>SubObject name as string to increment</param>

Check warning on line 1287 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

XML comment has badly formed XML -- 'Missing equals sign between attribute and attribute value.'

Check warning on line 1287 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net8, Release)

XML comment has badly formed XML -- 'Missing equals sign between attribute and attribute value.'
/// <param increment>increment for next SubObject</param>

Check warning on line 1288 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net481, Release)

XML comment has badly formed XML -- 'Missing equals sign between attribute and attribute value.'

Check warning on line 1288 in libEDSsharp/eds.cs

View workflow job for this annotation

GitHub Actions / build (net8, Release)

XML comment has badly formed XML -- 'Missing equals sign between attribute and attribute value.'
/// <returns>incremented name or the original string if no number is found at the end</returns>
public static string IncrementNumberAtEnd(string input, int increment)
{
// Regex to match the last token if it's a number
Regex regex = new Regex(@"(\d+)$");
Match match = regex.Match(input);

if (match.Success)
{
// Extract the number and increment it
int number = int.Parse(match.Value);
number += increment;

// Replace the old number with the new number
string result = regex.Replace(input, number.ToString());
return result;
}

// Return the original string if no number is found at the end
return input;
}
/// <summary>
/// Duplicate current sub entry and add it to parent
/// </summary>
Expand Down Expand Up @@ -1341,8 +1366,11 @@

newSubObjects.Add(newSubIndex++, subOd);

if (originalOd == subOd)
newSubObjects.Add(newSubIndex++, newOd);
if (lastSubOd == subOd) {
newSubObjects.Add(newSubIndex, newOd);
// Auto increment if the parameter name has a number at the end
newSubObjects[newSubIndex].parameter_name = IncrementNumberAtEnd(newSubObjects[(ushort)(newSubIndex-1)].parameter_name, 1);
}
}
if (originalOd == null)
newSubObjects.Add(newSubIndex++, newOd);
Expand Down
Loading