Beispiel #1
0
        public static void Init()
        {
            if (_IsInitialized)
            {
                return;
            }
            _IsInitialized = true;

            var asm = Assembly.GetEntryAssembly();

            if (asm == null)
            {
                asm = Assembly.GetAssembly(typeof(Engine));
            }
            var asm_name = asm.GetName(false);

            var distVersion = Defines.DistVersion;

            if (!String.IsNullOrEmpty(distVersion))
            {
                distVersion = String.Format(" ({0})", distVersion);
            }
            _VersionString = String.Format(
                "{0} {1}{2} - running on {3} {4}",
                Path.GetFileNameWithoutExtension(asm_name.Name),
                AssemblyVersion,
                distVersion,
                Platform.OperatingSystem,
                Platform.Architecture
                );

            _Config = new Config();
            _Config.Load();
            _Config.Save();

            string location = Path.GetDirectoryName(asm.Location);

            if (String.IsNullOrEmpty(location) &&
                Environment.OSVersion.Platform == PlatformID.Unix)
            {
                // we are mkbundled
                var locationBuilder = new StringBuilder(8192);
                if (Mono.Unix.Native.Syscall.readlink("/proc/self/exe", locationBuilder) >= 0)
                {
                    location = Path.GetDirectoryName(locationBuilder.ToString());
                }
            }
            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(location);
        }
Beispiel #2
0
        public static void Init()
        {
            if (_IsInitialized)
            {
                return;
            }
            _IsInitialized = true;

            var asm = Assembly.GetEntryAssembly();

            if (asm == null)
            {
                asm = Assembly.GetAssembly(typeof(Engine));
            }
            var asm_name = asm.GetName(false);

            _Version       = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();

            var distVersion = Defines.DistVersion;

            if (!String.IsNullOrEmpty(distVersion))
            {
                distVersion = String.Format(" ({0})", distVersion);
            }
            _VersionString = String.Format(
                "{0} {1}{2} - running on {3} {4}",
                Path.GetFileNameWithoutExtension(asm_name.Name),
                _Version,
                distVersion,
                Platform.OperatingSystem,
                Platform.Architecture
                );

            _Config = new Config();
            _Config.Load();
            _Config.Save();

            string location = Assembly.GetExecutingAssembly().Location;

            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(Path.GetDirectoryName(location));

            _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
        }
Beispiel #3
0
        public static void Init()
        {
            if (_IsInitialized)
            {
                return;
            }
            _IsInitialized = true;

            Assembly                 asm      = Assembly.GetAssembly(typeof(Engine));
            AssemblyName             asm_name = asm.GetName(false);
            AssemblyProductAttribute pr       = (AssemblyProductAttribute)asm.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];

            _Version       = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();

            var distVersion = Defines.DistVersion;

            if (!String.IsNullOrEmpty(distVersion))
            {
                distVersion = String.Format(" ({0})", distVersion);
            }
            _VersionString = String.Format(
                "{0} {1}{2} - running on {3} {4}",
                pr.Product,
                _Version,
                distVersion,
                Platform.OperatingSystem,
                Platform.Architecture
                );

            _Config = new Config();
            _Config.Load();
            _Config.Save();

            string location = Assembly.GetExecutingAssembly().Location;

            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(Path.GetDirectoryName(location));

            _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
        }
Beispiel #4
0
        public static void Init()
        {
            if (_IsInitialized) {
                return;
            }
            _IsInitialized = true;

            var asm = Assembly.GetEntryAssembly();
            if (asm == null) {
                asm = Assembly.GetAssembly(typeof(Engine));
            }
            var asm_name = asm.GetName(false);
            _Version = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();

            var distVersion = Defines.DistVersion;
            if (!String.IsNullOrEmpty(distVersion)) {
                distVersion = String.Format(" ({0})", distVersion);
            }
            _VersionString = String.Format(
                "{0} {1}{2} - running on {3} {4}",
                Path.GetFileNameWithoutExtension(asm_name.Name),
                _Version,
                distVersion,
                Platform.OperatingSystem,
                Platform.Architecture
            );

            _Config = new Config();
            _Config.Load();
            _Config.Save();

            string location = Assembly.GetExecutingAssembly().Location;
            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(Path.GetDirectoryName(location));

            _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
        }
Beispiel #5
0
        public static void Init()
        {
            if (_IsInitialized) {
                return;
            }
            _IsInitialized = true;

            Assembly asm = Assembly.GetAssembly(typeof(Engine));
            AssemblyName asm_name = asm.GetName(false);
            AssemblyProductAttribute pr = (AssemblyProductAttribute)asm.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
            _Version = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();
            _VersionString = String.Format("{0} {1} - running on {2} {3}", pr.Product, _Version, Platform.OperatingSystem, Platform.Architecture);

            _Config = new Config();
            _Config.Load();
            _Config.Save();

            string location = Assembly.GetExecutingAssembly().Location;
            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(Path.GetDirectoryName(location));

            _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
        }
Beispiel #6
0
        public static void Init()
        {
            if (_IsInitialized) {
                return;
            }
            _IsInitialized = true;

            var asm = Assembly.GetEntryAssembly();
            if (asm == null) {
                asm = Assembly.GetAssembly(typeof(Engine));
            }
            var asm_name = asm.GetName(false);

            var distVersion = Defines.DistVersion;
            if (!String.IsNullOrEmpty(distVersion)) {
                distVersion = String.Format(" ({0})", distVersion);
            }
            _VersionString = String.Format(
                "{0} {1}{2} - running on {3} {4}",
                Path.GetFileNameWithoutExtension(asm_name.Name),
                AssemblyVersion,
                distVersion,
                Platform.OperatingSystem,
                Platform.Architecture
            );

            _Config = new Config();
            _Config.Load();
            _Config.Save();

            string location = Path.GetDirectoryName(asm.Location);
            if (String.IsNullOrEmpty(location) &&
                Environment.OSVersion.Platform == PlatformID.Unix) {
                // we are mkbundled
                var locationBuilder = new StringBuilder(8192);
                if (Mono.Unix.Native.Syscall.readlink("/proc/self/exe", locationBuilder) >= 0) {
                    location = Path.GetDirectoryName(locationBuilder.ToString());
                }
            }
            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(location);

            _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
        }
Beispiel #7
0
        public static void Init()
        {
            if (_IsInitialized)
            {
                return;
            }
            _IsInitialized = true;

            var asm = Assembly.GetEntryAssembly();

            if (asm == null)
            {
                asm = Assembly.GetAssembly(typeof(Engine));
            }
            var asm_name = asm.GetName(false);

            var distVersion = Defines.DistVersion;

            if (!String.IsNullOrEmpty(distVersion))
            {
                distVersion = String.Format(" ({0})", distVersion);
            }
            _VersionString = String.Format(
                "{0} {1}{2} - running on {3} {4}",
                Path.GetFileNameWithoutExtension(asm_name.Name),
                AssemblyVersion,
                distVersion,
                Platform.OperatingSystem,
                Platform.Architecture
                );

            _Config = new Config();
            _Config.Load();

            // migration config settins from 1.0 or earlier to 1.1
            if (_Config.PreviousVersion == null ||
                _Config.PreviousVersion < new Version(1, 1))
            {
                // migrate all existing IRC connections for Slack to the
                // SlackProtocolManager
                var users = (string[])_Config["Engine/Users/Users"];
                if (users != null)
                {
                    foreach (var user in users)
                    {
                        var userConfig       = new UserConfig(_Config, user);
                        var serverController = new ServerListController(userConfig);
                        var servers          = serverController.GetServerList();
                        foreach (var server in servers)
                        {
                            if (server.Protocol != "IRC")
                            {
                                continue;
                            }
                            if (!server.Hostname.EndsWith(".irc.slack.com"))
                            {
                                continue;
                            }
#if LOG4NET
                            f_Logger.InfoFormat(
                                "Migrating Slack server '{0}' of user '{1}' " +
                                "from IRC to Slack protocol manager",
                                server,
                                user
                                );
#endif
                            // this is Slack IRC bridge connection
                            var migratedServer = new ServerModel(server);
                            migratedServer.ServerID = null;
                            migratedServer.Protocol = "Slack";
                            serverController.AddServer(migratedServer);
                            // remove old Slack server with IRC as protocol
                            serverController.RemoveServer(server.Protocol,
                                                          server.ServerID);
                        }
                    }
                }
                _Config["Engine/ConfigVersion"] = _Config.CurrentVersion.ToString();
            }

            _Config.Save();

            string location = Path.GetDirectoryName(asm.Location);
            if (String.IsNullOrEmpty(location) &&
                Environment.OSVersion.Platform == PlatformID.Unix)
            {
                // we are mkbundled
                var locationBuilder = new StringBuilder(8192);
                if (Mono.Unix.Native.Syscall.readlink("/proc/self/exe", locationBuilder) >= 0)
                {
                    location = Path.GetDirectoryName(locationBuilder.ToString());
                }
            }
            _ProtocolManagerFactory = new ProtocolManagerFactory();
            _ProtocolManagerFactory.LoadAllProtocolManagers(location);
        }