string.PadLeft(int, char)

Here are the examples of the csharp api string.PadLeft(int, char) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1127 Examples 7

19 View Source File : Protocol16SerializerTest.cs
License : MIT License
Project Creator : 0blu

[Test]
        public void SerializeSuperLongString()
        {
            var actual = new Protocol16Stream();
            string input = string.Empty.PadLeft(short.MaxValue + 1, '0');
            replacedert.Throws<NotSupportedException>(
                () => { Protocol16Serializer.Serialize(actual, input, true); });
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : 13xforever

internal static async Task Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    Console.WriteLine("Drag .pkg files and/or folders onto this .exe to verify the packages.");
                    var isFirstChar = true;
                    var completedPath = false;
                    var path = new StringBuilder();
                    do
                    {
                        var keyInfo = Console.ReadKey(true);
                        if (isFirstChar)
                        {
                            isFirstChar = false;
                            if (keyInfo.KeyChar != '"')
                                return;
                        }
                        else
                        {
                            if (keyInfo.KeyChar == '"')
                            {
                                completedPath = true;
                                args = new[] {path.ToString()};
                            }
                            else
                                path.Append(keyInfo.KeyChar);
                        }
                    } while (!completedPath);
                    Console.Clear();
                }

                Console.OutputEncoding = new UTF8Encoding(false);
                Console.replacedle = replacedle;
                Console.CursorVisible = false;
                Console.WriteLine("Scanning for PKGs...");
                var pkgList = new List<FileInfo>();
                Console.ForegroundColor = ConsoleColor.Yellow;
                foreach (var item in args)
                {
                    var path = item.Trim('"');
                    if (File.Exists(path))
                        pkgList.Add(new FileInfo(path));
                    else if (Directory.Exists(path))
                        pkgList.AddRange(GetFilePaths(path, "*.pkg", SearchOption.AllDirectories).Select(p => new FileInfo(p)));
                    else
                        Console.WriteLine("Unknown path: " + path);
                }
                Console.ResetColor();
                if (pkgList.Count == 0)
                {
                    Console.WriteLine("No packages were found. Check paths, and try again.");
                    return;
                }

                var longestFilename = Math.Max(pkgList.Max(i => i.Name.Length), HeaderPkgName.Length);
                var sigWidth = Math.Max(HeaderSignature.Length, 8);
                var csumWidth = Math.Max(HeaderChecksum.Length, 5);
                var csumsWidth = 1 + sigWidth + 1 + csumWidth + 1;
                var idealWidth = longestFilename + csumsWidth;
                try
                {
                    if (idealWidth > Console.LargestWindowWidth)
                    {
                        longestFilename = Console.LargestWindowWidth - csumsWidth;
                        idealWidth = Console.LargestWindowWidth;
                    }
                    if (idealWidth > Console.WindowWidth)
                    {
                        Console.BufferWidth = Math.Max(Console.BufferWidth, idealWidth);
                        Console.WindowWidth = idealWidth;
                    }
                    Console.BufferHeight = Math.Max(Console.BufferHeight, Math.Min(9999, pkgList.Count + 10));
                }
                catch (PlatformNotSupportedException) { }
                Console.WriteLine($"{HeaderPkgName.Trim(longestFilename).PadRight(longestFilename)} {HeaderSignature.PadLeft(sigWidth)} {HeaderChecksum.PadLeft(csumWidth)}");
                using var cts = new CancellationTokenSource();
                Console.CancelKeyPress += (sender, eventArgs) => { cts.Cancel(); };
                var t = new Thread(() =>
                                   {
                                       try
                                       {
                                           var indicatorIdx = 0;
                                           while (!cts.Token.IsCancellationRequested)
                                           {
                                               Task.Delay(1000, cts.Token).ConfigureAwait(false).GetAwaiter().GetResult();
                                               if (cts.Token.IsCancellationRequested)
                                                   return;

                                               PkgChecker.Sync.Wait(cts.Token);
                                               try
                                               {
                                                   var frame = Animation[(indicatorIdx++) % Animation.Length];
                                                   var currentProgress = PkgChecker.CurrentFileProcessedBytes;
                                                   Console.replacedle = $"{replacedle} [{(double)(PkgChecker.ProcessedBytes + currentProgress) / PkgChecker.TotalFileSize * 100:0.00}%] {frame}";
                                                   if (PkgChecker.CurrentPadding > 0)
                                                   {
                                                       Console.CursorVisible = false;
                                                       var (top, left) = (Console.CursorTop, Console.CursorLeft);
                                                       Console.Write($"{(double)currentProgress / PkgChecker.CurrentFileSize * 100:0}%".PadLeft(PkgChecker.CurrentPadding));
                                                       Console.CursorTop = top;
                                                       Console.CursorLeft = left;
                                                       Console.CursorVisible = false;
                                                   }
                                               }
                                               finally
                                               {
                                                   PkgChecker.Sync.Release();
                                               }
                                           }
                                       }
                                       catch (TaskCanceledException)
                                       {
                                       }
                                   });
                t.Start();
                await PkgChecker.CheckAsync(pkgList, longestFilename, sigWidth, csumWidth, csumsWidth-2, cts.Token).ConfigureAwait(false);
                cts.Cancel(false);
                t.Join();
            }
            finally
            {
                Console.replacedle = replacedle;
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
                Console.WriteLine();
                Console.CursorVisible = true;
            }
        }

19 View Source File : ClientSideCaching.cs
License : MIT License
Project Creator : 2881099

bool TryGetCacheValue(string key, Type valueType, out object value)
            {
                if (_dict.TryGetValue(key, out var trydictval) && trydictval.Values.TryGetValue(valueType, out var tryval)
                    //&& DateTime.Now.Subtract(_dt2020.AddSeconds(tryval.SetTime)) < TimeSpan.FromMinutes(5)
                    )
                {
                    if (_options.CheckExpired?.Invoke(key, _dt2020.AddSeconds(tryval.SetTime)) == true)
                    {
                        RemoveCache(key);
                        value = null;
                        return false;
                    }
                    var time = GetTime();
                    if (_options.Capacity > 0)
                    {
                        lock (_dictLock)
                        {
                            _dictSort.Remove($"{trydictval.GetTime.ToString("X").PadLeft(16, '0')}{key}");
                            _dictSort.Add($"{time.ToString("X").PadLeft(16, '0')}{key}");
                        }
                    }
                    Interlocked.Exchange(ref trydictval.GetTime, time);
                    value = tryval.Value;
                    return true;
                }
                value = null;
                return false;
            }

19 View Source File : ClientSideCaching.cs
License : MIT License
Project Creator : 2881099

void SetCacheValue(string command, string key, Type valueType, object value)
            {
                _dict.GetOrAdd(key, keyTmp =>
                {
                    var time = GetTime();
                    if (_options.Capacity > 0)
                    {
                        string removeKey = null;
                        lock (_dictLock)
                        {
                            if (_dictSort.Count >= _options.Capacity) removeKey = _dictSort.First().Substring(16);
                            _dictSort.Add($"{time.ToString("X").PadLeft(16, '0')}{key}");
                        }
                        if (removeKey != null)
                            RemoveCache(removeKey);
                    }
                    return new DictValue(command, time);
                }).Values
                .AddOrUpdate(valueType, new DictValue.ObjectValue(value), (oldkey, oldval) => new DictValue.ObjectValue(value));
            }

19 View Source File : ClientSideCaching.cs
License : MIT License
Project Creator : 2881099

void RemoveCache(params string[] keys)
            {
                if (keys?.Any() != true) return;
                foreach (var key in keys)
                {
                    if (_dict.TryRemove(key, out var old))
                    {
                        if (_options.Capacity > 0)
                        {
                            lock (_dictLock)
                            {
                                _dictSort.Remove($"{old.GetTime.ToString("X").PadLeft(16, '0')}{key}");
                            }
                        }
                    }
                }
            }

