示例#1
0
 /// <summary>
 /// Write Configuration data in XML format to the XML Text Writer.
 /// </summary>
 /// <param name="writer">XML Text Writer</param>
 public override void WriteXmlConfig(XmlTextWriter writer)
 {
     writer.WriteStartElement("Hl7PeerToPeerConfiguration");
     writer.WriteStartElement("FromActor");
     writer.WriteStartElement("ActorName");
     writer.WriteElementString("ActorType", ActorTypes.Type(FromActorName.Type));
     writer.WriteElementString("ActorId", FromActorName.Id);
     writer.WriteEndElement();
     writer.WriteElementString("AeTitle", FromActorAeTitle);
     writer.WriteEndElement();
     writer.WriteStartElement("ToActor");
     writer.WriteStartElement("ActorName");
     writer.WriteElementString("ActorType", ActorTypes.Type(ToActorName.Type));
     writer.WriteElementString("ActorId", ToActorName.Id);
     writer.WriteEndElement();
     writer.WriteElementString("AeTitle", ToActorAeTitle);
     writer.WriteElementString("IpAddress", ToActorIpAddress);
     writer.WriteEndElement();
     writer.WriteElementString("PortNumber", PortNumber.ToString());
     writer.WriteElementString("MessageDelimiters", MessageDelimiters.ToString());
     writer.WriteElementString("SecureConnection", SecureConnection.ToString());
     writer.WriteElementString("AutoValidate", AutoValidate.ToString());
     writer.WriteElementString("ActorOption1", ActorOption1);
     writer.WriteElementString("ActorOption2", ActorOption2);
     writer.WriteElementString("ActorOption3", ActorOption3);
     writer.WriteElementString("SessionId", _sessionId.ToString());
     writer.WriteEndElement();
 }
示例#2
0
        public CoaperFinder()
        {
            InitializeComponent();

            PortTextBox.Text = PortNumber.ToString();

            UriTextBox.Text = URIValue;
        }
        } // GetNameWithUpperFirstLetter

        private string GetBody()
        {
            return(ReadIntoString("body")
                   .Replace(PortNumberMask, PortNumber.ToString())
                   .Replace(IndexFilePathMask, IndexFilePath + EntityName)
                   .Replace(SubdomainMask, GetNameWithLowerFirstLetter(EntityName) + "sapview")
                   .Replace(DomainMask, DomainName)
                   );
        }
 IDictionary <string, string> IConfigurationSection.ToDictionary()
 {
     return(new Dictionary <string, string>
     {
         { "AccountName", AccountName },
         { "AccountPassword", AccountPassword },
         { "SmtpHost", SmtpHost },
         { "PortNumber", PortNumber.ToString() },
         { "UseSSL", UseSsl.ToString(CultureInfo.InvariantCulture) }
     });
 }
示例#5
0
        public override IDictionary <String, String> GetValues()
        {
            var values = new Dictionary <String, String>
            {
                { nameof(VlanNumber), VlanNumber.ToString() },
                { nameof(PortNumber), PortNumber.ToString() },
            };

            foreach (var item in GetAdditonalValues())
            {
                values.Add(item.Key, item.Value);
            }

            return(values);
        }
示例#6
0
        protected void setStartInfo()
        {
            Emulator.StartInfo.UseShellExecute = true;
            Emulator.StartInfo.CreateNoWindow  = false;
            Emulator.StartInfo.WindowStyle     = ProcessWindowStyle.Maximized;
            Emulator.StartInfo.FileName        = Visible ? "wc3270.exe" : "ws3270.exe";
            Emulator.StartInfo.Arguments       =
                "-model " + ModelNumber +
                "-scriptport " + ScriptPort.ToString() +
                Address +
                (PortNumber != 0 ? (":" + PortNumber.ToString()) : "");

            Wrapper.StartInfo.UseShellExecute        = false;
            Wrapper.StartInfo.RedirectStandardInput  = true;
            Wrapper.StartInfo.RedirectStandardOutput = true;
            Wrapper.StartInfo.RedirectStandardError  = true;
            Wrapper.StartInfo.CreateNoWindow         = false;
            Wrapper.StartInfo.Arguments   = "-i -t " + ScriptPort.ToString();
            Wrapper.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            Wrapper.StartInfo.FileName    = "x3270if.exe";
        }
