INNER CODE UNIT · C#

GetPrefix

Corsinvest/cv4pve-autosnap · src/Corsinvest.ProxmoxVE.AutoSnap.Api/AutoSnapEngine.cs:231

    private static string GetPrefix(string label) => Prefix + label;

    /// <summary>
    /// Name of the snapshot of <paramref name="label"/> taken at <paramref name="date"/>. The timestamp uses the
    /// invariant culture: with the culture of the host a Thai, Persian or Hijri calendar would change the year.
    /// </summary>
    internal static string GetSnapName(string label, string timestampFormat, DateTime date)
        => GetPrefix(label) + date.ToString(GetTimestampFormat(timestampFormat), CultureInfo.InvariantCulture);

    internal static IEnumerable<VmSnapshot> FilterLabel(IEnumerable<VmSnapshot> snapshots, string label, string timestampFormat)
    {
        var lenTms = GetTimestampFormat(timestampFormat).Length;
        return FilterApp(snapshots.Where(a => (a.Name.Length > lenTms) && a.Name[..^lenTms] == GetPrefix(label)));
    }

    /// <summary>
    /// Execute a autosnap.
    /// </summary>

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…