19 View Source File : DownloadHandle.cs
License : GNU General Public License v3.0
Project Creator : 2dust

void ws_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            try
            {
                if (UpdateCompleted != null)
                {
                    if (e.Cancelled)
                    {
                        ((WebClientEx)sender).Dispose();
                        TimeSpan ts = (DateTime.Now - totalDatetime);
                        string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.0"));
                        UpdateCompleted(this, new ResultEventArgs(true, speed.PadLeft(8, ' ')));
                        return;
                    }

                    if (e.Error == null
                        || Utils.IsNullOrEmpty(e.Error.ToString()))
                    {

                        TimeSpan ts = (DateTime.Now - totalDatetime);
                        string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.0"));
                        UpdateCompleted(this, new ResultEventArgs(true, speed.PadLeft(8, ' ')));
                    }
                    else
                    {
                        throw e.Error;
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.SaveLog(ex.Message, ex);

                Error?.Invoke(this, new ErrorEventArgs(ex));
            }
        }

19 View Source File : SpeedtestHandler.cs
License : GNU General Public License v3.0
Project Creator : 2dust

private string FormatOut(object time, string unit)
        {
            if (time.ToString().Equals("-1"))
            {
                return "Timeout";
            }
            return string.Format("{0}{1}", time, unit).PadLeft(8, ' ');
        }

19 View Source File : StringExtension.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826

public static string ToMd5(this string str)
        {
            byte[] b = Encoding.UTF8.GetBytes(str);
            b = new MD5CryptoServiceProvider().ComputeHash(b);
            string ret = "";
            for (int i = 0; i < b.Length; i++)
            {
                ret = ret + b[i].ToString("x").PadLeft(2, '0');
            }
            return ret;
        }

19 View Source File : TextIndentationMethods.cs
License : MIT License
Project Creator : 8T4

internal static void AppendHorizontalLine(this StringBuilder builder, int size)
        {
            var line = string.Empty.PadLeft(size, '-');
            builder.AppendLine(line);
        }

19 View Source File : SecondToStringConverter.cs
License : MIT License
Project Creator : 944095635

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int offset)
            {
                var absOffset = Math.Abs(offset);
                var hour = ((absOffset / 3600)).ToString();
                var minute = ((absOffset - ((absOffset / 3600) * 3600)) / 60).ToString();
                var second = ((absOffset - ((absOffset / 3600) * 3600)) % 60).ToString();
                return $"{(offset >= 0 ? "" : "-")}{hour.PadLeft(2, '0')}:{minute.PadLeft(2, '0')}:{second.PadLeft(2, '0')}";
            }
            return value;
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : a-downing

public CPU.Value32 Read(uint addr) {
                Print($"Read(uint addr: 0x{addr.ToString("X").PadLeft(8, '0')}) -> 0x{data.Uint.ToString("X").PadLeft(8, '0')}");
                return data;
            }

19 View Source File : Program.cs
License : MIT License
Project Creator : a-downing

public void Write(uint addr, CPU.Value32 value) {
                Print($"Write(uint addr: 0x{addr.ToString("X").PadLeft(8, '0')}, uint value: 0x{value.Uint.ToString("X").PadLeft(8, '0')})");
                data = value;
            }

19 View Source File : ConsoleProgressBar.cs
License : MIT License
Project Creator : a-luna

private string GetProgressBarText(double currentProgress)
        {
            const string singleSpace = " ";

            var numBlocksCompleted = (int) (currentProgress * NumberOfBlocks);

            var completedBlocks =
                Enumerable.Range(0, numBlocksCompleted).Aggregate(
                    string.Empty,
                    (current, _) => current + CompletedBlock);

            var incompleteBlocks =
                Enumerable.Range(0, NumberOfBlocks - numBlocksCompleted).Aggregate(
                    string.Empty,
                    (current, _) => current + IncompleteBlock);

            var progressBar = $"{StartBracket}{completedBlocks}{incompleteBlocks}{EndBracket}";
            var percent = $"{currentProgress:P0}".PadLeft(4, '\u00a0');
            var animationFrame = AnimationSequence[AnimationIndex++ % AnimationSequence.Length];
            var animation = $"{animationFrame}";

            progressBar = DisplayBar
                ? progressBar + singleSpace
                : string.Empty;

            percent = DisplayPercentComplete
                ? percent + singleSpace
                : string.Empty;

            if (!DisplayAnimation || currentProgress is 1)
            {
                animation = string.Empty;
            }

            return (progressBar + percent + animation).TrimEnd();
        }

19 View Source File : FileTransferProgressBar.cs
License : MIT License
Project Creator : a-luna

