Skip to content

Instantly share code, notes, and snippets.

@warpech warpech/Convert.cs
Last active Sep 18, 2018

Embed
What would you like to do?
Convert ObjectNo to ObjectId
using System;
using System.Linq;
//Usage examples:
//
//star Convert.cs 6513
//star Convert.cs Blx
//
//Warning: the output goes to Starcounter Administrator
namespace Convert
{
public class Program
{
static void Main(string[] args)
{
if (args.Length > 0)
{
var input = args[0];
if (input.All(char.IsDigit))
{
UInt64 inputNo = Convert.ToUInt64(input);
string no = Starcounter.DbHelper.Base64EncodeObjectNo(inputNo);
Console.WriteLine("Base64-encoding " + input + " => " + no);
}
else
{
UInt64 inputNo = Starcounter.DbHelper.Base64DecodeObjectID(input);
Console.WriteLine("Base-64 decoding " + input + " => " + inputNo);
}
}
else
{
Console.WriteLine("Provide an argument that is either an ObjectID or ObjectNo");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.