This project is read-only.

Twitter Plugin

Oct 24, 2010 at 4:01 PM

Hi,

One thing I noticed is that the Twitter oAuth information has the consumerkey and consumersecret coded in to the plug-in source itself.  The token, tokensecret and pin all are pulled from the app.config.  Is there a particular reason why the consumerkey and consumersecret are hardcoded in to the source code?

Thanks!

--Sayron

Developer
Dec 17, 2010 at 2:30 AM

Here is a sample

 

            try
{
// parse the xml based reading
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(readingData);

XmlNode xNode = xDoc.SelectSingleNode("/msg/time");
TimeStamp = System.Xml.XmlConvert.ToDateTime(xNode.InnerText);
xNode = xDoc.SelectSingleNode("/msg/tmpr");
if (null == xNode)
{
// try the tmprF element instead
xNode = xDoc.SelectSingleNode("/msg/tmprF");
}
Temperature = System.Xml.XmlConvert.ToSingle(xNode.InnerText);
xNode = xDoc.SelectSingleNode("/msg/ch1/watts");
if ((null != xNode) && (string.Empty != xNode.InnerText))
{
Energy = System.Xml.XmlConvert.ToInt32(xNode.InnerText);
}

xNode = xDoc.SelectSingleNode("/msg/ch2/watts");
if ((null != xNode) && (string.Empty != xNode.InnerText))
{
Energy += System.Xml.XmlConvert.ToInt32(xNode.InnerText);
}

xNode = xDoc.SelectSingleNode("/msg/ch3/watts");
if ((null != xNode) && (string.Empty != xNode.InnerText))
{
Energy += System.Xml.XmlConvert.ToInt32(xNode.InnerText);
}

IsValid = true;
}
catch (Exception ex)
{
// invalid reading
Debug.WriteLine("Error parsing xml data to create EnergyReading: " + ex.Message);
}
}