示例#7
0
 public override List <ProviderParameter> GetInitializationParameters()
 {
     return(new List <ProviderParameter>
     {
         new ProviderParameter("Path", Path, GetConfigKey("Path")),
         new ProviderParameter("FilterPattern", FilterPattern, GetConfigKey("FilterPattern")),
         new ProviderParameter("ModifiedSinceUTC", ModifiedSinceUTC, GetConfigKey("ModifiedSinceUTC")),
         new ProviderParameter("RecuirseFolders", RecuirseFolders.ToString(), GetConfigKey("RecuirseFolders")),
         new ProviderParameter("WebFriendlyPaths", WebFriendlyPaths.ToString(), GetConfigKey("WebFriendlyPaths")),
         new ProviderParameter("Protocol", Protocol.ToString(), GetConfigKey("Protocol")),
         new ProviderParameter("HostName", HostName, GetConfigKey("HostName")),
         new ProviderParameter("PortNumber", PortNumber.ToString(CultureInfo.InvariantCulture), GetConfigKey("HostName")),
         new ProviderParameter("UserName", UserName, GetConfigKey("UserName")),
         new ProviderParameter("Password", SecurityService.EncryptValue(Password), GetConfigKey("Password")),
         new ProviderParameter("FtpSecure", FtpSecure.ToString(), GetConfigKey("FtpSecure")),
         new ProviderParameter("AcceptAnyTlsHostCertificate", AcceptAnyTlsHostCertificate.ToString(CultureInfo.InvariantCulture), GetConfigKey("AcceptAnyTlsHostCertificate")),
         new ProviderParameter("AcceptAnySshHostKey", AcceptAnySshHostKey.ToString(CultureInfo.InvariantCulture), GetConfigKey("AcceptAnySshHostKey")),
         new ProviderParameter("SshHostKeyFingerprint", SshHostKeyFingerprint, GetConfigKey("SshHostKeyFingerprint")),
         new ProviderParameter("SshPrivateKeyPassphrase", SecurityService.EncryptValue(SshPrivateKeyPassphrase), GetConfigKey("SshPrivateKeyPassphrase")),
         new ProviderParameter("SshPrivateKeyPath", SshPrivateKeyPath, GetConfigKey("SshPrivateKeyPath"))
     });
 }
示例#8
0
 /// <summary>
 /// Write Configuration data in XML format to the XML Text Writer.
 /// </summary>
 /// <param name="writer">XML Text Writer</param>
 public override void WriteXmlConfig(XmlTextWriter writer)
 {
     writer.WriteStartElement("DicomPeerToPeerConfiguration");
     writer.WriteStartElement("FromActor");
     writer.WriteStartElement("ActorName");
     writer.WriteElementString("ActorType", ActorTypes.Type(FromActorName.Type));
     writer.WriteElementString("ActorId", FromActorName.Id);
     writer.WriteEndElement();
     writer.WriteElementString("AeTitle", FromActorAeTitle);
     writer.WriteEndElement();
     writer.WriteStartElement("ToActor");
     writer.WriteStartElement("ActorName");
     writer.WriteElementString("ActorType", ActorTypes.Type(ToActorName.Type));
     writer.WriteElementString("ActorId", ToActorName.Id);
     writer.WriteEndElement();
     writer.WriteElementString("AeTitle", ToActorAeTitle);
     writer.WriteElementString("IpAddress", ToActorIpAddress);
     writer.WriteEndElement();
     writer.WriteElementString("PortNumber", PortNumber.ToString());
     writer.WriteElementString("SecureConnection", SecureConnection.ToString());
     writer.WriteElementString("AutoValidate", AutoValidate.ToString());
     writer.WriteElementString("ActorOption1", ActorOption1);
     writer.WriteElementString("ActorOption2", ActorOption2);
     writer.WriteElementString("ActorOption3", ActorOption3);
     writer.WriteElementString("SessionId", _sessionId.ToString());
     writer.WriteElementString("SourceDataDirectory", _sourceDataDirectory);
     writer.WriteElementString("StoreDataDirectory", _storeDataDirectory);
     writer.WriteElementString("StoreData", _storeData.ToString());
     writer.WriteStartElement("DefinitionFiles");
     foreach (System.String defintionFilename in _definitionFiles)
     {
         writer.WriteElementString("DefinitionFile", defintionFilename);
     }
     writer.WriteEndElement();
     writer.WriteEndElement();
 }
