Advertisement
Guest User

Untitled

a guest
Jan 29th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1.                 // This STARTS the thread that eventually throws the exception...
  2.                 if (Thread_Object != null)
  3.                 {
  4.                     Thread_Object.Stop(250);
  5.                 }
  6.                 Thread_Object = new ObjectDataCollection.ObjectThread();
  7.                 Thread_Object.Start();
  8.  
  9. // Here is the ObjectThread (LoopThread is called on the above .Start()):
  10.  
  11.             public override void LoopThread()
  12.             {
  13.                 try
  14.                 {
  15.                     LoadData();
  16.  
  17.                     Random random = new Random();
  18.  
  19.                     while (true)
  20.                     {
  21.                         Console.WriteLine("THIS PRINTS!");
  22.                     }
  23.                 }
  24.             }
  25.  
  26.             private void LoadData()
  27.             {
  28.                 try
  29.                 {
  30.                     String Path = DataPath;
  31.  
  32.                     if (Path == null || Path.Length == 0)
  33.                     {
  34.                         return;
  35.                     }
  36.  
  37.                     // nothing to load!
  38.                     if (!File.Exists(Path))
  39.                     {
  40.                         return;
  41.                     }
  42.  
  43.                     FileInfo f2 = new FileInfo(Path);
  44.                     if (f2.Length == 0)
  45.                     {
  46.                         return;
  47.                     }
  48.  
  49.                     // the below line dies w/an exception, no idea why
  50.                     DataStore = MyWoW.Classes.XmlSerializer.Deserialize<ObjectData>(Path);
  51.                     Console.WriteLine("Loaded data for {0} objects!", DataStore.Data.Count);
  52.                 }
  53.                 catch
  54.                 {
  55.  
  56.                 }
  57.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement