Inheritance: UnityEngine.ScriptableObject
Example #1
0
        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.DarkRed;
            Console.Clear();

            //Attach a console listener
            System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.ConsoleTraceListener());

            //Start server
            ServerSettings settings = new ServerSettings();
            StateServer server = new StateServer(settings, new SHA256_AESAuthenticator(settings["PeerPassword"]));
            server.Start();

            Console.WriteLine("[SERVER STARTED. PRESS ESCAPE KEY TO QUIT.]\r\n");

            //Wait for user signal to end server
            while (true)
            {
                if (Console.KeyAvailable)
                {
                    if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                    {
                        break;
                    }
                }
                else
                {
                    Thread.Sleep(500);
                }
            }

            //Stop server
            server.Stop();
        }
Example #2
0
 protected override void OnStart(string[] args)
 {
     //Start server
     ServerSettings settings = new ServerSettings();
     server = new StateServer(settings, new SHA256_AESAuthenticator(settings["PeerPassword"]));
     server.Start();
 }
Example #3
0
        public Workspace(IFileSystem fileSystem, ServerSettings serverSettings)
        {
            ServerSettings = serverSettings;
            FileSystem = fileSystem;

            TempWorkDir = FileSystem.CreateTempWorkingDir(ServerSettings.WorkDir);
        }
Example #4
0
 private static void InitializeServiceChannelFactories()
 {
     ServerSettings serverSettings = new ServerSettings();
     serverSettings.ServerName = Properties.Settings.Default.ArgusTVServerName;
     serverSettings.Port = Properties.Settings.Default.ArgusTVPort;
     ServiceChannelFactories.Initialize(serverSettings, false);
 }
Example #5
0
 private PiBroker(ICameraClient cameraClient, IBrowserClient browserClients)
 {
     Camera = cameraClient;
     Browsers = browserClients;
     ServerSettings = new ServerSettings {JpegCompression= 90};
     PiSettings = new PiSettings {TransmitImagePeriod = TimeSpan.FromMilliseconds(200)};
 }
	public static void AddSettings(ConfigManager config, string key, string value, ServerSettings.Type type)
	{
		if (key.IsEmpty()) return;
		
		int duplicated = -1;
		
		ConfigManager.CachedServerSettings newSetting = new ConfigManager.CachedServerSettings();
		newSetting.key = key;
		newSetting.setting = new ServerSettings.Serializable(value, type);
		
		for(int i = 0; i < config.serverSettings.Length; i++)
		{
			ConfigManager.CachedServerSettings setting = config.serverSettings[i];
			if (setting.key == key)
			{
				duplicated = i;
				break;	
			}
		}
		
		if (!(duplicated >= 0))
		{
			Array.Resize(ref config.serverSettings, config.serverSettings.Length + 1);
			config.serverSettings[config.serverSettings.Length - 1] = newSetting;
			
			Array.Sort(config.serverSettings,
	    		delegate(ConfigManager.CachedServerSettings a, ConfigManager.CachedServerSettings b)
				{ return a.key.CompareTo(b.key); }
			);
			
			return;
		}
		
		config.serverSettings[duplicated] = newSetting;
	}
        public ServerSettings Get(QueryServerSettings request)
        {
            ServerSettings config;

            using (var session = DocumentStore.OpenSession())
            {
                config = session.Load<ServerSettings>("ServerSettings/1");

                if (config == null)
                {
                    // provide some default values and store them
                    config = new ServerSettings()
                    {
                        Id = 1,
                        GitExecutable = @"c:\Program Files (x86)\git\bin\git.exe",
                        NuGetServerUri = new Uri("http://localhost/nuggy/nuget"),
                        VersionControlSystem = VersionControlSystem.Git,
                        WorkDir = @"c:\powerdeploy\work",
                    };

                    session.Store(config);
                    session.SaveChanges();
                }
            }

            return config;
        }
	public void StartService(string deviceID, float longitude , float latitude, float altitude, ServerSettings serverSettings)
	{
		Hashtable data = new Hashtable ();
		data.Add("dispId",deviceID);
		data.Add("long",longitude);
		data.Add("lat",latitude);
		data.Add("alt",altitude);
		RequestOnlineService(SERVICE_CALL_STRING,data,serverSettings);
	}
Example #9
0
        /* used to add a new server entry */
        public void Create()
        {
            ServerSettings settings = new ServerSettings();
            ServerType sType = new ServerType();

            string ServerName = GetSeverName();

            settings = CreateChatServer(ServerName);
            Console.WriteLine(settings.server_name + " server created.");
            CreateNewServer(settings);
        }
Example #10
0
        public ServerInstance(ServerSettings settings)
        {
            ServiceLocator.Current.GetInstance<UnityContainer>()
                .BuildUp(this);

            this.settings = settings;

            DatabaseConnect();
            CreateQueueInstance();
            RegisterDTOMapping();
            CreateServices();
        }
Example #11
0
	public void StartService(string deviceID, string userEmail , string password ,string cellphone,string placa,UserType type, ServerSettings serverSettings)
	{
		Hashtable data = new Hashtable ();
		data.Add("dispId",deviceID);
		data.Add("email",userEmail);
		data.Add("pw",password);
		data.Add ("role", GetType (type));
		if(!string.IsNullOrEmpty(cellphone))
			data.Add("cellphone",cellphone);
		if(!string.IsNullOrEmpty(placa))
			data.Add("placa",placa);
		RequestOnlineService(SERVICE_CALL_STRING,data,serverSettings);
	}
Example #12
0
        public ServerSettings CreateChatServer(string ServerName)
        {
            ServerSettings settings = new ServerSettings();
            ServerList serverlist = new ServerList();

            settings.server_name = ServerName;
            settings.server_password = GetServerPassword();
            settings.backlog = GetServerBacklog();
            settings.port_number = GetServerPortNumber();
            settings.server_ip_address = GetServerIPAddress();

            return settings;
        }
 /// <summary>
 /// Creates a new <see cref="HistorianServer"/> instance.
 /// </summary>
 public HistorianServer(int? port)
 {
     var server = new ServerSettings();
     if (port.HasValue)
     {
         var settings = new SnapSocketListenerSettings() { LocalTcpPort = port.Value };
         settings.DefaultUserCanRead = true;
         settings.DefaultUserCanWrite = true;
         settings.DefaultUserIsAdmin = true;
         server.Listeners.Add(settings);
     }
     // Maintain a member level list of all established archive database engines
     m_host = new SnapServer(server);
 }
        public void Put(ServerSettings request)
        {
            using (var session = DocumentStore.OpenSession())
            {
                var config = session.Load<ServerSettings>("ServerSettings/" + request.Id);

                if (config == null)
                {
                    throw HttpError.NotFound("ServerSettings not found.");
                }

                config.PopulateWith(request);
                session.SaveChanges();
            }
        }
Example #15
0
	public void StartService(string userID,List<Vector2> points ,int currentZoom,ServerSettings serverSettings)
	{
		Hashtable data = new Hashtable ();
		data.Add("dispId",userID);
		data.Add("p0_bound_lat",points[0].x);
		data.Add("p0_bound_lng",points[0].y);
		data.Add("p1_bound_lat",points[1].x);
		data.Add("p1_bound_lng",points[1].y);
		data.Add("p2_bound_lat",points[2].x);
		data.Add("p2_bound_lng",points[2].y);
		data.Add("p3_bound_lat",points[3].x);
		data.Add("p3_bound_lng",points[3].y);
		data.Add("zoom_act",currentZoom);
		RequestOnlineService(SERVICE_CALL_STRING,data,serverSettings);
	}
Example #16
0
        /* this method is used when the server starts to search and load settings to be passed to the Listen() method */
        public static ServerSettings Init(string ServerName)
        {
            ServerList SL = new ServerList();
            string[] ServerList = SL.GetServerList(); // list of all directory paths
            string ServerPath = "";
            // ex: ServerList[0] = Server\Caleb

            // we want to remove the parent directory from the path so we can retrieve the name
            // for checking
            // then we populate ConfigurationFile with elements of the txt file.
            // we then use a SeverSettings to pass into Listen()

            //for (int i = 0; i < ServerList.Length; i++)
            //    ServerList[i] = ServerList[i].Remove(0, SL.MainServerDirectory.Length + 1);

            for (int i = 0; i < ServerList.Length; i++)
            {
                if (ServerName == ServerList[i])
                {
                    ServerPath = SL.MainServerDirectory + @"\" + ServerName;
                }
            }

            //gets the configuration file from the Servers\myserver directory
            DirectoryInfo ConfigFileInfo = new DirectoryInfo(ServerPath);
            FileInfo[] files = ConfigFileInfo.GetFiles();
            string ConfigFilePath = "";

            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].Extension == ".txt" && files[i].Name.Contains("_Config"))
                {
                    ConfigFilePath = files[i].FullName;
                }
            }

            List<string> ConfigurationFile = Tools.IO.ReadTextFileList(ConfigFilePath);
            ServerSettings settings = new ServerSettings();

            //TODO: could I just iterate through this and add through the structure to make it less hacky?
            settings.server_name = ConfigurationFile[1];
            settings.server_password = ConfigurationFile[2];
            settings.backlog = int.Parse(ConfigurationFile[3]);
            settings.server_ip_address = ConfigurationFile[4];
            settings.port_number = int.Parse(ConfigurationFile[5]);

            return settings;
        }
Example #17
0
 private static void InitializeArgusTVServiceChannelFactories(out string errorMessage)
 {
     try
     {
         errorMessage = null;
         ServerSettings serverSettings = new ServerSettings();
         serverSettings.ServerName = Properties.Settings.Default.ArgusTVServerName;
         serverSettings.Transport = ServiceTransport.NetTcp;
         serverSettings.Port = Properties.Settings.Default.ArgusTVPort;
         ServiceChannelFactories.Initialize(serverSettings, true);
     }
     catch (Exception ex)
     {
         errorMessage = ex.Message;
     }
 }
        public AppSettings()
        {
            _settings = new NameValueCollection(ConfigurationManager.AppSettings);

            var missing = Values.FirstOrDefault(kvp => kvp.Value.ToUpper().Trim() == "#TBD");
            if(missing.Key != null)
            {
                throw new ConfigurationErrorsException(
                    "Missing required configuration value {0}".FormatFrom(missing.Key));
            }

            _settings = _settings.ExpandTokens();

            Server = new ServerSettings(_settings);
            Git = new GitSettings(_settings);
            Env = new EnvSettings(_settings);
            Smtp = new SmtpSettings(_settings);
        }
    //Creates a DataTable with the proper number of rows and columns, and fills in the "time" column taking into account the analogInLogTimes defined in Atticus
    public static DataTable InitializeDataTable(DataTable dataTable, SequenceData sequence,ServerSettings settings,List<string> analog_in_names)
    {
        int numOfChannels = analog_in_names.Count;
        dataTable.Rows.Clear();
        dataTable.Columns.Clear();
        DataColumn[] dataColumn = new DataColumn[numOfChannels + 1];

        dataColumn[0] = new DataColumn();
        dataColumn[0].DataType = typeof(double);
        dataColumn[0].ColumnName = "t";

        for (int currentChannelIndex = 1; currentChannelIndex < numOfChannels + 1; currentChannelIndex++)
        {
            dataColumn[currentChannelIndex] = new DataColumn();
            dataColumn[currentChannelIndex].DataType = typeof(double);
            dataColumn[currentChannelIndex].ColumnName = analog_in_names[currentChannelIndex - 1];
        }

        dataTable.Columns.AddRange(dataColumn);

        List<double> theTimes = new List<double>();
        int samplesFreq = settings.AIFrequency;
        foreach (AnalogInLogTime theLogTime in settings.AILogTimes)
        {
            double timestep = Math.Round(sequence.timeAtTimestep(theLogTime.TimeStep - 1), 3, MidpointRounding.AwayFromZero);
            double timebefore = Math.Max(timestep - ((double)theLogTime.TimeBefore) / 1000, 0);
            double timeafter = Math.Min(timestep + ((double)theLogTime.TimeAfter) / 1000, Math.Round(sequence.SequenceDuration, 3, MidpointRounding.AwayFromZero));
            for (int k = (int)(timebefore * samplesFreq); k < (int)(timeafter * samplesFreq + 1); k++)
            {
                theTimes.Add((double)k / (double)samplesFreq);
            }
        }
        theTimes = DedupCollection(theTimes);
        theTimes.Sort();

        int numOfRows = theTimes.Count;
        for (int currentDataIndex = 0; currentDataIndex < numOfRows; currentDataIndex++)
        {
            object[] rowArr = new object[numOfChannels + 1];
            dataTable.Rows.Add(rowArr);
            dataTable.Rows[currentDataIndex][0] = theTimes[currentDataIndex];
        }
        return dataTable;
    }
	public static void FixEmptySetting(ServerSettings.Serializable setting)
	{
		setting.value = "";
		
		// singles
		if (setting.type == ServerSettings.Type.String)
			setting.value = "";
		else if (setting.type == ServerSettings.Type.Int || setting.type == ServerSettings.Type.Float ||
			setting.type == ServerSettings.Type.Double || setting.type == ServerSettings.Type.Bool)
			setting.value = 0.ToString();
		else if (setting.type == ServerSettings.Type.Vector2)
			setting.value = Vector2.zero.ToString();
		else if (setting.type == ServerSettings.Type.Vector3)
			setting.value = Vector3.zero.ToString();
		else if (setting.type == ServerSettings.Type.Vector4 || setting.type == ServerSettings.Type.Quaternion)
			setting.value = Vector4.zero.ToString();
		else if (setting.type == ServerSettings.Type.Color)
			setting.value = Color.black.ToHex();
		
		// arrays
		else if (setting.type == ServerSettings.Type.ArrayString)
		{
			string[] array = new string[1];
			array[0] = "";
			setting.value = array.ToStringArray();
		}
		else if (setting.type == ServerSettings.Type.ArrayInt)
			setting.value = new int[1].ToStringArray();
		else if (setting.type == ServerSettings.Type.ArrayFloat || setting.type == ServerSettings.Type.ArrayDouble)
			setting.value = new float[1].ToStringArray();
		else if (setting.type == ServerSettings.Type.ArrayBool)
			setting.value = new bool[1].ToStringArray();
		else if (setting.type == ServerSettings.Type.ArrayVector2)
			setting.value = new Vector2[1].ToStringArray();
		else if (setting.type == ServerSettings.Type.ArrayVector3)
			setting.value = new Vector3[1].ToStringArray();
		else if (setting.type == ServerSettings.Type.ArrayVector4 || setting.type == ServerSettings.Type.ArrayQuaternion)
			setting.value = new Vector4[1].ToStringArray();
		else if (setting.type == ServerSettings.Type.ArrayColor)
			setting.value = new Color[1].ToStringArray();
	}