string GetProgressBarText(double currentProgress)
		{
			const string singleSpace = " ";

			var numBlocksCompleted = (int)(currentProgress * NumberOfBlocks);

			var completedBlocks =
				Enumerable.Range(0, numBlocksCompleted).Aggregate(
					string.Empty,
					(current, _) => current + CompletedBlock);

			var incompleteBlocks =
				Enumerable.Range(0, NumberOfBlocks - numBlocksCompleted).Aggregate(
					string.Empty,
					(current, _) => current + IncompleteBlock);

			var progressBar = $"{StartBracket}{completedBlocks}{incompleteBlocks}{EndBracket}";
			var percent = $"{currentProgress:P0}".PadLeft(4, '\u00a0');

			var fileSizeInBytes = FileHelper.FileSizeToString(FileSizeInBytes);
			var padLength = fileSizeInBytes.Length;
			var bytesReceived = FileHelper.FileSizeToString(BytesReceived).PadLeft(padLength, '\u00a0');
			var bytes = $"{bytesReceived} of {fileSizeInBytes}";

			var animationFrame = AnimationSequence[AnimationIndex++ % AnimationSequence.Length];
			var animation = $"{animationFrame}";

		    progressBar = DisplayBar
		        ? progressBar + singleSpace
		        : string.Empty;

		    percent = DisplayPercentComplete
		        ? percent + singleSpace
		        : string.Empty;

		    bytes = DisplayBytes
		        ? bytes + singleSpace
		        : string.Empty;

			if (!DisplayAnimation || currentProgress is 1)
			{
				animation = string.Empty;
			}

			return progressBar + bytes + percent + animation;
		}

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryNoOffsetMultipleOrderByWithCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = i % 5 == 0 ? "RC" : "DC",
                    CountryId = i % 2 == 0 ? 1 : 2,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            var parameters = new { state = "DC" };

            //order by country ASC, name ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.First, null, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00124", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.Next, null, new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00126", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00248", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.Last, null, null, null, parameters).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00877", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00999", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.Previous, null, new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00751", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00873", cityList[49].Name);

            //order by countryid desc, name asc
            //First Page
            cityList = cityRepo.ReadAllPaged("countryid desc, name", 50, PageNavigationEnum.First, null, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00123", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("countryid desc,name", 50, PageNavigationEnum.Next, null, new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00127", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00249", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("countryid desc,name", 50, PageNavigationEnum.Last, null, null, null, parameters).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00876", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00998", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("countryid desc,name", 50, PageNavigationEnum.Previous, null, new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00752", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00874", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryNoOffsetWithCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = i % 2 == 0 ? "RC" : "DC",
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            var parameters = new { state = "RC" };

            //order by ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.First, null, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.Next, null, new[] { cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00102", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00200", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.Last, null, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00902", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.Previous, null, new[] { cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00802", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00900", cityList[49].Name);

            //order by desc
            //First Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.First, null, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00902", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.Next, null, new[] { cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00900", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00802", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.Last, null, null, null, parameters).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.Previous, null, new[] { cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00200", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00102", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryNoOffsetMultipleOrderByNoCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = i % 2 == 0 ? "RC" : "DC",
                    CountryId = i % 2 == 0 ? 1 : 2,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            //order by country ASC, name ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.Next, "*",  new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00102", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00200", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00901", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00999", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("countryid,name", 50, PageNavigationEnum.Previous, "*",  new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00801", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00899", cityList[49].Name);

            //order by countryid desc, name asc
            //First Page
            cityList = cityRepo.ReadAllPaged("countryid desc, name", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00099", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("countryid desc,name", 50, PageNavigationEnum.Next, "*", new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00101", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00199", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("countryid desc,name", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00902", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("countryid desc,name", 50, PageNavigationEnum.Previous, "*", new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00802", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00900", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryNoOffsetNoCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = "RC",
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            //order by ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00050", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.Next, "*", new[] { cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00051", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00951", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("name", 50, PageNavigationEnum.Previous, "*", new[] { cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00901", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00950", cityList[49].Name);

            //order by desc
            //First Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00951", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.Next, "*",  new[] { cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00950", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00901", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00050", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("name desc", 50, PageNavigationEnum.Previous, "*", new[] { cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00051", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void WithQueryNoOffsetMultipleOrderByWithCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = i % 5 == 0 ? "RC" : "DC",
                    CountryId = i % 2 == 0 ? 1 : 2,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            var parameters = new { state = "DC" };

            //order by country ASC, name ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid,name", 50, PageNavigationEnum.First,null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00124", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid,name", 50, PageNavigationEnum.Next, new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00126", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00248", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid,name", 50, PageNavigationEnum.Last, null, null, parameters).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00877", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00999", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid,name", 50, PageNavigationEnum.Previous, new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00751", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00873", cityList[49].Name);

            //order by countryid desc, name asc
            //First Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid desc, name", 50, PageNavigationEnum.First, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00123", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid desc,name", 50, PageNavigationEnum.Next, new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00127", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00249", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid desc,name", 50, PageNavigationEnum.Last, null, null, parameters).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00876", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00998", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "countryid desc,name", 50, PageNavigationEnum.Previous, new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00752", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00874", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void WithQueryNoOffsetWithCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = i % 2 == 0 ? "RC" : "DC",
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            var parameters = new { state = "RC" };

            //order by ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name", 50, PageNavigationEnum.First, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name", 50, PageNavigationEnum.Next, new[] { cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00102", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00200", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name", 50, PageNavigationEnum.Last, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00902", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name", 50, PageNavigationEnum.Previous, new[] { cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00802", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00900", cityList[49].Name);

            //order by desc
            //First Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name desc", 50, PageNavigationEnum.First, null, null, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00902", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name desc", 50, PageNavigationEnum.Next, new[] { cityList[49].Name }, cityList[49].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00900", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00802", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name desc", 50, PageNavigationEnum.Last, null, null, parameters).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name desc", 50, PageNavigationEnum.Previous, new[] { cityList[0].Name }, cityList[0].Id, parameters).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00200", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00102", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void WithQueryNoOffsetMultipleOrderByNoCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = i % 2 == 0 ? "RC" : "DC",
                    CountryId = i % 2 == 0 ? 1 : 2,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            //order by country ASC, name ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid,name", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00002", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid,name", 50, PageNavigationEnum.Next, new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00102", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00200", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid,name", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00901", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00999", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid,name", 50, PageNavigationEnum.Previous, new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00801", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00899", cityList[49].Name);

            //order by countryid desc, name asc
            //First Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid desc, name", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00099", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid desc,name", 50, PageNavigationEnum.Next, new object[] { cityList[49].CountryId, cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(2, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00101", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00199", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid desc,name", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00902", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "countryid desc,name", 50, PageNavigationEnum.Previous, new object[] { cityList[0].CountryId, cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal(1, cityList[0].CountryId);
            replacedert.Equal("PagedNoCriteriaTest.00802", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00900", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void WithQueryNoOffsetNoCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    State = "RC",
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            //order by ASC
            //First Page
            List<City> cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00050", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name", 50, PageNavigationEnum.Next, new[] { cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00051", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00951", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name", 50, PageNavigationEnum.Previous, new[] { cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00901", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00950", cityList[49].Name);

            //order by desc
            //First Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name desc", 50, PageNavigationEnum.First).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.01000", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00951", cityList[49].Name);

            //Next Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name desc", 50, PageNavigationEnum.Next, new[] { cityList[49].Name }, cityList[49].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00950", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00901", cityList[49].Name);

            //Last Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name desc", 50, PageNavigationEnum.Last).ToList();

            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00050", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00001", cityList[49].Name);

            //Previous Page
            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name desc", 50, PageNavigationEnum.Previous, new[] { cityList[0].Name }, cityList[0].Id).ToList();
            replacedert.Equal(50, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.00100", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.00051", cityList[49].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryNoCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 100;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(4, '0'),
                    State = "RC",
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            List<City> cityList = cityRepo.ReadAllPaged("name", 1, 10).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0010", cityList[9].Name);

            cityList = cityRepo.ReadAllPaged("name", 5, 10).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0041", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0050", cityList[9].Name);

        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryWithCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 100;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(4, '0'),
                    State = (i % 2 == 0 ? "RC" : "DC"),
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            List<City> cityList = cityRepo.ReadAllPaged("name", 1, 10, null, new { state = "DC" }).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0019", cityList[9].Name);

            cityList = cityRepo.ReadAllPaged("name", 5, 10, null, new { state = "RC" }).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0082", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0100", cityList[9].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void WithQueryNoCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 100;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(4,'0'),
                    State = "RC",
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            List<City> cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name", 1, 10).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0010", cityList[9].Name);

            cityList = cityRepo.ReadAllPaged("SELECT * FROM city", "name", 5, 10).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0041", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0050", cityList[9].Name);

        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void WithQueryWithCriteriaTest()
        {
            Repository<City> cityRepo = new Repository<City>(Fixture.Connection);

            cityRepo.DropTable();
            cityRepo.CreateTable();

            int counter = 100;

            for (int i = 1; i <= counter; i++)
            {
                City city = new City()
                {
                    Name = "PagedNoCriteriaTest." + i.ToString().PadLeft(4, '0'),
                    State = (i % 2 == 0 ? "RC" : "DC"),
                    CountryId = 1,
                    Longitude = 1m,
                    Lareplacedude = 1m,
                    CreatedBy =Fixture.CurrentUserId
                };
                city.Id = (long)cityRepo.Add(city);
            }

            List<City> cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name", 1, 10, new { state = "DC" }).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0001", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0019", cityList[9].Name);

            cityList = cityRepo.ReadAllPaged("SELECT * FROM city WHERE [email protected]", "name", 5, 10, new { state = "RC" }).ToList();

            replacedert.Equal(10, cityList.Count);
            replacedert.Equal("PagedNoCriteriaTest.0082", cityList[0].Name);
            replacedert.Equal("PagedNoCriteriaTest.0100", cityList[9].Name);
        }

19 View Source File : ReadPagedTests.cs
License : Apache License 2.0
Project Creator : aadreja

[Fact]
        public void NoQueryNoOffsetMultipleOrderByWithCriteriaTestCompositePrimaryKey()
        {
            Repository<Address> addRepo = new Repository<Address>(Fixture.Connection);

            addRepo.DropTable();
            addRepo.CreateTable();

            int counter = 1000;

            for (int i = 1; i <= counter; i++)
            {
                Address city = new Address()
                {
                    AddressLine1 = "Line1PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    AddressLine2 = "Line2PagedNoCriteriaTest." + i.ToString().PadLeft(5, '0'),
                    AddressType = i % 5 == 0 ? "HOME" : "OFFICE",
                    CustomerCode = i % 2 == 0 ? "P0001" : "P0002",
                    Town = "Ahmedabad",
                    
                };
                city.Id = (long)addRepo.Add(city);
            }

            var parameters = new { AddressType = "OFFICE" };

            //order by country ASC, name ASC
            //First Page
            List<Address> addList = addRepo.ReadAllPaged("customercode,addressline1", 50, PageNavigationEnum.First, "*", null, null, parameters).ToList();
            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0001", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00002", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00124", addList[49].AddressLine1);

            //Next Page
            addList = addRepo.ReadAllPaged("customercode,addressline1", 50, PageNavigationEnum.Next, "*", new object[] { addList[49].CustomerCode, addList[49].AddressLine1 }, new Address() { Id= addList[49].Id, AddressType="HOME" }, parameters).ToList();
            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0001", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00126", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00248", addList[49].AddressLine1);

            //Last Page
            addList = addRepo.ReadAllPaged("customercode,addressline1", 50, PageNavigationEnum.Last, "*", null, null, parameters).ToList();

            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0002", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00877", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00999", addList[49].AddressLine1);

            //Previous Page
            addList = addRepo.ReadAllPaged("customercode,addressline1", 50, PageNavigationEnum.Previous, "*", new object[] { addList[0].CustomerCode, addList[0].AddressLine1 }, new Address() { Id = addList[0].Id, AddressType = "HOME" }, parameters).ToList();
            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0002", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00751", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00873", addList[49].AddressLine1);

            //order by countryid desc, name asc
            //First Page
            addList = addRepo.ReadAllPaged("customercode desc,addressline1", 50, PageNavigationEnum.First, "*", null, null, parameters).ToList();
            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0002", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00001", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00123", addList[49].AddressLine1);

            //Next Page
            addList = addRepo.ReadAllPaged("customercode desc,addressline1", 50, PageNavigationEnum.Next, "*", new object[] { addList[49].CustomerCode, addList[49].AddressLine1 }, new Address() { Id = addList[49].Id, AddressType="HOME" }, parameters).ToList();
            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0002", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00127", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00249", addList[49].AddressLine1);

            //Last Page
            addList = addRepo.ReadAllPaged("customercode desc,addressline1", 50, PageNavigationEnum.Last, "*", null, null, parameters).ToList();

            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0001", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00876", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00998", addList[49].AddressLine1);

            //Previous Page
            addList = addRepo.ReadAllPaged("customercode desc,addressline1", 50, PageNavigationEnum.Previous, "*", new object[] { addList[0].CustomerCode, addList[0].AddressLine1 }, new Address() { Id = addList[0].Id, AddressType = "HOME" }, parameters).ToList();
            replacedert.Equal(50, addList.Count);
            replacedert.Equal("P0001", addList[0].CustomerCode);
            replacedert.Equal("Line1PagedNoCriteriaTest.00752", addList[0].AddressLine1);
            replacedert.Equal("Line1PagedNoCriteriaTest.00874", addList[49].AddressLine1);
        }

19 View Source File : AllegianceNode.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

public void ShowInfo(int depth = 0)
        {
            var prefix = "".PadLeft(depth * 2, ' ');
            Console.WriteLine($"{prefix}- {Player.Name}");
            foreach (var vreplacedal in Vreplacedals.Values)
                vreplacedal.ShowInfo(depth + 1);
        }

19 View Source File : ExpressionNode.cs
License : MIT License
Project Creator : actions

private static void TraceVerbose(
            EvaluationContext context,
            Int32 level,
            String message)
        {
            context.Trace.Verbose(String.Empty.PadLeft(level * 2, '.') + (message ?? String.Empty));
        }

19 View Source File : EvaluationResult.cs
License : MIT License
Project Creator : actions

private void TraceVerbose(
            EvaluationContext context,
            String message)
        {
            if (!m_omitTracing)
            {
                context?.Trace.Verbose(String.Empty.PadLeft(m_level * 2, '.') + (message ?? String.Empty));
            }
        }

19 View Source File : Global.cs
License : MIT License
Project Creator : adamped

public static string ShortHash(object obj)
        {
            return obj.GetHashCode().ToUnsigned(20).ToRadixString(16).PadLeft(5, '0');
        }

19 View Source File : AdColonyUtils.cs
License : Apache License 2.0
Project Creator : AdColony

void SerializeString(string aString, StringBuilder builder)
        {
            builder.Append("\"");

            char[] charArray = aString.ToCharArray();
            for (int i = 0; i < charArray.Length; i++)
            {
                char c = charArray[i];
                if (c == '"')
                {
                    builder.Append("\\\"");
                }
                else if (c == '\\')
                {
                    builder.Append("\\\\");
                }
                else if (c == '\b')
                {
                    builder.Append("\\b");
                }
                else if (c == '\f')
                {
                    builder.Append("\\f");
                }
                else if (c == '\n')
                {
                    builder.Append("\\n");
                }
                else if (c == '\r')
                {
                    builder.Append("\\r");
                }
                else if (c == '\t')
                {
                    builder.Append("\\t");
                }
                else
                {
                    int codepoint = Convert.ToInt32(c);
                    if ((codepoint >= 32) && (codepoint <= 126))
                    {
                        builder.Append(c);
                    }
                    else
                    {
                        builder.Append("\\u" + Convert.ToString(codepoint, 16).PadLeft(4, '0'));
                    }
                }
            }

            builder.Append("\"");
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : AdvancedHacker101

public void serialize(String hexDump)
        {
            //Dns request parts reference: https://technet.microsoft.com/en-us/library/dd197470%28v=ws.10%29.aspx

            //Get Request Count
            reqCount = int.Parse(hexDump.Substring(0, 4), System.Globalization.NumberStyles.HexNumber); //.Substring(2).Substring(0, 2)
            //Get the request flags
            string ff = hexDump.Substring(4).Substring(0, 4); //ff = flagsField
            string binary = Convert.ToString(Convert.ToInt32(ff, 16), 2);
            binary = binary.PadLeft(16, '0');
            /* Response = 1 bit
             * OpCode = 4 bit
             * Authoritive answer = 1 bit
             * truncation = 1 bit
             * rec desired = 1 bit
             * rec avail = 1 bit
             * reserved = 3 bit (const 0)
             * return code = 4 bit
             */
            response = Convert.ToInt32(binary.Substring(0, 1), 2);
            opcode = Convert.ToInt32(binary.Substring(1, 4), 2);
            AuthAnswer = Convert.ToInt32(binary.Substring(5, 1), 2);
            truncation = Convert.ToInt32(binary.Substring(6, 1), 2);
            recursion_desired = Convert.ToInt32(binary.Substring(7, 1), 2);
            if ((DnsResponse)response != DnsResponse.request)
            {
                recursion_available = Convert.ToInt32(binary.Substring(8, 1), 2);
                return_code = Convert.ToInt32(binary.Substring(12, 4), 2);
            }
            else
            {
                recursion_available = 0;
                return_code = 0;
            }
            /*int flagCode = int.Parse(ff, System.Globalization.NumberStyles.HexNumber);
            response = (flagCode >> 15);
            if (response != 0) //Message is a request
            {
                return_code = (flagCode >> 3);
                recursion_available = (flagCode >> 7);
            }
            else
            {
                return_code = 0;
                recursion_available = 0;
            }
            recursion_desired = (flagCode >> 8);
            truncation = (flagCode >> 9);
            AuthAnswer = (flagCode >> 10);
            opcode = (flagCode >> 14);*/
            //Get resource record counts
            question_resource_record_count = int.Parse(hexDump.Substring(8).Substring(0, 4), System.Globalization.NumberStyles.HexNumber);
            answer_resource_record_count = int.Parse(hexDump.Substring(12).Substring(0, 4), System.Globalization.NumberStyles.HexNumber);
            authority_resource_record_count = int.Parse(hexDump.Substring(16).Substring(0, 4), System.Globalization.NumberStyles.HexNumber);
            additional_resource_record_count = int.Parse(hexDump.Substring(20).Substring(0, 4), System.Globalization.NumberStyles.HexNumber);
            int questionStart = 24;
            for (int q = 0; q < question_resource_record_count; q++)
            {
                //Get Question hostname
                string question = hexDump.Substring(questionStart);
                int bytesRead = 0;
                GeneralRecord queryResource = (GeneralRecord)serializeRecords(question, DnsResourceType.Query, out bytesRead, 0, hexDump);
                questionStart += bytesRead;
                records.Add(queryResource);
            }

            for (int q = 0; q < answer_resource_record_count; q++)
            {
                //Get Question hostname
                string question = hexDump.Substring(questionStart);
                int bytesRead = 0;
                AnswerRecord answerResource = (AnswerRecord)serializeRecords(question, DnsResourceType.Answer, out bytesRead, 0, hexDump);
                questionStart += bytesRead;
                records.Add(answerResource);
            }

            for (int q = 0; q < authority_resource_record_count; q++)
            {
                //Get Question hostname
                string question = hexDump.Substring(questionStart);
                int bytesRead = 0;
                AuthoritiveRecord authorityResource = (AuthoritiveRecord)serializeRecords(question, DnsResourceType.Authority, out bytesRead, 0, hexDump);
                questionStart += bytesRead;
                records.Add(authorityResource);
            }

            for (int q = 0; q < additional_resource_record_count; q++)
            {
                //Get Question hostname
                string question = hexDump.Substring(questionStart);
                int bytesRead = 0;
                AdditionalRecord additionalResource = (AdditionalRecord)serializeRecords(question, DnsResourceType.Additional, out bytesRead, 0, hexDump);
                questionStart += bytesRead;
                records.Add(additionalResource);
            }

            //Serialization Completed!! yay :)
            Console.WriteLine("Serialized!");
        }

19 View Source File : Token.cs
License : MIT License
Project Creator : AgathokakologicalBit

public override string ToString()
        {
            return  $"({Line.ToString().PadLeft(3, '0')}:" +
                    $"{Position.ToString().PadLeft(3, '0')}) " +
                    $"{SubType.ToString().PadRight(20, ' ')} " +
                    $"({Length.ToString().PadLeft(2, ' ')}) {Value}";
        }

19 View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : AgentRev

private long VersionNum(string data)
        {
            string[] separate = data.Split(new char[] { '.' }, 4);
            separate[1] = separate[1].PadLeft(4, '0');
            separate[2] = separate[2].PadLeft(4, '0');

            if (separate.Length == 4)
                separate[3] = separate[3].PadLeft(4, '0');
            else
                separate[2] = separate[2].PadRight(8, '0');

            long result;
            long.TryParse(separate[0] + separate[1] + separate[2] + (separate.Length == 4 ? separate[3] : ""), out result);

            return result;
        }

19 View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : AgentRev

private long VersionNum(string data)
        {
            string[] separate = data.Split(new char[] { '.' }, 4);
            separate[1] = separate[1].PadLeft(4, '0');
            separate[2] = separate[2].PadLeft(4, '0');
            if (separate.Length == 4) separate[3] = separate[3].PadLeft(4, '0');
            else separate[2] = separate[2].PadRight(8, '0');

            long result;
            long.TryParse(separate[0] + separate[1] + separate[2] + (separate.Length == 4 ? separate[3] : ""), out result);

            return result;
        }

19 View Source File : LicensePacker.cs
License : MIT License
Project Creator : AhmedMinegames

[STAThread]
        static void Main()
        {
            try
            {
                bool IsPresent = false;
                CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref IsPresent);
                if (Debugger.IsAttached || IsDebuggerPresent() || IsPresent || CloseHandleAntiDebug())
                {
                    Environment.Exit(0);
                }
                else
                {
                    if (!File.Exists(Environment.CurrentDirectory + @"\SOS13"))
                    {
                        MessageBox.Show("Please Make a SOS13 file in the current program directory and enter the program license to it to continue.", "License Not Found", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        IntPtr NtdllModule = GetModuleHandle("ntdll.dll");
                        IntPtr DbgUiRemoteBreakinAddress = GetProcAddress(NtdllModule, "DbgUiRemoteBreakin");
                        IntPtr DbgUiConnectToDbgAddress = GetProcAddress(NtdllModule, "DbgUiConnectToDbg");
                        byte[] Int3InvaildCode = { 0xCC };
                        WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiRemoteBreakinAddress, Int3InvaildCode, 6, 0);
                        WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiConnectToDbgAddress, Int3InvaildCode, 6, 0);
                        string License = File.ReadAllText(Environment.CurrentDirectory + @"\SOS13");
                        if (string.IsNullOrEmpty(License))
                        {
                            Environment.Exit(0);
                        }
                        else
                        {
                            StringBuilder NewLicense = new StringBuilder();
                            for (int c = 0; c < License.Length; c++)
                                NewLicense.Append((char)((uint)License[c] ^ (uint)Convert.FromBase64String("decryptkeyencryption")[c % 4]));
                            StringBuilder ROT13Encoding = new StringBuilder();
                            Regex regex = new Regex("[A-Za-z]");
                            foreach (char KSXZ in NewLicense.ToString())
                            {
                                if (regex.IsMatch(KSXZ.ToString()))
                                {
                                    int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                                    ROT13Encoding.Append((char)C);
                                }
                            }
                            StringBuilder sb = new StringBuilder(); foreach (char c in ROT13Encoding.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
                            var GetTextToHEX = Encoding.Unicode.GetBytes(sb.ToString());
                            var BuildHEX = new StringBuilder();
                            foreach (var FinalHEX in GetTextToHEX)
                            {
                                BuildHEX.Append(FinalHEX.ToString("X2"));
                            }
                            string HashedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(BuildHEX.ToString())));
                            HMACMD5 HMACMD = new HMACMD5();
                            HMACMD.Key = UTF8Encoding.UTF8.GetBytes("LXSO12");
                            string HashedKey2 = UTF8Encoding.UTF8.GetString(HMACMD.ComputeHash(UTF8Encoding.UTF8.GetBytes(HashedKey)));
                            string DecryptedProgram = TqMIJUcgsXjVgxqJ(ProgramToDecrypt, HashedKey2.ToString(), IV);
                            byte[] ProgramToRun = Convert.FromBase64String(DecryptedProgram);
                            replacedembly RunInMemory = replacedembly.Load(ProgramToRun);
                            RunInMemory.EntryPoint.Invoke(null, null);
                        }
                    }
                }
            }
            catch (CryptographicException)
            {
                MessageBox.Show("Sorry, but looks like your license key are invalid.", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : AhmedMinegames

[STAThread]
        static void Main()
        {
            try
            {
                bool IsPresent = false;
                CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref IsPresent);
                if (Debugger.IsAttached || IsDebuggerPresent() || IsPresent || CloseHandleAntiDebug())
                {
                    Environment.Exit(0);
                }
                else
                {
                    IntPtr NtdllModule = GetModuleHandle("ntdll.dll");
                    IntPtr DbgUiRemoteBreakinAddress = GetProcAddress(NtdllModule, "DbgUiRemoteBreakin");
                    IntPtr DbgUiConnectToDbgAddress = GetProcAddress(NtdllModule, "DbgUiConnectToDbg");
                    byte[] Int3InvaildCode = { 0xCC };
                    WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiRemoteBreakinAddress, Int3InvaildCode, 6, 0);
                    WriteProcessMemory(Process.GetCurrentProcess().Handle, DbgUiConnectToDbgAddress, Int3InvaildCode, 6, 0);
                    string HWID = GetHardwareID();
                    StringBuilder DecryptEncryptionKey = new StringBuilder();
                    for (int c = 0; c < HWID.Length; c++)
                        DecryptEncryptionKey.Append((char)((uint)HWID[c] ^ (uint)Convert.FromBase64String("SOS12")[c % 4]));
                    StringBuilder ROT13Encoding = new StringBuilder();
                    Regex regex = new Regex("[A-Za-z]");
                    foreach (char KSXZ in DecryptEncryptionKey.ToString())
                    {
                        if (regex.IsMatch(KSXZ.ToString()))
                        {
                            int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                            ROT13Encoding.Append((char)C);
                        }
                    }
                    string HashedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(ROT13Encoding.ToString())));
                    var GetTextToHEX = Encoding.Unicode.GetBytes(HashedKey);
                    var BuildHEX = new StringBuilder();
                    foreach (var FinalHEX in GetTextToHEX)
                    {
                        BuildHEX.Append(FinalHEX.ToString("X2"));
                    }
                    StringBuilder sb = new StringBuilder(); foreach (char c in BuildHEX.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
                    byte[] keys = MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(sb.ToString()));
                    StringBuilder builder = new StringBuilder();
                    for (int i = 0; i < keys.Length; i++)
                    {
                        builder.Append(keys[i].ToString("x2"));
                    }
                    string DecryptedProgram = TqMIJUcgsXjVgxqJ(ProgramToDecrypt, builder.ToString(), IV);
                    byte[] ProgramToRun = Convert.FromBase64String(DecryptedProgram);
                    replacedembly RunInMemory = replacedembly.Load(ProgramToRun);
                    RunInMemory.EntryPoint.Invoke(null, null);
                }
            }
            catch(CryptographicException)
            {
                MessageBox.Show("Sorry But looks like you are not authorized to use this program.", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : AhmedMinegames

private void HWIDPacking(string FileToPack, string Output)
        {
            var Options = new Dictionary<string, string>();
            Options.Add("CompilerVersion", "v4.0");
            Options.Add("language", "c#");
            var codeProvider = new CSharpCodeProvider(Options);
            CompilerParameters parameters = new CompilerParameters();
            parameters.CompilerOptions = "/target:winexe";
            parameters.GenerateExecutable = true;
            parameters.Outputreplacedembly = Output;
            parameters.IncludeDebugInformation = false;
            string[] Librarys = { "System", "System.Windows.Forms", "System.Management", "System.Core", "System.Runtime", "System.Runtime.InteropServices" };
            foreach (string Library in Librarys)
            {
                parameters.Referencedreplacedemblies.Add(Library + ".dll");
            }
            byte[] CodeToProtect = File.ReadAllBytes(FileToPack);
            string RandomIV = RandomPreplacedword(16);
            string RandomKey = RandomPreplacedword(4);
            StringBuilder ROT13Encoding = new StringBuilder();
            Regex regex = new Regex("[A-Za-z]");
            foreach (char KSXZ in XOREncryptionKeys(textBox2.Text, RandomKey))
            {
                if (regex.IsMatch(KSXZ.ToString()))
                {
                    int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                    ROT13Encoding.Append((char)C);
                }
            }
            AesAlgorithms EncryptingBytes = new AesAlgorithms();
            string EncryptedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(ROT13Encoding.ToString())));
            var GetTextToHEX = Encoding.Unicode.GetBytes(EncryptedKey);
            var BuildHEX = new StringBuilder();
            foreach (var FinalHEX in GetTextToHEX)
            {
                BuildHEX.Append(FinalHEX.ToString("X2"));
            }
            StringBuilder sb = new StringBuilder(); foreach (char c in BuildHEX.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
            byte[] keys = MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(sb.ToString()));
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < keys.Length; i++)
            {
                builder.Append(keys[i].ToString("x2"));
            }
            string Final = EncryptingBytes.AesTextEncryption(Convert.ToBase64String(CodeToProtect), builder.ToString(), RandomIV);
            string HWIDPacker = Resource1.HWIDPacker;
            string NewHWIDPackerCode = HWIDPacker.Replace("DecME", Final).Replace("THISISIV", RandomIV).Replace("HWIDPacker", "namespace " + RandomName(14));
            string MyShinyNewPacker = NewHWIDPackerCode.Replace("SOS12", Convert.ToBase64String(Encoding.UTF8.GetBytes(RandomKey)));
            codeProvider.CompilereplacedemblyFromSource(parameters, MyShinyNewPacker);
        }