示例#9
0
        public void Send(byte[] msg)
        {
            byte[] toSend;
            string content = String.Empty;

            if (UseBytes)
            {
                toSend = new byte[ByteHeader.Length + msg.Length + ByteFooter.Length];
                ByteHeader.CopyTo(toSend, 0);
                msg.CopyTo(toSend, ByteHeader.Length);
                ByteFooter.CopyTo(toSend, ByteHeader.Length + msg.Length);
            }
            else
            {
                toSend = msg;
            }
            if (MessageEncoding == Encoding.ASCII)
            {
                content = System.Text.Encoding.UTF8.GetString(toSend);
            }
            try
            {
                if (tcpSocket == null)// && tcpSocket.Connected)
                {
                    AppLogger.Log(LogLevel.INFO,
                                  String.Format("{0}:{1} No connected client",
                                                ConnectionType.ToString() + " " + IpAddress + ":" + PortNumber.ToString(),
                                                ConnectionName));
                    return;
                }
                tcpSocket.BeginSend(msg, 0, msg.Length, 0, new AsyncCallback(SendCallback), tcpSocket);
                AppLogger.Log(LogLevel.INFO,
                              String.Format("{0}:{1} sending {2}",
                                            ConnectionType.ToString() + " " + IpAddress + ":" + PortNumber.ToString(),
                                            ConnectionName,
                                            content));
            }
            catch (Exception e)
            {
                AppLogger.Log(LogLevel.ERROR,
                              String.Format("{0}:{1} error sending {2} {3}",
                                            ConnectionType.ToString() + " " + IpAddress + ":" + PortNumber.ToString(),
                                            ConnectionName,
                                            content, e.Message));
            }
        }
示例#10
0
        private void openTCPConnection()
        {
            string msg = IpAddress + ":" + PortNumber.ToString();

            if (ConnectionType == SocketTransactorType.server)
            {
                IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse(IpAddress), PortNumber);
                Socket     listener      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                try
                {
                    listener.Bind(localEndPoint);
                    listener.Listen(MaxNumConnections);
                    while (RunningInBG)
                    {
                        allDone.Reset();
                        listener.BeginAccept(new AsyncCallback(AcceptCallback), listener);
                        allDone.WaitOne();
                    }
                    // bye-bye
                    if (listener.Connected)
                    {
                        listener.Shutdown(SocketShutdown.Both);
                    }
                    listener.Close();
                    OnTcpDisconnected(EventArgs.Empty);
                    AppLogger.Log(LogLevel.VERBOSE,
                                  String.Format("{0} closed.", ConnectionType.ToString()));
                }
                catch (Exception e)
                {
                    AppLogger.Log(LogLevel.ERROR,
                                  String.Format("Problem {0} {1} opening connection: {2}",
                                                ConnectionType.ToString(), msg, e.Message));
                }
            }
            else if (ConnectionType == SocketTransactorType.client)
            {
                string cxnMsg = String.Empty;
                try
                {
                    IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(IpAddress), PortNumber);
                    tcpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                    tcpSocket.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), tcpSocket);
                    connectDone.WaitOne();
                    //OnTcpConnected(EventArgs.Empty);
                    AppLogger.Log(LogLevel.DEBUG,
                                  String.Format("{0} {1} {2}",
                                                ConnectionType.ToString(),
                                                msg, MessageEncoding.ToString()));
                    Receive(); // non-blocking due to callbacks
                    receiveDone.WaitOne();
                    // TODO: revisit these later to debug
                    //tcpSocket.Shutdown(SocketShutdown.Both);
                    //tcpSocket.Close();
                    //OnTcpDisconnected(EventArgs.Empty);
                }
                catch (Exception e)
                {
                    AppLogger.Log(LogLevel.ERROR,
                                  String.Format("Error client connecting to {0}: {1}",
                                                tcpSocket.RemoteEndPoint.ToString(),
                                                e.Message));
                }
            }
        }