Example #21
0
    public static void CreateSettings()
    {
        PhotonNetwork.PhotonServerSettings = (ServerSettings)Resources.Load(PhotonNetwork.serverSettingsAssetFile, typeof(ServerSettings));
        if (PhotonNetwork.PhotonServerSettings != null)
        {
            return;
        }

        // find out if ServerSettings can be instantiated (existing script check)
        ScriptableObject serverSettingTest = ScriptableObject.CreateInstance("ServerSettings");
        if (serverSettingTest == null)
        {
            Debug.LogError("missing settings script");
            return;
        }
        UnityEngine.Object.DestroyImmediate(serverSettingTest);

        // if still not loaded, create one
        if (PhotonNetwork.PhotonServerSettings == null)
        {
            string settingsPath = Path.GetDirectoryName(PhotonNetwork.serverSettingsAssetPath);
            if (!Directory.Exists(settingsPath))
            {
                Directory.CreateDirectory(settingsPath);
                AssetDatabase.ImportAsset(settingsPath);
            }

            PhotonNetwork.PhotonServerSettings = (ServerSettings)ScriptableObject.CreateInstance("ServerSettings");
            if (PhotonNetwork.PhotonServerSettings != null)
            {
                AssetDatabase.CreateAsset(PhotonNetwork.PhotonServerSettings, PhotonNetwork.serverSettingsAssetPath);
            }
            else
            {
                Debug.LogError("PUN failed creating a settings file. ScriptableObject.CreateInstance(\"ServerSettings\") returned null. Will try again later.");
            }
        }
    }
Example #22
0
 /// <summary>
 /// Fetch the given settings value for this entry
 /// </summary>
 /// <param name="setting"></param>
 /// <returns></returns>
 public bool FetchSetting(ServerSettings setting)
 {
     return(FetchParsedSettingsHeader()[(int)setting]);
 }
Example #23
0
        static bool SaveApplySettings(SQLLib sql, ServerSettings newsettings)
        {
            if (Certificates.CertificateExists(newsettings.UseCertificate, System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine) == false)
            {
                return(false);
            }

            if (newsettings.EMailPort < 1 || newsettings.EMailPort > 65535)
            {
                return(false);
            }

            if (newsettings.KeepEventLogDays < 0)
            {
                return(false);
            }
            if (newsettings.KeepNonPresentDisks < 0)
            {
                return(false);
            }
            if (newsettings.KeepReports < 0)
            {
                return(false);
            }
            if (newsettings.KeepChatLogs < 0)
            {
                return(false);
            }
            if (newsettings.KeepBitlockerRK < 0)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(newsettings.AdministratorName) == true)
            {
                newsettings.AdministratorName = "Administrator";
            }

            if (string.IsNullOrWhiteSpace(newsettings.AdminIPAddresses) == true)
            {
                newsettings.AdminIPAddresses = "";
            }
            else
            {
                foreach (string s in newsettings.AdminIPAddresses.Split(','))
                {
                    if (s.Contains("/") == false)
                    {
                        return(false);
                    }
                    IPNetwork ip;
                    if (IPNetwork.TryParse(s, out ip) == false)
                    {
                        return(false);
                    }
                }
            }

            Settings.UseCertificate        = newsettings.UseCertificate;
            Settings.KeepEventLogDays      = newsettings.KeepEventLogDays;
            Settings.KeepBitlockerRK       = newsettings.KeepBitlockerRK;
            Settings.KeepChatLogs          = newsettings.KeepChatLogs;
            Settings.KeepNonPresentDisks   = newsettings.KeepNonPresentDisks;
            Settings.EMailAdminTo          = newsettings.EMailAdminTo;
            Settings.EMailFrom             = newsettings.EMailFrom;
            Settings.EMailFromFriendly     = newsettings.EMailFromFriendly;
            Settings.EMailPort             = newsettings.EMailPort;
            Settings.EMailServer           = newsettings.EMailServer;
            Settings.EMailUsername         = newsettings.EMailUsername;
            Settings.EMailPassword         = newsettings.EMailPassword;
            Settings.EMailUseSSL           = newsettings.EMailUseSSL;
            Settings.EMailAdminScheduling  = newsettings.EMailAdminScheduling;
            Settings.EMailClientScheduling = newsettings.EMailClientScheduling;
            Settings.EMailAdminIsHTML      = newsettings.EMailAdminIsHTML;
            Settings.EMailClientIsHTML     = newsettings.EMailClientIsHTML;
            Settings.EMailAdminText        = newsettings.EMailAdminText;
            Settings.EMailClientText       = newsettings.EMailClientText;
            Settings.EMailAdminSubject     = newsettings.EMailAdminSubject;
            Settings.EMailClientSubject    = newsettings.EMailClientSubject;
            Settings.AdminIPAddresses      = newsettings.AdminIPAddresses;
            Settings.AdministratorName     = newsettings.AdministratorName;
            Settings.KeepReports           = newsettings.KeepReports;
            Settings.MessageDisclaimer     = newsettings.MessageDisclaimer;

            PutString(sql, "UseCertificate", Settings.UseCertificate);
            PutInt64(sql, "KeepEventLogDays", Settings.KeepEventLogDays);
            PutInt64(sql, "KeepNonPresentDisks", Settings.KeepNonPresentDisks);
            PutInt64(sql, "KeepBitlockerRK", Settings.KeepBitlockerRK);
            PutInt64(sql, "KeepReports", Settings.KeepReports);
            PutInt64(sql, "KeepChatLogs", Settings.KeepChatLogs);
            PutString(sql, "EMailAdminTo", Settings.EMailAdminTo);
            PutString(sql, "EMailFrom", Settings.EMailFrom);
            PutString(sql, "EMailFromFriendly", Settings.EMailFromFriendly);
            PutInt(sql, "EMailPort", Settings.EMailPort);
            PutString(sql, "EMailServer", Settings.EMailServer);
            PutString(sql, "EMailUsername", Settings.EMailUsername);
            PutString(sql, "EMailPassword", Settings.EMailPassword);
            PutBool(sql, "EMailUseSSL", Settings.EMailUseSSL);
            PutBool(sql, "EMailAdminIsHTML", Settings.EMailAdminIsHTML);
            PutBool(sql, "EMailClientIsHTML", Settings.EMailClientIsHTML);
            PutString(sql, "EMailAdminText", Settings.EMailAdminText);
            PutString(sql, "EMailClientText", Settings.EMailClientText);
            PutString(sql, "EMailAdminSubject", Settings.EMailAdminSubject);
            PutString(sql, "EMailClientSubject", Settings.EMailClientSubject);
            PutString(sql, "AdminIPAddresses", Settings.AdminIPAddresses);
            PutString(sql, "AdminstratorName", Settings.AdministratorName);
            PutString(sql, "MessageDisclaimer", Settings.MessageDisclaimer);
            PutString(sql, "EMailAdminSched", JsonConvert.SerializeObject(Settings.EMailAdminScheduling));
            PutString(sql, "EMailClientSched", JsonConvert.SerializeObject(Settings.EMailClientScheduling));
            return(true);
        }
Example #24
0
 void Start()
 {
     if(!PlayerPrefs.HasKey("Music")){
         PlayerPrefs.SetInt("Music", 1);
     }
     AudioManager.Instance.loadSoundsForLevel("lobby");
     if (!PhotonNetwork.connected)
     {
         // PhotonNetwork.ConnectUsingSettings("1.0");
         ServerSettings ss = new ServerSettings();
         ss.UseCloud("c2bd3559-19e2-4734-88c9-fdd1d789be53", (int)CloudServerRegion.US);
         PhotonNetwork.Connect(ss.ServerAddress, ss.ServerPort, ss.AppID, "1.1");
         chooseRegion = true;
     }
     // generate a name for this player, if none is assigned yet
     if (!PlayerPrefs.HasKey("PlayerName"))
     {
         playerNameBuffer = PhotonNetwork.playerName = "Guest" + Random.Range(1, 9999);
         PlayerPrefs.SetString("PlayerName", playerNameBuffer);
     }else{
         playerNameBuffer = PhotonNetwork.playerName = PlayerPrefs.GetString("PlayerName");
     }
 }
Example #25
0
 private ServerSettings ConfigureServer(ServerSettings settings, ClusterKey clusterKey)
 {
     return(settings.With(
                heartbeatInterval: clusterKey.HeartbeatInterval,
                heartbeatTimeout: clusterKey.HeartbeatTimeout));
 }
Example #26
0
        public async Task Create(ServerSettings model)
        {
            await _gypsyContext.ServerSettings.AddAsync(model);

            await _gypsyContext.SaveChangesAsync();
        }
Example #27
0
        // constructors
        public Server(ClusterId clusterId, IClusterClock clusterClock, ClusterConnectionMode clusterConnectionMode, ServerSettings settings, EndPoint endPoint, IConnectionPoolFactory connectionPoolFactory, IServerMonitorFactory serverMonitorFactory, IEventSubscriber eventSubscriber)
        {
            Ensure.IsNotNull(clusterId, nameof(clusterId));
            _clusterClock          = Ensure.IsNotNull(clusterClock, nameof(clusterClock));
            _clusterConnectionMode = clusterConnectionMode;
            _settings = Ensure.IsNotNull(settings, nameof(settings));
            _endPoint = Ensure.IsNotNull(endPoint, nameof(endPoint));
            Ensure.IsNotNull(connectionPoolFactory, nameof(connectionPoolFactory));
            Ensure.IsNotNull(serverMonitorFactory, nameof(serverMonitorFactory));
            Ensure.IsNotNull(eventSubscriber, nameof(eventSubscriber));

            _serverId       = new ServerId(clusterId, endPoint);
            _connectionPool = connectionPoolFactory.CreateConnectionPool(_serverId, endPoint);
            _state          = new InterlockedInt32(State.Initial);
            _monitor        = serverMonitorFactory.Create(_serverId, _endPoint);

            eventSubscriber.TryGetEventHandler(out _openingEventHandler);
            eventSubscriber.TryGetEventHandler(out _openedEventHandler);
            eventSubscriber.TryGetEventHandler(out _closingEventHandler);
            eventSubscriber.TryGetEventHandler(out _closedEventHandler);
            eventSubscriber.TryGetEventHandler(out _descriptionChangedEventHandler);
        }
