Region |
Imports the list of regions.
If a region already exists, it will be updated and if it does not exist, it will be created.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void Import( ISimpleCollection<SimpleRegionV1> regions )
Parameters
- regions ISimpleCollection<SimpleRegionV1>
- The regions.
Implements
ISimpleClientRegionRepositoryV1.Import(ISimpleCollection<SimpleRegionV1>)Example
The following example illustrates how the SimpleClient imports regions.
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class Example { static void Main() { // Create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfoV1 token; // Connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // If a region already exists, it will be updated and if it does not exist, it will be created. // We can create one region var region = new SimpleRegionV1( Guid.Parse("{3670E353-AD4A-4C16-BE9D-6A0CD0ABA1B8}"), "RegionUpdate", EntityRoot.Region, EntityCategory.Region); // create region client.Regions.Create(region); // updated data for region region.Data["Description"] = "Region description"; region.Data["shape_Prop"] = "Region shape property"; region.Data["shape_Region"] = "Region shape"; //Prepare anther region, not create, but import var newRegion = new SimpleRegionV1( Guid.Parse("{2C7B6F76-3956-4B1B-AF46-7249BC831F63}"), "RegionImport", EntityRoot.Region, EntityCategory.Region); // create list for import var regionsToImport = new SimpleCollection<SimpleRegionV1> { region, newRegion }; // import client.Regions.Import(regionsToImport); var result = client.Regions.GetAll(); foreach(var resultRegion in result) { Console.WriteLine($"Region name: {resultRegion.Name}"); } // Disconnect from server client.Disconnect(); } }
See Also