Ejemplo n.º 1
0
        protected override int GetHorizontalPageCount()
        {
            var    pageCountX     = 0;
            double totalWidth     = 0;
            double lastTotalWidth = 0;
            int    columnCount    = 0;

            for (var i = 0; i < PrintTableDefination.ColumnWidths.Count; i++)
            {
                lastTotalWidth = totalWidth + PrintTableDefination.ColumnWidths[i];
                if (totalWidth + PrintTableDefination.ColumnWidths[i] <= PrintablePageWidth)
                {
                    totalWidth += PrintTableDefination.ColumnWidths[i];
                    columnCount++;
                }
                else
                {
                    pageCountX++;
                    ColumnCount.Add(columnCount);
                    AdjustedPageWidths.Add(totalWidth);
                    columnCount = 0;
                    totalWidth  = 0;
                    i--;
                }
            }
            ColumnCount.Add(columnCount);
            AdjustedPageWidths.Add(lastTotalWidth);
            return(pageCountX + 1);
        }
        public static int ColumnCount <CompareWith>(this CassandraColumnFamily <CompareWith> family, BytesType key, CompareWith columnStart, CompareWith columnEnd, bool reversed = false, int count = 100)
            where CompareWith : CassandraType
        {
            var op = new ColumnCount(key, new RangeSlicePredicate(columnStart, columnEnd, reversed, count));

            return(family.ExecuteOperation(op));
        }
        public static int ColumnCount <CompareWith>(this CassandraColumnFamily <CompareWith> family, BytesType key, IEnumerable <CompareWith> columnNames)
            where CompareWith : CassandraType
        {
            var op = new ColumnCount(key, new ColumnSlicePredicate(columnNames));

            return(family.ExecuteOperation(op));
        }