Example #28
0
        public static void HostServer(ServerSettings settings, bool fromReplay, bool withSimulation = false, bool debugMode = false, bool logDesyncTraces = false)
        {
            Log.Message($"Starting the server");

            var session = Multiplayer.session = new MultiplayerSession();

            session.myFactionId   = Faction.OfPlayer.loadID;
            session.localSettings = settings;
            session.gameName      = settings.gameName;

            var localServer = new MultiplayerServer(settings);

            if (withSimulation)
            {
                localServer.savedGame = GZipStream.CompressBuffer(OnMainThread.cachedGameData);
                localServer.mapData   = OnMainThread.cachedMapData.ToDictionary(kv => kv.Key, kv => GZipStream.CompressBuffer(kv.Value));
                localServer.mapCmds   = OnMainThread.cachedMapCmds.ToDictionary(kv => kv.Key, kv => kv.Value.Select(c => c.Serialize()).ToList());
            }
            else
            {
                OnMainThread.ClearCaches();
            }

            localServer.debugMode         = debugMode;
            localServer.debugOnlySyncCmds = new HashSet <int>(Sync.handlers.Where(h => h.debugOnly).Select(h => h.syncId));
            localServer.hostOnlySyncCmds  = new HashSet <int>(Sync.handlers.Where(h => h.hostOnly).Select(h => h.syncId));
            localServer.hostUsername      = Multiplayer.username;
            localServer.coopFactionId     = Faction.OfPlayer.loadID;

            localServer.rwVersion      = session.mods.remoteRwVersion = VersionControl.CurrentVersionString;
            localServer.modNames       = session.mods.remoteModNames = LoadedModManager.RunningModsListForReading.Select(m => m.Name).ToArray();
            localServer.modIds         = session.mods.remoteModIds = LoadedModManager.RunningModsListForReading.Select(m => m.PackageId).ToArray();
            localServer.workshopModIds = session.mods.remoteWorkshopModIds = ModManagement.GetEnabledWorkshopMods().ToArray();
            localServer.defInfos       = session.mods.defInfo = Multiplayer.localDefInfos;
            Log.Message($"MP Host modIds: {string.Join(", ", localServer.modIds)}");
            Log.Message($"MP Host workshopIds: {string.Join(", ", localServer.workshopModIds)}");

            if (settings.steam)
            {
                localServer.NetTick += SteamIntegration.ServerSteamNetTick;
            }

            if (fromReplay)
            {
                localServer.gameTimer = TickPatch.Timer;
            }

            MultiplayerServer.instance = localServer;
            session.localServer        = localServer;

            if (!fromReplay)
            {
                SetupGame();
            }

            foreach (var tickable in TickPatch.AllTickables)
            {
                tickable.Cmds.Clear();
            }

            Find.PlaySettings.usePlanetDayNightSystem = false;

            Multiplayer.RealPlayerFaction = Faction.OfPlayer;
            localServer.playerFactions[Multiplayer.username] = Faction.OfPlayer.loadID;

            SetupLocalClient();

            Find.MainTabsRoot.EscapeCurrentTab(false);

            Multiplayer.session.AddMsg("If you are having a issue with the mod and would like some help resolving it, then please reach out to us on our discord server:", false);
            Multiplayer.session.AddMsg(new ChatMsg_Url("https://discord.gg/S4bxXpv"), false);

            if (withSimulation)
            {
                StartServerThread();
            }
            else
            {
                var timeSpeed = TimeSpeed.Paused;

                Multiplayer.WorldComp.TimeSpeed = timeSpeed;
                foreach (var map in Find.Maps)
                {
                    map.AsyncTime().TimeSpeed = timeSpeed;
                }
                Multiplayer.WorldComp.UpdateTimeSpeed();

                Multiplayer.WorldComp.debugMode       = debugMode;
                Multiplayer.WorldComp.logDesyncTraces = logDesyncTraces;

                LongEventHandler.QueueLongEvent(() =>
                {
                    SaveLoad.CacheGameData(SaveLoad.SaveAndReload());
                    SaveLoad.SendCurrentGameData(false);

                    StartServerThread();
                }, "MpSaving", false, null);
            }

            void StartServerThread()
            {
                var netStarted = localServer.StartListeningNet();
                var lanStarted = localServer.StartListeningLan();

                string text = "Server started.";

                if (netStarted != null)
                {
                    text += (netStarted.Value ? $" Direct at {settings.bindAddress}:{localServer.NetPort}." : " Couldn't bind direct.");
                }

                if (lanStarted != null)
                {
                    text += (lanStarted.Value ? $" LAN at {settings.lanAddress}:{localServer.LanPort}." : " Couldn't bind LAN.");
                }

                session.serverThread = new Thread(localServer.Run)
                {
                    Name = "Local server thread"
                };
                session.serverThread.Start();

                Messages.Message(text, MessageTypeDefOf.SilentInput, false);
                Log.Message(text);
            }
        }
Example #29
0
        public Server(IPEndPoint endpoint, ServerSettings settings, ModData modData)
        {
            Log.AddChannel("server", "server.log");

            internalState = ServerState.WaitingPlayers;
            listener      = new TcpListener(endpoint);
            listener.Start();
            var localEndpoint = (IPEndPoint)listener.LocalEndpoint;

            Ip   = localEndpoint.Address;
            Port = localEndpoint.Port;

            Settings = settings;
            ModData  = modData;

            randomSeed = (int)DateTime.Now.ToBinary();

            if (Settings.AllowPortForward)
            {
                UPnP.ForwardPort(3600);
            }

            foreach (var trait in modData.Manifest.ServerTraits)
            {
                serverTraits.Add(modData.ObjectCreator.CreateObject <ServerTrait>(trait));
            }

            LobbyInfo = new Session();
            LobbyInfo.GlobalSettings.RandomSeed = randomSeed;
            LobbyInfo.GlobalSettings.Map        = settings.Map;
            LobbyInfo.GlobalSettings.ServerName = settings.Name;
            LobbyInfo.GlobalSettings.Dedicated  = settings.Dedicated;
            FieldLoader.Load(LobbyInfo.GlobalSettings, modData.Manifest.LobbyDefaults);

            foreach (var t in serverTraits.WithInterface <INotifyServerStart>())
            {
                t.ServerStarted(this);
            }

            Log.Write("server", "Initial mod: {0}", ModData.Manifest.Mod.Id);
            Log.Write("server", "Initial map: {0}", LobbyInfo.GlobalSettings.Map);

            new Thread(_ =>
            {
                var timeout = serverTraits.WithInterface <ITick>().Min(t => t.TickTimeout);
                for (;;)
                {
                    var checkRead = new List <Socket>();
                    if (State == ServerState.WaitingPlayers)
                    {
                        checkRead.Add(listener.Server);
                    }
                    foreach (var c in Conns)
                    {
                        checkRead.Add(c.Socket);
                    }
                    foreach (var c in PreConns)
                    {
                        checkRead.Add(c.Socket);
                    }

                    if (checkRead.Count > 0)
                    {
                        Socket.Select(checkRead, null, null, timeout);
                    }
                    if (State == ServerState.ShuttingDown)
                    {
                        EndGame();
                        break;
                    }

                    foreach (var s in checkRead)
                    {
                        if (s == listener.Server)
                        {
                            AcceptConnection();
                        }
                        else if (PreConns.Count > 0)
                        {
                            var p = PreConns.SingleOrDefault(c => c.Socket == s);
                            if (p != null)
                            {
                                p.ReadData(this);
                            }
                        }
                        else if (Conns.Count > 0)
                        {
                            var conn = Conns.SingleOrDefault(c => c.Socket == s);
                            if (conn != null)
                            {
                                conn.ReadData(this);
                            }
                        }
                    }

                    foreach (var t in serverTraits.WithInterface <ITick>())
                    {
                        t.Tick(this);
                    }

                    if (State == ServerState.ShuttingDown)
                    {
                        EndGame();
                        if (Settings.AllowPortForward)
                        {
                            UPnP.RemovePortforward();
                        }
                        break;
                    }
                }

                foreach (var t in serverTraits.WithInterface <INotifyServerShutdown>())
                {
                    t.ServerShutdown(this);
                }

                PreConns.Clear();
                Conns.Clear();
                try { listener.Stop(); }
                catch { }
            })
            {
                IsBackground = true
            }.Start();
        }
Example #30
0
        public Server(IPEndPoint endpoint, ServerSettings settings, ModData modData, bool dedicated)
        {
            Log.AddChannel("server", "server.log");

            listener = new TcpListener(endpoint);
            listener.Start();
            var localEndpoint = (IPEndPoint)listener.LocalEndpoint;

            Ip        = localEndpoint.Address;
            Port      = localEndpoint.Port;
            Dedicated = dedicated;
            Settings  = settings;

            Settings.Name = OpenRA.Settings.SanitizedServerName(Settings.Name);

            ModData = modData;

            randomSeed = (int)DateTime.Now.ToBinary();

            if (Settings.AllowPortForward)
            {
                UPnP.ForwardPort(Settings.ListenPort, Settings.ExternalPort).Wait();
            }

            foreach (var trait in modData.Manifest.ServerTraits)
            {
                serverTraits.Add(modData.ObjectCreator.CreateObject <ServerTrait>(trait));
            }

            LobbyInfo = new Session
            {
                GlobalSettings =
                {
                    RandomSeed         = randomSeed,
                    Map                = settings.Map,
                    ServerName         = settings.Name,
                    EnableSingleplayer = settings.EnableSingleplayer || !dedicated,
                    GameUid            = Guid.NewGuid().ToString()
                }
            };

            new Thread(_ =>
            {
                foreach (var t in serverTraits.WithInterface <INotifyServerStart>())
                {
                    t.ServerStarted(this);
                }

                Log.Write("server", "Initial mod: {0}", ModData.Manifest.Id);
                Log.Write("server", "Initial map: {0}", LobbyInfo.GlobalSettings.Map);

                var timeout = serverTraits.WithInterface <ITick>().Min(t => t.TickTimeout);
                for (;;)
                {
                    var checkRead = new List <Socket>();
                    if (State == ServerState.WaitingPlayers)
                    {
                        checkRead.Add(listener.Server);
                    }

                    checkRead.AddRange(Conns.Select(c => c.Socket));
                    checkRead.AddRange(PreConns.Select(c => c.Socket));

                    if (checkRead.Count > 0)
                    {
                        Socket.Select(checkRead, null, null, timeout);
                    }

                    if (State == ServerState.ShuttingDown)
                    {
                        EndGame();
                        break;
                    }

                    foreach (var s in checkRead)
                    {
                        if (s == listener.Server)
                        {
                            AcceptConnection();
                            continue;
                        }

                        var preConn = PreConns.SingleOrDefault(c => c.Socket == s);
                        if (preConn != null)
                        {
                            preConn.ReadData(this);
                            continue;
                        }

                        var conn = Conns.SingleOrDefault(c => c.Socket == s);
                        if (conn != null)
                        {
                            conn.ReadData(this);
                        }
                    }

                    foreach (var t in serverTraits.WithInterface <ITick>())
                    {
                        t.Tick(this);
                    }

                    if (State == ServerState.ShuttingDown)
                    {
                        EndGame();
                        if (Settings.AllowPortForward)
                        {
                            UPnP.RemovePortForward().Wait();
                        }
                        break;
                    }
                }

                foreach (var t in serverTraits.WithInterface <INotifyServerShutdown>())
                {
                    t.ServerShutdown(this);
                }

                PreConns.Clear();
                Conns.Clear();
                try { listener.Stop(); }
                catch { }
            })
            {
                IsBackground = true
            }.Start();
        }
