This commit is contained in:
2019-06-10 20:47:00 +00:00
parent d1110a7d3c
commit 709e9ff94d
4 changed files with 50 additions and 7 deletions

View File

@@ -16,7 +16,8 @@ REALLY MAKING MORE PROGRESS WHEN CLIENT DEV DRIVES BACKEND DEV, STICK TO THAT!!
DO CLIENT STUFF NOW COME BACK TO THIS STUFF LATER
###*** BEFORE NEXT UPDATE TO DEVOPS SERVER:::::::
TODO: 2019-06-07 10:47:57.8894|WARN|Microsoft.AspNetCore.Cors.Infrastructure.CorsService|The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the policy by listing individual origins if credentials needs to be supported.
2
TODO: NEEDS A THINK, SOME CHANGES REQUIRE DB ERASURE BEFORE STARTUP
- Make it fucking easier to test deploy and erase db and fetch key and all that shit

View File

@@ -140,6 +140,7 @@ namespace AyaNova.Biz
Widget outObj = new Widget();
CopyObject.Copy(dbObj, outObj);
outObj.Name = outObj.Name;
//Test get serial id visible id number from generator
outObj.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();

View File

@@ -63,6 +63,22 @@ namespace AyaNova.Util
}
/// <summary>
/// Returns current date/time in sortable format
///(used for duplicate names by stringUtil and others)
/// </summary>
/// <returns></returns>
public static string SortableShortCurrentDateTimeValue
{
get
{
return DateTime.Now.ToString("s");
//Was going to use MaxValue but apparently that varies depending on culture
// and Postgres has issues with year 1 as it interprets as year 2001
// so to be on safe side just defining one for all usage
}
}

View File

@@ -50,14 +50,14 @@ namespace AyaNova.Util
/// <param name="sIP"></param>
/// <returns></returns>
public static string MaskIPAddress(string sIP)
{
{
//My test station ip address!?
//"::ffff:127.0.0.1"
//weird dual format, new method that covers both v4 and v4 inside v6 format
if(sIP.Contains("."))
if (sIP.Contains("."))
{
//new algorithm, replace anything after last period with an xxx
var ret=sIP.Substring(0,sIP.LastIndexOf("."))+".xxx";
var ret = sIP.Substring(0, sIP.LastIndexOf(".")) + ".xxx";
return ret;
}
@@ -65,9 +65,9 @@ namespace AyaNova.Util
//8 groups IPV6 Address format
if (sIP.Contains(":"))
{
sIP=sIP.Replace("::",":0:");//rehydrate "compressed" addresses
{
sIP = sIP.Replace("::", ":0:");//rehydrate "compressed" addresses
var segs = sIP.Split(':');
if (segs.Length < 7)
return "UNRECOGNIZED V6 IP ADDRESS FORMAT";
@@ -90,6 +90,31 @@ namespace AyaNova.Util
}
/// <summary>
/// Make a unique but duplicate object name of desired length
/// (Used by Duplicate object function)
/// </summary>
/// <param name="s"></param>
/// <param name="maxLength"></param>
/// <returns></returns>
public static string NameUniquify(string s, int maxLength)
{
//Unique string
string unique = " - " + DateUtil.SortableShortCurrentDateTimeValue;
string ret = s + unique;
var diff = maxLength - ret.Length;
if (diff < 0)
{
if (unique.Length >= maxLength)
{
throw new System.ArgumentOutOfRangeException("StringUtil::nameUniquify - maxlength> unique value, source field too short for this function?");
}
ret = s.Substring(0, Math.Abs(diff)) + unique;
}
return ret;
}
}//eoc