Click here to Skip to main content
15,885,216 members
Articles / Multimedia / GDI+

A 3D Plotting Library in C#

Rate me:
Please Sign up or sign in to vote.
4.91/5 (171 votes)
9 Jun 2006CPOL9 min read 455.5K   13.9K   431  
A library which draws 3D images on any GDI+ Graphics object.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Reflection;

namespace Tests
{
    static class TestLogger
    {
        # region Static Fields

        public static bool LogTests = false;
        public static System.IO.TextWriter LogFile = Console.Out;

        # endregion

        # region Static Methods

        public static void Log(params string[] paramValues)
        {
            if (LogTests == false)
                return;

            StackFrame frame = new StackFrame(1, false);
            MethodBase method = frame.GetMethod();

            string methodName = method.Name;

            ParameterInfo[] parameters = method.GetParameters();

            if (parameters.Length != paramValues.Length)
                throw new ArgumentException("Number of values specified is different than the method's parameter count.", "paramValues");

            string[] parameterNames = new string[parameters.Length];
            string[] parameterTypes = new string[parameters.Length];

            for (int i = 0; i < parameters.Length; i++)
            {
                parameterTypes[i] = parameters[i].ParameterType.Name;
            }

            LogInternal(methodName, parameterTypes, paramValues);
        }

        private static void LogInternal(string name, string[] parameterTypes, string[] parameterValues)
        {
            LogFile.Write("Executing {0}({1})", name, string.Join(", ", parameterTypes));

            if (parameterValues.Length > 0)
                LogFile.WriteLine(" with values [{0}].", string.Join(", ", parameterValues));
            else
                LogFile.WriteLine(".");
        }

        # endregion

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Pete has just recently become a corporate sell-out, working for a wholly-owned subsidiary of "The Man". He counter-balances his soul-crushing professional life by practicing circus acrobatics and watching Phineas and Ferb reruns. Ducky Momo is his friend.

Comments and Discussions