Example #31
0
 private void ImageViewerLoad(object sender, EventArgs e)
 {
     _settings = ServerSettings.LoadSettings();
     Width     = _settings.ViewerWidth;
     Height    = _settings.ViewerHeight;
 }
        // constructors
        public ClusterableServer(ClusterId clusterId, ClusterConnectionMode clusterConnectionMode, ServerSettings settings, EndPoint endPoint, IConnectionPoolFactory connectionPoolFactory, IConnectionFactory heartbeatConnectionFactory, IEventSubscriber eventSubscriber)
        {
            Ensure.IsNotNull(clusterId, nameof(clusterId));
            _clusterConnectionMode = clusterConnectionMode;
            _settings = Ensure.IsNotNull(settings, nameof(settings));;
            _endPoint = Ensure.IsNotNull(endPoint, nameof(endPoint));
            Ensure.IsNotNull(connectionPoolFactory, nameof(connectionPoolFactory));
            _heartbeatConnectionFactory = Ensure.IsNotNull(heartbeatConnectionFactory, nameof(heartbeatConnectionFactory));
            Ensure.IsNotNull(eventSubscriber, nameof(eventSubscriber));

            _serverId        = new ServerId(clusterId, endPoint);
            _baseDescription = _currentDescription = new ServerDescription(_serverId, endPoint);
            _connectionPool  = connectionPoolFactory.CreateConnectionPool(_serverId, endPoint);
            _state           = new InterlockedInt32(State.Initial);

            eventSubscriber.TryGetEventHandler(out _openingEventHandler);
            eventSubscriber.TryGetEventHandler(out _openedEventHandler);
            eventSubscriber.TryGetEventHandler(out _closingEventHandler);
            eventSubscriber.TryGetEventHandler(out _closedEventHandler);
            eventSubscriber.TryGetEventHandler(out _heartbeatStartedEventHandler);
            eventSubscriber.TryGetEventHandler(out _heartbeatSucceededEventHandler);
            eventSubscriber.TryGetEventHandler(out _heartbeatFailedEventHandler);
            eventSubscriber.TryGetEventHandler(out _descriptionChangedEventHandler);
        }
Example #33
0
		void CreateAndJoin()
		{
			var name = Settings.SanitizedServerName(panel.Get<TextFieldWidget>("SERVER_NAME").Text);
			int listenPort, externalPort;
			if (!Exts.TryParseIntegerInvariant(panel.Get<TextFieldWidget>("LISTEN_PORT").Text, out listenPort))
				listenPort = 1234;

			if (!Exts.TryParseIntegerInvariant(panel.Get<TextFieldWidget>("EXTERNAL_PORT").Text, out externalPort))
				externalPort = 1234;

			var passwordField = panel.GetOrNull<PasswordFieldWidget>("PASSWORD");
			var password = passwordField != null ? passwordField.Text : "";

			// Save new settings
			Game.Settings.Server.Name = name;
			Game.Settings.Server.ListenPort = listenPort;
			Game.Settings.Server.ExternalPort = externalPort;
			Game.Settings.Server.AdvertiseOnline = advertiseOnline;
			Game.Settings.Server.AllowPortForward = allowPortForward;
			Game.Settings.Server.Map = preview.Uid;
			Game.Settings.Server.Password = password;
			Game.Settings.Save();

			// Take a copy so that subsequent changes don't affect the server
			var settings = new ServerSettings(Game.Settings.Server);

			// Create and join the server
			try
			{
				Game.CreateServer(settings);
			}
			catch (System.Net.Sockets.SocketException e)
			{
				var err_msg = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort);
				if (e.ErrorCode == 10048) { // AddressAlreadyInUse (WSAEADDRINUSE)
					err_msg += "\n\nCheck if the port is already being used.";
				} else {
					err_msg += "\n\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
				}

				ConfirmationDialogs.CancelPrompt("Server Creation Failed", err_msg, cancelText: "OK");
				return;
			}

			ConnectionLogic.Connect(IPAddress.Loopback.ToString(), Game.Settings.Server.ListenPort, password, onCreate, onExit);
		}
Example #34
0
    protected virtual void UiSetupApp()
    {
        GUI.skin.label.wordWrap = true;
        if (!this.isSetupWizard)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(CurrentLang.MainMenuButton, GUILayout.ExpandWidth(false)))
            {
                this.photonSetupState = PhotonSetupStates.MainUi;
            }

            GUILayout.EndHorizontal();
        }


        // setup header
        UiTitleBox(CurrentLang.SetupWizardTitle, BackgroundImage);

        // setup info text
        GUI.skin.label.richText = true;
        GUILayout.Label(CurrentLang.SetupWizardInfo);

        // input of appid or mail
        EditorGUILayout.Separator();
        GUILayout.Label(CurrentLang.EmailOrAppIdLabel);
        this.mailOrAppId = EditorGUILayout.TextField(this.mailOrAppId).Trim(); // note: we trim all input

        if (this.mailOrAppId.Contains("@"))
        {
            // this should be a mail address
            this.minimumInput = (this.mailOrAppId.Length >= 5 && this.mailOrAppId.Contains("."));
            this.useMail      = this.minimumInput;
            this.useAppId     = false;
        }
        else
        {
            // this should be an appId
            this.minimumInput = ServerSettings.IsAppId(this.mailOrAppId);
            this.useMail      = false;
            this.useAppId     = this.minimumInput;
        }

        // button to skip setup
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button(CurrentLang.SkipButton, GUILayout.Width(100)))
        {
            this.photonSetupState = PhotonSetupStates.GoEditPhotonServerSettings;
            this.useSkip          = true;
            this.useMail          = false;
            this.useAppId         = false;
        }

        // SETUP button
        EditorGUI.BeginDisabledGroup(!this.minimumInput);
        if (GUILayout.Button(CurrentLang.SetupButton, GUILayout.Width(100)))
        {
            this.useSkip = false;
            GUIUtility.keyboardControl = 0;
            if (this.useMail)
            {
                RegisterWithEmail(this.mailOrAppId); // sets state
            }
            if (this.useAppId)
            {
                this.photonSetupState = PhotonSetupStates.GoEditPhotonServerSettings;
                Undo.RecordObject(PhotonNetwork.PhotonServerSettings, "Update PhotonServerSettings for PUN");
                PhotonNetwork.PhotonServerSettings.UseCloud(this.mailOrAppId);
                PhotonEditor.SaveSettings();
            }
        }
        EditorGUI.EndDisabledGroup();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();


        // existing account needs to fetch AppId online
        if (this.photonSetupState == PhotonSetupStates.EmailAlreadyRegistered)
        {
            // button to open dashboard and get the AppId
            GUILayout.Space(15);
            GUILayout.Label(CurrentLang.AlreadyRegisteredInfo);


            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent(CurrentLang.OpenCloudDashboardText, CurrentLang.OpenCloudDashboardTooltip), GUILayout.Width(205)))
            {
                Application.OpenURL(UrlCloudDashboard + Uri.EscapeUriString(this.mailOrAppId));
                this.mailOrAppId = "";
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }


        if (this.photonSetupState == PhotonSetupStates.GoEditPhotonServerSettings)
        {
            if (!this.highlightedSettings)
            {
                this.highlightedSettings = true;
                HighlightSettings();
            }

            GUILayout.Space(15);
            if (this.useSkip)
            {
                GUILayout.Label(CurrentLang.SkipRegistrationInfo);
            }
            else if (this.useMail)
            {
                GUILayout.Label(CurrentLang.RegisteredNewAccountInfo);
            }
            else if (this.useAppId)
            {
                GUILayout.Label(CurrentLang.AppliedToSettingsInfo);
            }


            // setup-complete info
            GUILayout.Space(15);
            GUILayout.Label(CurrentLang.SetupCompleteInfo);


            // close window (done)
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(CurrentLang.CloseWindowButton, GUILayout.Width(205)))
            {
                this.close = true;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
        GUI.skin.label.richText = false;
    }
 public void Setup()
 {
     _cacheProviderInstanceFactory = new CacheProviderInstanceFactory();
     _serverSettings = new ServerSettings("", 0, "");
 }
	public UserAuthentication (ServerSettings serverSettings)
	{
		this.serverSettings = serverSettings;
	}
Example #37
0
        public void Initialize(string api, string connectionToken, string examId, string oauth2Token, ServerSettings settings)
        {
            this.api             = JsonConvert.DeserializeObject <ApiVersion1>(api);
            this.connectionToken = connectionToken;
            this.examId          = examId;
            this.oauth2Token     = oauth2Token;

            Initialize(settings);
        }
        private void LoadSettings(bool onlyServerSettings)
        {
            _serverSettings = PluginMain.LoadServerSettings();
            int timeout = _serverSettings.WakeOnLan.TimeoutSeconds;

            bool valueFoundInList = false;
            for (int i = 0; i <= 100; i++)
            {
                _WolTimeoutButton.AddSpinLabel(i.ToString(), 0);
                if (i == timeout) valueFoundInList = true;
            }

            if (valueFoundInList)
            {
                _WolTimeoutButton.SpinValue = timeout;
            }
            else
            {
                _WolTimeoutButton.AddSpinLabel(timeout.ToString(), 0);
                _WolTimeoutButton.SpinValue = _WolTimeoutButton.SpinMaxValue() - 1;
            }

            _serverNameButton.Label = _serverSettings.ServerName;
            _tcpPortButton.Label = _serverSettings.Port.ToString();
            _enableWolButton.Selected = _serverSettings.WakeOnLan.Enabled;

            if (!onlyServerSettings)
            {
                _standbyOnHomeButton.Selected = PluginMain.NoClientStandbyWhenNotHome;
                _autoStreamingButton.Selected = PluginMain.AutoStreamingMode;
                _rtspStreamingTVButton.Selected = PluginMain.PreferRtspForLiveTv;
                _rtspStreamingRecButton.Selected = PluginMain.PlayRecordingsOverRtsp;

                using (Settings xmlreader = new MPSettings())
                {
                    _recordingNotificationButton.Selected = xmlreader.GetValueAsBool("mytv", "enableRecNotifier", false);
                    _autoFullScreenButton.Selected = xmlreader.GetValueAsBool("mytv", "autofullscreen", true);
                    _showChannelNumbersButton.Selected = xmlreader.GetValueAsBool("mytv", "showchannelnumber", false);
                    _hideAllChannelsGroupButton.Selected = xmlreader.GetValueAsBool("mytv", "hideAllChannelsGroup", false);
                    _dvbSubtitlesButton.Selected = xmlreader.GetValueAsBool("tvservice", "dvbbitmapsubtitles", false);
                    _teletextSubtitleButton.Selected = xmlreader.GetValueAsBool("tvservice", "dvbttxtsubtitles", false);
                    _preferAC3Button.Selected = xmlreader.GetValueAsBool("tvservice", "preferac3", false);
                }
            }
        }
Example #39
0
        public void Initialize()
        {
            string message = ServerSettings.GetSetting("StartFlyMessage");

            if (!String.IsNullOrEmpty(message))
            {
                startFlyMessage = message;
            }
            message = ServerSettings.GetSetting("StopFlyMessage");
            if (!String.IsNullOrEmpty(message))
            {
                stopFlyMessage = message;
            }
            string flyGlassSize = ServerSettings.GetSetting("FlyGlassSize");
            string flyWaterSize = ServerSettings.GetSetting("FlyWaterSize");

            string[] splitGlass = flyGlassSize.Split(' ', ',', ';', ':');
            string[] splitWater = flyWaterSize.Split(' ', ',', ';', ':');
            int      xz         = 5;
            int      y          = 2;
            bool     midblock   = ServerSettings.GetSettingBoolean("Fly+");

            if (splitGlass.Length == 1 && String.IsNullOrWhiteSpace(splitGlass[0]))
            {
                try { y = int.Parse(splitGlass[0]); }
                catch { }
            }
            else if (splitGlass.Length > 2)
            {
                try { xz = int.Parse(splitGlass[0]); }
                catch { }
                try { y = int.Parse(splitGlass[1]); }
                catch { }
            }
            List <Vector3S> blocks = new List <Vector3S>();

            for (int a = -xz / 2; a < xz / 2 + ((xz % 2 != 0) ? 1 : 0); a++)
            {
                for (int b = -xz / 2; b < xz / 2 + ((xz % 2 != 0) ? 1 : 0); b++)
                {
                    for (int c = 0; c > -y; c--)
                    {
                        blocks.Add(new Vector3S((short)a, (short)b, (short)c));
                    }
                }
            }
            glassesFlat = blocks.ToArray();
            if (midblock)
            {
                blocks.Add(new Vector3S(0, 0, 1));
                glassesFlatAndMiddle = blocks.ToArray();
            }
            blocks.Clear();
            if (splitWater.Length == 1)
            {
                try {
                    xz = int.Parse(splitWater[0]);
                    for (int a = -xz / 2; a < xz / 2 + ((xz % 2 != 0) ? 1 : 0); a++)
                    {
                        for (int b = -xz / 2; b < xz / 2 + ((xz % 2 != 0) ? 1 : 0); b++)
                        {
                            for (int c = -xz / 2; c < xz / 2 + ((xz % 2 != 0) ? 1 : 0); c++)
                            {
                                blocks.Add(new Vector3S((short)a, (short)b, (short)c));
                            }
                        }
                    }
                    fluidCube = blocks.ToArray();
                }
                catch { }
            }
            else if (splitWater.Length > 3)
            {
                try {
                    int x = int.Parse(splitWater[0]);
                    int z = int.Parse(splitWater[1]);
                    y = int.Parse(splitWater[2]);
                    for (int a = -x / 2; a < x / 2 + ((x % 2 != 0) ? 1 : 0); a++)
                    {
                        for (int b = -z / 2; b < z / 2 + ((z % 2 != 0) ? 1 : 0); b++)
                        {
                            for (int c = -y / 2; c < y / 2 + ((y % 2 != 0) ? 1 : 0); y++)
                            {
                                blocks.Add(new Vector3S((short)a, (short)b, (short)c));
                            }
                        }
                    }
                    fluidCube = blocks.ToArray();
                }
                catch { }
            }
            if (fluidCube == null)
            {
                Logger.Log("/fly water: disabled");
            }
            if (glassesFlatAndMiddle == null)
            {
                Logger.Log("/fly +: disabled");
            }
            Command.AddReference(this, "fly");
        }
        protected async Task <bool> InitializeConnectionToArgusTV()
        {
            ServerSettings serverSettings = GetServerSettings();

            return(await Proxies.InitializeAsync(serverSettings, false));
        }
Example #41
0
 void Update()
 {
     if(chooseRegion){
         ConnectionUpdate();
     }else{
         VectorGui.Label("Select Region:");
         foreach(CloudServerRegion region in CloudServerRegion.GetValues(typeof(CloudServerRegion))){
             if (VectorGui.Button(region.ToString()))
             {
                 ServerSettings ss = new ServerSettings();
                 ss.UseCloud("c2bd3559-19e2-4734-88c9-fdd1d789be53", (int)region);
                 PhotonNetwork.Connect(ss.ServerAddress, ss.ServerPort, ss.AppID, "1.0");
                 chooseRegion = true;
                 break;
             }
         }
     }
     /*
     // icon renderer.
     LineRenderManager lines = GameObject.Find("LineRenderManager").GetComponent<LineRenderManager>();
     Vector2 bp = new Vector2(0,0);
     Color ourColor = Color.white;
     lines.AddCircle(new Vector3(bp.x, bp.y, 25), 20, ourColor, Time.time * 20, 3);
     lines.AddCircle(new Vector3(bp.x, bp.y, 25), 20, ourColor, 10);
     int numPoints = 25;
     int currentHealth = 25;
     for(int i=0;i<currentHealth;i++){
         float sAngle = (i/(float)(numPoints)*360.0f-Time.time*40.0f)*Mathf.Deg2Rad;
         Vector3 pa = new Vector3(Mathf.Cos(sAngle)*20+bp.x, Mathf.Sin(sAngle)*20+bp.y, 40);
         float ar = 40+((Mathf.Sin(Time.time*4.0f+i)+1.0f)*0.5f)*(40-20);
         Vector3 pb = new Vector3(Mathf.Cos(sAngle)*ar+bp.x, Mathf.Sin(sAngle)*ar+bp.y, 40);
         lines.AddLine(pa, pb, new Color(ourColor.r, ourColor.g, ourColor.b, 0.25f));
     }
     */
 }
Example #42
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            if (args.Length == 0)
            {
                args = new string[] {
                    "--path=" + Path.GetFullPath("../Frontend"),
                    "--api=http://localhost:7077/rpc",
                };
            }

            string apiHost = null;

            var apiTag = "--api";

            foreach (var arg in args)
            {
                if (arg.StartsWith(apiTag))
                {
                    apiHost = arg.Substring(apiTag.Length + 1);
                }
            }

            if (string.IsNullOrEmpty(apiHost))
            {
                Console.WriteLine("Please insert a valid --api argument, should be URL pointing to a valid Phantasma RPC node");
                Environment.Exit(-1);
            }

            var settings = ServerSettings.Parse(args);

            var server = new HTTPServer(settings, ConsoleLogger.Write);

            var templateEngine = new TemplateEngine(server, "views");

            Console.WriteLine("Frontend path: " + settings.Path);
            Console.WriteLine("Phantasma RPC: " + apiHost);

            /*var locFiles = Directory.GetFiles("Localization", "*.csv");
             * foreach (var fileName in locFiles)
             * {
             *  var language = Path.GetFileNameWithoutExtension(fileName).Split("_")[1];
             *  LocalizationManager.LoadLocalization(language, fileName);
             * }*/

            phantasmaAPI = new SDK.API(apiHost);
            GetAllOTC();

            Func <HTTPRequest, Dictionary <string, object> > GetContext = (request) =>
            {
                var context = new Dictionary <string, object>();

                context["available_languages"] = LocalizationManager.Languages;

                var langCode = request.session.GetString("language", "auto");

                if (langCode == "auto")
                {
                    langCode = DetectLanguage(request);
                    request.session.SetString("language", langCode);
                }

                context["current_language"] = LocalizationManager.GetLanguage(langCode);

                context["offers"] = offers;

                var userAddr = request.session.GetString("userAddr", "empty");
                if (userAddr == "empty")
                {
                    userAddr = request.GetVariable("userAddr");
                    request.session.SetString("userAddr", userAddr);
                }
                context["userAddr"] = userAddr;

                var provider = request.session.GetString("provider", "none");
                if (provider == "none")
                {
                    provider = request.GetVariable("provider");
                    request.session.SetString("provider", provider);
                }
                context["provider"] = provider;

                var connector = request.session.GetString("connector", "none");
                if (connector == "none")
                {
                    connector = request.GetVariable("connector");
                    request.session.SetString("connector", connector);
                }
                context["connector"] = connector;


                var logged = request.session.GetBool("logged", false);
                context["logged"] = logged;

                return(context);
            };

            server.Get("/language/{code}", (request) =>
            {
                var code = request.GetVariable("code");

                if (LocalizationManager.GetLanguage(code) != null)
                {
                    request.session.SetString("language", code);
                }

                return(HTTPResponse.Redirect("/"));
            });

            server.Get("/", (request) =>
            {
                var context = GetContext(request);
                return(templateEngine.Render(context, "main"));
            });

            server.Post("/login", (request) =>
            {
                var userAddr  = request.GetVariable("address");
                var provider  = request.GetVariable("provider");
                var connector = request.GetVariable("connector");

                if (userAddr != null && provider != null && connector != null)
                {
                    request.session.SetString("userAddr", userAddr);
                    request.session.SetString("provider", provider);
                    request.session.SetString("connector", connector);
                    request.session.SetBool("logged", true);
                }
                return(HTTPResponse.FromString("{login:true}"));
            });

            server.Post("/logout", (request) =>
            {
                var logged = request.session.GetBool("logged", false);

                if (logged)
                {
                    request.session.Remove("userAddr");
                    request.session.Remove("provider");
                    request.session.Remove("connector");
                    request.session.Remove("logged");
                }

                return(HTTPResponse.FromString("{logout:true}"));
            });

            server.Get("/offers", (request) =>
            {
                GetAllOTC();
                var context = GetContext(request);
                return(templateEngine.Render(context, "offer"));
            });

            server.Get("/offers/json", (request) =>
            {
                GetAllOTC();
                var js                      = new JsonSerializerOptions();
                js.WriteIndented            = true;
                js.IgnoreReadOnlyProperties = false;
                js.IgnoreNullValues         = false;
                var json                    = JsonSerializer.Serialize(offers, js);

                string output = "[";
                offers.ForEach((offer) =>
                {
                    output += "{";
                    output += $"id:'{offer.ID}',";
                    output += $"seller:'{offer.seller}',";
                    output += $"sellSymbol:'{offer.sellSymbol}',";
                    output += $"sellAmount:{offer.sellAmount},";
                    output += $"buySymbol:'{offer.buySymbol}',";
                    output += $"buyAmount:{offer.buyAmount}";
                    output += "},";
                });
                output.Remove(output.Length - 1);
                output += "]";
                return(HTTPResponse.FromString(output));
            });

            server.Run();

            bool running = true;

            Console.CancelKeyPress += delegate {
                server.Stop();
                running = false;
            };

            while (running)
            {
                Thread.Sleep(500);
            }
        }
Example #43
0
 public void Use(Player p, string[] args)
 {
     if (args.Length == 0) { Help(p); return; }
     string function = args[0].ToLower();
     switch (function) {
         #region ==Enter==
         case "enter":
         case "join":
             bool ops = false;
             Server.ForeachPlayer(delegate(Player pl) { if (pl.Group.Permission >= ServerSettings.GetSettingInt("ReviewModeratorPerm")) { ops = true; } });
             if (!ops) { p.SendMessage("There are no ops online! Please wait for one to come on before asking for review"); return; }
             if (Server.ReviewList.Contains(p)) { p.SendMessage("You're already in the review queue!"); SendPositon(false, p); return; }
                 Server.ReviewList.Add(p);
                 p.SendMessage("You have been added to the review queue!");
                 Player.UniversalChatOps(p.Color.ToString() + p.Username + " has entered the review queue!");
                 SendPositon(false, p);
             break;
         #endregion
         #region ==View==
         case "view":
             if (Server.ReviewList.Count == 0) { p.SendMessage("There are no players in the review queue!"); return; }
             string send = "Players in the review queue: ";
             foreach (Player pl in Server.ReviewList) 
             {
                 send += p.Color + pl.Username + ", ";
             }
             send = send.Trim().TrimEnd(',');
             p.SendMessage(send);
             break;
         #endregion
         #region ==Position==
         case "position":
         case "pos":
         case "place":
             if (!Server.ReviewList.Contains(p)) {
                 p.SendMessage("You're not in the review queue!");
                 p.SendMessage("Use &9/review &benter " + Server.DefaultColor + "to enter the queue!");
                 return;
             }
             SendPositon(false, p);
             break;
         #endregion
         #region ==Remove==
         case "remove":
             if (p.Group.Permission < ServerSettings.GetSettingInt("ReviewModeratorPerm")) { p.SendMessage("You can't remove players from review queue!"); return; }
             Player who = Player.Find(args[1]);
             if (who == null) { p.SendMessage("Cannot find player!"); return; }
             if (!Server.ReviewList.Contains(who)) { p.SendMessage(who.Username + " is not in the review queue!"); return; }
             Server.ReviewList.Remove(who);
             Player.UniversalChat(who.Username + " has been removed from the review queue!");
             SendPositon(true);
             break;
         #endregion
         #region ==Leave==
         case "leave":
             if (!Server.ReviewList.Contains(p)) 
             { 
                 p.SendMessage("You're not in the review queue!");
                 p.SendMessage("Use &9/review &benter " + Server.DefaultColor + "to enter the queue!");
                 return;
             }
             Server.ReviewList.Remove(p);
             Player.UniversalChat(p.Color.ToString() + p.Username + " has left the queue!");
             p.SendMessage("You have been removed from the review queue!");
             SendPositon(true);
             break;
         #endregion
         #region ==Next==
         case "next":
             if (p.Group.Permission < ServerSettings.GetSettingInt("ReviewModeratorPerm")) 
             { 
                 p.SendMessage("You can't use &9/review &bnext" + Server.DefaultColor + "!"); 
                 p.SendMessage("Use &9/review &benter " + Server.DefaultColor + "to enter the queue!");
                 return;
             }
             Player rev = Server.ReviewList[0];
             if (rev == null) { p.SendMessage(rev.Username + " isn't online! Removing..."); Server.ReviewList.Remove(rev); SendPositon(true); return; }
             if (rev == p) { p.SendMessage("Cannot review yourself! Removing..."); Server.ReviewList.Remove(rev); SendPositon(true); return; }              
             SendPositon(true);
             string[] meep = new string[1] { rev.Username };
             ICommand cmd = Command.Find("tp");
             p.SendMessage(cmd.Name);
             cmd.Use(p, meep);
             Server.ReviewList.Remove(rev);
             p.SendMessage("You are reviewing " + rev.Username + "!");
             p.SendMessage("Rank: " + rev.Group.Name);
             p.SendMessage(p.Username + " has came to review you!");
             break;
         #endregion
         #region ==Clear==
         case "clear":
             if (p.Group.Permission < ServerSettings.GetSettingInt("ReviewModeratorPerm")) { p.SendMessage("You can't clear the review queue!"); return; }
             Player.UniversalChat("The review queue has been cleared by " + p.Username + "!");
             Server.ReviewList.Clear();
             break;
         default:
             p.SendMessage("You have specified a wrong option!");
             Help(p);
             break;
         #endregion
     }
 }