示例#11
0
        public void Execute(AxApplicationAction Action)
        {
            string options    = ActionOptions;
            string applPath   = ApplicationPath(ServerName, PortNumber.ToString());
            string sourcePath = SourcesFolder;

            string[] labels;
            string[] layers;
            switch (Action)
            {
            case AxApplicationAction.CLEANLABELS:
                labels = options.Split(',');
                foreach (string label in labels)
                {
                    IEnumerable <string> files = System.IO.Directory.EnumerateFiles(applPath, String.Format("ax{0}*.al?", label));
                    foreach (string file in files)
                    {
                        System.IO.File.SetAttributes(file, FileAttributes.Normal);
                        System.IO.File.Delete(file);
                    }
                }
                break;

            case AxApplicationAction.CLEANLAYERS:
                layers = options.Split(',');
                System.IO.File.Delete(String.Format(@"{0}\axapd.aoi"));
                foreach (string layer in layers)
                {
                    IEnumerable <string> files = System.IO.Directory.EnumerateFiles(applPath, String.Format("ax{0}*.ald", layer));
                    foreach (string file in files)
                    {
                        System.IO.File.SetAttributes(file, FileAttributes.Normal);
                        System.IO.File.Delete(file);
                    }
                }
                break;

            case AxApplicationAction.INSTALLLABELS:
                options = options.ToUpper();
                labels  = options.Split(',');
                foreach (string label in labels)
                {
                    IEnumerable <string> files = System.IO.Directory.EnumerateFiles(sourcePath, String.Format("ax{0}*.ald", label));
                    foreach (string file in files)
                    {
                        if (!IsEmptyLabelFile(file))
                        {
                            string language = file.Substring(file.LastIndexOf('\\') + 6, file.Length - 4 - file.LastIndexOf('\\') - 6);

                            Console.WriteLine(String.Format("Copying language {0} for label file {1}", language, label), BuildMessageImportance.High);

                            string sourceFile = String.Format(@"{0}\ax{1}{2}.ald", sourcePath, label, language);
                            string targetFile = String.Format(@"{0}\ax{1}{2}.ald", applPath, label, language);
                            System.IO.File.Copy(sourceFile, targetFile);
                            System.IO.File.SetAttributes(targetFile, FileAttributes.Normal);

                            sourceFile = String.Format(@"{0}\ax{1}{2}.alc", sourcePath, label, language);
                            targetFile = String.Format(@"{0}\ax{1}{2}.alc", applPath, label, language);
                            System.IO.File.Copy(sourceFile, targetFile);
                            System.IO.File.SetAttributes(targetFile, FileAttributes.Normal);
                        }
                    }
                }
                break;

            case AxApplicationAction.INSTALLLAYERS:
                layers = options.Split(',');
                System.IO.File.Delete(String.Format(@"{0}\axapd.aoi"));
                foreach (string layer in layers)
                {
                    IEnumerable <string> files = System.IO.Directory.EnumerateFiles(sourcePath, String.Format("ax{0}*.ald", layer));
                    foreach (string file in files)
                    {
                        string newLayerFile = String.Format(@"{0}\ax{1}.ald", applPath, layer.ToUpper());
                        System.IO.File.Copy(file, newLayerFile);
                        System.IO.File.SetAttributes(newLayerFile, FileAttributes.Normal);
                    }
                }
                break;

            case AxApplicationAction.EXPORTLAYERS:
                layers = options.Split(',');
                string targetFolder = ExportFolder;
                foreach (string layer in layers)
                {
                    IEnumerable <string> files = System.IO.Directory.EnumerateFiles(applPath, String.Format("ax{0}*.ald", layer));
                    foreach (string file in files)
                    {
                        string exportFile = String.Format(@"{0}\ax{1}.ald", targetFolder, layer.ToUpper());
                        System.IO.File.Copy(file, exportFile);
                    }
                }
                break;
            }
        }