19 View Source File : Main.cs
License : MIT License
Project Creator : AhmedMinegames

private void LicensePacking(string FileToPack, string Output)
        {
            var Options = new Dictionary<string, string>();
            Options.Add("CompilerVersion", "v4.0");
            Options.Add("language", "c#");
            var codeProvider = new CSharpCodeProvider(Options);
            CompilerParameters parameters = new CompilerParameters();
            parameters.CompilerOptions = "/target:winexe";
            parameters.GenerateExecutable = true;
            parameters.Outputreplacedembly = Output;
            parameters.IncludeDebugInformation = false;
            string[] Librarys = { "System", "System.Windows.Forms", "System.Management", "System.Net", "System.Core", "System.Net.Http", "System.Runtime", "System.Runtime.InteropServices" };
            foreach (string Library in Librarys)
            {
                parameters.Referencedreplacedemblies.Add(Library + ".dll");
            }
            byte[] CodeToProtect = File.ReadAllBytes(FileToPack);
            string RandomIV = RandomPreplacedword(16);
            AesAlgorithms EncryptingBytes = new AesAlgorithms();
            string RandomKey = RandomPreplacedword(4);
            Random rnd = new Random();
            int RandomINT = rnd.Next(6, 13);
            string RandomHashingKey = RandomPreplacedword(RandomINT);
            StringBuilder ROT13Encoding = new StringBuilder();
            Regex regex = new Regex("[A-Za-z]");
            foreach (char KSXZ in XOREncryptionKeys(textBox3.Text, RandomKey))
            {
                if (regex.IsMatch(KSXZ.ToString()))
                {
                    int C = ((KSXZ & 223) - 52) % 26 + (KSXZ & 32) + 65;
                    ROT13Encoding.Append((char)C);
                }
            }
            StringBuilder sb = new StringBuilder(); foreach (char c in ROT13Encoding.ToString().ToCharArray()) { sb.Append(Convert.ToString(c, 2).PadLeft(8, '0')); }
            var GetTextToHEX = Encoding.Unicode.GetBytes(sb.ToString());
            var BuildHEX = new StringBuilder();
            foreach (var FinalHEX in GetTextToHEX)
            {
                BuildHEX.Append(FinalHEX.ToString("X2"));
            }
            string HashedKey = UTF8Encoding.UTF8.GetString(MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(BuildHEX.ToString())));
            HMACMD5 HMACMD = new HMACMD5();
            HMACMD.Key = UTF8Encoding.UTF8.GetBytes("LXSO12".Replace(UTF8Encoding.UTF8.GetString(Convert.FromBase64String("TFhTTzEy")), RandomHashingKey));
            string HashedKey2 = UTF8Encoding.UTF8.GetString(HMACMD.ComputeHash(UTF8Encoding.UTF8.GetBytes(HashedKey)));
            string Final = EncryptingBytes.AesTextEncryption(Convert.ToBase64String(CodeToProtect), HashedKey2.ToString(), RandomIV);
            string LicensePacker = Resource1.LicensePacker;
            string NewLicensePackerCode = LicensePacker.Replace("DecME", Final).Replace("THISISIV", RandomIV).Replace("LicensePacker", "namespace " + RandomName(14));
            string MyShinyNewPacker = NewLicensePackerCode.Replace("decryptkeyencryption", Convert.ToBase64String(Encoding.UTF8.GetBytes(RandomKey))).Replace("SOS13", textBox4.Text).Replace(UTF8Encoding.UTF8.GetString(Convert.FromBase64String("TFhTTzEy")), RandomHashingKey);
            codeProvider.CompilereplacedemblyFromSource(parameters, MyShinyNewPacker);
        }