Example #44
0
 public AppSettingsAccessor(IOptions <ServerSettings> optionsAccessor)
 {
     _serverSettings = optionsAccessor.Value;
     _filePath       = string.Concat(Directory.GetCurrentDirectory(), "\\appsettings.json");
 }
Example #45
0
        /// <summary>
        /// Try to connect to the core service, if not connected.
        /// </summary>
        /// <param name="showHomeOnError"></param>
        /// <param name="schowError"></param>
        /// <returns></returns>
        internal static bool EnsureConnection(bool showHomeOnError, bool schowError)
        {
            if (!Proxies.IsInitialized)
            {
                bool           succeeded      = false;
                string         errorMessage   = string.Empty;
                ServerSettings serverSettings = LoadServerSettings();

                if (IsSingleSeat)
                {
                    StartServices(serverSettings.ServerName);
                }

                /*else
                 * {
                 *  if (!NetworkAvailable)
                 *  {
                 *      if (((showHomeOnError || !_connectionErrorShown)
                 *          && GUIWindowManager.ActiveWindow != 0) && schowError)
                 *      {
                 *          GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                 *          dlg.Reset();
                 *          dlg.SetHeading(Utility.GetLocalizedText(TextId.Error));
                 *          dlg.SetLine(1, "Failed to connect to ARGUS TV");
                 *          dlg.SetLine(2, "No internet connection!");
                 *          dlg.SetLine(3, "");
                 *          dlg.DoModal(GUIWindowManager.ActiveWindow);
                 *          _connectionErrorShown = true;
                 *      }
                 *
                 *      _connected = false;
                 *      return false;
                 *  }
                 * }*/

                succeeded = Utility.InitialiseServerSettings(serverSettings, out errorMessage);
                if (!succeeded && !IsSingleSeat)
                {
                    StartServices(serverSettings.ServerName);
                    succeeded = Utility.InitialiseServerSettings(serverSettings, out errorMessage);
                }

                if (!succeeded)
                {
                    if (((showHomeOnError || !_connectionErrorShown) &&
                         GUIWindowManager.ActiveWindow != 0) && schowError)
                    {
                        GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                        dlg.Reset();
                        dlg.SetHeading("Failed to connect to ARGUS TV");
                        dlg.SetLine(1, serverSettings.ServiceUrlPrefix);
                        dlg.SetLine(2, errorMessage);
                        dlg.SetLine(3, "Check plugin setup in Configuration");
                        dlg.DoModal(GUIWindowManager.ActiveWindow);
                        _connectionErrorShown = true;
                    }
                }
            }

            if (!Proxies.IsInitialized)
            {
                if (showHomeOnError && GUIWindowManager.ActiveWindow != 0)
                {
                    using (Settings xmlreader = new MPSettings())
                    {
                        bool _startWithBasicHome = xmlreader.GetValueAsBool("gui", "startbasichome", false);
                        if (_startWithBasicHome && System.IO.File.Exists(GUIGraphicsContext.Skin + @"\basichome.xml"))
                        {
                            GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SECOND_HOME);
                        }
                        else
                        {
                            GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_HOME);
                        }
                    }
                }
                _connected = false;
                return(false);
            }

            _connected = true;
            return(true);
        }
Example #46
0
        Action ResetAdvancedPanel(Widget panel)
        {
            var ds = Game.Settings.Debug;
            var ss = Game.Settings.Server;
            var dds = new DebugSettings();
            var dss = new ServerSettings();

            return () =>
            {
                ss.DiscoverNatDevices = dss.DiscoverNatDevices;
                ss.VerboseNatDiscovery = dss.VerboseNatDiscovery;
                ds.PerfText = dds.PerfText;
                ds.PerfGraph = dds.PerfGraph;
                ds.SanityCheckUnsyncedCode = dds.SanityCheckUnsyncedCode;
                ds.BotDebug = dds.BotDebug;
                ds.LuaDebug = dds.LuaDebug;
            };
        }
    public static void ReLoadCurrentSettings()
    {
        // this now warns developers if there are more than one settings files in resources folders. first will be used.
        UnityEngine.Object[] settingFiles = Resources.LoadAll(PhotonNetwork.serverSettingsAssetFile, typeof(ServerSettings));
        if (settingFiles != null && settingFiles.Length > 0)
        {
            PhotonEditor.Current = (ServerSettings)settingFiles[0];

            if (settingFiles.Length > 1)
            {
                Debug.LogWarning(CurrentLang.MoreThanOneLabel + PhotonNetwork.serverSettingsAssetFile + CurrentLang.FilesInResourceFolderLabel + AssetDatabase.GetAssetPath(PhotonEditor.Current));
            }
        }
    }
Example #48
0
        private void OnStartup(object a, StartupEventArgs e)
        {
            Console.CancelKeyPress += (sender, args) => Dispatcher.Invoke(() =>
            {
                args.Cancel = true;
                Shutdown();
            });
            Icon = new TaskbarIcon();
            using (var iconStream = GetResourceStream(new Uri("pack://application:,,,/ShokoServer;component/db.ico"))
                                    ?.Stream)
            {
                if (iconStream != null)
                {
                    Icon.Icon = new Icon(iconStream);
                }
            }
            Icon.ToolTipText = "Shoko Server";
            ContextMenu menu  = new ContextMenu();
            MenuItem    webui = new MenuItem();

            webui.Header = "Open WebUI";
            webui.Click += (sender, args) =>
            {
                try
                {
                    string IP = GetLocalIPv4(NetworkInterfaceType.Ethernet);
                    if (string.IsNullOrEmpty(IP))
                    {
                        IP = "127.0.0.1";
                    }

                    string url = $"http://{IP}:{ServerSettings.Instance.ServerPort}";
                    OpenUrl(url);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, ex.ToString());
                }
            };
            menu.Items.Add(webui);
            webui        = new MenuItem();
            webui.Header = "Exit";
            webui.Click += (sender, args) => Dispatcher.Invoke(Shutdown);
            menu.Items.Add(webui);
            Icon.ContextMenu    = menu;
            Icon.MenuActivation = PopupActivationMode.All;
            Icon.Visibility     = Visibility.Visible;

            string instance = null;

            for (int x = 0; x < e.Args.Length; x++)
            {
                if (!e.Args[x].Equals("instance", StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }
                if (x + 1 >= e.Args.Length)
                {
                    continue;
                }
                instance = e.Args[x + 1];
                break;
            }

            var arguments = new ProgramArguments {
                Instance = instance
            };

            if (!string.IsNullOrEmpty(arguments.Instance))
            {
                ServerSettings.DefaultInstance = arguments.Instance;
            }

            ShokoServer.Instance.InitLogger();

            ServerSettings.LoadSettings();
            ServerState.Instance.LoadSettings();

            if (!ShokoServer.Instance.StartUpServer())
            {
                return;
            }

            // Ensure that the AniDB socket is initialized. Try to Login, then start the server if successful.
            ShokoServer.Instance.RestartAniDBSocket();
            if (!ServerSettings.Instance.FirstRun)
            {
                ShokoServer.RunWorkSetupDB();
            }
            else
            {
                Logger.Warn("The Server is NOT STARTED. It needs to be configured via webui or the settings.json");
            }

            ShokoServer.Instance.ServerShutdown += (sender, eventArgs) => Shutdown();
            Utils.YesNoRequired += (sender, e) =>
            {
                e.Cancel = true;
            };

            ServerState.Instance.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == "StartupFailedMessage" && ServerState.Instance.StartupFailed)
                {
                    Console.WriteLine("Startup failed! Error message: " + ServerState.Instance.StartupFailedMessage);
                }
            };
            ShokoService.CmdProcessorGeneral.OnQueueStateChangedEvent +=
                ev => Console.WriteLine($"General Queue state change: {ev.QueueState.formatMessage()}");
        }
Example #49
0
        public void UpdateServer(ServerSettings settings)
        {
            var roiPercentChanged = settings.RegionOfInterestPercent != ServerSettings.RegionOfInterestPercent;

            ServerSettings = settings;

            if (roiPercentChanged)
            {
                Camera.SetRegionOfInterest(GetRegionOfInterest());
            }

            Browsers.InformSettings(ServerSettings);

            if (!roiPercentChanged) // don't spam
            {
                Browsers.Toast("New settings received");
            }
        }
