/// <summary>
        /// Called by Snarl to get details about the extension -
        /// this is called before <see cref="Initialize()"/> and <see cref="Start()"/>.
        /// </summary>
        public void GetInfo(ref extension_info info)
        {
            // The info struct is filled according to the discussion found here:
            // http://groups.google.com/group/snarl-development/browse_thread/thread/53a5677b15fa9e68

            info.Author      = "Toke Noer";
            info.Copyright   = "Copyright © Noer.IT 2011";
            info.Date        = VersionDate;
            info.Description = "Shows time until it is Christmas on every startup";
            // info.Flags     = SNARL_EXTENSION_FLAGS.SNARL_EXTN_IS_CONFIGURABLE | SNARL_EXTENSION_FLAGS.SNARL_EXTN_WANTS_PULSE;
            info.IconPath     = IconPath;
            info.Name         = ApplicationName;
            info.Path         = Assembly.GetExecutingAssembly().Location;
            info.Release      = Release;
            info.Revision     = Revision;
            info.SupportEmail = "*****@*****.**";
            info.URL          = "http://www.noer.it/Snarl/";
            info.Version      = SnarlApiVersion;        // API version
        }
Beispiel #2
0
        public NativeOperatorCallbacks(string path)
        {
            library = new NativeLibrary(path);

            get_extension_info_t get_extension_info = null;

            Resolve(ref get_extension_info, "get_extension_info");
            if (get_extension_info == null)
            {
                library.Dispose();
                library = null;
                throw new InvalidOperationException();
            }

            extension_info info = get_extension_info();

            if (info.library_name != IntPtr.Zero)
            {
                implementationName = Marshal.PtrToStringAnsi(info.library_name);

                if (info.version_build != 0)
                {
                    implementationName += " v" + info.version_major + "." + info.version_minor + "." + info.version_build;
                }
                else if (info.version_major != 0 || info.version_minor != 0)
                {
                    implementationName += " v" + info.version_major + "." + info.version_minor;
                }

                if ((info.flags & extension_flags.AVX2) != 0)
                {
                    implementationName += " [AVX2]";
                }
                else if ((info.flags & extension_flags.AVX) != 0)
                {
                    implementationName += " [AVX]";
                }
                else if ((info.flags & extension_flags.SSE2) != 0)
                {
                    implementationName += " [SSE2]";
                }
                else if ((info.flags & extension_flags.SSE) != 0)
                {
                    implementationName += " [SSE]";
                }
            }
            else
            {
                implementationName = "Unknown";
            }

            List <string> missingCallbacksList = new List <string>();

            Constant e = null;

            Resolve(ref e, "constant_e", missingCallbacksList);
            if (e != null)
            {
                constant_e = e();
            }

            Constant pi = null;

            Resolve(ref pi, "constant_pi", missingCallbacksList);
            if (pi != null)
            {
                constant_pi = pi();
            }

            Resolve(ref add, "operator_add", missingCallbacksList);
            Resolve(ref subtract, "operator_subtract", missingCallbacksList);
            Resolve(ref multiply, "operator_multiply", missingCallbacksList);
            Resolve(ref divide, "operator_divide", missingCallbacksList);
            Resolve(ref pow, "operator_pow", missingCallbacksList);
            Resolve(ref remainder, "operator_remainder", missingCallbacksList);

            Resolve(ref abs, "operator_abs", missingCallbacksList);
            Resolve(ref sqrt, "operator_sqrt", missingCallbacksList);
            Resolve(ref exp, "operator_exp", missingCallbacksList);
            Resolve(ref ln, "operator_ln", missingCallbacksList);
            Resolve(ref log, "operator_log", missingCallbacksList);
            Resolve(ref sin, "operator_sin", missingCallbacksList);
            Resolve(ref cos, "operator_cos", missingCallbacksList);
            Resolve(ref tan, "operator_tan", missingCallbacksList);
            Resolve(ref asin, "operator_asin", missingCallbacksList);
            Resolve(ref acos, "operator_acos", missingCallbacksList);
            Resolve(ref atan, "operator_atan", missingCallbacksList);
            Resolve(ref sinh, "operator_sinh", missingCallbacksList);
            Resolve(ref cosh, "operator_cosh", missingCallbacksList);
            Resolve(ref tanh, "operator_tanh", missingCallbacksList);

            Resolve(ref round, "operator_round", missingCallbacksList);
            Resolve(ref floor, "operator_floor", missingCallbacksList);
            Resolve(ref ceil, "operator_ceil", missingCallbacksList);

            missingCallbacks = missingCallbacksList.ToArray();
        }