19 View Source File : Utils.cs
License : Apache License 2.0
Project Creator : ajuna-network

public static byte[] HexToByteArray(string hex, bool evenLeftZeroPad = false)
        {
            if (hex.Equals("0x0")) return new byte[] {0x00};

            if (hex.Length % 2 == 1 && !evenLeftZeroPad)
                throw new Exception("The binary key cannot have an odd number of digits");

            if (hex.StartsWith("0x")) hex = hex.Substring(2);

            if (hex.Length % 2 != 0) hex = hex.PadLeft(hex.Length + 1, '0');

            var arr = new byte[hex.Length >> 1];

            for (var i = 0; i < hex.Length >> 1; ++i)
                arr[i] = (byte) ((GetHexVal(hex[i << 1]) << 4) + GetHexVal(hex[(i << 1) + 1]));

            return arr;
        }

19 View Source File : UntypedBuffer.cs
License : MIT License
Project Creator : Alan-FGR

public unsafe void PrintDebugData(int count, Type type)
    {
        List<String> strs = new List<String>();
        for (int i = 0; i < count; i++)
        {
            String str;
            try
            {
                var cast = Activator.CreateInstance(type);
                var handle = GCHandle.Alloc(cast, GCHandleType.Pinned);
                var addr = (void*)handle.AddrOfPinnedObject();
                Buffer.MemoryCopy(At(i), addr, ElementSizeInBytes, ElementSizeInBytes);
                handle.Free();
                str = cast.ToString();
                str = str.Substring(Math.Max(0, str.Length - 16), Math.Min(str.Length, 16)).PadLeft(16, '_');
            }
            catch (Exception e)
            {
                ulong ul = 0ul;
                Buffer.MemoryCopy(At(i), &ul, ElementSizeInBytes, ElementSizeInBytes);
                str = ul.ToString("X").PadLeft(16, '0');
            }
            strs.Add(str);
        }

        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine($"    {GetType()}<{type}>, elSize={ElementSizeInBytes}, bfSize={bufferSizeInBytes_}, ptr={buffer_}, unaligned={unalignedPtr_}");
        Console.ForegroundColor = ConsoleColor.Cyan;
        Console.WriteLine($"      objs: {String.Join(", ", strs)}");
    }

19 View Source File : Flags.cs
License : MIT License
Project Creator : Alan-FGR

public override string ToString()
    {
        return $"FLG {Convert.ToString((long)bits_, 2).PadLeft(8, '0')}";
    }

19 View Source File : Program.cs
License : MIT License
Project Creator : Alan-FGR

static void Main(string[] args)
        {
            int depth = 4;

            var dels = new List<string>();
            var defs = new List<string>();
            for (int i = 2; i < depth+2; i++)
            {
                var typeList = new List<string>();
                var parList = new List<string>();

                for (int j = 0; j < i-1; j++)
                {
                    typeList.Add($"T{j}");
                    parList.Add($"ref T{j} component{j}"); //todo linq select
                }

                string del = "public delegate void ProcessComponent<";
                del += String.Join(", ", typeList);
                del += ">(int entIdx, ";
                del += String.Join(", ", parList);
                del += ");";
                dels.Add(del);

                StringBuilder sb = new StringBuilder();

                sb.Append("public void Loop<");
                sb.Append(String.Join(", ", typeList));
                sb.Append(">(ProcessComponent<");
                sb.Append(String.Join(", ", typeList));
                sb.Append("> loopAction)\r\n");
                sb.Append(String.Join(" ", typeList.Select(x => "where "+x+" : struct"))+"\r\n");
                sb.Append("{\r\n");
                
                sb.AppendLine("  ushort typeMask = 0;");

                for (int j = 0; j < i-1; j++)
                {
                    sb.AppendLine($"  var t{j}Base = componentsManager_.GetBufferSlow<T{j}>();");
                    sb.AppendLine($"  if (t{j}Base.Sparse) typeMask |= 1 << {j};");
                }

                sb.AppendLine("  switch (typeMask) {");

                uint bits = 0;

                var fsb = new StringBuilder();

                while ((bits & (1 << i-1)) == 0)
                {
                    string binrepr = Convert.ToString(bits, 2).PadLeft(i-1, '0');

                    sb.AppendLine($"    case 0b{binrepr}:");
                    sb.AppendLine($"      Loop{binrepr}(loopAction,");

                    fsb.AppendLine($"private void Loop{binrepr}<{String.Join(", ", typeList)}>(");
                    fsb.AppendLine($"ProcessComponent<{String.Join(", ", typeList)}> loopAction,");

                    for (int j = 0; j < i - 1; j++)
                    {
                        bool dense = (bits & (1 << j)) == 0;
                        string type = dense ? "Dense" : "Sparse";
                        sb.AppendLine($"        (ComponentBuffer{type}<T{j}>)t{j}Base" + ( j == i-2 ? "" : ","));

                        fsb.AppendLine($"ComponentBuffer{type}<T{j}> t{j}B" + (j == i - 2 ? ")" : ","));
                    }

                    sb.AppendLine($"      ); return;");

                    for (int j = 0; j < i - 1; j++)
                    {
                        fsb.AppendLine($"where T{j} : struct");
                    }

                    fsb.AppendLine("{");

                    fsb.AppendLine($"  var compBuffers = t0B.__GetBuffers();");
                    fsb.AppendLine($"  var lastCompIndex = t0B.ComponentCount-1;");
                    fsb.AppendLine($"  var compIdx2EntIdx = compBuffers.i2EntIdx;");
                    fsb.AppendLine($"  var components = compBuffers.data;");

                    for (int j = 1; j < i - 1; j++)
                    {
                        fsb.AppendLine($"  var matcher{j}Flag = t{j}B.Matcher.Flag;");
                        fsb.AppendLine($"  var matcher{j}Buffers = t{j}B.__GetBuffers();");
                    }

                    fsb.AppendLine("  for (var i = lastCompIndex; i >= 0; i--) {");
                    fsb.AppendLine("    ref T0 component0 = ref components[i];");
                    fsb.AppendLine("    EntIdx entIdx = compIdx2EntIdx[i];");
                    fsb.AppendLine("    ref EnreplacedyData enreplacedyData = ref data_[entIdx];");

                    GenerateNestedSelectors(fsb, i, bits);

                    fsb.AppendLine($"}} // for components");
                    fsb.AppendLine($"}} // Loop{binrepr}");

                    bits++;
                }

                sb.AppendLine("  } // end switch (typeMask)");
                sb.AppendLine("} // end function");

                sb.AppendLine(fsb.ToString());

                defs.Add(sb.ToString());

            }








            var file = new List<string>();
            
            file.Add("using System.Collections.Generic;\r\n" +
                     "using System.Linq;\r\n" +
                     "using EntIdx = System.Int32;\r\n" +
                     "partial clreplaced EnreplacedyRegistry\r\n{");
            
            file.AddRange(dels);
            file.AddRange(defs);

            file.Add("\r\n}");

            File.WriteAllLines("../../../../minECS/EnreplacedyRegistryGenerated.cs", file);


            
        }

