• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Utility.CharStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中KeePassLib.Utility.CharStream的典型用法代码示例。如果您正苦于以下问题:C# CharStream类的具体用法?C# CharStream怎么用?C# CharStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CharStream类属于KeePassLib.Utility命名空间,在下文中一共展示了CharStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: JsonArray

        public JsonArray(CharStream csDataSource)
        {
            if(csDataSource == null) throw new ArgumentNullException("csDataSource");

            char chInit = csDataSource.ReadChar(true);
            if(chInit != '[') throw new JsonFormatException();

            List<JsonValue> lValues = new List<JsonValue>();

            while(true)
            {
                char chNext = csDataSource.PeekChar(true);
                if(chNext == ']') break;

                lValues.Add(new JsonValue(csDataSource));

                chNext = csDataSource.PeekChar(true);
                if(chNext == ',') csDataSource.ReadChar(true);
            }

            char chTerminator = csDataSource.ReadChar(true);
            if(chTerminator != ']') throw new JsonFormatException();

            m_values = lValues.ToArray();
        }
开发者ID:Stoom,项目名称:KeePass,代码行数:25,代码来源:Json.cs


示例2: JsonObject

		public JsonObject(CharStream csDataSource)
		{
			if(csDataSource == null) throw new ArgumentNullException("csDataSource");

			char chInit = csDataSource.ReadChar(true);
			if(chInit != '{') throw new JsonFormatException();

			while(true)
			{
				string strName = (new JsonString(csDataSource)).Value;

				char chSeparator = csDataSource.ReadChar(true);
				if(chSeparator != ':') throw new JsonFormatException();

				JsonValue jValue = new JsonValue(csDataSource);

				m_dict[strName] = jValue;

				char chNext = csDataSource.PeekChar(true);
				if(chNext == '}') break;
				else if(chNext == ',') csDataSource.ReadChar(true);
				else throw new JsonFormatException();
			}

			char chTerminator = csDataSource.ReadChar(true);
			if(chTerminator != '}') throw new JsonFormatException();
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:27,代码来源:Json.cs


示例3: ParseRepl

        internal static Dictionary<string, string> ParseRepl(string str)
        {
            Dictionary<string, string> d = new Dictionary<string, string>();
            if(str == null) { Debug.Assert(false); return d; }

            CharStream cs = new CharStream(str + ",,");
            StringBuilder sb = new StringBuilder();
            string strKey = string.Empty;
            bool bValue = false;

            while(true)
            {
                char ch = cs.ReadChar();
                if(ch == char.MinValue) break;

                if(ch == ',')
                {
                    if(!bValue)
                    {
                        strKey = sb.ToString();
                        sb.Remove(0, sb.Length);
                    }

                    if(strKey.Length > 0) d[strKey] = sb.ToString();

                    sb.Remove(0, sb.Length);
                    bValue = false;
                }
                else if(ch == '>')
                {
                    strKey = sb.ToString();

                    sb.Remove(0, sb.Length);
                    bValue = true;
                }
                else if(ch == '\\')
                {
                    char chSub = cs.ReadChar();

                    if(chSub == 'n') sb.Append('\n');
                    else if(chSub == 'r') sb.Append('\r');
                    else if(chSub == 't') sb.Append('\t');
                    else sb.Append(chSub);
                }
                else sb.Append(ch);
            }

            return d;
        }
开发者ID:rdealexb,项目名称:keepass,代码行数:49,代码来源:GxiImporter.cs


示例4: Import

		public override void Import(PwDatabase pwStorage, Stream sInput,
			IStatusLogger slLogger)
		{
			StreamReader sr = new StreamReader(sInput, Encoding.UTF8);
			string strContent = sr.ReadToEnd();
			sr.Close();

			if(strContent.Length == 0) return;

			CharStream cs = new CharStream(strContent);

			JsonObject jRoot = new JsonObject(cs);
			AddObject(pwStorage.RootGroup, jRoot, pwStorage, false);
			Debug.Assert(cs.PeekChar(true) == char.MinValue);
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:15,代码来源:MozillaBookmarksJson100.cs


示例5: Import

		public override void Import(PwDatabase pwStorage, Stream sInput,
			IStatusLogger slLogger)
		{
			StreamReader sr = new StreamReader(sInput, Encoding.UTF8);
			string strFileContents = sr.ReadToEnd();
			sr.Close();

			CharStream csSource = new CharStream(strFileContents);

			while(true)
			{
				if(ReadEntry(pwStorage, csSource) == false)
					break;
			}
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:15,代码来源:KeePassCsv1x.cs


示例6: ReadEntry

		private static bool ReadEntry(PwDatabase pwStorage, CharStream csSource)
		{
			PwEntry pe = new PwEntry(true, true);

			string strTitle = ReadCsvField(csSource);
			if(strTitle == null) return false; // No entry available

			string strUser = ReadCsvField(csSource);
			if(strUser == null) throw new InvalidDataException();

			string strPassword = ReadCsvField(csSource);
			if(strPassword == null) throw new InvalidDataException();

			string strUrl = ReadCsvField(csSource);
			if(strUrl == null) throw new InvalidDataException();

			string strNotes = ReadCsvField(csSource);
			if(strNotes == null) throw new InvalidDataException();

			if((strTitle == "Account") && (strUser == "Login Name") &&
				(strPassword == "Password") && (strUrl == "Web Site") &&
				(strNotes == "Comments"))
			{
				return true; // Ignore header entry
			}

			pe.Strings.Set(PwDefs.TitleField, new ProtectedString(
				pwStorage.MemoryProtection.ProtectTitle, strTitle));
			pe.Strings.Set(PwDefs.UserNameField, new ProtectedString(
				pwStorage.MemoryProtection.ProtectUserName, strUser));
			pe.Strings.Set(PwDefs.PasswordField, new ProtectedString(
				pwStorage.MemoryProtection.ProtectPassword, strPassword));
			pe.Strings.Set(PwDefs.UrlField, new ProtectedString(
				pwStorage.MemoryProtection.ProtectUrl, strUrl));
			pe.Strings.Set(PwDefs.NotesField, new ProtectedString(
				pwStorage.MemoryProtection.ProtectNotes, strNotes));

			pwStorage.RootGroup.AddEntry(pe, true);
			return true;
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:40,代码来源:KeePassCsv1x.cs


示例7: Import

		public override void Import(PwDatabase pwStorage, Stream sInput,
			IStatusLogger slLogger)
		{
			StreamReader sr = new StreamReader(sInput, StrUtil.Utf8);
			string strContent = sr.ReadToEnd();
			sr.Close();

			if(string.IsNullOrEmpty(strContent)) return;

			CharStream cs = new CharStream(strContent);

			Dictionary<string, List<string>> dTags =
				new Dictionary<string, List<string>>();
			List<PwEntry> lCreatedEntries = new List<PwEntry>();

			JsonObject jRoot = new JsonObject(cs);
			AddObject(pwStorage.RootGroup, jRoot, pwStorage, false, dTags,
				lCreatedEntries);
			Debug.Assert(cs.PeekChar(true) == char.MinValue);

			// Assign tags
			foreach(PwEntry pe in lCreatedEntries)
			{
				string strUri = pe.Strings.ReadSafe(PwDefs.UrlField);
				if(strUri.Length == 0) continue;

				foreach(KeyValuePair<string, List<string>> kvp in dTags)
				{
					foreach(string strTagUri in kvp.Value)
					{
						if(strUri.Equals(strTagUri, StrUtil.CaseIgnoreCmp))
							pe.AddTag(kvp.Key);
					}
				}
			}
		}
开发者ID:riking,项目名称:go-keepass2,代码行数:36,代码来源:MozillaBookmarksJson100.cs


示例8: MakeList

        public static void MakeList()
        {
            string strData = File.ReadAllText("MostPopularPasswords.txt", StrUtil.Utf8);
             strData += " ";
             CharStream cs = new CharStream(strData);

             List<string> vPasswords = new List<string>();
             StringBuilder sbPassword = new StringBuilder();
             while (true)
             {
            char ch = cs.ReadChar();
            if (ch == char.MinValue) break;

            if (char.IsWhiteSpace(ch))
            {
               string strPassword = sbPassword.ToString();
               strPassword = strPassword.ToLower();

               if (strPassword.Length > 3)
               {
                  if (vPasswords.IndexOf(strPassword) < 0)
                     vPasswords.Add(strPassword);
               }

               sbPassword = new StringBuilder();
            }
            else
            {
               Debug.Assert(!char.IsControl(ch) && !char.IsHighSurrogate(ch) &&
                            !char.IsLowSurrogate(ch) && !char.IsSurrogate(ch));
               Debug.Assert(IsPopularChar(ch));
               sbPassword.Append(ch);
            }
             }

             ulong[] vTable = new ulong[PpcTableSize / 64];
             Array.Clear(vTable, 0, vTable.Length);

             long lBitsInTable = 0;
             foreach (string strPassword in vPasswords)
             {
            byte[] pbUtf8 = StrUtil.Utf8.GetBytes(strPassword);
            int[] vIndices = GetTableIndices(pbUtf8, PpcTableSize);

            foreach (int i in vIndices)
            {
               if (SetTableBit(vTable, i)) ++lBitsInTable;
            }
             }

             StringBuilder sb = new StringBuilder();
             sb.Append("\t\t\t");
             for (int i = 0; i < vTable.Length; ++i)
             {
            if (i > 0)
            {
               if ((i % 3) == 0)
               {
                  sb.AppendLine(",");
                  sb.Append("\t\t\t");
               }
               else sb.Append(", ");
            }

            sb.Append("0x");
            sb.Append(vTable[i].ToString("X16"));
            sb.Append("UL");
             }

             sb.AppendLine();
             sb.AppendLine();
             sb.AppendLine("Bits set: " + lBitsInTable.ToString() + " of " +
                       PpcTableSize.ToString());
             int cHashFn = GetTableIndices(StrUtil.Utf8.GetBytes("Dummy"), PpcTableSize).Length;
             sb.AppendLine("Hash functions: " + cHashFn.ToString());
             double dblPhi = Math.Pow(1.0 - ((double) cHashFn / PpcTableSize),
                                  (double) vPasswords.Count);
             sb.AppendLine("Phi (bits unset ratio) estimation: " +
                       dblPhi.ToString(CultureInfo.InvariantCulture));
             dblPhi = ((double) (PpcTableSize - lBitsInTable) / (double) PpcTableSize);
             sb.AppendLine("Exact Phi: " + dblPhi.ToString(CultureInfo.InvariantCulture));
             sb.AppendLine("False positives ratio: " + Math.Pow(1.0 - dblPhi,
                                                            (double) cHashFn).ToString(CultureInfo.InvariantCulture));

             File.WriteAllText("Table.txt", sb.ToString());
        }
开发者ID:enecciari,项目名称:mackeepass,代码行数:86,代码来源:PopularPasswords.cs


示例9: JsonNumber

        public JsonNumber(CharStream csDataSource)
        {
            if(csDataSource == null) throw new ArgumentNullException("csDataSource");

            StringBuilder sb = new StringBuilder();
            while(true)
            {
                char ch = csDataSource.PeekChar(true);

                if(((ch >= '0') && (ch <= '9')) || (ch == 'e') || (ch == 'E') ||
                    (ch == '+') || (ch == '-') || (ch == '.'))
                {
                    csDataSource.ReadChar(true);
                    sb.Append(ch);
                }
                else break;
            }

            const NumberStyles ns = (NumberStyles.Integer | NumberStyles.AllowDecimalPoint |
                NumberStyles.AllowThousands | NumberStyles.AllowExponent);
            if(!double.TryParse(sb.ToString(), ns, NumberFormatInfo.InvariantInfo,
                out m_value)) { Debug.Assert(false); }
        }
开发者ID:Stoom,项目名称:KeePass,代码行数:23,代码来源:Json.cs


示例10: CsvStreamReader

 public CsvStreamReader(string strData, bool bAllowUnquoted)
 {
     m_sChars = new CharStream(strData);
     m_bAllowUnquoted = bAllowUnquoted;
 }
开发者ID:saadware,项目名称:kpn,代码行数:5,代码来源:CsvStreamReader.cs


示例11: Parse

        private static List<SiEvent> Parse(string strSequence)
        {
            CharStream cs = new CharStream(strSequence);
            List<SiEvent> l = new List<SiEvent>();
            string strError = KPRes.AutoTypeSequenceInvalid;

            Keys kCurKbMods = Keys.None;

            List<Keys> lMods = new List<Keys>();
            lMods.Add(Keys.None);

            while(true)
            {
                char ch = cs.ReadChar();
                if(ch == char.MinValue) break;

                if((ch == '+') || (ch == '^') || (ch == '%'))
                {
                    if(lMods.Count == 0) { Debug.Assert(false); break; }
                    else if(ch == '+') lMods[lMods.Count - 1] |= Keys.Shift;
                    else if(ch == '^') lMods[lMods.Count - 1] |= Keys.Control;
                    else if(ch == '%') lMods[lMods.Count - 1] |= Keys.Alt;
                    else { Debug.Assert(false); }

                    continue;
                }
                else if(ch == '(')
                {
                    lMods.Add(Keys.None);
                    continue;
                }
                else if(ch == ')')
                {
                    if(lMods.Count >= 2)
                    {
                        lMods.RemoveAt(lMods.Count - 1);
                        lMods[lMods.Count - 1] = Keys.None;
                    }
                    else throw new FormatException(strError);

                    continue;
                }

                Keys kEffMods = Keys.None;
                foreach(Keys k in lMods) kEffMods |= k;

                EnsureKeyModifiers(kEffMods, ref kCurKbMods, l);

                if(ch == '{')
                {
                    List<SiEvent> lSub = ParseSpecial(cs);
                    if(lSub == null) throw new FormatException(strError);

                    l.AddRange(lSub);
                }
                else if(ch == '}')
                    throw new FormatException(strError);
                else if(ch == '~')
                {
                    SiEvent si = new SiEvent();
                    si.Type = SiEventType.Key;
                    si.VKey = (int)Keys.Enter;

                    l.Add(si);
                }
                else
                {
                    SiEvent si = new SiEvent();
                    si.Type = SiEventType.Char;
                    si.Char = ch;

                    l.Add(si);
                }

                lMods[lMods.Count - 1] = Keys.None;
            }

            EnsureKeyModifiers(Keys.None, ref kCurKbMods, l);

            return l;
        }
开发者ID:rdealexb,项目名称:keepass,代码行数:81,代码来源:SendInputEx.cs


示例12: JsonNumber

		public JsonNumber(CharStream csDataSource)
		{
			if(csDataSource == null) throw new ArgumentNullException("csDataSource");

			StringBuilder sb = new StringBuilder();
			while(true)
			{
				char ch = csDataSource.PeekChar(true);

				if(((ch >= '0') && (ch <= '9')) || (ch == 'e') || (ch == 'E') ||
					(ch == '+') || (ch == '-') || (ch == '.'))
				{
					csDataSource.ReadChar(true);
					sb.Append(ch);
				}
				else break;
			}

			if(!double.TryParse(sb.ToString(), out m_value)) { Debug.Assert(false); }
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:20,代码来源:Json.cs


示例13: SplitKeySequence

        private static List<string> SplitKeySequence(string strKeys)
        {
            List<string> vParts = new List<string>();
            if(string.IsNullOrEmpty(strKeys)) return vParts;

            CharStream cs = new CharStream(strKeys);
            StringBuilder sbRawText = new StringBuilder();

            while(true)
            {
                char ch = cs.ReadChar();
                if(ch == char.MinValue) break;

                switch(ch)
                {
                    case ')':
                    case '}':
                        throw new FormatException();

                    case '(':
                    case '{':
                    case '+':
                    case '^':
                    case '%':
                    case ' ':
                    case '\t':
                        string strBuf = sbRawText.ToString();
                        if(strBuf.IndexOfAny(new char[]{ '+', '^', '%',
                            ' ', '\t' }) < 0)
                        {
                            if(strBuf.Length > 0) vParts.Add(strBuf);
                            sbRawText.Remove(0, sbRawText.Length);
                        }

                        if(ch == '(')
                        {
                            ReadParenthesized(cs, sbRawText);
                            if(sbRawText.Length > 0)
                                vParts.Add(sbRawText.ToString());
                            sbRawText.Remove(0, sbRawText.Length);
                        }
                        else if(ch == '{')
                        {
                            ReadBraced(cs, sbRawText);
                            if(sbRawText.Length > 0)
                                vParts.Add(sbRawText.ToString());
                            sbRawText.Remove(0, sbRawText.Length);
                        }
                        else if(ch == ' ')
                        {
                            vParts.Add(" ");
                            sbRawText.Remove(0, sbRawText.Length);
                        }
                        else if(ch == '\t')
                        {
                            vParts.Add("\t");
                            sbRawText.Remove(0, sbRawText.Length);
                        }
                        else sbRawText.Append(ch);
                        break;

                    default:
                        sbRawText.Append(ch);
                        break;
                }
            }

            if(sbRawText.Length > 0) vParts.Add(sbRawText.ToString());
            return vParts;
        }
开发者ID:elitak,项目名称:keepass,代码行数:70,代码来源:SendInputEx.cs


示例14: Generate

		public static PwgError Generate(ProtectedString psOutBuffer,
			PwProfile pwProfile, CryptoRandomStream crsRandomSource)
		{
			LinkedList<char> vGenerated = new LinkedList<char>();
			PwCharSet pcsCurrent = new PwCharSet();
			PwCharSet pcsCustom = new PwCharSet();
			PwCharSet pcsUsed = new PwCharSet();
			bool bInCharSetDef = false;

			string strPattern = ExpandPattern(pwProfile.Pattern);
			if(strPattern.Length == 0) return PwgError.Success;

			CharStream csStream = new CharStream(strPattern);
			char ch = csStream.ReadChar();

			while(ch != char.MinValue)
			{
				pcsCurrent.Clear();

				bool bGenerateChar = false;

				if(ch == '\\')
				{
					ch = csStream.ReadChar();
					if(ch == char.MinValue) // Backslash at the end
					{
						vGenerated.AddLast('\\');
						break;
					}

					if(bInCharSetDef) pcsCustom.Add(ch);
					else
					{
						vGenerated.AddLast(ch);
						pcsUsed.Add(ch);
					}
				}
				else if(ch == '[')
				{
					pcsCustom.Clear();
					bInCharSetDef = true;
				}
				else if(ch == ']')
				{
					pcsCurrent.Add(pcsCustom.ToString());

					bInCharSetDef = false;
					bGenerateChar = true;
				}
				else if(bInCharSetDef)
				{
					if(pcsCustom.AddCharSet(ch) == false)
						pcsCustom.Add(ch);
				}
				else if(pcsCurrent.AddCharSet(ch) == false)
				{
					vGenerated.AddLast(ch);
					pcsUsed.Add(ch);
				}
				else bGenerateChar = true;

				if(bGenerateChar)
				{
					PwGenerator.PrepareCharSet(pcsCurrent, pwProfile);

					if(pwProfile.NoRepeatingCharacters)
						pcsCurrent.Remove(pcsUsed.ToString());

					char chGen = PwGenerator.GenerateCharacter(pwProfile,
						pcsCurrent, crsRandomSource);

					if(chGen == char.MinValue) return PwgError.TooFewCharacters;

					vGenerated.AddLast(chGen);
					pcsUsed.Add(chGen);
				}

				ch = csStream.ReadChar();
			}

			if(vGenerated.Count == 0) return PwgError.Success;

			char[] vArray = new char[vGenerated.Count];
			vGenerated.CopyTo(vArray, 0);

			if(pwProfile.PatternPermutePassword)
				PwGenerator.ShufflePassword(vArray, crsRandomSource);

			byte[] pbUtf8 = Encoding.UTF8.GetBytes(vArray);
			psOutBuffer.SetString(Encoding.UTF8.GetString(pbUtf8, 0, pbUtf8.Length));
			Array.Clear(pbUtf8, 0, pbUtf8.Length);
			Array.Clear(vArray, 0, vArray.Length);
			vGenerated.Clear();

			return PwgError.Success;
		}
开发者ID:olivierdagenais,项目名称:testoriented,代码行数:96,代码来源:PatternBasedGenerator.cs


示例15: ReadParenthesized

        private static void ReadParenthesized(CharStream csIn, StringBuilder sbBuffer)
        {
            sbBuffer.Append('(');

            while(true)
            {
                char ch = csIn.ReadChar();

                if((ch == char.MinValue) || (ch == '}'))
                    throw new FormatException();
                else if(ch == ')')
                {
                    sbBuffer.Append(ch);
                    break;
                }
                else if(ch == '(')
                    ReadParenthesized(csIn, sbBuffer);
                else if(ch == '{')
                    ReadBraced(csIn, sbBuffer);
                else sbBuffer.Append(ch);
            }
        }
开发者ID:elitak,项目名称:keepass,代码行数:22,代码来源:SendInputEx.cs


示例16: ReadBraced

        private static void ReadBraced(CharStream csIn, StringBuilder sbBuffer)
        {
            sbBuffer.Append('{');

            char chFirst = csIn.ReadChar();
            if(chFirst == char.MinValue)
                throw new FormatException();

            char chSecond = csIn.ReadChar();
            if(chSecond == char.MinValue)
                throw new FormatException();

            if((chFirst == '{') && (chSecond == '}'))
            {
                sbBuffer.Append(@"{}");
                return;
            }
            else if((chFirst == '}') && (chSecond == '}'))
            {
                sbBuffer.Append(@"}}");
                return;
            }
            else if(chSecond == '}')
            {
                sbBuffer.Append(chFirst);
                sbBuffer.Append(chSecond);
                return;
            }

            sbBuffer.Append(chFirst);
            sbBuffer.Append(chSecond);

            while(true)
            {
                char ch = csIn.ReadChar();

                if((ch == char.MinValue) || (ch == ')'))
                    throw new FormatException();
                else if(ch == '(')
                    ReadParenthesized(csIn, sbBuffer);
                else if(ch == '{')
                    ReadBraced(csIn, sbBuffer);
                else if(ch == '}')
                {
                    sbBuffer.Append(ch);
                    break;
                }
                else sbBuffer.Append(ch);
            }
        }
开发者ID:elitak,项目名称:keepass,代码行数:50,代码来源:SendInputEx.cs


示例17: ParseSpecial

        private static List<SiEvent> ParseSpecial(CharStream cs)
        {
            // Skip leading white space
            while(true)
            {
                char ch = cs.PeekChar();
                if(ch == char.MinValue) { Debug.Assert(false); return null; }

                if(!char.IsWhiteSpace(ch)) break;
                cs.ReadChar();
            }

            // First char is *always* part of the name (support for "{{}", etc.)
            char chFirst = cs.ReadChar();
            if(chFirst == char.MinValue) { Debug.Assert(false); return null; }

            int iPart = 0;
            StringBuilder sbName = new StringBuilder(), sbParams =
                new StringBuilder();
            sbName.Append(chFirst);

            while(true)
            {
                char ch = cs.ReadChar();
                if(ch == char.MinValue) { Debug.Assert(false); return null; }
                if(ch == '}') break;

                if(iPart == 0)
                {
                    if(char.IsWhiteSpace(ch)) ++iPart;
                    else sbName.Append(ch);
                }
                else sbParams.Append(ch);
            }

            string strName = sbName.ToString();
            string strParams = sbParams.ToString().Trim();

            uint? ouParam = null;
            if(strParams.Length > 0)
            {
                uint uParamTry;
                if(uint.TryParse(strParams, out uParamTry)) ouParam = uParamTry;
            }

            List<SiEvent> l = new List<SiEvent>();

            if(strName.Equals("DELAY", StrUtil.CaseIgnoreCmp))
            {
                if(!ouParam.HasValue) { Debug.Assert(false); return null; }

                SiEvent si = new SiEvent();
                si.Type = SiEventType.Delay;
                si.Delay = ouParam.Value;

                l.Add(si);
                return l;
            }
            if(strName.StartsWith("DELAY=", StrUtil.CaseIgnoreCmp))
            {
                SiEvent si = new SiEvent();
                si.Type = SiEventType.SetDefaultDelay;

                string strDelay = strName.Substring(6).Trim();
                uint uDelay;
                if(uint.TryParse(strDelay, out uDelay))
                    si.Delay = uDelay;
                else { Debug.Assert(false); return null; }

                l.Add(si);
                return l;
            }
            if(strName.Equals("VKEY", StrUtil.CaseIgnoreCmp) ||
                strName.Equals("VKEY-NX", StrUtil.CaseIgnoreCmp) ||
                strName.Equals("VKEY-EX", StrUtil.CaseIgnoreCmp))
            {
                if(!ouParam.HasValue) { Debug.Assert(false); return null; }

                SiEvent si = new SiEvent();
                si.Type = SiEventType.Key;
                si.VKey = (int)ouParam.Value;

                if(strName.EndsWith("-NX", StrUtil.CaseIgnoreCmp))
                    si.ExtendedKey = false;
                else if(strName.EndsWith("-EX", StrUtil.CaseIgnoreCmp))
                    si.ExtendedKey = true;

                l.Add(si);
                return l;
            }
            if(strName.Equals("APPACTIVATE", StrUtil.CaseIgnoreCmp))
            {
                SiEvent si = new SiEvent();
                si.Type = SiEventType.AppActivate;
                si.Text = strParams;

                l.Add(si);
                return l;
            }

//.........这里部分代码省略.........
开发者ID:rdealexb,项目名称:keepass,代码行数:101,代码来源:SendInputEx.cs


示例18: JsonValue

		public JsonValue(CharStream csDataSource)
		{
			if(csDataSource == null) throw new ArgumentNullException("csDataSource");

			char chNext = csDataSource.PeekChar(true);

			if(chNext == '\"') m_value = (new JsonString(csDataSource)).Value;
			else if(chNext == '{') m_value = new JsonObject(csDataSource);
			else if(chNext == '[') m_value = new JsonArray(csDataSource);
			else if(chNext == 't')
			{
				for(int i = 0; i < 4; ++i) csDataSource.ReadChar(true);
				m_value = true;
			}
			else if(chNext == 'f')
			{
				for(int i = 0; i < 5; ++i) csDataSource.ReadChar(true);
				m_value = false;
			}
			else if(chNext == 'n')
			{
				for(int i = 0; i < 4; ++i) csDataSource.ReadChar(true);
				m_value = null;
			}
			else m_value = new JsonNumber(csDataSource);
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:26,代码来源:Json.cs


示例19: ReadCsvField

        private static string ReadCsvField(CharStream cs)
        {
            StringBuilder sbValue = new StringBuilder();
            char ch;

            while(true)
            {
                ch = cs.ReadChar();
                if(ch == char.MinValue) return null;
                else if(ch == '\"') break;
            }

            while(true)
            {
                ch = cs.ReadChar();

                if(ch == char.MinValue)
                    return null;
                else if(ch == '\r')
                    continue;
                else if(ch == '\"')
                {
                    char chSucc = cs.ReadChar();

                    if(chSucc == '\"') sbValue.Append('\"');
                    else break;
                }
                else if(ch == '\n')
                    sbValue.Append(MessageService.NewLine);
                else sbValue.Append(ch);
            }

            return sbValue.ToString();
        }
开发者ID:eis,项目名称:keepass-eis-flavored,代码行数:34,代码来源:Whisper32Csv116.cs


示例20: JsonString

		public JsonString(CharStream csDataSource)
		{
			if(csDataSource == null) throw new ArgumentNullException("csDataSource");

			char chInit = csDataSource.ReadChar(true);
			if(chInit != '\"') throw new JsonFormatException();

			StringBuilder sb = new StringBuilder();

			while(true)
			{
				char ch = csDataSource.ReadChar();
				if(ch == char.MinValue) throw new JsonFormatException();

				if(ch == '\"') break; // End of string
				else if(ch == '\\')
				{
					char chNext = csDataSource.ReadChar();
					if(chNext == char.MinValue) throw new JsonFormatException();

					if((chNext == 'b') || (chNext == 'f')) { } // Ignore
					else if(chNext == 'r') sb.Append('\r');
					else if(chNext == 'n') sb.Append('\n');
					else if(chNext == 't') sb.Append('\t');
					else if(chNext == 'u')
					{
						char ch1 = csDataSource.ReadChar();
						char ch2 = csDataSource.ReadChar();
						char ch3 = csDataSource.ReadChar();
						char ch4 = csDataSource.ReadChar();
						if(ch4 == char.MinValue) throw new JsonFormatException();

						byte[] pbUni = MemUtil.HexStringToByteArray(new string(
							new char[] { ch1, ch2, ch3, ch4 }));
						if((pbUni != null) && (pbUni.Length == 2))
							sb.Append((char)(((ushort)pbUni[0] << 8) | (ushort)pbUni[1]));
						else throw new JsonFormatException();
					}
					else sb.Append(chNext);
				}
				else sb.Append(ch);
			}

			m_str = sb.ToString();
		}
开发者ID:ComradeP,项目名称:KeePass-2.x,代码行数:45,代码来源:Json.cs



注:本文中的KeePassLib.Utility.CharStream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.KeenClient类代码示例发布时间:2022-05-26
下一篇:
C# Security.ProtectedString类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap