SmartFoxLoadConfig Method (String, Boolean) |
Namespace: Sfs2X
public void LoadConfig( string filePath, bool connectOnSuccess )
<SmartFoxConfig> <!-- required --> <host>localhost</host> <!-- required --> <port>9933</port> <udpHost>localhost</udpHost> <udpPort>9933</udpPort> <zone>BasicExamples</zone> <debug>true</debug> <httpPort>8080</httpPort> <httpsPort>8443</httpsPort> <blueBox> <isActive>true</isActive> <useHttps>false</useHttps> <pollingRate>500</pollingRate> <proxy> <host></host> <port></port> <userName></userName> <password></password> <bypassLocal>true</bypassLocal> </proxy> </blueBox> </SmartFoxConfig>
void SomeMethod() { sfs.AddEventListener(SFSEvent.CONFIG_LOAD_SUCCESS, OnConfigLoadSuccessHandler); sfs.AddEventListener(SFSEvent.CONFIG_LOAD_FAILURE, OnConfigLoadFailureHandler); sfs.LoadConfig("testEnvironmentConfig.xml", false); } void OnConfigLoadSuccessHandler(BaseEvent evt) { Console.WriteLine("Config file loaded, now connecting..."); sfs.Connect(sfs.IpAddress, sfs.Port); } void OnConfigLoadFailureHandler(BaseEvent evt) { Console.WriteLine("Failed loading config file: " + evt.Params["message"]); }