EntryPoint.cs :  » Bloggers » dasBlog » DasBlog » Import » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » dasBlog 
dasBlog » DasBlog » Import » EntryPoint.cs
using System;
using RJH.CommandLineHelper;

namespace DasBlog.Import{
  /// <summary>
  /// Summary description for EntryPoint.
  /// </summary>
  public class EntryPoint
  {
  
    public static CommandLine CommandLine
    {
      [System.Diagnostics.DebuggerStepThrough()]
      get 
      { 
        return m_CommandLine; 
      }  
      [System.Diagnostics.DebuggerStepThrough()]
      set
      { 
        m_CommandLine = value; 
      }  
    } 
    private static CommandLine m_CommandLine;

    /// <summary>
    /// This is the entry point into the DLL.  It parses the command line and
    /// delegates the work out to each program.
    /// </summary>
    /// <param name="commandLine">The commandline that invoked the program.  Usually
    /// this corresponds to System.Environment.CommandLine</param>
    /// <returns></returns>
    public static void DllMain(string commandLine)
    {
      CommandLine = new CommandLine();
      Parser parser = new Parser(commandLine, CommandLine);      
      parser.Parse();

      if(CommandLine.Help)
      {
        Console.WriteLine("This program is used to import blog data from other blogging programs.");
        Console.WriteLine("  Note that this program will modify your content directory so back it up.");
        Console.WriteLine("  Also, the program will require an internet connection in some instances, ");
        Console.WriteLine("  like importing comments from an external server.");
        Console.WriteLine( parser.GetHelpText() );
      }
      else
      {
        switch(CommandLine.Source)
        {
          case BlogSourceType.Radio:
            if(CommandLine.SourceDirectory !=  null && CommandLine.SourceDirectory.Length > 0
              && CommandLine.ContentDirectory != null && CommandLine.ContentDirectory.Length > 0)
            {
              Console.WriteLine("Importing entries from Radio...");
              DasBlog.Import.Radio.EntryImporter.Import(
                CommandLine.SourceDirectory,
                CommandLine.ContentDirectory);
            }
            else
            {
              Console.WriteLine("Entries from Radio not imported because either source directory or content directory were not specified.");
            }
            
            if(CommandLine.UserID != null && CommandLine.UserID.Length > 0 
              && CommandLine.ContentDirectory != null && CommandLine.ContentDirectory.Length > 0)

            {
              if(CommandLine.CommentServer != null && CommandLine.CommentServer.Length > 0)
              {
                Console.WriteLine("Defaulting to comment server {0}.  You may need to check your radio source.  radiocomments2, etc",DasBlog.Import.Radio.CommentImporter.DefaultCommentServer);
              }

              Console.WriteLine("BETA: Importing comments from Radio...");
              DasBlog.Import.Radio.CommentImporter.Import(
                CommandLine.UserID, CommandLine.ContentDirectory, CommandLine.CommentServer );
            }
            else
            {
              Console.WriteLine("Comments from Radio not imported because comment server, userid or content directory were not specified.");
            }


            break;
          case BlogSourceType.none:
            goto default;
          default:
            throw new ApplicationException(
              string.Format("The source option was not specified or else was invalid."));
        }
      }
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.