Esempio n. 1
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                GlobalUtil.SetAuthorizedUser(ConfigurationManager.AppSettings["AuthorizedUser"], ConfigurationManager.AppSettings["AuthorizedPassword"]);
                GlobalUtil.SetMaxLengthOfUserID(byte.Parse(ConfigurationManager.AppSettings["MaxLengthOfUserID"]));
                OMCSConfiguration config = new OMCSConfiguration();

                //用于验证登录用户的帐密
                DefaultUserVerifier userVerifier = new DefaultUserVerifier();
                Program.MultimediaServer = MultimediaServerFactory.CreateMultimediaServer(int.Parse(ConfigurationManager.AppSettings["Port"]), userVerifier, config, bool.Parse(ConfigurationManager.AppSettings["SecurityLogEnabled"]));


                ServerForm form = new ServerForm(Program.MultimediaServer);

                Application.Run(form);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Esempio n. 2
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                GlobalUtil.SetAuthorizedUser(ConfigurationManager.AppSettings["AuthorizedUser"], ConfigurationManager.AppSettings["AuthorizedPassword"]);
                GlobalUtil.SetMaxLengthOfUserID(byte.Parse(ConfigurationManager.AppSettings["MaxLengthOfUserID"]));
                OMCSConfiguration config = new OMCSConfiguration(
                    int.Parse(ConfigurationManager.AppSettings["CameraFramerate"]),
                    int.Parse(ConfigurationManager.AppSettings["DesktopFramerate"])
                   );

                //用于验证登录用户的帐密
                DefaultUserVerifier userVerifier = new DefaultUserVerifier();
                Program.MultimediaServer = MultimediaServerFactory.CreateMultimediaServer(int.Parse(ConfigurationManager.AppSettings["Port"]), userVerifier, config, bool.Parse(ConfigurationManager.AppSettings["SecurityLogEnabled"]));
                ServerForm form = new ServerForm(Program.MultimediaServer);

                Application.Run(form);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Esempio n. 3
0
        void InitOMCSServer()
        {
            try
            {
                GlobalUtil.SetAuthorizedUser("FreeUser", "");
                GlobalUtil.SetMaxLengthOfUserID(CurrentConfig.MaxLengthOfUserID);
                OMCSConfiguration config = new OMCSConfiguration();

                //用于验证登录用户的帐密
                DefaultUserVerifier userVerifier = new DefaultUserVerifier();
                MultimediaServer = MultimediaServerFactory.CreateMultimediaServer(CurrentConfig.AudioPort, userVerifier, config, true);
                MultimediaServer.UserConnected    += MultimediaServer_UserConnected;
                MultimediaServer.UserDisconnected += MultimediaServer_UserDisconnected;
            }
            catch (Exception ee)
            {
                //MessageBox.Show(ee.Message);
            }
        }
Esempio n. 4
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                LoginForm f1 = new LoginForm();
                if (f1.ShowDialog() != DialogResult.OK)//f1的button点击确定后值为ok,所以返回
                {
                    return;
                }
                OMCSConfiguration config = new OMCSConfiguration();
                //用于验证登录用户的帐密
                DefaultUserVerifier userVerifier = new DefaultUserVerifier();
                Program.MultimediaServer = MultimediaServerFactory.CreateMultimediaServer(int.Parse(ConfigurationManager.AppSettings["Port"]), userVerifier, config, bool.Parse(ConfigurationManager.AppSettings["SecurityLogEnabled"]));

                f1.sever2(Program.MultimediaServer);

                IMultimediaManager multimediaManager = MultimediaManagerFactory.GetSingleton();
                multimediaManager.Advanced.AllowDiscardFrameWhenBroadcast = false; //正式部署使用时,建议设置为true。
                multimediaManager.CameraVideoSize = new System.Drawing.Size(320, 240);
                multimediaManager.AutoAdjustCameraEncodeQuality = true;
                multimediaManager.ChannelMode           = ChannelMode.P2PDisabled;
                multimediaManager.SecurityLogEnabled    = false;
                multimediaManager.CameraDeviceIndex     = 0;
                multimediaManager.MicrophoneDeviceIndex = int.Parse(ConfigurationManager.AppSettings["MicrophoneIndex"]);
                multimediaManager.SpeakerIndex          = int.Parse(ConfigurationManager.AppSettings["SpeakerIndex"]);
                multimediaManager.DesktopEncodeQuality  = 3;
                multimediaManager.Initialize(f1.Bccount, f1.Cccount, ConfigurationManager.AppSettings["ServerIP"], int.Parse(ConfigurationManager.AppSettings["ServerPort"]));

                MainForm f3 = new MainForm(multimediaManager, f1.RoomID);
                Application.Run(f3);
            }
            catch (Exception ee)
            { MessageBox.Show(ee.Message); }
        }
