예제 #1
0
        public bool NetPermissionWrapper(Action action)
        {
            try
            {
                action();
            }
            catch (Exception e)
            {
                if (Utils.IsAdministrator())
                {
                    Utils.ShowMessage(null, "Settings the ports, after that JMMServer will quit, run again in normal mode");

                    try
                    {
                        action();
                    }
                    catch (Exception exception)
                    {
                        Utils.ShowErrorMessage("Unable start hosting");
                        logger.Error("Unable to run task: " + (action.Method.Name));
                        logger.Error(exception);
                    }
                    finally
                    {
                        ShutDown();
                    }

                    return(false);
                }

                Utils.ShowErrorMessage("Unable to start hosting, please run JMMServer as administrator once.");
                logger.Error(e);
                ShutDown();
                return(false);
            }

            return(true);
        }