Exemplo n.º 1
0
 public abstract string CaptureText( string account, OnlineCredentials credentials );
Exemplo n.º 2
0
        /// <summary>
        /// Gets credentials for an online reader.
        /// </summary>
        /// <param name="readerName"></param>
        /// <returns></returns>
        public OnlineCredentials GetCredentials( string readerName )
        {
            if( xmlCredentials == null )
            {
                xmlCredentials = new XmlDocument();
                xmlCredentials.Load( Path.Combine( ConfigurationManager.AppSettings["DataDir"], "Credentials.xml" ) );
            }

            OnlineCredentials credentials = new OnlineCredentials();

            foreach( XmlNode node in xmlCredentials.SelectNodes( "/Credentials/Reader" ) )
            {
                if( node.Attributes["Name"].Value.ToLower() == readerName.ToLower() )
                {
                    bool encrypted = false;
                    if( node.Attributes["Encrypted"] != null )
                        encrypted = Convert.ToBoolean( node.Attributes["Encrypted"].Value );

                    // Found matching Reader node
                    foreach( XmlNode childNode in node.ChildNodes )
                    {
                        if( childNode.Name.ToLower() == "add" )
                        {
                            credentials.Add( childNode.Attributes["key"].Value, childNode.Attributes["value"].Value );
                        }
                    }
                }
            }

            return credentials;
        }