Exemple #1
0
		public void Save (System.Collections.Generic.List<Hanselman.Portable.Tweet> tweets)
		{

			var FileManager = new Foundation.NSFileManager ();
      var appGroupContainer = FileManager.GetContainerUrl("group.com.refractored.hanselman");
      if(appGroupContainer == null)
      {
        Console.WriteLine("You must go into apple developer console and create a new app group");
     
        return;
      }
			var path = System.IO.Path.Combine(appGroupContainer.Path, "tweets.xml");
			Console.WriteLine ("agcpath: " + path);


      var json = JsonConvert.SerializeObject(tweets);

      File.WriteAllText(path, json);


			/*var serializer = new XmlSerializer(typeof(List<Tweet>));
			using (var stream = File.Open(path, FileMode.CreateNew, FileAccess.ReadWrite))
			{
				serializer.Serialize(stream, tweets);
			}*/
		}
Exemple #2
0
        public void Save(System.Collections.Generic.List <Hanselman.Portable.Tweet> tweets)
        {
            var FileManager       = new Foundation.NSFileManager();
            var appGroupContainer = FileManager.GetContainerUrl("group.com.refractored.hanselman");

            if (appGroupContainer == null)
            {
                Console.WriteLine("You must go into apple developer console and create a new app group");

                return;
            }
            var path = System.IO.Path.Combine(appGroupContainer.Path, "tweets.xml");

            Console.WriteLine("agcpath: " + path);


            var json = JsonConvert.SerializeObject(tweets);

            File.WriteAllText(path, json);


            /*var serializer = new XmlSerializer(typeof(List<Tweet>));
             * using (var stream = File.Open(path, FileMode.CreateNew, FileAccess.ReadWrite))
             * {
             *      serializer.Serialize(stream, tweets);
             * }*/
        }
		static string GetJSONPath (string outputFile)
		{
			var path = string.Empty;
			var FileManager = new Foundation.NSFileManager ();
			var appGroupContainer = FileManager.GetContainerUrl ("group.com.xamarin.kinderchat.security");
			if (appGroupContainer == null) {
				Console.WriteLine ("You must create the app group: \"group.com.xamarin.kinderchat.security\" in order to run the project.");
			} else {
				path = Path.Combine (appGroupContainer.Path, outputFile);
			}
			//Console.WriteLine ("Json file path: {0}", path);
			return path;
		}
Exemple #4
0
        static string GetJSONPath(string outputFile)
        {
            var path              = string.Empty;
            var FileManager       = new Foundation.NSFileManager();
            var appGroupContainer = FileManager.GetContainerUrl("group.com.xamarin.kinderchat.security");

            if (appGroupContainer == null)
            {
                Console.WriteLine("You must create the app group: \"group.com.xamarin.kinderchat.security\" in order to run the project.");
            }
            else
            {
                path = Path.Combine(appGroupContainer.Path, outputFile);
            }
            //Console.WriteLine ("Json file path: {0}", path);
            return(path);
        }