Ejemplo n.º 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (TimeColumnSpecId.Length != 0)
            {
                hash ^= TimeColumnSpecId.GetHashCode();
            }
            if (RowCount != 0L)
            {
                hash ^= RowCount.GetHashCode();
            }
            if (ValidRowCount != 0L)
            {
                hash ^= ValidRowCount.GetHashCode();
            }
            if (ColumnCount != 0L)
            {
                hash ^= ColumnCount.GetHashCode();
            }
            hash ^= inputConfigs_.GetHashCode();
            if (Etag.Length != 0)
            {
                hash ^= Etag.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 5
0
 protected override string ReplaceTemplates(string fileTexts)
 {
     fileTexts = base.ReplaceTemplates(fileTexts);
     fileTexts = fileTexts.Replace("#TABLENAMEORIGINAL#", TableName);
     fileTexts = fileTexts.Replace("#TABLENAME#", TableName.ToCamelCase());
     fileTexts = fileTexts.Replace("#STABLENAME#", TableName.ToCamelCase().ToLower());
     return(fileTexts.Replace("#COLUMNCOUNT#", ColumnCount.ToString()));
 }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hash = 17;
                hash = hash * 23 + m_featureArray.GetHashCode();
                hash = hash * 23 + ColumnCount.GetHashCode();
                hash = hash * 23 + RowCount.GetHashCode();

                return(hash);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 异步写入单行数据, 可多次执行, 之后执行 Close 方法关闭写入流.
        /// </summary>
        /// <typeparam name="T">要写入的数据对象类型</typeparam>
        /// <param name="rowData">要写入的数据对象实例</param>
        /// <param name="expression">处理对象实例,返回字段集合的方法.</param>
        /// <returns>Task</returns>
        public async Task WriteLineAsync <T>(T rowData, Func <T, List <string> > expression) where T : new()
        {
            if (this.CancelToken.IsCancellationRequested)
            {
                this.CancelToken.ThrowIfCancellationRequested();
            }

            if (rowData == null)
            {
                throw new ArgumentNullException("rowData");
            }

            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            //取转换后的行数据
            var row = expression.Invoke(rowData);

            //如果写入过一条数据, 则字段数固定. 如果再次写入的字段数不同, 报异常.
            if (this.ColumnCount > 0 && this.ColumnCount != row.Count)
            {
                throw new ArgumentException("the rowData count must be equal to " + ColumnCount.ToString());
            }

            List <string> rows = this.SerializeRows(row);

            await this.CsvStream.WriteLineAsync(rows[0]);

            this.TotalRowCount++;

            //设置字段数
            if (this.ColumnCount == 0)
            {
                this.ColumnCount = row.Count;
            }

            //发送通知
            if (Progress != null)
            {
                //如果取余数=0, 发送通知.
                if (TotalRowCount % this.WriteProgressSize == 0L)
                {
                    CsvWriteProgressInfo info = new CsvHelperAsync.CsvWriteProgressInfo();
                    info.CurrentRowCount = this.WriteProgressSize;
                    info.WirteRowCount   = this.TotalRowCount;
                    Progress.Report(info);
                }
            }
        }
Ejemplo n.º 8
0
        private int convertColumnCountEnumToInt(ColumnCount columnCount)
        {
            switch (columnCount)
            {
            default:
            case ColumnCount.One:
                return(1);

            case ColumnCount.Two:
                return(2);

            case ColumnCount.Three:
                return(3);
            }
        }
Ejemplo n.º 9
0
        public void SaveSettings(object sender, RoutedEventArgs e)
        {
            DataBase.SetSetting("WIDTH", WindowWidth.ToString());
            DataBase.SetSetting("HEIGHT", WindowHeight.ToString());
            DataBase.SetSetting("COLS", ColumnCount.ToString());
            DataBase.SetSetting("ROWS", RowCount.ToString());
            DataBase.SetSetting("TOPMOST", IsTopMost ? "TRUE" : "FALSE");
            DataBase.SetSetting("STARTUP", StartUp ? "TRUE" : "FALSE");
            InstallStartUp(StartUp);

            DataBase.SetTabs(Tabs);

            // 재시작
            System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
            Application.Current.Shutdown();
        }
Ejemplo n.º 10
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VariousPropertyBits;
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)PicturePosition;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (Accelerator?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Size?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Picture?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (MouseIcon?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (TextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)MaxLength;
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ DisplayStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ (PasswordChar?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)ListWidth;
         hashCode = (hashCode * 397) ^ BoundColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ TextColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnCount.GetHashCode();
         hashCode = (hashCode * 397) ^ ListRows.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnInfoCount.GetHashCode();
         hashCode = (hashCode * 397) ^ MatchEntry.GetHashCode();
         hashCode = (hashCode * 397) ^ ListStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ ShowDropButtonWhen.GetHashCode();
         hashCode = (hashCode * 397) ^ DropButtonStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ MultiSelect.GetHashCode();
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (GroupName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Remainder?.Length.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Ejemplo n.º 11
0
 private void ResizeOurself(int r, int c)
 {
     //adjust rows and cols, do nothing if they equal
     //
     while (c < ColumnCount)
     {
         Columns.RemoveAt(ColumnCount - 1);
     }
     while (c > ColumnCount)
     {
         AddColumn(ColumnCount.ToString());
     }
     while (r < RowCount)
     {
         Rows.RemoveAt(RowCount - 1);
     }
     while (r > RowCount)
     {
         AddRow(RowCount.ToString());
     }
 }
Ejemplo n.º 12
0
 public void SetValue(Matrix4x4[] value)
 {
     // FIXME: All Matrix sizes... this will get ugly. -flibit
     unsafe
     {
         float *dstPtr = (float *)values;
         if (ColumnCount == 4 && RowCount == 4)
         {
             for (int i = 0; i < value.Length; i += 1, dstPtr += 16)
             {
                 dstPtr[0]  = value[i].M11;
                 dstPtr[1]  = value[i].M21;
                 dstPtr[2]  = value[i].M31;
                 dstPtr[3]  = value[i].M41;
                 dstPtr[4]  = value[i].M12;
                 dstPtr[5]  = value[i].M22;
                 dstPtr[6]  = value[i].M32;
                 dstPtr[7]  = value[i].M42;
                 dstPtr[8]  = value[i].M13;
                 dstPtr[9]  = value[i].M23;
                 dstPtr[10] = value[i].M33;
                 dstPtr[11] = value[i].M43;
                 dstPtr[12] = value[i].M14;
                 dstPtr[13] = value[i].M24;
                 dstPtr[14] = value[i].M34;
                 dstPtr[15] = value[i].M44;
             }
         }
         else if (ColumnCount == 3 && RowCount == 3)
         {
             for (int i = 0; i < value.Length; i += 1, dstPtr += 12)
             {
                 dstPtr[0]  = value[i].M11;
                 dstPtr[1]  = value[i].M21;
                 dstPtr[2]  = value[i].M31;
                 dstPtr[4]  = value[i].M12;
                 dstPtr[5]  = value[i].M22;
                 dstPtr[6]  = value[i].M32;
                 dstPtr[8]  = value[i].M13;
                 dstPtr[9]  = value[i].M23;
                 dstPtr[10] = value[i].M33;
             }
         }
         else if (ColumnCount == 4 && RowCount == 3)
         {
             for (int i = 0; i < value.Length; i += 1, dstPtr += 12)
             {
                 dstPtr[0]  = value[i].M11;
                 dstPtr[1]  = value[i].M21;
                 dstPtr[2]  = value[i].M31;
                 dstPtr[3]  = value[i].M41;
                 dstPtr[4]  = value[i].M12;
                 dstPtr[5]  = value[i].M22;
                 dstPtr[6]  = value[i].M32;
                 dstPtr[7]  = value[i].M42;
                 dstPtr[8]  = value[i].M13;
                 dstPtr[9]  = value[i].M23;
                 dstPtr[10] = value[i].M33;
                 dstPtr[11] = value[i].M43;
             }
         }
         else if (ColumnCount == 3 && RowCount == 4)
         {
             for (int i = 0; i < value.Length; i += 1, dstPtr += 16)
             {
                 dstPtr[0]  = value[i].M11;
                 dstPtr[1]  = value[i].M21;
                 dstPtr[2]  = value[i].M31;
                 dstPtr[4]  = value[i].M12;
                 dstPtr[5]  = value[i].M22;
                 dstPtr[6]  = value[i].M32;
                 dstPtr[8]  = value[i].M13;
                 dstPtr[9]  = value[i].M23;
                 dstPtr[10] = value[i].M33;
                 dstPtr[12] = value[i].M14;
                 dstPtr[13] = value[i].M24;
                 dstPtr[14] = value[i].M34;
             }
         }
         else if (ColumnCount == 2 && RowCount == 2)
         {
             for (int i = 0; i < value.Length; i += 1, dstPtr += 8)
             {
                 dstPtr[0] = value[i].M11;
                 dstPtr[1] = value[i].M21;
                 dstPtr[4] = value[i].M12;
                 dstPtr[5] = value[i].M22;
             }
         }
         else
         {
             throw new NotImplementedException(
                       "Matrix Size: " +
                       RowCount.ToString() + " " +
                       ColumnCount.ToString()
                       );
         }
     }
 }
Ejemplo n.º 13
0
 public void SetValueTranspose(Matrix value)
 {
     // FIXME: All Matrix sizes... this will get ugly. -flibit
     unsafe
     {
         float *dstPtr = (float *)values;
         if (ColumnCount == 4 && RowCount == 4)
         {
             dstPtr[0]  = value.M11;
             dstPtr[1]  = value.M21;
             dstPtr[2]  = value.M31;
             dstPtr[3]  = value.M41;
             dstPtr[4]  = value.M12;
             dstPtr[5]  = value.M22;
             dstPtr[6]  = value.M32;
             dstPtr[7]  = value.M42;
             dstPtr[8]  = value.M13;
             dstPtr[9]  = value.M23;
             dstPtr[10] = value.M33;
             dstPtr[11] = value.M43;
             dstPtr[12] = value.M14;
             dstPtr[13] = value.M24;
             dstPtr[14] = value.M34;
             dstPtr[15] = value.M44;
         }
         else if (ColumnCount == 3 && RowCount == 3)
         {
             dstPtr[0] = value.M11;
             dstPtr[1] = value.M21;
             dstPtr[2] = value.M31;
             dstPtr[3] = value.M12;
             dstPtr[4] = value.M22;
             dstPtr[5] = value.M32;
             dstPtr[6] = value.M13;
             dstPtr[7] = value.M23;
             dstPtr[8] = value.M33;
         }
         else if (ColumnCount == 4 && RowCount == 3)
         {
             dstPtr[0]  = value.M11;
             dstPtr[1]  = value.M21;
             dstPtr[2]  = value.M31;
             dstPtr[3]  = value.M41;
             dstPtr[4]  = value.M12;
             dstPtr[5]  = value.M22;
             dstPtr[6]  = value.M32;
             dstPtr[7]  = value.M42;
             dstPtr[8]  = value.M13;
             dstPtr[9]  = value.M23;
             dstPtr[10] = value.M33;
             dstPtr[11] = value.M43;
         }
         else if (ColumnCount == 3 && RowCount == 4)
         {
             dstPtr[0]  = value.M11;
             dstPtr[1]  = value.M21;
             dstPtr[2]  = value.M31;
             dstPtr[3]  = value.M12;
             dstPtr[4]  = value.M22;
             dstPtr[5]  = value.M32;
             dstPtr[6]  = value.M13;
             dstPtr[7]  = value.M23;
             dstPtr[8]  = value.M33;
             dstPtr[9]  = value.M14;
             dstPtr[10] = value.M24;
             dstPtr[11] = value.M34;
         }
         else
         {
             throw new NotImplementedException(
                       "Matrix Size: " +
                       RowCount.ToString() + " " +
                       ColumnCount.ToString()
                       );
         }
     }
 }
Ejemplo n.º 14
0
 public void SetValue(Matrix[] value)
 {
     // FIXME: All Matrix sizes... this will get ugly. -flibit
     unsafe
     {
         float *dstPtr    = (float *)values;
         int    curOffset = 0;
         if (ColumnCount == 4 && RowCount == 4)
         {
             for (int i = 0; i < value.Length; i += 1)
             {
                 dstPtr[curOffset++] = value[i].M11;
                 dstPtr[curOffset++] = value[i].M12;
                 dstPtr[curOffset++] = value[i].M13;
                 dstPtr[curOffset++] = value[i].M14;
                 dstPtr[curOffset++] = value[i].M21;
                 dstPtr[curOffset++] = value[i].M22;
                 dstPtr[curOffset++] = value[i].M23;
                 dstPtr[curOffset++] = value[i].M24;
                 dstPtr[curOffset++] = value[i].M31;
                 dstPtr[curOffset++] = value[i].M32;
                 dstPtr[curOffset++] = value[i].M33;
                 dstPtr[curOffset++] = value[i].M34;
                 dstPtr[curOffset++] = value[i].M41;
                 dstPtr[curOffset++] = value[i].M42;
                 dstPtr[curOffset++] = value[i].M43;
                 dstPtr[curOffset++] = value[i].M44;
             }
         }
         else if (ColumnCount == 3 && RowCount == 3)
         {
             for (int i = 0; i < value.Length; i += 1)
             {
                 dstPtr[curOffset++] = value[i].M11;
                 dstPtr[curOffset++] = value[i].M12;
                 dstPtr[curOffset++] = value[i].M13;
                 dstPtr[curOffset++] = value[i].M21;
                 dstPtr[curOffset++] = value[i].M22;
                 dstPtr[curOffset++] = value[i].M23;
                 dstPtr[curOffset++] = value[i].M31;
                 dstPtr[curOffset++] = value[i].M32;
                 dstPtr[curOffset++] = value[i].M33;
             }
         }
         else if (ColumnCount == 4 && RowCount == 3)
         {
             for (int i = 0; i < value.Length; i += 1)
             {
                 dstPtr[curOffset++] = value[i].M11;
                 dstPtr[curOffset++] = value[i].M12;
                 dstPtr[curOffset++] = value[i].M13;
                 dstPtr[curOffset++] = value[i].M21;
                 dstPtr[curOffset++] = value[i].M22;
                 dstPtr[curOffset++] = value[i].M23;
                 dstPtr[curOffset++] = value[i].M31;
                 dstPtr[curOffset++] = value[i].M32;
                 dstPtr[curOffset++] = value[i].M33;
                 dstPtr[curOffset++] = value[i].M41;
                 dstPtr[curOffset++] = value[i].M42;
                 dstPtr[curOffset++] = value[i].M43;
             }
         }
         else if (ColumnCount == 3 && RowCount == 4)
         {
             for (int i = 0; i < value.Length; i += 1)
             {
                 dstPtr[curOffset++] = value[i].M11;
                 dstPtr[curOffset++] = value[i].M12;
                 dstPtr[curOffset++] = value[i].M13;
                 dstPtr[curOffset++] = value[i].M14;
                 dstPtr[curOffset++] = value[i].M21;
                 dstPtr[curOffset++] = value[i].M22;
                 dstPtr[curOffset++] = value[i].M23;
                 dstPtr[curOffset++] = value[i].M24;
                 dstPtr[curOffset++] = value[i].M31;
                 dstPtr[curOffset++] = value[i].M32;
                 dstPtr[curOffset++] = value[i].M33;
                 dstPtr[curOffset++] = value[i].M34;
             }
         }
         else
         {
             throw new NotImplementedException(
                       "Matrix Size: " +
                       RowCount.ToString() + " " +
                       ColumnCount.ToString()
                       );
         }
     }
 }
Ejemplo n.º 15
0
 public Matrix[] GetValueMatrixTransposeArray(int count)
 {
     // FIXME: All Matrix sizes... this will get ugly. -flibit
     Matrix[] result = new Matrix[count];
     unsafe
     {
         float *resPtr    = (float *)values;
         int    curOffset = 0;
         if (ColumnCount == 4 && RowCount == 4)
         {
             for (int i = 0; i < count; i += 1)
             {
                 result[i] = new Matrix(
                     resPtr[curOffset + 0],
                     resPtr[curOffset + 4],
                     resPtr[curOffset + 8],
                     resPtr[curOffset + 12],
                     resPtr[curOffset + 1],
                     resPtr[curOffset + 5],
                     resPtr[curOffset + 9],
                     resPtr[curOffset + 13],
                     resPtr[curOffset + 2],
                     resPtr[curOffset + 6],
                     resPtr[curOffset + 10],
                     resPtr[curOffset + 14],
                     resPtr[curOffset + 3],
                     resPtr[curOffset + 7],
                     resPtr[curOffset + 11],
                     resPtr[curOffset + 15]
                     );
                 curOffset += 16;
             }
         }
         else if (ColumnCount == 3 && RowCount == 3)
         {
             for (int i = 0; i < count; i += 1)
             {
                 result[i] = new Matrix(
                     resPtr[curOffset],
                     resPtr[curOffset + 3],
                     resPtr[curOffset + 6],
                     0.0f,
                     resPtr[curOffset + 1],
                     resPtr[curOffset + 4],
                     resPtr[curOffset + 7],
                     0.0f,
                     resPtr[curOffset + 2],
                     resPtr[curOffset + 5],
                     resPtr[curOffset + 8],
                     0.0f,
                     0.0f,
                     0.0f,
                     0.0f,
                     0.0f
                     );
                 curOffset += 9;
             }
         }
         else if (ColumnCount == 4 && RowCount == 3)
         {
             for (int i = 0; i < count; i += 1)
             {
                 result[i] = new Matrix(
                     resPtr[curOffset],
                     resPtr[curOffset + 4],
                     resPtr[curOffset + 8],
                     0.0f,
                     resPtr[curOffset + 1],
                     resPtr[curOffset + 5],
                     resPtr[curOffset + 9],
                     0.0f,
                     resPtr[curOffset + 2],
                     resPtr[curOffset + 6],
                     resPtr[curOffset + 10],
                     0.0f,
                     resPtr[curOffset + 3],
                     resPtr[curOffset + 7],
                     resPtr[curOffset + 11],
                     0.0f
                     );
                 curOffset += 12;
             }
         }
         else if (ColumnCount == 3 && RowCount == 4)
         {
             for (int i = 0; i < count; i += 1)
             {
                 result[i] = new Matrix(
                     resPtr[curOffset],
                     resPtr[curOffset + 3],
                     resPtr[curOffset + 6],
                     resPtr[curOffset + 9],
                     resPtr[curOffset + 1],
                     resPtr[curOffset + 4],
                     resPtr[curOffset + 7],
                     resPtr[curOffset + 10],
                     resPtr[curOffset + 2],
                     resPtr[curOffset + 5],
                     resPtr[curOffset + 8],
                     resPtr[curOffset + 11],
                     0.0f,
                     0.0f,
                     0.0f,
                     0.0f
                     );
                 curOffset += 12;
             }
         }
         else
         {
             throw new NotImplementedException(
                       "Matrix Size: " +
                       RowCount.ToString() + " " +
                       ColumnCount.ToString()
                       );
         }
     }
     return(result);
 }
Ejemplo n.º 16
0
 public Matrix GetValueMatrixTranspose()
 {
     // FIXME: All Matrix sizes... this will get ugly. -flibit
     unsafe
     {
         float *resPtr = (float *)values;
         if (ColumnCount == 4 && RowCount == 4)
         {
             return(new Matrix(
                        resPtr[0],
                        resPtr[4],
                        resPtr[8],
                        resPtr[12],
                        resPtr[1],
                        resPtr[5],
                        resPtr[9],
                        resPtr[13],
                        resPtr[2],
                        resPtr[6],
                        resPtr[10],
                        resPtr[14],
                        resPtr[3],
                        resPtr[7],
                        resPtr[11],
                        resPtr[15]
                        ));
         }
         else if (ColumnCount == 3 && RowCount == 3)
         {
             return(new Matrix(
                        resPtr[0],
                        resPtr[3],
                        resPtr[6],
                        0.0f,
                        resPtr[1],
                        resPtr[4],
                        resPtr[7],
                        0.0f,
                        resPtr[2],
                        resPtr[5],
                        resPtr[8],
                        0.0f,
                        0.0f,
                        0.0f,
                        0.0f,
                        0.0f
                        ));
         }
         else if (ColumnCount == 4 && RowCount == 3)
         {
             return(new Matrix(
                        resPtr[0],
                        resPtr[4],
                        resPtr[8],
                        0.0f,
                        resPtr[1],
                        resPtr[5],
                        resPtr[9],
                        0.0f,
                        resPtr[2],
                        resPtr[6],
                        resPtr[10],
                        0.0f,
                        resPtr[3],
                        resPtr[7],
                        resPtr[11],
                        0.0f
                        ));
         }
         else if (ColumnCount == 3 && RowCount == 4)
         {
             return(new Matrix(
                        resPtr[0],
                        resPtr[3],
                        resPtr[6],
                        resPtr[9],
                        resPtr[1],
                        resPtr[4],
                        resPtr[7],
                        resPtr[10],
                        resPtr[2],
                        resPtr[5],
                        resPtr[8],
                        resPtr[11],
                        0.0f,
                        0.0f,
                        0.0f,
                        0.0f
                        ));
         }
         else
         {
             throw new NotImplementedException(
                       "Matrix Size: " +
                       RowCount.ToString() + " " +
                       ColumnCount.ToString()
                       );
         }
     }
 }
        public static int ColumnCount(this CassandraColumnFamily family, CassandraObject key, CassandraObject columnStart, CassandraObject columnEnd, bool reversed = false, int count = 100)
        {
            var op = new ColumnCount(key, new CassandraRangeSlicePredicate(columnStart, columnEnd, reversed, count));

            return(family.ExecuteOperation(op));
        }
		public static int SuperColumnCount(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, IEnumerable<CassandraObject> columnNames)
		{
			var op = new ColumnCount(key, superColumnName, new CassandraColumnSlicePredicate(columnNames));
			return family.ExecuteOperation(op);
		}
Ejemplo n.º 19
0
 protected DataSet loadAll(bool debug = false)
 {
     /* if (localCN.State != ConnectionState.Open)
      * {
      *  try
      *  {
      *      localCN.Open();
      *  }
      *  catch (System.Data.SqlClient.SqlException ex)
      *  {
      *      Log.Log((int)LogClass.logType.ErrorCondition, "Opening database: <" + localCN.ConnectionString + ">" + "\r\n" + "   " + loadAllStmt + "\r\n" + "   " + ex.Message, false, MessageBoxButtons.OK);
      *      return null;
      *  }
      *  catch (System.Exception ex)
      *  {
      *      Log.Log((int)LogClass.logType.ErrorCondition, "Opening database: <" + localCN.ConnectionString + ">" + "\r\n" + "   " + loadAllStmt + "\r\n" + "   " + ex.Message);
      *      return null;
      *  }
      * }   */
     try
     {
         if (debug)
         {
             GlobalShared.Log.debug = true;
             GlobalShared.Log.Log((int)LogClass.logType.Debug, "clsDB.loadAll [ConnectionString= " + GlobalShared.CN.ConnectionString + "]", false);
             GlobalShared.Log.debug = false;
         }
         if (debug)
         {
             GlobalShared.Log.debug = true;
             GlobalShared.Log.Log((int)LogClass.logType.Debug, "clsDB.loadAll [" + loadAllStmt + "]", false);
             GlobalShared.Log.debug = false;
         }
         //localCN.ConnectionString = connectionString;
         System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(loadAllStmt, GlobalShared.CN.ConnectionString);
         DataSet ds = new DataSet(DS_DATA_SET);
         da.Fill(ds, DS_DATA_SET);
         ColumnCount = ds.Tables[0].Columns.Count;
         if (debug)
         {
             GlobalShared.Log.debug = true;
             GlobalShared.Log.Log((int)LogClass.logType.Debug, "clsDB.loadAll [ColumnCount= " + ColumnCount.ToString() + "]", false);
             GlobalShared.Log.debug = false;
         }
         return(ds);
     }
     catch (System.Data.SqlClient.SqlException ex)
     {
         ErrorMessage = ex.Message;
         Log.Log((int)LogClass.logType.ErrorCondition, "Error while retrieving records from " + localTable + ": " + ex.Message, false, MessageBoxButtons.OK);
         return(null);
     }
     catch (System.Exception ex)
     {
         ErrorMessage = ex.Message;
         Log.Log((int)LogClass.logType.ErrorCondition, "Error while retrieving records from " + localTable + ": " + ex.Message, false, MessageBoxButtons.OK);
     }
     return(null);
 }
Ejemplo n.º 20
0
 public bool EqualSize(Matrix other)
 {
     return(ColumnCount.Equals(other.ColumnCount) && RowCount.Equals(other.RowCount));
 }
Ejemplo n.º 21
0
        protected DataSet load(string stmt, string[] options, bool LogZero = false)
        {
            if (options != null)
            {
                if (options.Length > 0 && options[0] != null && options[0].Trim() != "")
                {
                    stmt = prepareStatement(stmt, options);
                }
            }
            //MessageBoxCustom.Show("Query = " + stmt);

            System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(stmt, GlobalShared.CN.ConnectionString);
            DataSet ds = new DataSet(DS_DATA_SET);

            try
            {
                da.Fill(ds, (localTable == null || localTable.Trim().Equals("") ? "TABLE" : localTable));
                ColumnCount = ds.Tables[0].Columns.Count;
                if (LogZero && (ds == null || ds.Tables[0].Rows.Count == 0))
                {
                    GlobalShared.Log.Log((int)LogClass.logType.Warning, "No records returned [clsDb.load(stmt, options)]: columns=" + ColumnCount.ToString() + ", " + stmt, false);
                }
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                ErrorMessage = ex.Message;
                GlobalShared.Log.Log((int)LogClass.logType.ErrorCondition, "[clsDb.load(stmt, options)]: " + ex.Message + System.Environment.NewLine + "   Stmt: " + stmt, true);
                return(null);
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                GlobalShared.Log.Log((int)LogClass.logType.ErrorCondition, "[clsDb.load(stmt, options)]: " + ex.Message + System.Environment.NewLine + "   Stmt: " + stmt, true);
                return(null);
            }

            return(ds);
        }
		public static int SuperColumnCount(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject columnStart, CassandraObject columnEnd, bool reversed = false, int count = 100)
		{
			var op = new ColumnCount(key, superColumnName, new CassandraRangeSlicePredicate(columnStart, columnEnd, reversed, count));
			return family.ExecuteOperation(op);
		}
        public static int ColumnCount(this CassandraColumnFamily family, CassandraObject key, IEnumerable <CassandraObject> columnNames)
        {
            var op = new ColumnCount(key, new CassandraColumnSlicePredicate(columnNames));

            return(family.ExecuteOperation(op));
        }