示例#12
0
 // Start is called before the first frame update
 void Start()
 {
     serial = new SerialPort(portNumber.ToString(), int.Parse(baudRate));
 }
示例#13
0
        public int Execute()
        {
            string        modelName       = ModelName;
            string        modelPublisher  = ModelPublisher;
            string        configFile      = AXConfigurationFile;
            string        serverName      = ServerName;
            string        portNumber      = PortNumber.ToString();
            string        layer           = Layer;
            string        layerCode       = Layer;
            string        commandArgument = CommandArgument;
            List <string> parameterList   = new List <string>();

            int exitcode = 0;

            if (!String.IsNullOrEmpty(configFile))
            {
                parameterList.Add(String.Format("\"{0}\"", configFile));
            }
            else
            {
                // TODO: -AOS doesn't seem to be working!!
                if (!String.IsNullOrEmpty(serverName) && !String.IsNullOrEmpty(portNumber))
                {
                    parameterList.Add(String.Format("-aos={0}@{1}", serverName, portNumber));
                }
                else
                {
                    Console.WriteLine("No configuration file or server/port specified.");
                }

                if (!String.IsNullOrEmpty(layer))
                {
                    if (String.IsNullOrEmpty(layerCode) && layer.ToLower() != "usr" && layer.ToLower() != "usp")
                    {
                        throw new Exception("Missing layer code for layer different than USR/USP");
                    }

                    parameterList.Add(String.Format("-aol={0}", layer));
                    parameterList.Add(String.Format("-aolcode={0}", layerCode));
                }
            }

            if (!String.IsNullOrEmpty(ModelManifest))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(ModelManifest);

                modelName      = doc.DocumentElement.SelectSingleNode("Name").InnerText;
                modelPublisher = doc.DocumentElement.SelectSingleNode("Publisher").InnerText;
                string modelLayer = doc.DocumentElement.SelectSingleNode("Layer").InnerText;

                if (!String.IsNullOrEmpty(layer) && modelLayer.ToLower() != layer.ToLower())
                {
                    throw new Exception(String.Format("Trying to import into model {0} in layer {1}, but configuration file connects to layer {2}", modelName, modelLayer.ToLower(), layer.ToLower()));
                }
                // TODO: check against configuration file??!
            }

            if (!String.IsNullOrEmpty(modelName))
            {
                if (String.IsNullOrEmpty(modelPublisher) || String.IsNullOrEmpty(modelPublisher.Trim()))
                {
                    parameterList.Add(String.Format("\"-Model={0}\"", modelName));
                }
                else
                {
                    parameterList.Add(String.Format("\"-Model=({0},{1})\"", modelName, modelPublisher));
                }
            }

            parameterList.Add("-MINIMIZE");

            //if(LazyClassLoading.Get(context) == true)
            parameterList.Add("-LAZYCLASSLOADING");

            //if(LazyClassLoading.Get(context) == true)
            parameterList.Add("-LAZYTABLELOADING");

            string language;

            switch (Command)
            {
            case ClientCommand.IMPORTXPO:
                Console.WriteLine("Executing import of XPO file");
                if (NoCompileOnImport)
                {
                    parameterList.Add(String.Format("-NOCOMPILEONIMPORT"));
                }
                parameterList.Add(String.Format("\"-AOTIMPORTFILE={0}\"", commandArgument));

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.IMPORTLABELFOLDER:

                Console.WriteLine("Executing label folder import");

                if (NoCompileOnImport)
                {
                    parameterList.Add(String.Format("-NOCOMPILEONIMPORT"));
                }

                if (System.IO.Directory.Exists(commandArgument))
                {
                    IEnumerable <string> files = System.IO.Directory.EnumerateFiles(commandArgument, String.Format("*.ald"), System.IO.SearchOption.AllDirectories);
                    foreach (string file in files)
                    {
                        language = file.Substring(file.LastIndexOf('\\') + 6, file.Length - 4 - file.LastIndexOf('\\') - 6);

                        if (!AxApplicationFiles.IsEmptyLabelFile(file))
                        {
                            Console.WriteLine(String.Format("Importing labels for language {0}", language), BuildMessageImportance.High);

                            List <string> labelParameters = new List <string>();
                            labelParameters.AddRange(parameterList);
                            labelParameters.Add(String.Format("\"-StartupCmd=aldimport_{0}\"", file));

                            exitcode = CallClient(labelParameters);
                        }
                        else
                        {
                            Console.WriteLine(String.Format("Skipping label language {0} because it is empty", language));
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Label files folder not found, skipping label import.");
                }
                break;

            case ClientCommand.IMPORTLABELFILE:

                language = commandArgument.Substring(commandArgument.LastIndexOf('\\') + 6, commandArgument.Length - 4 - commandArgument.LastIndexOf('\\') + 6);

                if (AxApplicationFiles.IsEmptyLabelFile(commandArgument))
                {
                    Console.WriteLine(String.Format("Skipping label file language {0} because it is empty", language));
                }

                Console.WriteLine(String.Format("Executing label file import for language {0}", language), BuildMessageImportance.High);
                parameterList.Add(String.Format("\"-StartupCmd=aldimport_{0}\"", commandArgument));

                if (NoCompileOnImport)
                {
                    parameterList.Add(String.Format("-NOCOMPILEONIMPORT"));
                }

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.SYNCHRONIZE:
                Console.WriteLine("Executing data dictionary synchronize");
                parameterList.Add("-StartupCmd=Synchronize");

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.COMPILEXPP:
                if (!String.IsNullOrEmpty(commandArgument))
                {
                    Console.WriteLine("Executing full X++ compile with cross-reference update");
                    parameterList.Add("-StartupCmd=CompileAll_+");
                }
                else
                {
                    Console.WriteLine("Executing full X++ compile");
                    parameterList.Add("-StartupCmd=CompileAll");
                }
                #region RRB CU7 updates
                //CallClient(parameterList, context);
                CallAxBuild();
                #endregion
                break;

            case ClientCommand.GENERATECIL:
                Console.WriteLine("Executing CIL generation");
                parameterList.Add("-StartupCmd=CompileIL");

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.RUNTESTPROJECT:
                Console.WriteLine("Executing test project run");
                if (String.IsNullOrEmpty(commandArgument))
                {
                    throw new Exception("Expecting command argument containing the test project to run");
                }
                parameterList.Add(String.Format("-StartupCmd=RunTestProject_{0}", commandArgument));

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.XMLDOCUMENTATION:
                Console.WriteLine("Executing XML documentation");
                if (String.IsNullOrEmpty(commandArgument))
                {
                    throw new Exception("Expecting command argument containing xml documentation filename");
                }
                parameterList.Add(String.Format("\"-StartupCmd=xmldocumentation_{0}\"", commandArgument));

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.AUTORUN:
                Console.WriteLine(String.Format("Executing autorun script \"{0}\"", commandArgument));
                parameterList.Add("-nocompileonimport");
                parameterList.Add(String.Format("\"-StartupCmd=AutoRun_{0}\"", commandArgument));

                exitcode = CallClient(parameterList);
                break;

            case ClientCommand.STARTUPCMD:
                Console.WriteLine(String.Format("Executing startup command \"{0}\"", commandArgument));
                parameterList.Add(String.Format("\"-StartupCmd={0}\"", commandArgument));

                exitcode = CallClient(parameterList);
                break;
            }

            return(exitcode);
        }