// Copyright 2005 by Omar Al Zabir. All rights are reserved.
//
// If you like this code then feel free to go ahead and use it.
// The only thing I ask is that you don't remove or alter my copyright notice.
//
// Your use of this software is entirely at your own risk. I make no claims or
// warrantees about the reliability or fitness of this code for any particular purpose.
// If you make changes or additions to this code please mark your code as being yours.
//
// website http://www.oazabir.com, email OmarAlZabir@gmail.com, msn oazabir@hotmail.com
using System;
using System.Xml;
using System.IO;
using System.Windows.Forms;
using Microsoft.Practices.EnterpriseLibrary.Logging;
namespace RSSFeeder.Helpers{
using RSSCommon;
/// <summary>
/// Helper class for dealing newsgator settings
/// </summary>
public class NewsgatorHelper
{
private static string GetNewsgatorPath()
{
string applicationDataPath = Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData );
string newsGatorPath = Path.Combine( applicationDataPath, "RAI\\Newsgator" );
return newsGatorPath;
}
private static string GetNewsgatorOpmlPath( string newsGatorPath )
{
return Path.Combine( newsGatorPath, "NewsGatorSubs.opml" );
}
public static bool IsNewsgatorAround()
{
string newsGatorPath = GetNewsgatorPath();
if( Directory.Exists( newsGatorPath ) )
{
string opmlFile = GetNewsgatorOpmlPath( newsGatorPath );
if( File.Exists( opmlFile ) )
return true;
else
return false;
}
else
{
return false;
}
}
/// <summary>
/// Import channels from newsgator OPML file
/// </summary>
public static void ImportNewsgator()
{
string newsGatorPath = GetNewsgatorPath();
string newsGatorOpmlPath = GetNewsgatorOpmlPath( newsGatorPath );
OPMLHelper.ImportOPML( newsGatorOpmlPath );
}
}
}
|