108 lines
5.2 KiB
C#
108 lines
5.2 KiB
C#
/*
|
|
* Copyright (c) 2018 iTAC Software AG, Germany. All Rights Reserved.
|
|
*
|
|
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
|
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
|
* without the written permission of iTAC Software AG.
|
|
*/
|
|
// created 26.11.2018 13:28:02
|
|
// skip property ExtensionDataObject, declared in DeviceLocator
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace com.itac.oib.linecontrol.contracts.data
|
|
{
|
|
// source: assembly 3.0.0.0
|
|
// source: assembly ASM.AS.OIB.Client
|
|
public class DeviceLocatorMapper
|
|
{
|
|
// used for itac->asm: True
|
|
// used for asm->itac: True
|
|
|
|
// maps iTAC namespace conform type to ASM namespace type
|
|
public static www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator get(DeviceLocator itacDeviceLocator)
|
|
{
|
|
if (itacDeviceLocator == null) { return null; }
|
|
www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator asmDeviceLocator = new www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator();
|
|
mapItac2Asm(asmDeviceLocator, itacDeviceLocator);
|
|
return asmDeviceLocator;
|
|
}
|
|
|
|
public static void mapItac2Asm(www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator asmDeviceLocator, DeviceLocator itacDeviceLocator)
|
|
{
|
|
// skip property ExtensionDataObject, declared in DeviceLocator
|
|
asmDeviceLocator.LineName = itacDeviceLocator.LineName;
|
|
asmDeviceLocator.MachineId = itacDeviceLocator.MachineId;
|
|
asmDeviceLocator.MachineName = itacDeviceLocator.MachineName;
|
|
asmDeviceLocator.MachineType = itacDeviceLocator.MachineType;
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace array
|
|
public static www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator[] get(DeviceLocator[] itacDeviceLocator)
|
|
{
|
|
if (itacDeviceLocator == null) { return null; }
|
|
www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator[] asmDeviceLocator = new www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator[itacDeviceLocator.Length];
|
|
for (int i = 0; i < itacDeviceLocator.Length; i++)
|
|
{
|
|
// to itac array
|
|
asmDeviceLocator[i] = DeviceLocatorMapper.get(itacDeviceLocator[i]);
|
|
}
|
|
return asmDeviceLocator;
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace list
|
|
public static List<www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator> getList(DeviceLocator[] asmDeviceLocator)
|
|
{
|
|
if (asmDeviceLocator == null) { return null; }
|
|
List<www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator> itacDeviceLocator = new List<www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator>();
|
|
for (int i = 0; i < asmDeviceLocator.Length; i++)
|
|
{
|
|
itacDeviceLocator.Add(DeviceLocatorMapper.get(asmDeviceLocator[i]));
|
|
}
|
|
return itacDeviceLocator;
|
|
}
|
|
|
|
// map type from ASM namespace to iTAC namespace
|
|
public static DeviceLocator get(www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator asmDeviceLocator)
|
|
{
|
|
if (asmDeviceLocator == null) { return null; }
|
|
DeviceLocator itacDeviceLocator = new DeviceLocator();
|
|
mapAsm2Itac(asmDeviceLocator, itacDeviceLocator);
|
|
return itacDeviceLocator;
|
|
}
|
|
|
|
public static void mapAsm2Itac(www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator asmDeviceLocator, DeviceLocator itacDeviceLocator)
|
|
{
|
|
// skip property ExtensionDataObject, declared in DeviceLocator
|
|
itacDeviceLocator.LineName = asmDeviceLocator.LineName;
|
|
itacDeviceLocator.MachineId = asmDeviceLocator.MachineId;
|
|
itacDeviceLocator.MachineName = asmDeviceLocator.MachineName;
|
|
itacDeviceLocator.MachineType = asmDeviceLocator.MachineType;
|
|
}
|
|
|
|
// maps ASM namespace conform list to iTAC namespace array
|
|
public static DeviceLocator[] getArray(IList<www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator> asmDeviceLocator)
|
|
{
|
|
if (asmDeviceLocator == null) { return null; }
|
|
DeviceLocator[] itacDeviceLocator = new DeviceLocator[asmDeviceLocator.Count];
|
|
for (int i = 0; i < asmDeviceLocator.Count; i++)
|
|
{
|
|
itacDeviceLocator[i] = DeviceLocatorMapper.get(asmDeviceLocator[i]);
|
|
}
|
|
return itacDeviceLocator;
|
|
}
|
|
|
|
// maps ASM namespace conform array to iTAC namespace array
|
|
public static DeviceLocator[] getArray(www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data.DeviceLocator[] asmDeviceLocator)
|
|
{
|
|
if (asmDeviceLocator == null) { return null; }
|
|
DeviceLocator[] itacDeviceLocator = new DeviceLocator[asmDeviceLocator.Length];
|
|
for (int i = 0; i < asmDeviceLocator.Length; i++)
|
|
{
|
|
itacDeviceLocator[i] = DeviceLocatorMapper.get(asmDeviceLocator[i]);
|
|
}
|
|
return itacDeviceLocator;
|
|
}
|
|
}
|
|
}
|