Guest User

Savermethod

a guest
Oct 18th, 2011
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using Yaml;
  4. using System.IO;
  5. using System.Text;
  6. using System;
  7.  
  8. public class SaverClass {
  9.  
  10.    
  11.  
  12.     public static void SaveString(string fileName, string name, string value)
  13.     {
  14.  
  15.         {
  16.             string path = @"c:\tmp\"+fileName+".yml";
  17.  
  18.            
  19.             {
  20.  
  21.                 // Delete the file if it exists.
  22.                 if (!File.Exists(path))
  23.                 {                
  24.                     // Create the file.
  25.                     using (FileStream fs = File.Create(path)) { }
  26.  
  27.                 }
  28.  
  29.                 Sequence sequence = new Sequence(
  30.  
  31.       new Node[]
  32.     {
  33.         new Yaml.String (name
  34. ),
  35.         new Mapping (
  36.             new MappingNode []
  37.             {
  38.                 new MappingNode (new Yaml.String (name), new Yaml.String (value))
  39.    
  40. ,
  41.  
  42.             } ),
  43.  
  44.     });
  45.                
  46.                     sequence.ToFile(path);
  47.             }
  48.        
  49.  
  50.            
  51.  
  52.  
  53.         }
  54.     }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment