コード例 #1
0
        private void RetrieveSubstitution(XmlTextWriter writer, IJPSubstitutionRule srs, Ba rule, int start, int end)
        {
            int n = end - start + 1;

            string[] subCode = new string[n];
            for (int i = 0; i < n; i++)
            {
                switch (rule)
                {
                case Ba.Year:
                    subCode[i] = srs.GetYearSetup(i + start);
                    break;

                case Ba.Month:
                    subCode[i] = srs.GetMonthSetup(i + start);
                    break;

                case Ba.Day:
                    subCode[i] = srs.GetDaySetup(i + start);
                    break;

                case Ba.Hour:
                    subCode[i] = srs.GetHourSetup(i + start);
                    break;

                case Ba.Minute:
                    subCode[i] = srs.GetMinuteSetup(i + start);
                    break;

                case Ba.WeekNumber:
                    subCode[i] = srs.GetWeekNumberSetup(i);
                    break;

                case Ba.DayOfWeek:
                    subCode[i] = srs.GetWeekSetup((DayOfWeek)i);
                    break;
                }
            }
            for (int i = 0; i < n; i += 10)
            {
                writer.WriteStartElement("Rule");
                {
                    writer.WriteAttributeString("Type", rule.ToString());
                    writer.WriteAttributeString("Base", (i + start).ToString());
                    writer.WriteString(string.Join("/", subCode, i, Math.Min(10, n - i)));
                }
                writer.WriteEndElement(); // Rule
            }
        }
コード例 #2
0
        public static string MD5Sifrele(string Metin)
        {
            MD5CryptoServiceProvider Md5 = new MD5CryptoServiceProvider();

            byte[] Bte = Encoding.UTF8.GetBytes(Metin);
            Bte = Md5.ComputeHash(Bte);

            StringBuilder Sb = new StringBuilder();

            foreach (byte Ba in Bte)
            {
                Sb.Append(Ba.ToString("x2").ToLower());
            }
            return(Sb.ToString());
        }