Example #50
0
    public override void OnInspectorGUI()
    {
        ServerSettings settings = (ServerSettings)target;

        Undo.RecordObject(settings, "Edit PhotonServerSettings");
        settings.HostType     = (ServerSettings.HostingOption)EditorGUILayout.EnumPopup("Hosting", settings.HostType);
        EditorGUI.indentLevel = 1;

        switch (settings.HostType)
        {
        case ServerSettings.HostingOption.BestRegion:
        case ServerSettings.HostingOption.PhotonCloud:
            // region selection
            if (settings.HostType == ServerSettings.HostingOption.PhotonCloud)
            {
                settings.PreferredRegion = (CloudRegionCode)EditorGUILayout.EnumPopup("Region", settings.PreferredRegion);
            }
            else     // Bestregion
            {
                string _regionFeedback = "Prefs:" + ServerSettings.BestRegionCodeInPreferences.ToString();

                // the NameServer does not have a region itself. it's global (although it has regional instances)
                if (PhotonNetwork.connected && PhotonNetwork.Server != ServerConnection.NameServer)
                {
                    _regionFeedback = "Current:" + PhotonNetwork.CloudRegion + " " + _regionFeedback;
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel(" ");
                Rect rect        = GUILayoutUtility.GetRect(new GUIContent(_regionFeedback), "Label");
                int  indentLevel = EditorGUI.indentLevel;
                EditorGUI.indentLevel = 0;
                EditorGUI.LabelField(rect, _regionFeedback);
                EditorGUI.indentLevel = indentLevel;

                rect.x    += rect.width - 39;
                rect.width = 39;

                rect.height -= 2;
                if (GUI.Button(rect, "Reset", EditorStyles.miniButton))
                {
                    ServerSettings.ResetBestRegionCodeInPreferences();
                }
                EditorGUILayout.EndHorizontal();


                // Dashboard region settings
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Regions");
                Rect rect2 = GUILayoutUtility.GetRect(new GUIContent("Online WhiteList"), "Label");
                if (!string.IsNullOrEmpty(settings.AppID))
                {
                    int indentLevel2 = EditorGUI.indentLevel;
                    EditorGUI.indentLevel = 0;
                    EditorGUI.LabelField(rect2, "Online WhiteList");
                    EditorGUI.indentLevel = indentLevel2;

                    rect2.x    += rect2.width - 80;
                    rect2.width = 80;

                    rect2.height -= 2;
                    if (GUI.Button(rect2, "Dashboard", EditorStyles.miniButton))
                    {
                        Application.OpenURL("https://www.photonengine.com/en-US/Dashboard/Manage/" + settings.AppID);
                    }
                }
                else
                {
                    GUI.Label(rect2, "n/a");
                }

                EditorGUILayout.EndHorizontal();


                //EditorGUI.indentLevel ++;
                //CloudRegionFlag valRegions = (CloudRegionFlag)EditorGUILayout.EnumMaskField(" ", settings.EnabledRegions);

                //                if (valRegions != settings.EnabledRegions)
                //                {
                //                    settings.EnabledRegions = valRegions;
                //                    this.showMustHaveRegion = valRegions == 0;
                //                }
                //                if (this.showMustHaveRegion)
                //                {
                //                    EditorGUILayout.HelpBox("You should enable at least two regions for 'Best Region' hosting.", MessageType.Warning);
                //                }
                //EditorGUI.indentLevel --;
            }

            // appid
            string valAppId = EditorGUILayout.TextField("AppId", settings.AppID);
            if (valAppId != settings.AppID)
            {
                settings.AppID = valAppId.Trim();
            }
            if (!ServerSettings.IsAppId(settings.AppID))
            {
                EditorGUILayout.HelpBox("PUN needs an AppId (GUID).\nFind it online in the Dashboard.", MessageType.Warning);
            }

            // protocol
            ConnectionProtocol valProtocol = settings.Protocol;
            valProtocol       = (ConnectionProtocol)EditorGUILayout.EnumPopup("Protocol", valProtocol);
            settings.Protocol = (ConnectionProtocol)valProtocol;
                #if UNITY_WEBGL
            EditorGUILayout.HelpBox("WebGL always use Secure WebSockets as protocol.\nThis setting gets ignored in current export.", MessageType.Warning);
                #endif
            break;

        case ServerSettings.HostingOption.SelfHosted:
            // address and port (depends on protocol below)
            bool hidePort = false;
            if (settings.Protocol == ConnectionProtocol.Udp && (settings.ServerPort == 4530 || settings.ServerPort == 0))
            {
                settings.ServerPort = 5055;
            }
            else if (settings.Protocol == ConnectionProtocol.Tcp && (settings.ServerPort == 5055 || settings.ServerPort == 0))
            {
                settings.ServerPort = 4530;
            }
                #if RHTTP
            if (settings.Protocol == ConnectionProtocol.RHttp)
            {
                settings.ServerPort = 0;
                hidePort            = true;
            }
                #endif
            settings.ServerAddress = EditorGUILayout.TextField("Server Address", settings.ServerAddress);
            settings.ServerAddress = settings.ServerAddress.Trim();
            if (!hidePort)
            {
                settings.ServerPort = EditorGUILayout.IntField("Server Port", settings.ServerPort);
            }
            // protocol
            valProtocol       = settings.Protocol;
            valProtocol       = (ConnectionProtocol)EditorGUILayout.EnumPopup("Protocol", valProtocol);
            settings.Protocol = (ConnectionProtocol)valProtocol;
                #if UNITY_WEBGL
            EditorGUILayout.HelpBox("WebGL always use Secure WebSockets as protocol.\nThis setting gets ignored in current export.", MessageType.Warning);
                #endif

            // appid
            settings.AppID = EditorGUILayout.TextField("AppId", settings.AppID);
            settings.AppID = settings.AppID.Trim();
            break;

        case ServerSettings.HostingOption.OfflineMode:
            EditorGUI.indentLevel = 0;
            EditorGUILayout.HelpBox("In 'Offline Mode', the client does not communicate with a server.\nAll settings are hidden currently.", MessageType.Info);
            break;

        case ServerSettings.HostingOption.NotSet:
            EditorGUI.indentLevel = 0;
            EditorGUILayout.HelpBox("Hosting is 'Not Set'.\nConnectUsingSettings() will not be able to connect.\nSelect another option or run the PUN Wizard.", MessageType.Info);
            break;

        default:
            DrawDefaultInspector();
            break;
        }

        if (PhotonEditor.CheckPunPlus())
        {
            settings.Protocol = ConnectionProtocol.Udp;
            EditorGUILayout.HelpBox("You seem to use PUN+.\nPUN+ only supports reliable UDP so the protocol is locked.", MessageType.Info);
        }



        // CHAT SETTINGS
        if (PhotonEditorUtils.HasChat)
        {
            GUILayout.Space(5);
            EditorGUI.indentLevel = 0;
            EditorGUILayout.LabelField("Photon Chat Settings");
            EditorGUI.indentLevel = 1;
            string valChatAppid = EditorGUILayout.TextField("Chat AppId", settings.ChatAppID);
            if (valChatAppid != settings.ChatAppID)
            {
                settings.ChatAppID = valChatAppid.Trim();
            }
            if (!ServerSettings.IsAppId(settings.ChatAppID))
            {
                EditorGUILayout.HelpBox("Photon Chat needs an AppId (GUID).\nFind it online in the Dashboard.", MessageType.Warning);
            }

            EditorGUI.indentLevel = 0;
        }



        // VOICE SETTINGS
        if (PhotonEditorUtils.HasVoice)
        {
            GUILayout.Space(5);
            EditorGUI.indentLevel = 0;
            EditorGUILayout.LabelField("Photon Voice Settings");
            EditorGUI.indentLevel = 1;
            switch (settings.HostType)
            {
            case ServerSettings.HostingOption.BestRegion:
            case ServerSettings.HostingOption.PhotonCloud:
                // voice appid
                string valVoiceAppId = EditorGUILayout.TextField("Voice AppId", settings.VoiceAppID);
                if (valVoiceAppId != settings.VoiceAppID)
                {
                    settings.VoiceAppID = valVoiceAppId.Trim();
                }
                if (!ServerSettings.IsAppId(settings.VoiceAppID))
                {
                    EditorGUILayout.HelpBox("Photon Voice needs an AppId (GUID).\nFind it online in the Dashboard.", MessageType.Warning);
                }
                break;

            case ServerSettings.HostingOption.SelfHosted:
                if (settings.VoiceServerPort == 0)
                {
                    settings.VoiceServerPort = 5055;
                }
                settings.VoiceServerPort = EditorGUILayout.IntField("Server Port UDP", settings.VoiceServerPort);
                break;

            case ServerSettings.HostingOption.OfflineMode:
            case ServerSettings.HostingOption.NotSet:
                break;
            }
            EditorGUI.indentLevel = 0;
        }



        // PUN Client Settings
        GUILayout.Space(5);
        EditorGUI.indentLevel = 0;
        EditorGUILayout.LabelField("Client Settings");
        EditorGUI.indentLevel = 1;
        //EditorGUILayout.LabelField("game version");
        settings.JoinLobby             = EditorGUILayout.Toggle("Auto-Join Lobby", settings.JoinLobby);
        settings.EnableLobbyStatistics = EditorGUILayout.Toggle("Enable Lobby Stats", settings.EnableLobbyStatistics);

        // Pun Logging Level
        PhotonLogLevel _PunLogging = (PhotonLogLevel)EditorGUILayout.EnumPopup("Pun Logging", settings.PunLogging);
        if (EditorApplication.isPlaying && PhotonNetwork.logLevel != _PunLogging)
        {
            PhotonNetwork.logLevel = _PunLogging;
        }
        settings.PunLogging = _PunLogging;

        // Network Logging Level
        DebugLevel _DebugLevel = (DebugLevel)EditorGUILayout.EnumPopup("Network Logging", settings.NetworkLogging);
        if (EditorApplication.isPlaying && settings.NetworkLogging != _DebugLevel)
        {
            settings.NetworkLogging = _DebugLevel;
        }
        settings.NetworkLogging = _DebugLevel;


        //EditorGUILayout.LabelField("automaticallySyncScene");
        //EditorGUILayout.LabelField("autoCleanUpPlayerObjects");
        //EditorGUILayout.LabelField("lobby stats");
        //EditorGUILayout.LabelField("sendrate / serialize rate");
        //EditorGUILayout.LabelField("quick resends");
        //EditorGUILayout.LabelField("max resends");
        //EditorGUILayout.LabelField("enable crc checking");


        // Application settings
        GUILayout.Space(5);
        EditorGUI.indentLevel = 0;
        EditorGUILayout.LabelField("Build Settings");
        EditorGUI.indentLevel = 1;

        settings.RunInBackground = EditorGUILayout.Toggle("Run In Background", settings.RunInBackground);


        // RPC-shortcut list
        GUILayout.Space(5);
        EditorGUI.indentLevel = 0;
        SerializedObject   sObj  = new SerializedObject(target);
        SerializedProperty sRpcs = sObj.FindProperty("RpcList");
        EditorGUILayout.PropertyField(sRpcs, true);
        sObj.ApplyModifiedProperties();

        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        if (GUILayout.Button("Refresh RPCs"))
        {
            PhotonEditor.UpdateRpcList();
            Repaint();
        }
        if (GUILayout.Button("Clear RPCs"))
        {
            PhotonEditor.ClearRpcList();
        }
        if (GUILayout.Button("Log HashCode"))
        {
            Debug.Log("RPC-List HashCode: " + RpcListHashCode() + ". Make sure clients that send each other RPCs have the same RPC-List.");
        }
        GUILayout.Space(20);
        GUILayout.EndHorizontal();


        //SerializedProperty sp = serializedObject.FindProperty("RpcList");
        //EditorGUILayout.PropertyField(sp, true);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);     // even in Unity 5.3+ it's OK to SetDirty() for non-scene objects.
        }
    }
Example #51
0
        public Server(List <IPEndPoint> endpoints, ServerSettings settings, ModData modData, ServerType type)
        {
            Log.AddChannel("server", "server.log", true);

            SocketException lastException   = null;
            var             checkReadServer = new List <Socket>();

            foreach (var endpoint in endpoints)
            {
                var listener = new TcpListener(endpoint);
                try
                {
                    try
                    {
                        listener.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, 1);
                    }
                    catch (Exception ex)
                    {
                        if (ex is SocketException || ex is ArgumentException)
                        {
                            Log.Write("server", "Failed to set socket option on {0}: {1}", endpoint.ToString(), ex.Message);
                        }
                        else
                        {
                            throw;
                        }
                    }

                    listener.Start();
                    listeners.Add(listener);
                    checkReadServer.Add(listener.Server);
                }
                catch (SocketException ex)
                {
                    lastException = ex;
                    Log.Write("server", "Failed to listen on {0}: {1}", endpoint.ToString(), ex.Message);
                }
            }

            if (listeners.Count == 0)
            {
                throw lastException;
            }

            Type     = type;
            Settings = settings;

            Settings.Name = OpenRA.Settings.SanitizedServerName(Settings.Name);

            ModData = modData;

            playerDatabase = modData.Manifest.Get <PlayerDatabase>();

            randomSeed = (int)DateTime.Now.ToBinary();

            if (type != ServerType.Local && settings.EnableGeoIP)
            {
                GeoIP.Initialize();
            }

            if (UPnP.Status == UPnPStatus.Enabled)
            {
                UPnP.ForwardPort(Settings.ListenPort, Settings.ListenPort).Wait();
            }

            foreach (var trait in modData.Manifest.ServerTraits)
            {
                serverTraits.Add(modData.ObjectCreator.CreateObject <ServerTrait>(trait));
            }

            serverTraits.TrimExcess();

            LobbyInfo = new Session
            {
                GlobalSettings =
                {
                    RandomSeed         = randomSeed,
                    Map                = settings.Map,
                    ServerName         = settings.Name,
                    EnableSingleplayer = settings.EnableSingleplayer || Type != ServerType.Dedicated,
                    EnableSyncReports  = settings.EnableSyncReports,
                    GameUid            = Guid.NewGuid().ToString(),
                    Dedicated          = Type == ServerType.Dedicated
                }
            };

            new Thread(_ =>
            {
                foreach (var t in serverTraits.WithInterface <INotifyServerStart>())
                {
                    t.ServerStarted(this);
                }

                Log.Write("server", "Initial mod: {0}", ModData.Manifest.Id);
                Log.Write("server", "Initial map: {0}", LobbyInfo.GlobalSettings.Map);

                while (true)
                {
                    var checkRead = new List <Socket>();
                    if (State == ServerState.WaitingPlayers)
                    {
                        checkRead.AddRange(checkReadServer);
                    }

                    checkRead.AddRange(Conns.Select(c => c.Socket));
                    checkRead.AddRange(PreConns.Select(c => c.Socket));

                    // Block for at most 1 second in order to guarantee a minimum tick rate for ServerTraits
                    // Decrease this to 100ms to improve responsiveness if we are waiting for an authentication query
                    var localTimeout = waitingForAuthenticationCallback > 0 ? 100000 : 1000000;
                    if (checkRead.Count > 0)
                    {
                        Socket.Select(checkRead, null, null, localTimeout);
                    }

                    if (State == ServerState.ShuttingDown)
                    {
                        EndGame();
                        break;
                    }

                    foreach (var s in checkRead)
                    {
                        var serverIndex = checkReadServer.IndexOf(s);
                        if (serverIndex >= 0)
                        {
                            AcceptConnection(listeners[serverIndex]);
                            continue;
                        }

                        var preConn = PreConns.SingleOrDefault(c => c.Socket == s);
                        if (preConn != null)
                        {
                            preConn.ReadData(this);
                            continue;
                        }

                        var conn = Conns.SingleOrDefault(c => c.Socket == s);
                        conn?.ReadData(this);
                    }

                    delayedActions.PerformActions(0);

                    // PERF: Dedicated servers need to drain the action queue to remove references blocking the GC from cleaning up disposed objects.
                    if (Type == ServerType.Dedicated)
                    {
                        Game.PerformDelayedActions();
                    }

                    foreach (var t in serverTraits.WithInterface <ITick>())
                    {
                        t.Tick(this);
                    }

                    if (State == ServerState.ShuttingDown)
                    {
                        EndGame();
                        if (UPnP.Status == UPnPStatus.Enabled)
                        {
                            UPnP.RemovePortForward().Wait();
                        }
                        break;
                    }
                }

                foreach (var t in serverTraits.WithInterface <INotifyServerShutdown>())
                {
                    t.ServerShutdown(this);
                }

                PreConns.Clear();
                Conns.Clear();

                foreach (var listener in listeners)
                {
                    try { listener.Stop(); }
                    catch { }
                }
            })
            {
                IsBackground = true
            }.Start();
        }
 public AccountController(IAccountService accountService, ServerSettings serverSettings, IMapper mapper)
 {
     _accountService = accountService;
     _serverSettings = serverSettings;
     _mapper         = mapper;
 }
Example #53
0
 public TestServer(Protocol protocol, IPAddress ipAddress, ServerSettings serverSettings = null) : base(
         protocol,
         ipAddress,
         serverSettings)
 {
 }
Example #54
0
 protected BaseApi(ServerSettings settings, CookieContainer cookies)
 {
     Settings     = settings;
     this.cookies = cookies;
 }
Example #55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerOpenedEvent"/> struct.
 /// </summary>
 /// <param name="serverId">The server identifier.</param>
 /// <param name="serverSettings">The server settings.</param>
 /// <param name="duration">The duration of time it took to open the server.</param>
 public ServerOpenedEvent(ServerId serverId, ServerSettings serverSettings, TimeSpan duration)
 {
     _serverId       = serverId;
     _serverSettings = serverSettings;
     _duration       = duration;
 }
Example #56
0
    public override void OnInspectorGUI()
    {
        ServerSettings settings = (ServerSettings)target;

        Undo.RecordObject(settings, "Edit PhotonServerSettings");

        settings.HostType     = (ServerSettings.HostingOption)EditorGUILayout.EnumPopup("Hosting", settings.HostType);
        EditorGUI.indentLevel = 1;

        switch (settings.HostType)
        {
        case ServerSettings.HostingOption.BestRegion:
        case ServerSettings.HostingOption.PhotonCloud:
            // region selection
            if (settings.HostType == ServerSettings.HostingOption.PhotonCloud)
            {
                settings.PreferredRegion = (CloudRegionCode)EditorGUILayout.EnumPopup("Region", settings.PreferredRegion);
            }
            else
            {
                CloudRegionFlag valRegions = (CloudRegionFlag)EditorGUILayout.EnumMaskField("Enabled Regions", settings.EnabledRegions);

                if (valRegions != settings.EnabledRegions)
                {
                    settings.EnabledRegions = valRegions;
                    this.showMustHaveRegion = valRegions == 0;
                }
                if (this.showMustHaveRegion)
                {
                    EditorGUILayout.HelpBox("You should enable at least two regions for 'Best Region' hosting.", MessageType.Warning);
                }
            }

            // appid
            string valAppId = EditorGUILayout.TextField("AppId", settings.AppID);
            if (valAppId != settings.AppID)
            {
                settings.AppID     = valAppId;
                this.showAppIdHint = !IsAppId(settings.AppID);
            }
            if (this.showAppIdHint)
            {
                EditorGUILayout.HelpBox("The Photon Cloud needs an AppId (GUID) set.\nYou can find it online in your Dashboard.", MessageType.Warning);
            }

            // protocol
            ProtocolChoices valProtocol = settings.Protocol == ConnectionProtocol.Tcp ? ProtocolChoices.Tcp : ProtocolChoices.Udp;
            valProtocol       = (ProtocolChoices)EditorGUILayout.EnumPopup("Protocol", valProtocol);
            settings.Protocol = (ConnectionProtocol)valProtocol;
                #if UNITY_WEBGL
            EditorGUILayout.HelpBox("WebGL always use Secure WebSockets as protocol.\nThis setting gets ignored in current export.", MessageType.Warning);
                #endif
            break;

        case ServerSettings.HostingOption.SelfHosted:
            // address and port (depends on protocol below)
            bool hidePort = false;
            if (settings.Protocol == ConnectionProtocol.Udp && (settings.ServerPort == 4530 || settings.ServerPort == 0))
            {
                settings.ServerPort = 5055;
            }
            else if (settings.Protocol == ConnectionProtocol.Tcp && (settings.ServerPort == 5055 || settings.ServerPort == 0))
            {
                settings.ServerPort = 4530;
            }
                #if RHTTP
            if (settings.Protocol == ConnectionProtocol.RHttp)
            {
                settings.ServerPort = 0;
                hidePort            = true;
            }
                #endif
            settings.ServerAddress = EditorGUILayout.TextField("Server Address", settings.ServerAddress);
            settings.ServerAddress = settings.ServerAddress.Trim();
            if (!hidePort)
            {
                settings.ServerPort = EditorGUILayout.IntField("Server Port", settings.ServerPort);
            }

            // protocol
            valProtocol       = settings.Protocol == ConnectionProtocol.Tcp ? ProtocolChoices.Tcp : ProtocolChoices.Udp;
            valProtocol       = (ProtocolChoices)EditorGUILayout.EnumPopup("Protocol", valProtocol);
            settings.Protocol = (ConnectionProtocol)valProtocol;
                #if UNITY_WEBGL
            EditorGUILayout.HelpBox("WebGL always use Secure WebSockets as protocol.\nThis setting gets ignored in current export.", MessageType.Warning);
                #endif

            // appid
            settings.AppID = EditorGUILayout.TextField("AppId", settings.AppID);
            break;

        case ServerSettings.HostingOption.OfflineMode:
            EditorGUI.indentLevel = 0;
            EditorGUILayout.HelpBox("In 'Offline Mode', the client does not communicate with a server.\nAll settings are hidden currently.", MessageType.Info);
            break;

        case ServerSettings.HostingOption.NotSet:
            EditorGUI.indentLevel = 0;
            EditorGUILayout.HelpBox("Hosting is 'Not Set'.\nConnectUsingSettings() will not be able to connect.\nSelect another option or run the PUN Wizard.", MessageType.Info);
            break;

        default:
            DrawDefaultInspector();
            break;
        }

        EditorGUI.indentLevel = 0;
        EditorGUILayout.LabelField("Client Settings");
        EditorGUI.indentLevel = 1;
        //EditorGUILayout.LabelField("game version");
        settings.JoinLobby             = EditorGUILayout.Toggle("Auto-Join Lobby", settings.JoinLobby);
        settings.EnableLobbyStatistics = EditorGUILayout.Toggle("Enable Lobby Stats", settings.EnableLobbyStatistics);
        //EditorGUILayout.LabelField("automaticallySyncScene");
        //EditorGUILayout.LabelField("autoCleanUpPlayerObjects");
        //EditorGUILayout.LabelField("log level");
        //EditorGUILayout.LabelField("lobby stats");
        //EditorGUILayout.LabelField("sendrate / serialize rate");
        //EditorGUILayout.LabelField("quick resends");
        //EditorGUILayout.LabelField("max resends");
        //EditorGUILayout.LabelField("enable crc checking");


        if (PhotonEditor.CheckPunPlus())
        {
            settings.Protocol = ConnectionProtocol.Udp;
            EditorGUILayout.HelpBox("You seem to use PUN+.\nPUN+ only supports reliable UDP so the protocol is locked.", MessageType.Info);
        }

        settings.AppID = settings.AppID.Trim();


        // RPC-shortcut list
        EditorGUI.indentLevel = 0;
        SerializedObject   sObj  = new SerializedObject(target);
        SerializedProperty sRpcs = sObj.FindProperty("RpcList");
        EditorGUILayout.PropertyField(sRpcs, true);
        sObj.ApplyModifiedProperties();

        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        if (GUILayout.Button("Refresh RPCs"))
        {
            PhotonEditor.UpdateRpcList();
            Repaint();
        }
        if (GUILayout.Button("Clear RPCs"))
        {
            PhotonEditor.ClearRpcList();
        }
        if (GUILayout.Button("Log HashCode"))
        {
            Debug.Log("RPC-List HashCode: " + RpcListHashCode() + ". Make sure clients that send each other RPCs have the same RPC-List.");
        }
        GUILayout.Space(20);
        GUILayout.EndHorizontal();

        //SerializedProperty sp = serializedObject.FindProperty("RpcList");
        //EditorGUILayout.PropertyField(sp, true);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);     // even in Unity 5.3+ it's OK to SetDirty() for non-scene objects.
        }
    }
Example #57
0
        public override IList <Response> Execute(SenderSettings senderDetail, IMessageDetail args)
        {
            string               retVal         = "";
            ServerSettings       serverSettings = senderDetail.ServerSettings;
            CommandMessageHelper command        = new CommandMessageHelper(serverSettings.CommandSymbol, args.Message);

            string[] commandParams = command.CommandParams;
            ushort   flips;

            Discord.Color responseColor = new Discord.Color(0);

            if (commandParams.Length == 1)
            {
                flips = 1;
            }
            else
            {
                if (!ushort.TryParse(commandParams[1], out flips) || flips <= 0)
                {
                    retVal = ($"{Emojis.CrossSymbol} {languageHandler.GetPhrase(serverSettings.Language, Errors.ErrorCode.IncorrectParameter)}: {commandParams[1]}. [1-{uint.MaxValue}].");
                }
            }

            if (flips > 0)
            {
                int    heads = 0, tails = 0;
                string localeHead = languageHandler.GetPhrase(serverSettings.Language, "CoinHead");
                string localeTail = languageHandler.GetPhrase(serverSettings.Language, "CoinTail");

                if (flips == 1)
                {
                    switch (rand.Next(2))
                    {
                    default:
                    case 0: retVal = localeHead; heads++; break;

                    case 1: retVal = localeTail; tails++; break;
                    }
                }
                else
                {
                    char headLetter = (localeHead)[0];
                    char tailLetter = (localeTail)[0];

                    string flipped = languageHandler.GetPhrase(serverSettings.Language, "Flipped");
                    if (flips > 100)
                    {
                        for (int i = 0; i < flips; i++)
                        {
                            switch (rand.Next(2))
                            {
                            case 0: heads++; break;

                            case 1: tails++; break;
                            }
                        }
                        retVal = ($"{flipped} {flips}x, `{localeHead}:` {heads}, `{localeTail}:` {tails}");
                    }
                    else
                    {
                        StringBuilder coinflips = new StringBuilder();
                        for (int i = 0; i < flips; i++)
                        {
                            switch (rand.Next(2))
                            {
                            case 0: coinflips.Append(headLetter); heads++; break;

                            case 1: coinflips.Append(tailLetter); tails++; break;
                            }
                        }

                        retVal = ($"{flipped} {flips}x, `{localeHead}:` {heads}, `{localeTail}:` {tails}: {coinflips.ToString()}");
                    }
                }

                if (heads < tails)
                {
                    responseColor = new Discord.Color(200, 50, 50);
                }
                else if (heads > tails)
                {
                    responseColor = new Discord.Color(50, 200, 50);
                }
                else
                {
                    responseColor = new Discord.Color(200, 200, 50);
                }
            }

            Response response = new Response
            {
                Embed        = Utility.EmbedUtility.ToEmbed(retVal, responseColor),
                Message      = retVal,
                ResponseType = ResponseType.Default
            };

            return(new[] { response });
        }
 public ConnectionProfile(string name, ServerSettings serverSettings, bool savePassword)
 {
     this.Name = name;
     this.ServerSettings = serverSettings;
     this.SavePassword = savePassword;
 }
Example #59
0
 public PhotonNetworkConnector(ServerSettings photonServerSettings, ILogger logger)
 {
     _photonServerSettings = photonServerSettings;
     _logger = logger;
 }
Example #60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerOpeningEvent"/> struct.
 /// </summary>
 /// <param name="serverId">The server identifier.</param>
 /// <param name="serverSettings">The server settings.</param>
 public ServerOpeningEvent(ServerId serverId, ServerSettings serverSettings)
 {
     _serverId       = serverId;
     _serverSettings = serverSettings;
 }