static void Main(string[] args) { PISystem local = new PISystems().DefaultPISystem; AFDatabase db = local.Databases.DefaultDatabase; AFTable translation = db.Tables["Translations"]; local.ExportXml(translation, PIExportMode.AllReferences, @"..\translation.xml", null, null, null); AFTable uomconversion = db.Tables["UOM Conversion"]; local.ExportXml(uomconversion, PIExportMode.AllReferences, @"..\uomConversion.xml", null, null, null); }
static void Main(string[] args) { var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { // Command values are available here currency = options.currency; } var version = "v2016B"; var pisystem = new PISystems().DefaultPISystem; var db = pisystem.Databases.DefaultDatabase; var directoryPath = $"..\\{db.Name}"; try { System.IO.Directory.CreateDirectory(directoryPath); } catch (Exception e) { Console.WriteLine(e.Message); } pisystem.ExportXml(db, PIExportMode.NoUniqueID, $"{directoryPath}\\OSIDemo_Utilities Management System_{version}.xml", null, null, null); UOMClass uomclass; try { foreach (var UOMClassName in new string[] { "Power", $"Energy Cost - {currency} Currency", $"Volume Cost - {currency} Currency", "Volume Flow Rate", $"{currency} Currency", $"Energy per Volume" }) { uomclass = pisystem.UOMDatabase.UOMClasses[UOMClassName]; if (uomclass == null) { Console.WriteLine($"Could not find: {UOMClassName}"); } else { pisystem.ExportXml(uomclass, PIExportMode.NoUniqueID, $"{directoryPath}\\UOM_{uomclass.Name}_{version}.xml", null, null, null); } } } catch (Exception e) { Console.WriteLine(e.StackTrace); } ZipFile.CreateFromDirectory(directoryPath, $"..\\{db.Name}_{uomgrouping}_{language}_{currency}.zip", CompressionLevel.Optimal, false); }