• /r/csharp
  • Having trouble getting LogonUser to work on my campus network

    In my application, I'm simply trying to get a user to re-authenticate before using it. I have this working fine on my personal computer, but when I use a system on campus, I'm getting authentication failures. Here is the function I'm using: http://ift.tt/1LE1epx The function inputs I'm using are: UserName: MAINLOCAL\\username PWD: myPassword Domain: main.local.universityName.edu […]

  • /r/csharp
  • RedditSharp, very slow at grabbing posts?

    So, I seen something about RedditSharp and decided to give it a little whirl and tinker around with it. One thing I am noticing is that it takes an abnormal time to grab posts from a subreddit. HotPostCollection = Subreddit.Hot.Take(20); foreach(RedditSharp.Things.Post p in Maincontrol.HotPostCollection){ ListViewItem item = new ListViewItem(p.Title); HotPostsView.Items.Add(item); } Now, even when I […]

  • /r/csharp
  • [Question] Using ReplaceChild

    Hello, I was wondering if someone knows how to properly use ReplaceChild and point out how I'm using it wrong. private void SaveFile() { XmlDocument doc=new XmlDocument(); doc.Load("C:\\Test.xml"); XmlNode Vehicles=doc.SelectSingleNode("//Vehicles"); XmlNode oldData=doc.SelectSingleNode("//Bus01"); XmlElement Admin=doc.CreateElement("Bus01"); XmlElement Serial=doc.CreateElement("Serial"); if(oldData!=null) { Vehicles.ReplaceChild(Admin,oldData); } else { Admin.AppendChild(Serial); Vehicles.AppendChild(Admin); } doc.Save("C:\\Test.xml"); } If the Test.xml doesn't exist, it adds an […]

  • /r/csharp
  • Deserializing JSON

    I have a string array with multiple JSON and the only way to make it work looks to be like this: public void method(string [] data) { foreach(var item in data) { var theData = JsonConvert.DeserializeObject<List<SampleObject>>(item); } } The problem with this is that each time I do this the list loses the previous data […]