19 View Source File : ComponentBufferDense.cs
License : MIT License
Project Creator : Alan-FGR

public override string GetDebugString(bool detailed)
    {
        return
            $"  Flag: {Convert.ToString((long)Matcher.Flag, 2).PadLeft(32, '0').Replace('0', '_').Replace('1', '■')}\n" +
            buffer_.GetDebugString(detailed);
    }

19 View Source File : Registry.cs
License : MIT License
Project Creator : Alan-FGR

public string GetEnreplacedyDebugData(EntUID entUID)
    {
        return $"Enreplacedy Debug Data: UID: {entUID}, Idx: {GetIndexFromKey(entUID)}\n" +
               $" FlagsD:{Convert.ToString((long)GetDataFromKey(entUID).FlagsDense, 2).PadLeft(32, '0').Replace('0', '_').Replace('1', '■')}\n" +
               $" FlagsS:{Convert.ToString((long)GetDataFromKey(entUID).FlagsSparse, 2).PadLeft(32, '0').Replace('0', '_').Replace('1', '■')}\n" +
               $" Tags:  {Convert.ToString((long)GetDataFromKey(entUID).Tags, 2).PadLeft(32, '0').Replace('0', '_').Replace('1', '■')}\n" +
               $" Components: {string.Join(", ", componentsManager_.MatchersFromFlagsSlow(GetDataFromKey(entUID)).Select(x => x.GetType().GenericTypeArguments[0].Name))}"
            ;
    }

