Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 22nd, 2012  |  syntax: None  |  size: 1.06 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to write a string in a resource file?
  2. StreamReader reader = new StreamReader(Auctions_Parser.Properties.Resources.Settings);
  3.                 string content = reader.ReadToEnd();
  4.                 reader.Close();
  5.                 string ebay = "";
  6.  
  7.                 if (checkBox1.Checked){ ebay = "1"; } else { ebay = "0"; }
  8.                 content = Regex.Replace(content, @"Ebay&d", "Ebay&"+ebay);
  9.                 StreamWriter writer = new StreamWriter(Auctions_Parser.Properties.Resources.Settings);
  10.                 writer.Write(content);
  11.                 writer.Close();
  12.        
  13. SaveFolder&C:/Desktop/
  14. Ebay&1
  15. Delcampe&1
  16. BidStart&1
  17. eBid&1
  18. Proxy&0
  19. OpenFolder&0
  20. TurnOff&0
  21.        
  22. using System.Resources;
  23.  
  24.   // Creates a resource writer.
  25.   IResourceWriter writer = new ResourceWriter("myResources.resources");
  26.  
  27.   // Adds resources to the resource writer.
  28.   writer.AddResource("String 1", "First String");
  29.  
  30.   writer.AddResource("String 2", "Second String");
  31.  
  32.   writer.AddResource("String 3", "Third String");
  33.  
  34.   // Writes the resources to the file or stream, and closes it.
  35.   writer.Close();