Пример #1
0
        public static void Main(string[] args)
        {
            Console.WindowWidth  = 120;
            Console.WindowHeight = 50;
            printLogo();
            Console.Title = "Wolpertinger Manager";
            Console.WriteLine();
            ConsoleHelper.WriteLine(ConsoleColor.Cyan, " Wolpertinger Manager {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            ConsoleHelper.WriteLine(ConsoleColor.Cyan, " Wolpertinger.Core    {0}", Assembly.GetAssembly(typeof(DefaultConnectionManager)).GetName().Version.ToString());
            Console.WriteLine();

            //Set up XmlSerializer
            XmlSerializer.RegisterType(typeof(ClientInfo), "clientInfo");
            XmlSerializer.RegisterType(typeof(DirectoryObject), "directoryObject");
            XmlSerializer.RegisterType(typeof(FileObject), "fileObject");
            XmlSerializer.RegisterType(typeof(Permission), "permission");
            XmlSerializer.RegisterType(typeof(MountInfo), "mountInfo");
            XmlSerializer.RegisterType(typeof(SnapshotInfo), "snapshotInfo");
            XmlSerializer.RegisterType(typeof(RemoteMethodCall), "remoteMethodCall");
            XmlSerializer.RegisterType(typeof(RemoteMethodResponse), "remoteMethodResponse");
            XmlSerializer.RegisterType(typeof(RemoteError), "remoteError");


            string profileFolderArg = args.Any(x => x.ToLower().StartsWith("profilefolder=")) ? args.First(x => x.ToLower().StartsWith("profilefolder=")): null;

            profileFolderArg = (profileFolderArg == null) ? null : profileFolderArg.Replace("profilefolder=", "");
            profileFolderArg = (Directory.Exists(profileFolderArg)) ? profileFolderArg : null;

            string folder = profileFolderArg.IsNullOrEmpty() ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Wolpertinger", "Manager") : profileFolderArg;

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            connectionManager = new DefaultConnectionManager();
            //connectionManager.ComponentFactory = new DefaultComponentFactory();
            connectionManager.AcceptIncomingConnections = false;
            connectionManager.LoadSettings(folder);


            //connectionManager.Connect();
            XmppLogger.ConnectionManager = connectionManager;


            //Console.WriteLine("Account: {0}@{1}", connectionManager.XmppUsername, connectionManager.XmppServer);
            Console.WriteLine();

            ILogger consoleLogger = new Wolpertinger.Core.ConsoleLogger();

            LoggerService.SetLogger(consoleLogger);


            mainContext   = new MainContext();
            activeContext = mainContext;

            waitForCommand();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            Console.WindowWidth = 120;
            Console.WindowHeight = 50;
            printLogo();
            Console.Title = "Wolpertinger Manager";
            Console.WriteLine();
            ConsoleHelper.WriteLine(ConsoleColor.Cyan, " Wolpertinger Manager {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            ConsoleHelper.WriteLine(ConsoleColor.Cyan, " Wolpertinger.Core    {0}", Assembly.GetAssembly(typeof(DefaultConnectionManager)).GetName().Version.ToString());
            Console.WriteLine();

            //Set up XmlSerializer
            XmlSerializer.RegisterType(typeof(ClientInfo),"clientInfo");
            XmlSerializer.RegisterType(typeof(DirectoryObject),"directoryObject");
            XmlSerializer.RegisterType(typeof(FileObject),"fileObject");
            XmlSerializer.RegisterType(typeof(Permission),"permission");
            XmlSerializer.RegisterType(typeof(MountInfo), "mountInfo");
            XmlSerializer.RegisterType(typeof(SnapshotInfo), "snapshotInfo");
            XmlSerializer.RegisterType(typeof(RemoteMethodCall),"remoteMethodCall");
            XmlSerializer.RegisterType(typeof(RemoteMethodResponse),"remoteMethodResponse");
            XmlSerializer.RegisterType(typeof(RemoteError), "remoteError");

            string profileFolderArg = args.Any(x => x.ToLower().StartsWith("profilefolder=")) ? args.First(x => x.ToLower().StartsWith("profilefolder=")): null;
            profileFolderArg = (profileFolderArg == null) ? null : profileFolderArg.Replace("profilefolder=", "");
            profileFolderArg = (Directory.Exists(profileFolderArg)) ? profileFolderArg : null;

            string folder = profileFolderArg.IsNullOrEmpty() ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Wolpertinger", "Manager") : profileFolderArg;

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            connectionManager = new DefaultConnectionManager();
            //connectionManager.ComponentFactory = new DefaultComponentFactory();
            connectionManager.AcceptIncomingConnections = false;
            connectionManager.LoadSettings(folder);

            //connectionManager.Connect();
            XmppLogger.ConnectionManager = connectionManager;

            //Console.WriteLine("Account: {0}@{1}", connectionManager.XmppUsername, connectionManager.XmppServer);
            Console.WriteLine();

            ILogger consoleLogger = new Wolpertinger.Core.ConsoleLogger();
            LoggerService.SetLogger(consoleLogger);

            mainContext = new MainContext();
            activeContext = mainContext;

            waitForCommand();
        }