19 View Source File : Program.cs
License : MIT License
Project Creator : Alan-FGR

string mask2str(ulong mask)
    {
        return Convert.ToString((long) mask, 2).PadLeft(8, '0').Replace('0', '.').Replace('1', '|');
    }

19 View Source File : Program.cs
License : MIT License
Project Creator : Alan-FGR

static void lr(string action, Registry r = null)
    {
        Console.ForegroundColor = ConsoleColor.White;
        Console.WriteLine((" "+action.ToUpper()).PadLeft(90,'#'));
        if (r == null) reg.PrintDebugData();
        else r.PrintDebugData();
        Console.WriteLine();
    }

19 View Source File : LocRecord.cs
License : Apache License 2.0
Project Creator : alexreinert

private string ToDegreeString()
			{
				string res = String.Empty;

				if (Milliseconds != 0)
					res = "." + Milliseconds.ToString().PadLeft(3, '0').TrimEnd('0');

				if ((res.Length > 0) || (Seconds != 0))
					res = " " + Seconds + res;

				if ((res.Length > 0) || (Minutes != 0))
					res = " " + Minutes + res;

				res = Degrees + res;

				return res;
			}

19 View Source File : Simulation.cs
License : Apache License 2.0
Project Creator : Algoryx

protected void OnGUI()
    {
      if ( m_simulation == null )
        return;

      if ( !NativeHandler.Instance.HasValidLicense ) {
        GUILayout.Window( GUIUtility.GetControlID( FocusType.Preplacedive ),
                          new Rect( new Vector2( 16,
                                                 0.5f * Screen.height ),
                                    new Vector2( Screen.width - 32, 32 ) ),
                          id =>
                          {
                            // Invalid license if initialized.
                            if ( NativeHandler.Instance.Initialized && agx.Runtime.instance().getStatus().Length > 0 )
                              GUILayout.Label( Utils.GUI.MakeLabel( "AGX Dynamics: " + agx.Runtime.instance().getStatus(),
                                                                    Color.red,
                                                                    18,
                                                                    true ),
                                               Utils.GUI.Skin.label );
                            else
                              GUILayout.Label( Utils.GUI.MakeLabel( "AGX Dynamics: Errors occurred during initialization of AGX Dynamics.",
                                                                    Color.red,
                                                                    18,
                                                                    true ),
                                               Utils.GUI.Skin.label );
                          },
                          "AGX Dynamics not properly initialized",
                          Utils.GUI.Skin.window );

        return;
      }

      if ( m_statisticsWindowData == null )
        return;

      var simColor      = Color.Lerp( Color.white, Color.blue, 0.2f );
      var spaceColor    = Color.Lerp( Color.white, Color.green, 0.2f );
      var dynamicsColor = Color.Lerp( Color.white, Color.yellow, 0.2f );
      var eventColor    = Color.Lerp( Color.white, Color.cyan, 0.2f );
      var dataColor     = Color.Lerp( Color.white, Color.magenta, 0.2f );
      var memoryColor   = Color.Lerp( Color.white, Color.red, 0.2f );

      var labelStyle         = m_statisticsWindowData.LabelStyle;
      var stats              = agx.Statistics.instance();
      var simTime            = stats.getTimingInfo( "Simulation", "Step forward time" );
      var spaceTime          = stats.getTimingInfo( "Simulation", "Collision-detection time" );
      var dynamicsSystemTime = stats.getTimingInfo( "Simulation", "Dynamics-system time" );
      var preCollideTime     = stats.getTimingInfo( "Simulation", "Pre-collide event time" );
      var preTime            = stats.getTimingInfo( "Simulation", "Pre-step event time" );
      var postTime           = stats.getTimingInfo( "Simulation", "Post-step event time" );
      var lastTime           = stats.getTimingInfo( "Simulation", "Last-step event time" );
      var contactEventsTime  = stats.getTimingInfo( "Simulation", "Triggering contact events" );

      var numBodies      = m_system.getRigidBodies().Count;
      var numShapes      = m_space.getGeometries().Count;
      var numConstraints = m_system.getConstraints().Count +
                           m_space.getGeometryContacts().Count;
      var numParticles   = Native.getParticleSystem() != null ?
                             (int)Native.getParticleSystem().getNumParticles() :
                             0;

      GUILayout.Window( m_statisticsWindowData.Id,
                        DisplayMemoryAllocations ? m_statisticsWindowData.RectMemoryEnabled : m_statisticsWindowData.Rect,
                        id =>
                        {
                          StatisticsLabel( "Total time:            ", simTime, simColor, labelStyle, true );
                          StatisticsLabel( "  - Pre-collide step:      ", preCollideTime, eventColor, labelStyle );
                          StatisticsLabel( "  - Collision detection:   ", spaceTime, spaceColor, labelStyle );
                          StatisticsLabel( "  - Contact event:         ", contactEventsTime, eventColor, labelStyle );
                          StatisticsLabel( "  - Pre step:              ", preTime, eventColor, labelStyle );
                          StatisticsLabel( "  - Dynamics solvers:      ", dynamicsSystemTime, dynamicsColor, labelStyle );
                          StatisticsLabel( "  - Post step:             ", postTime, eventColor, labelStyle );
                          StatisticsLabel( "  - Last step:             ", lastTime, eventColor, labelStyle );
                          StatisticsLabel( "Data:                  ", dataColor, labelStyle, true );
                          StatisticsLabel( "  - Update frequency:      ", (int)( 1.0f / TimeStep + 0.5f ) + " Hz", dataColor, labelStyle );
                          StatisticsLabel( "  - Number of bodies:      ", numBodies.ToString(), dataColor, labelStyle );
                          StatisticsLabel( "  - Number of shapes:      ", numShapes.ToString(), dataColor, labelStyle );
                          StatisticsLabel( "  - Number of constraints: ", numConstraints.ToString(), dataColor, labelStyle );
                          StatisticsLabel( "  - Number of particles:   ", numParticles.ToString(), dataColor, labelStyle );
                          GUILayout.Space( 12 );
                          StatisticsLabel( "StepForward (managed):", memoryColor, labelStyle, true );
                          StatisticsLabel( "  - Step forward:          ",
                                           m_statisticsWindowData.ManagedStepForward.ToString( "0.00" ).PadLeft( 5, ' ' ) + " ms",
                                           memoryColor,
                                           labelStyle );
                          if ( !DisplayMemoryAllocations )
                            return;
                          StatisticsLabel( "Allocations (managed):", memoryColor, labelStyle, true );
                          StatisticsLabel( "  - Pre step callbacks:    ",
                                           MemoryAllocations.GetDeltaString( MemoryAllocations.Section.PreStepForward ).PadLeft( 6, ' ' ),
                                           memoryColor,
                                           labelStyle );
                          StatisticsLabel( "  - Pre synchronize:       ",
                                           MemoryAllocations.GetDeltaString( MemoryAllocations.Section.PreSynchronizeTransforms ).PadLeft( 6, ' ' ),
                                           memoryColor,
                                           labelStyle );
                          StatisticsLabel( "  - Step forward:          ",
                                           MemoryAllocations.GetDeltaString( MemoryAllocations.Section.StepForward ).PadLeft( 6, ' ' ),
                                           memoryColor,
                                           labelStyle );
                          StatisticsLabel( "  - Post synchronize:      ",
                                           MemoryAllocations.GetDeltaString( MemoryAllocations.Section.PostSynchronizeTransforms ).PadLeft( 6, ' ' ),
                                           memoryColor,
                                           labelStyle );
                          StatisticsLabel( "  - Post step callbacks:   ",
                                           MemoryAllocations.GetDeltaString( MemoryAllocations.Section.PostStepForward ).PadLeft( 6, ' ' ),
                                           memoryColor,
                                           labelStyle );
                        },
                        "AGX Dynamics statistics",
                        m_statisticsWindowData.WindowStyle );
    }

See More Examples