예제 #1
0
 private void BuildTableSorted()
 {
     if (this.sortMode == Window_DebugTable.SortMode.Off)
     {
         this.tableSorted = this.tableRaw;
     }
     else
     {
         List <List <string> > list = new List <List <string> >();
         for (int i = 1; i < this.tableRaw.GetLength(1); i++)
         {
             list.Add(new List <string>());
             for (int j = 0; j < this.tableRaw.GetLength(0); j++)
             {
                 list[i - 1].Add(this.tableRaw[j, i]);
             }
         }
         NumericStringComparer      comparer = new NumericStringComparer();
         Window_DebugTable.SortMode sortMode = this.sortMode;
         if (sortMode != Window_DebugTable.SortMode.Ascending)
         {
             if (sortMode != Window_DebugTable.SortMode.Descending)
             {
                 if (sortMode == Window_DebugTable.SortMode.Off)
                 {
                     throw new Exception();
                 }
             }
             else
             {
                 list = list.OrderByDescending((List <string> x) => x[this.sortColumn], comparer).ToList <List <string> >();
             }
         }
         else
         {
             list = list.OrderBy((List <string> x) => x[this.sortColumn], comparer).ToList <List <string> >();
         }
         this.tableSorted = new string[this.tableRaw.GetLength(0), this.tableRaw.GetLength(1)];
         for (int k = 0; k < this.tableRaw.GetLength(1); k++)
         {
             for (int l = 0; l < this.tableRaw.GetLength(0); l++)
             {
                 if (k == 0)
                 {
                     this.tableSorted[l, k] = this.tableRaw[l, k];
                 }
                 else
                 {
                     this.tableSorted[l, k] = list[k - 1][l];
                 }
             }
         }
     }
     this.colWidths.Clear();
     for (int m = 0; m < this.tableRaw.GetLength(0); m++)
     {
         float item;
         if (this.colVisible[m])
         {
             float num = 0f;
             for (int n = 0; n < this.tableRaw.GetLength(1); n++)
             {
                 string text = this.tableRaw[m, n];
                 float  x2   = Text.CalcSize(text).x;
                 if (x2 > num)
                 {
                     num = x2;
                 }
             }
             item = num + 2f;
         }
         else
         {
             item = 10f;
         }
         this.colWidths.Add(item);
     }
     this.rowHeights.Clear();
     for (int num2 = 0; num2 < this.tableSorted.GetLength(1); num2++)
     {
         float num3 = 0f;
         for (int num4 = 0; num4 < this.tableSorted.GetLength(0); num4++)
         {
             string text2 = this.tableSorted[num4, num2];
             float  y     = Text.CalcSize(text2).y;
             if (y > num3)
             {
                 num3 = y;
             }
         }
         this.rowHeights.Add(num3 + 2f);
     }
 }
        private void BuildTableSorted()
        {
            if (sortMode == SortMode.Off)
            {
                tableSorted = tableRaw;
            }
            else
            {
                List <List <string> > list = new List <List <string> >();
                for (int i = 1; i < tableRaw.GetLength(1); i++)
                {
                    list.Add(new List <string>());
                    for (int j = 0; j < tableRaw.GetLength(0); j++)
                    {
                        list[i - 1].Add(tableRaw[j, i]);
                    }
                }
                NumericStringComparer comparer = new NumericStringComparer();
                switch (sortMode)
                {
                case SortMode.Ascending:
                    list = list.OrderBy((List <string> x) => x[sortColumn], comparer).ToList();
                    break;

                case SortMode.Descending:
                    list = list.OrderByDescending((List <string> x) => x[sortColumn], comparer).ToList();
                    break;

                case SortMode.Off:
                    throw new Exception();
                }
                tableSorted = new string[tableRaw.GetLength(0), tableRaw.GetLength(1)];
                for (int k = 0; k < tableRaw.GetLength(1); k++)
                {
                    for (int l = 0; l < tableRaw.GetLength(0); l++)
                    {
                        if (k == 0)
                        {
                            tableSorted[l, k] = tableRaw[l, k];
                        }
                        else
                        {
                            tableSorted[l, k] = list[k - 1][l];
                        }
                    }
                }
            }
            colWidths.Clear();
            for (int m = 0; m < tableRaw.GetLength(0); m++)
            {
                float item;
                if (colVisible[m])
                {
                    float num = 0f;
                    for (int n = 0; n < tableRaw.GetLength(1); n++)
                    {
                        float x2 = Text.CalcSize(tableRaw[m, n]).x;
                        if (x2 > num)
                        {
                            num = x2;
                        }
                    }
                    item = num + 2f;
                }
                else
                {
                    item = 10f;
                }
                colWidths.Add(item);
            }
            rowHeights.Clear();
            for (int num2 = 0; num2 < tableSorted.GetLength(1); num2++)
            {
                float num3 = 0f;
                for (int num4 = 0; num4 < tableSorted.GetLength(0); num4++)
                {
                    float y = Text.CalcSize(tableSorted[num4, num2]).y;
                    if (y > num3)
                    {
                        num3 = y;
                    }
                }
                rowHeights.Add(num3 + 2f);
            }
        }