Esempio n. 5
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                IDbPersister persister;
                if (bool.Parse(ConfigurationManager.AppSettings["UseVirtualDB"]))
                {
                    persister = new VirtualDB();
                }
                else
                {
                    var dataBaseType = (DataBaseType)Enum.Parse(typeof(DataBaseType), ConfigurationManager.AppSettings["DBType"]);
                    if (dataBaseType == DataBaseType.SqlServer)
                    {
                        persister = new RealDb(ConfigurationManager.AppSettings["DBName"], ConfigurationManager.AppSettings["DBIP"], ConfigurationManager.AppSettings["SaPwd"]);
                    }
                    else //MySQL
                    {
                        persister = new RealDb(ConfigurationManager.AppSettings["DBName"], ConfigurationManager.AppSettings["DBIP"], int.Parse(ConfigurationManager.AppSettings["DBPort"]), ConfigurationManager.AppSettings["SaPwd"]);
                    }
                }

                var globalCache = new GlobalCache(persister);

                #region 初始化ESFramework服务端引擎
                ESPlus.GlobalUtil.SetAuthorizedUser("FreeUser", "");
                ESPlus.GlobalUtil.SetMaxLengthOfUserID(20);
                ESPlus.GlobalUtil.SetMaxLengthOfMessage(1024 * 1024 * 10);

                //自定义的联系人管理器
                var contactsManager = new ContactsManager(globalCache);
                Program.RapidServerEngine.ContactsManager = contactsManager;


                var nDiskHandler   = new NDiskHandler(); //网盘处理器 V1.9
                var handler        = new CustomizeHandler();
                var complexHandler = new ComplexCustomizeHandler(nDiskHandler, handler);

                //初始化服务端引擎
                Program.RapidServerEngine.SecurityLogEnabled = false;
                Program.RapidServerEngine.Initialize(int.Parse(ConfigurationManager.AppSettings["Port"]), complexHandler, new BasicHandler(globalCache));
                Program.RapidServerEngine.ContactsController.ContactsConnectedNotifyEnabled    = false;
                Program.RapidServerEngine.ContactsController.ContactsDisconnectedNotifyEnabled = true;
                Program.RapidServerEngine.ContactsController.BroadcastBlobListened             = true; //为群聊天记录

                //初始化网盘处理器 V1.9
                var networkDiskPathManager = new NetworkDiskPathManager();
                var networkDisk            = new NetworkDisk(networkDiskPathManager, Program.RapidServerEngine.FileController);
                nDiskHandler.Initialize(Program.RapidServerEngine.FileController, networkDisk);

                //设置重登陆模式
                Program.RapidServerEngine.UserManager.RelogonMode = RelogonMode.ReplaceOld;

                //离线消息控制器 V3.2
                var offlineFileController = new OfflineFileController(Program.RapidServerEngine, globalCache);

                handler.Initialize(globalCache, Program.RapidServerEngine, offlineFileController);
                #endregion

                #region 初始化OMCS服务器
                OMCS.GlobalUtil.SetAuthorizedUser("FreeUser", "");
                OMCS.GlobalUtil.SetMaxLengthOfUserID(20);
                var config = new OMCSConfiguration();

                //用于验证登录用户的帐密
                var userVerifier = new DefaultUserVerifier();
                Program.MultimediaServer = MultimediaServerFactory.CreateMultimediaServer(int.Parse(ConfigurationManager.AppSettings["OmcsPort"]), userVerifier, config, false);

                #endregion

                #region 发布用于注册的Remoting服务
                RemotingConfiguration.Configure("GGTalk.Server.exe.config", false);
                var registerService = new Server.RemotingService(globalCache, Program.RapidServerEngine);
                RemotingServices.Marshal(registerService, "RemotingService");
                #endregion

                //如果不需要默认的UI显示,可以替换下面这句为自己的Form
                var mainForm = new MainServerForm(Program.RapidServerEngine);
                mainForm.Text = ConfigurationManager.AppSettings["SoftwareName"] + " 服务器";
                Application.Run(mainForm);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }