update headers
This commit is contained in:
parent
d8f5895dbb
commit
477a3a2e2b
13 changed files with 2151 additions and 2096 deletions
|
@ -1,25 +1,25 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 27-08-2016
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By : Frede H.
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="ExtensionsEx.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="ExtensionsEx.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
@ -27,8 +27,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Class ExtensionsEx.
|
||||
/// </summary>
|
||||
|
@ -46,4 +46,3 @@ namespace FCS.Lib.Utility
|
|||
action(item);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 2020-07-01
|
||||
// Author : fhdk
|
||||
// Created : 2023 02 02 06:59
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="Generators.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="Generators.cs" company="FCS">
|
||||
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
@ -29,8 +29,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Generators
|
||||
/// </summary>
|
||||
|
@ -81,7 +81,7 @@ namespace FCS.Lib.Utility
|
|||
for (var i = 0; i < leftGroupsOrder.Length; i++)
|
||||
leftGroupsOrder[i] = i;
|
||||
|
||||
// Using our private randomizer
|
||||
// Using our private random number generator
|
||||
var random = RandomSeed();
|
||||
|
||||
// This array will hold short-url characters.
|
||||
|
@ -133,9 +133,8 @@ namespace FCS.Lib.Utility
|
|||
// so that we don't pick it until we process all characters in
|
||||
// this group.
|
||||
if (lastCharIdx != nextCharIdx)
|
||||
{
|
||||
(charGroups[nextGroupIdx][lastCharIdx], charGroups[nextGroupIdx][nextCharIdx]) = (charGroups[nextGroupIdx][nextCharIdx], charGroups[nextGroupIdx][lastCharIdx]);
|
||||
}
|
||||
(charGroups[nextGroupIdx][lastCharIdx], charGroups[nextGroupIdx][nextCharIdx]) = (
|
||||
charGroups[nextGroupIdx][nextCharIdx], charGroups[nextGroupIdx][lastCharIdx]);
|
||||
|
||||
// Decrement the number of unprocessed characters in
|
||||
// this group.
|
||||
|
@ -153,9 +152,8 @@ namespace FCS.Lib.Utility
|
|||
// Swap processed group with the last unprocessed group
|
||||
// so that we don't pick it until we process all groups.
|
||||
if (lastLeftGroupsOrderIdx != nextLeftGroupsOrderIdx)
|
||||
{
|
||||
(leftGroupsOrder[lastLeftGroupsOrderIdx], leftGroupsOrder[nextLeftGroupsOrderIdx]) = (leftGroupsOrder[nextLeftGroupsOrderIdx], leftGroupsOrder[lastLeftGroupsOrderIdx]);
|
||||
}
|
||||
(leftGroupsOrder[lastLeftGroupsOrderIdx], leftGroupsOrder[nextLeftGroupsOrderIdx]) = (
|
||||
leftGroupsOrder[nextLeftGroupsOrderIdx], leftGroupsOrder[lastLeftGroupsOrderIdx]);
|
||||
|
||||
// Decrement the number of unprocessed groups.
|
||||
lastLeftGroupsOrderIdx--;
|
||||
|
@ -176,7 +174,7 @@ namespace FCS.Lib.Utility
|
|||
{
|
||||
options ??= new StringOptions
|
||||
{
|
||||
RequiredLength = 10,
|
||||
RequiredLength = 16,
|
||||
RequireDigit = true,
|
||||
RequireLowercase = true,
|
||||
RequireUppercase = true,
|
||||
|
@ -197,13 +195,13 @@ namespace FCS.Lib.Utility
|
|||
{
|
||||
options ??= new StringOptions
|
||||
{
|
||||
RequiredLength = 10,
|
||||
RequiredLength = 16,
|
||||
RequireDigit = true,
|
||||
RequireLowercase = true,
|
||||
RequireUppercase = true,
|
||||
RequiredUniqueChars = 4,
|
||||
RequireNonLetterOrDigit = true,
|
||||
RequireNonAlphanumeric = true
|
||||
RequiredUniqueChars = 8,
|
||||
RequireNonLetterOrDigit = false,
|
||||
RequireNonAlphanumeric = false
|
||||
};
|
||||
return GenerateRandomString(options);
|
||||
}
|
||||
|
@ -240,7 +238,7 @@ namespace FCS.Lib.Utility
|
|||
{
|
||||
options ??= new StringOptions
|
||||
{
|
||||
RequiredLength = 10,
|
||||
RequiredLength = 16,
|
||||
RequireDigit = true,
|
||||
RequireLowercase = true,
|
||||
RequireUppercase = true,
|
||||
|
@ -257,7 +255,7 @@ namespace FCS.Lib.Utility
|
|||
"!@$?_-" // non-alphanumeric
|
||||
};
|
||||
|
||||
// Using our private randomizer
|
||||
// Using our private random number generator
|
||||
var rand = RandomSeed();
|
||||
|
||||
var chars = new List<char>();
|
||||
|
@ -320,4 +318,3 @@ namespace FCS.Lib.Utility
|
|||
return new Random(seed);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,40 @@
|
|||
using System;
|
||||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="GuidGenerator.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Used for generating UUID based on RFC 4122.
|
||||
/// </summary>
|
||||
/// <seealso href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace</seealso>
|
||||
public static class GuidGenerator
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// number of bytes in guid
|
||||
/// </summary>
|
||||
|
@ -53,16 +78,6 @@ namespace FCS.Lib.Utility
|
|||
// offset to move from 1/1/0001, which is 0-time for .NET, to gregorian 0-time of 10/15/1582
|
||||
private static readonly DateTimeOffset GregorianCalendarStart = new(1582, 10, 15, 0, 0, 0, TimeSpan.Zero);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default clock sequence
|
||||
/// </summary>
|
||||
public static byte[] DefaultClockSequence { get; set; }
|
||||
/// <summary>
|
||||
/// Default node
|
||||
/// </summary>
|
||||
public static byte[] DefaultNode { get; set; }
|
||||
|
||||
static GuidGenerator()
|
||||
{
|
||||
DefaultClockSequence = new byte[2];
|
||||
|
@ -73,6 +88,17 @@ namespace FCS.Lib.Utility
|
|||
random.NextBytes(DefaultNode);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default clock sequence
|
||||
/// </summary>
|
||||
public static byte[] DefaultClockSequence { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default node
|
||||
/// </summary>
|
||||
public static byte[] DefaultNode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set default node
|
||||
/// </summary>
|
||||
|
@ -248,4 +274,3 @@ namespace FCS.Lib.Utility
|
|||
return new Guid(guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,31 @@
|
|||
namespace FCS.Lib.Utility
|
||||
{
|
||||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="GuidVersion.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Guid Version Enum
|
||||
/// </summary>
|
||||
|
@ -9,17 +35,19 @@
|
|||
/// Time
|
||||
/// </summary>
|
||||
TimeBased = 0x01,
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
Reserved = 0x02,
|
||||
|
||||
/// <summary>
|
||||
/// Name
|
||||
/// </summary>
|
||||
NameBased = 0x03,
|
||||
|
||||
/// <summary>
|
||||
/// Random
|
||||
/// </summary>
|
||||
Random = 0x04
|
||||
}
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 03-10-2015
|
||||
// Author : fhdk
|
||||
// Created : 2023 01 23 07:31
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="IAsyncReadonlyRepo.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="IAsyncReadonlyRepo.cs" company="FCS">
|
||||
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
@ -30,8 +30,8 @@ using System.Linq;
|
|||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Interface IRepositoryAsync
|
||||
/// </summary>
|
||||
|
@ -93,4 +93,3 @@ namespace FCS.Lib.Utility
|
|||
/// <returns>TEntity.</returns>
|
||||
TEntity GetById(string id);
|
||||
}
|
||||
}
|
|
@ -1,31 +1,31 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 05-13-2020
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="IRepository.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="IRepository.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Interface IRepository
|
||||
/// </summary>
|
||||
|
@ -58,4 +58,3 @@ namespace FCS.Lib.Utility
|
|||
/// <param name="id">The identifier.</param>
|
||||
void Delete(TKey id);
|
||||
}
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 03-10-2015
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="IRepositoryEx.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="IRepositoryEx.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
@ -29,8 +29,8 @@ using System.Linq;
|
|||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Interface IRepositoryEx
|
||||
/// </summary>
|
||||
|
@ -124,4 +124,3 @@ namespace FCS.Lib.Utility
|
|||
/// <returns>IQueryable<TEntity></returns>
|
||||
IQueryable<TEntity> All();
|
||||
}
|
||||
}
|
46
Mogrify.cs
46
Mogrify.cs
|
@ -1,25 +1,25 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 27-08-2016
|
||||
// Author : fhdk
|
||||
// Created : 2023 03 02 09:52
|
||||
//
|
||||
// Last Modified By : Frede H.
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="Mogrify.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="Mogrify.cs" company="FCS">
|
||||
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
@ -33,13 +33,27 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Mogrify between units
|
||||
/// </summary>
|
||||
public static class Mogrify
|
||||
{
|
||||
/// <summary>
|
||||
/// Remove everything but digits and country code
|
||||
/// </summary>
|
||||
/// <param name="phone"></param>
|
||||
/// <returns></returns>
|
||||
public static string SanitizePhone(string phone)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(phone))
|
||||
return "";
|
||||
phone = phone.Replace("+45", "").Replace("+46", "").Replace("+47", "");
|
||||
var regexObj = new Regex(@"[^\d]");
|
||||
return regexObj.Replace(phone, "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get month from timestamp
|
||||
/// </summary>
|
||||
|
@ -70,6 +84,7 @@ namespace FCS.Lib.Utility
|
|||
{
|
||||
return DateTimeIso8601(TimeStampToDateTime(timestamp));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// return date as ISO
|
||||
/// </summary>
|
||||
|
@ -89,7 +104,8 @@ namespace FCS.Lib.Utility
|
|||
{
|
||||
var dt1 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0);
|
||||
var dt2 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 23, 59, 59);
|
||||
return new Dictionary<string, long>{
|
||||
return new Dictionary<string, long>
|
||||
{
|
||||
{ "lower", DateTimeToTimeStamp(dt1) },
|
||||
{ "upper", DateTimeToTimeStamp(dt2) }
|
||||
};
|
||||
|
@ -334,6 +350,7 @@ namespace FCS.Lib.Utility
|
|||
|
||||
return flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get decimal from string
|
||||
/// </summary>
|
||||
|
@ -345,7 +362,7 @@ namespace FCS.Lib.Utility
|
|||
return
|
||||
!decimal.TryParse(inString.Replace(",", "").Replace(".", ""), NumberStyles.Number,
|
||||
CultureInfo.InvariantCulture, out var num)
|
||||
? (decimal?) null
|
||||
? null
|
||||
: decimal.Divide(num, new decimal((long)100));
|
||||
}
|
||||
|
||||
|
@ -475,4 +492,3 @@ namespace FCS.Lib.Utility
|
|||
// return empty;
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -17,5 +17,5 @@ using System.Runtime.InteropServices;
|
|||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("8D850197-78DB-4D16-A91F-E5BB6E8880A7")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.23023.0820")]
|
||||
[assembly: AssemblyFileVersion("1.0.23023.0820")]
|
||||
[assembly: AssemblyVersion("1.0.23077.1334")]
|
||||
[assembly: AssemblyFileVersion("1.0.23077.1334")]
|
|
@ -1,25 +1,25 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 01-01-2022
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="QueryHelper.cs" company="Frede Hundewadt">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="QueryHelper.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
@ -29,8 +29,8 @@ using System.Linq;
|
|||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Class QueryHelper.
|
||||
/// </summary>
|
||||
|
@ -94,5 +94,4 @@ namespace FCS.Lib.Utility
|
|||
|
||||
return desc ? q.OrderByDescending(exp) : q.OrderBy(exp);
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
29
Squid.cs
29
Squid.cs
|
@ -1,34 +1,34 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 2020-07-01
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 02-24-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="Squid.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="Squid.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the Affero GNU General Public License as
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// Affero GNU General Public License for more details.
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Affero GNU General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see [https://www.gnu.org/licenses]
|
||||
// </copyright>
|
||||
// <summary>Derived from https:github.com/csharpvitamins/CSharpVitamins.ShortGuid</summary>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// A wrapper for handling URL-safe Base64 encoded globally unique identifiers (GUID).
|
||||
/// </summary>
|
||||
|
@ -127,7 +127,7 @@ namespace FCS.Lib.Utility
|
|||
/// <returns>New Squid object</returns>
|
||||
public static Squid NewGuid()
|
||||
{
|
||||
return new(Guid.NewGuid());
|
||||
return new Squid(Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -392,4 +392,3 @@ namespace FCS.Lib.Utility
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 2020-09-09
|
||||
// Author : fhdk
|
||||
// Created : 2022 12 17 13:33
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 03-14-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="StringOptions.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="StringOptions.cs" company="FCS">
|
||||
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
|
@ -24,8 +24,8 @@
|
|||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Class StringOptions.
|
||||
/// </summary>
|
||||
|
@ -73,4 +73,3 @@ namespace FCS.Lib.Utility
|
|||
/// <value><c>true</c> if [require non alphanumeric]; otherwise, <c>false</c>.</value>
|
||||
public bool RequireNonAlphanumeric { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib.Utility
|
||||
// Author : FH
|
||||
// Created : 03-30-2022
|
||||
// Author : fhdk
|
||||
// Created : 2023 03 09 17:42
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 04-19-2022
|
||||
// Last Modified By: fhdk
|
||||
// Last Modified On : 2023 03 14 09:16
|
||||
// ***********************************************************************
|
||||
// <copyright file="VatFormatValidator.cs" company="FCS-TECH">
|
||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||
// <copyright file="VatFormatValidator.cs" company="FCS">
|
||||
// Copyright (C) 2023-2023 FCS Frede's Computer Services.
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
|
@ -24,12 +24,11 @@
|
|||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FCS.Lib.Utility
|
||||
{
|
||||
namespace FCS.Lib.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Vat format validator
|
||||
/// </summary>
|
||||
|
@ -123,7 +122,7 @@ namespace FCS.Lib.Utility
|
|||
// C10 is check digit
|
||||
|
||||
var orgToCheck = orgNumber;
|
||||
if (long.Parse(orgToCheck) == 0)
|
||||
if (!long.TryParse(orgToCheck, out _))
|
||||
return false;
|
||||
|
||||
switch (orgToCheck.Length)
|
||||
|
@ -217,7 +216,6 @@ namespace FCS.Lib.Utility
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -357,6 +355,4 @@ namespace FCS.Lib.Utility
|
|||
|
||||
// return nSum % 10 == 0;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue