C# code translation of Skyline/Gulliotine pack code