예제 #3
0
        private void BuildTableSorted()
        {
            if (sortMode == SortMode.Off)
            {
                tableSorted = tableRaw;
            }
            else
            {
                List <List <string> > list = new List <List <string> >();
                for (int i = 1; i < tableRaw.GetLength(1); i++)
                {
                    list.Add(new List <string>());
                    for (int j = 0; j < tableRaw.GetLength(0); j++)
                    {
                        list[i - 1].Add(tableRaw[j, i]);
                    }
                }
                NumericStringComparer comparer = new NumericStringComparer();
                switch (sortMode)
                {
                case SortMode.Ascending:
                    list = list.OrderBy((List <string> x) => x[sortColumn], comparer).ToList();
                    break;

                case SortMode.Descending:
                    list = list.OrderByDescending((List <string> x) => x[sortColumn], comparer).ToList();
                    break;

                case SortMode.Off:
                    throw new Exception();
                }
                tableSorted = new string[tableRaw.GetLength(0), tableRaw.GetLength(1)];
                for (int k = 0; k < tableRaw.GetLength(1); k++)
                {
                    for (int l = 0; l < tableRaw.GetLength(0); l++)
                    {
                        if (k == 0)
                        {
                            string[,] array = tableSorted;
                            int    num  = l;
                            int    num2 = k;
                            string text = tableRaw[l, k];
                            array[num, num2] = text;
                        }
                        else
                        {
                            string[,] array2 = tableSorted;
                            int    num3  = l;
                            int    num4  = k;
                            string text2 = list[k - 1][l];
                            array2[num3, num4] = text2;
                        }
                    }
                }
            }
            colWidths.Clear();
            for (int m = 0; m < tableRaw.GetLength(0); m++)
            {
                float item;
                if (colVisible[m])
                {
                    float num5 = 0f;
                    for (int n = 0; n < tableRaw.GetLength(1); n++)
                    {
                        string  text3  = tableRaw[m, n];
                        Vector2 vector = Text.CalcSize(text3);
                        float   x2     = vector.x;
                        if (x2 > num5)
                        {
                            num5 = x2;
                        }
                    }
                    item = num5 + 2f;
                }
                else
                {
                    item = 10f;
                }
                colWidths.Add(item);
            }
            rowHeights.Clear();
            for (int num6 = 0; num6 < tableSorted.GetLength(1); num6++)
            {
                float num7 = 0f;
                for (int num8 = 0; num8 < tableSorted.GetLength(0); num8++)
                {
                    string  text4   = tableSorted[num8, num6];
                    Vector2 vector2 = Text.CalcSize(text4);
                    float   y       = vector2.y;
                    if (y > num7)
                    {
                        num7 = y;
                    }
                }
                rowHeights.Add(num7 + 2f);
            }
        }