Beispiel #1
0
            internal static _GetValue GetValue()
            {
                if (_GetValueFunc == null)
                {
                    _GetValueFunc =
                        (_GetValue)Marshal.GetDelegateForFunctionPointer(
                            NativeLibrary.GetExport(
                                Torque3D.Torque3DLibHandle,
                                "fnGuiFilterCtrl_getValue"), typeof(_GetValue));
                }

                return(_GetValueFunc);
            }
            internal static _GetValue GetValue()
            {
                if (_GetValueFunc == null)
                {
                    _GetValueFunc =
                        (_GetValue)Marshal.GetDelegateForFunctionPointer(
                            Torque3D.DllLoadUtils.GetProcAddress(
                                Torque3D.Torque3DLibHandle,
                                "fnGuiFilterCtrl_getValue"), typeof(_GetValue));
                }

                return(_GetValueFunc);
            }
Beispiel #3
0
 public ValueInfoEnum(
     string tag,
     _GetValue <T> getValue,
     string description,
     bool spacerFollows,
     _SetValue <T> setValue,
     VT <T>[] possibleValues,
     InlineParamVis inlineParam)
     : base(tag, description, spacerFollows, inlineParam)
 {
     this.getValue       = getValue;
     this.setValue       = setValue;
     this.possibleValues = possibleValues;
 }
Beispiel #4
0
 public ValueInfoDouble(
     string tag,
     _GetValue <double> getValue,
     double defaultValue,
     string description,
     bool spacerFollows,
     _SetValue <double> setValue,
     InlineParamVis inlineParam)
     : base(tag, description, spacerFollows, inlineParam)
 {
     this.getValue     = getValue;
     this.defaultValue = defaultValue;
     this.setValue     = setValue;
 }
Beispiel #5
0
    public string[] sort_tiobe_filename_demo(string[] files)
    {
        int nCount = files.Length;

        string[] sorted = new string[nCount];

        // init buff
        int[,] buff = new int[11, 3];
        int   n     = 0;
        Regex regex = new Regex("^TIOBE Index for (\\w+) (\\d{4})\\.html$");

        for (int i = 0; i < nCount; i++)
        {
            buff[i, 0] = buff[i, 1] = i;
            MatchCollection ms        = regex.Matches(files[i]);
            int             nDatespan = 0;
            if (ms.Count == 1 && ms[0].Groups.Count == 3)
            {
                int nMonth = 0;
                _month.TryGetValue(ms[0].Groups[1].ToString(), out nMonth);
                nDatespan = Convert.ToInt32(ms[0].Groups[2].ToString()) * 100 + nMonth;
                // Console.WriteLine(ms[0].Groups[2] + ", " + ms[0].Groups[1]);
            }
            else
            {
                nDatespan = ++n;
            }
            buff[i, 2] = nDatespan;
        }

        // Func<int, int> GetIndex = (i) => { return buff[i, 1]; };
        // Func<int, int> GetData = (i) => { return buff[GetIndex(i), 2]; }

        _GetValue GetIndex = (i) => { return(buff[i, 1]); };
        _SetValue SetIndex = (i, nn) => { return(buff[i, 1] = nn); };
        _GetValue GetData  = (i) => { return(buff[GetIndex(i), 2]); };

        // insertion sort string
        for (int i = 0; i < nCount - 1; i++)
        {
            int nMin = i;
            for (int j = i + 1; j < nCount; j++)
            {
                if (GetData(j) < GetData(nMin))
                {
                    nMin = j;
                }
            }
            if (i != nMin)
            {
                int t = GetIndex(i);
                SetIndex(i, GetIndex(nMin));
                SetIndex(nMin, t);
            }
        }
        for (int i = 0; i < nCount; i++)
        {
            // Console.WriteLine(" " + buff[i, 0] + " " + buff[i, 1] + " " + buff[i, 2] + " ");
            sorted[i] = files[GetIndex(i)];
        }
        return(sorted);
    }