Beispiel #1
0
 public static void ErrorLine(Context caller, string error)
 {
     if (activeContext == caller)
         ErrorLine(error);
     else
         ErrorLine(String.Format("{0}: {1}", caller.Name, error));
 }
Beispiel #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();
        }
Beispiel #3
0
 public static void ErrorLine(Context caller, string format, params object[] args)
 {
     ErrorLine(caller, String.Format(format, args));
 }
Beispiel #4
0
 public static void UnknownCommand(Context context)
 {
     ErrorLine(context, "Unknown Command or Invalid Parameters");
 }
Beispiel #5
0
 public static void StatusLine(Context caller,string line)
 {
     if (activeContext == caller)
         StatusLine(line);
     else
         StatusLine(String.Format("{0}: {1}", caller.Name, line));
 }