Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        public static void UpdateNonIdentityCompleteTableAsExpandoObjectProperties(CompleteTable table)
        {
            var now = DateTime.SpecifyKind(
                DateTime.Parse(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fffff")),
                DateTimeKind.Unspecified);
            var item = table as IDictionary <string, object>;

            item["ColumnBigInt"]        = Convert.ToInt64(2);
            item["ColumnBigIntAsArray"] = new long[] { 1, 2, 3, 4, 5 };
            item["ColumnBigSerial"]     = Convert.ToInt64(2);
            //item["ColumnBit"] = true;
            item["ColumnBoolean"]          = true;
            item["ColumnChar"]             = 'C';
            item["ColumnCharacter"]        = "C";
            item["ColumnCharacterVarying"] = "ColumnCharacterVarying";
            item["ColumnDate"]             = now.Date;
            item["ColumnDateAsArray"]      = new[] { now.Date, now.Date, now.Date };
            item["ColumnInteger"]          = Convert.ToInt32(2);
            item["ColumnIntegerAsArray"]   = new[] { 1, 2, 3, 4, 5 };
            item["ColumnInterval"]         = now.TimeOfDay;
            item["ColumnIntervalAsArray"]  = new[] { now.TimeOfDay, now.TimeOfDay, now.TimeOfDay };
            //item["ColumnJson"] = "{\"field1\": 1, \"field2\": 2}";
            item["ColumnMoney"]    = Convert.ToDecimal(2);
            item["ColumnName"]     = $"ColumnName-{Guid.NewGuid()}-Updated";
            item["ColumnReal"]     = Convert.ToSingle(2);
            item["ColumnSmallInt"] = Convert.ToInt16(2);
            item["ColumnText"]     = $"ColumnText-{Guid.NewGuid()}-Updated";
            item["ColumnTimestampWithoutTimeZone"] = now;
        }
Esempio n. 2
0
        // Creates the Train and Test collections using the provided text document.
        public void CreateTrainAndTestSets()
        {
            // Temporary variables.
            var aRand = new Random();
            var aCompleteRandomTable = new DataTable();

            for (int col = 0; col < CompleteTable.Columns.Count; col++)
            {
                aCompleteRandomTable.Columns.Add(new DataColumn("Column" + (col + 1).ToString()));
            }

            // Add designated size of train set data points from complete set to train table. Completely randomized.
            aCompleteRandomTable = CompleteTable.AsEnumerable().OrderBy(r => aRand.Next()).Take(CompleteTable.Rows.Count).CopyToDataTable();

            int rowNumber = 0;

            foreach (DataRow row in aCompleteRandomTable.Rows)
            {
                if (rowNumber < 4000)
                {
                    TrainTable.ImportRow(row);
                }
                else
                {
                    TestTable.ImportRow(row);
                }

                rowNumber++;
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        public static void UpdateCompleteTableProperties(CompleteTable table)
        {
            var now = DateTime.SpecifyKind(
                DateTime.Parse(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fffff")),
                DateTimeKind.Unspecified);

            table.ColumnBigInt        = Convert.ToInt64(2);
            table.ColumnBigIntAsArray = new long[] { 1, 2, 3, 4, 5 };
            table.ColumnBigSerial     = Convert.ToInt64(2);
            //table.ColumnBit = true;
            table.ColumnBoolean          = (Randomizer.Next() % 2 != 0);
            table.ColumnChar             = 'C';
            table.ColumnCharacter        = "C";
            table.ColumnCharacterVarying = "ColumnCharacterVarying";
            table.ColumnDate             = now.Date;
            table.ColumnDateAsArray      = new[] { now.Date, now.Date, now.Date };
            table.ColumnInteger          = Convert.ToInt32(2);
            table.ColumnIntegerAsArray   = new[] { 1, 2, 3, 4, 5 };
            table.ColumnInterval         = now.TimeOfDay;
            table.ColumnIntervalAsArray  = new[] { now.TimeOfDay, now.TimeOfDay, now.TimeOfDay };
            //table.ColumnJson = "{\"field1\": 1, \"field2\": 2}";
            table.ColumnMoney    = Convert.ToDecimal(2);
            table.ColumnName     = $"{table.ColumnName} (Updated)";
            table.ColumnReal     = Convert.ToSingle(2);
            table.ColumnSmallInt = Convert.ToInt16(2);
            table.ColumnText     = $"{table.ColumnText} (Updated)";
            table.ColumnTimestampWithoutTimeZone = now;
        }
Esempio n. 4
0
        public void OnKrampusKilled()
        {
            Krampus = null;

            CompleteTable.Clear();
            TotalTradesComplete = 0;
        }
Esempio n. 5
0
        public void OnKrampusKilled()
        {
            Krampus = null;

            CompleteTable.Clear();
            TotalTradesComplete = 0;

            if (!Enabled)
            {
                Encounter = null;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Update the properties of <see cref="CompleteTable"/> instance.
        /// </summary>
        /// <param name="table">The instance to be updated.</param>
        public static void UpdateCompleteTableProperties(CompleteTable table)
        {
            var now = DateTime.SpecifyKind(
                DateTime.Parse(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fffff")),
                DateTimeKind.Unspecified);

            table.ColumnVarchar     = $"ColumnVarChar:{1}-Updated";
            table.ColumnInt         = 1;
            table.ColumnDecimal2    = Convert.ToDecimal(1);
            table.ColumnDateTime    = EpocDate;
            table.ColumnBlob        = Encoding.Default.GetBytes($"ColumnBlob:{1}-Updated");
            table.ColumnBlobAsArray = Encoding.Default.GetBytes($"ColumnBlobAsArray:{1}-Updated");
            table.ColumnBinary      = Encoding.Default.GetBytes($"ColumnBinary:{1}-Updated");
            table.ColumnLongBlob    = Encoding.Default.GetBytes($"ColumnLongBlob:{1}-Updated");
            table.ColumnMediumBlob  = Encoding.Default.GetBytes($"ColumnMediumBlob:{1}-Updated");
            table.ColumnTinyBlob    = Encoding.Default.GetBytes($"ColumnTinyBlob:{1}-Updated");
            table.ColumnVarBinary   = Encoding.Default.GetBytes($"ColumnVarBinary:{1}-Updated");
            table.ColumnDate        = EpocDate;
            table.ColumnDateTime2   = now;
            table.ColumnTime        = EpocDate.AddHours(5).AddMinutes(7).AddSeconds(12).TimeOfDay;
            table.ColumnTimeStamp   = now;
            table.ColumnYear        = Convert.ToInt16(now.Year);
            //table.ColumnGeometry = Encoding.Default.GetBytes($"ColumnGeometry:{1}");
            //table.ColumnLineString = Encoding.Default.GetBytes($"ColumnLineString:{1}");
            //table.ColumnMultiLineString = Encoding.Default.GetBytes($"ColumnMultiLineString:{1}");
            //table.ColumnMultiPoint = Encoding.Default.GetBytes($"ColumnMultiPoint:{1}");
            //table.ColumnMultiPolygon = Encoding.Default.GetBytes($"ColumnMultiPolygon:{1}");
            //table.ColumnPoint = Encoding.Default.GetBytes($"ColumnPoint:{1}");
            //table.ColumnPolygon = Encoding.Default.GetBytes($"ColumnPolygon:{1}");
            table.ColumnBigint     = 1;
            table.ColumnDecimal    = Convert.ToDecimal(1);
            table.ColumnDouble     = Convert.ToDouble(1);
            table.ColumnFloat      = Convert.ToSingle(1);
            table.ColumnInt2       = 1;
            table.ColumnMediumInt  = 1;
            table.ColumnReal       = Convert.ToDouble(1);
            table.ColumnSmallInt   = Convert.ToInt16(1);
            table.ColumnTinyInt    = (SByte)1;
            table.ColumnChar       = "C";
            table.ColumnJson       = "{\"Field\": \"Value-Updated\"}";
            table.ColumnNChar      = "C";
            table.ColumnNVarChar   = $"ColumnNVarChar:{1}-Updated";
            table.ColumnLongText   = $"ColumnLongText:{1}-Updated";
            table.ColumnMediumText = $"ColumnMediumText:{1}-Updated";
            table.ColumnText       = $"ColumText:{1}-Updated";
            table.ColumnTinyText   = $"ColumnTinyText:{1}-Updated";
            table.ColumnBit        = (UInt64)1;
        }
Esempio n. 7
0
        public string EncryptData(string data)
        {
            var extKey    = ExtendKeyPhrase(data.Length);
            var encrypted = new byte[data.Length];

            if (!CompleteTable.VerifyString(data))
            {
                throw new ArgumentException("Plaintext data contains characters that does not exist in the cipher table");
            }

            if (!CompleteTable.VerifyString(KeyPhrase))
            {
                throw new ArgumentException("Key data contains characters that does not exist in the cipher table");
            }

            var tbl = CompleteTable.Table;

            for (var i = 0; i < data.Length; i++)
            {
                if (char.IsWhiteSpace(data[i]))
                {
                    encrypted[i] = (byte)' ';
                    continue;
                }

                int plainPos = 0;

                for (var j = 0; j < CompleteTable.RawStringRow.Length; j++)
                {
                    if (data[i] == CompleteTable.RawStringRow[j])
                    {
                        plainPos = j;
                        break;
                    }
                }

                foreach (var row in tbl.Where(row => row[0] == extKey[i]))
                {
                    encrypted[i] = row[plainPos];
                    break;
                }
            }

            return(Encoding.Default.GetString(encrypted));
        }
Esempio n. 8
0
        /// <summary>
        /// Update the properties of <see cref="CompleteTable"/> instance.
        /// </summary>
        /// <param name="table">The instance to be updated.</param>
        public static void UpdateCompleteTableProperties(CompleteTable table)
        {
            var now = DateTime.SpecifyKind(
                DateTime.Parse(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fffff")),
                DateTimeKind.Unspecified);

            table.ColumnBigInt    = Convert.ToInt64(1);
            table.ColumnBoolean   = (Randomizer.Next() % 2 != 0);
            table.ColumnCharacter = "C";
            table.ColumnDate      = now.Date;
            table.ColumnInteger   = Convert.ToInt32(1);
            table.ColumnInterval  = now.TimeOfDay;
            table.ColumMoney      = Convert.ToDecimal(1);
            table.ColumName       = $"ColumnName{1}";
            table.ColumnReal      = Convert.ToSingle(1);
            table.ColumnSmallInt  = Convert.ToInt16(1);
            table.ColumnText      = $"ColumnText{1}";
            table.ColumnTimestampWithoutTimeZone = now;
        }
Esempio n. 9
0
 /// <summary>
 /// Update the properties of <see cref="CompleteTable"/> instance.
 /// </summary>
 /// <param name="table">The instance to be updated.</param>
 public static void UpdateCompleteTableProperties(CompleteTable table)
 {
     table.ColumnBigInt   = long.MaxValue;
     table.ColumnBlob     = Encoding.UTF32.GetBytes(Guid.NewGuid().ToString());
     table.ColumnBoolean  = true;
     table.ColumnChar     = char.Parse("C").ToString();
     table.ColumnDate     = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified).Date;
     table.ColumnDateTime = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified);
     table.ColumnDecimal  = Convert.ToDecimal(Randomizer.Next(1000000));
     table.ColumnDouble   = Convert.ToDouble(Randomizer.Next(1000000));
     table.ColumnInt      = Randomizer.Next(1000000);
     table.ColumnInteger  = Convert.ToInt64(Randomizer.Next(1000000));
     table.ColumnNumeric  = Convert.ToDecimal(Randomizer.Next(1000000));
     table.ColumnReal     = Convert.ToSingle(Randomizer.Next(1000000));
     table.ColumnString   = $"{table.ColumnString} - Updated with {Guid.NewGuid().ToString()}";
     table.ColumnText     = $"{table.ColumnText} - Updated with {Guid.NewGuid().ToString()}";
     table.ColumnTime     = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Unspecified);
     table.ColumnVarChar  = $"{table.ColumnVarChar} - Updated with {Guid.NewGuid().ToString()}";
 }
Esempio n. 10
0
        /// <summary>
        /// Update the properties of <see cref="CompleteTable"/> instance.
        /// </summary>
        /// <param name="table">The instance to be updated.</param>
        public static void UpdateCompleteTableProperties(CompleteTable table)
        {
            var now = DateTime.SpecifyKind(
                DateTime.Parse(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fffff")),
                DateTimeKind.Unspecified);

            table.ColumnBigInt         = Convert.ToInt64(2);
            table.ColumnBinary         = (byte[])null;
            table.ColumnBit            = true;
            table.ColumnChar           = "C";
            table.ColumnDate           = now.Date;
            table.ColumnDateTime       = now.Date;
            table.ColumnDateTime2      = now;
            table.ColumnDateTimeOffset = new DateTimeOffset(now.Date).ToOffset(TimeSpan.FromHours(2));
            table.ColumnDecimal        = Convert.ToDecimal(2);
            table.ColumnFloat          = Convert.ToDouble(2);
            //table.ColumnGeography = (object)null;
            //table.ColumnGeometry = (object)null;
            //table.ColumnHierarchyId = (object)null;
            table.ColumnImage         = (byte[])null;
            table.ColumnInt           = Convert.ToInt32(2);
            table.ColumnMoney         = Convert.ToDecimal(2);
            table.ColumnNChar         = "C";
            table.ColumnNText         = "NText - Updated";
            table.ColumnNumeric       = Convert.ToDecimal(2);
            table.ColumnNVarChar      = "NVarChar - Updated";
            table.ColumnReal          = Convert.ToSingle(2);
            table.ColumnSmallDateTime = now.Date;
            table.ColumnSmallInt      = Convert.ToInt16(2);
            table.ColumnSmallMoney    = Convert.ToDecimal(2);
            table.ColumnSqlVariant    = (object)null;
            table.ColumnText          = "Text - Updated";
            table.ColumnTime          = now.TimeOfDay;
            //table.ColumnTimestamp = (byte[])null;
            table.ColumnTinyInt          = (byte)0;
            table.ColumnUniqueIdentifier = Guid.NewGuid();
            table.ColumnVarBinary        = (byte[])null;
            table.ColumnVarChar          = "VarChar - Updated";
            table.ColumnXml = (string)null;
            table.SessionId = Guid.NewGuid();
        }
Esempio n. 11
0
        public void OnTradeComplete(Mobile m, TradeEntry entry)
        {
            bool distCheck = entry.Distance > 0;

            // 0 distance indicates they used a moongate
            if (m is PlayerMobile pm && distCheck)
            {
                if (!CompleteTable.ContainsKey(pm))
                {
                    CompleteTable[pm] = 1;
                }
                else
                {
                    CompleteTable[pm]++;
                }
            }

            if (TotalTradesComplete > MinComplete || distCheck)
            {
                TotalTradesComplete++;
            }
        }
Esempio n. 12
0
 public override string ToString()
 {
     return(CompleteTable.ToString());
 }