Пример #1
0
        protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var hostName   = HostName.Get(context);
            var portNumber = PortNumber.Get(context);
            var userName   = UserName.Get(context);
            var password   = Password.Get(context);


            var sftp_session = new SftpClient(hostName, portNumber, userName, password);

            sftp_session.Connect();
            sftp_Session_Var = sftp_session;
            _objectContainer.Add <SftpClient>(sftp_session);

            return((ctx) => {
                // Schedule child activities
                if (Body != null)
                {
                    ctx.ScheduleAction <IObjectContainer>(Body, _objectContainer, OnCompleted, OnFaulted);
                }

                // Outputs
            });
        }
Пример #2
0
        public override int GetHashCode()
        {
            var hash = 3;

            hash = (hash * 2) + EnableLdapAuthentication.GetHashCode();
            hash = (hash * 2) + StartTls.GetHashCode();
            hash = (hash * 2) + Ssl.GetHashCode();
            hash = (hash * 2) + SendWelcomeEmail.GetHashCode();
            hash = (hash * 2) + Server.GetHashCode();
            hash = (hash * 2) + UserDN.GetHashCode();
            hash = (hash * 2) + PortNumber.GetHashCode();
            hash = (hash * 2) + UserFilter.GetHashCode();
            hash = (hash * 2) + LoginAttribute.GetHashCode();
            hash = (hash * 2) + GroupMembership.GetHashCode();
            hash = (hash * 2) + GroupDN.GetHashCode();
            hash = (hash * 2) + GroupNameAttribute.GetHashCode();
            hash = (hash * 2) + GroupFilter.GetHashCode();
            hash = (hash * 2) + UserAttribute.GetHashCode();
            hash = (hash * 2) + GroupAttribute.GetHashCode();
            hash = (hash * 2) + Authentication.GetHashCode();
            hash = (hash * 2) + Login.GetHashCode();

            foreach (var pair in LdapMapping)
            {
                hash = (hash * 2) + pair.Value.GetHashCode();
            }

            foreach (var pair in AccessRights)
            {
                hash = (hash * 2) + pair.Value.GetHashCode();
            }

            return(hash);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pin"></param>
        /// <param name="data"></param>
        public void WritePin(PortNumber pin, bool data)
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException("PCF8574");
            }

            byte[] writeBuffer;
            byte[] readBuffer;

            readBuffer = new byte[1];
            _initialized[Address].I2cController.Read(readBuffer);

            writeBuffer = new byte[1];

            BitArray bits = new BitArray(readBuffer);

            bits[(int)pin] = data;

            ((ICollection)bits).CopyTo(writeBuffer, 0);

            _initialized[Address].I2cController.Write(writeBuffer);

            Debug.WriteLineIf(_debug, "Pin " + pin + " na " + writeBuffer[0]);
        }
        public override int GetHashCode()
        {
            var hash = 3;

            hash = (hash * 2) + EnableLdapAuthentication.GetHashCode();
            hash = (hash * 2) + StartTls.GetHashCode();
            hash = (hash * 2) + Server.GetHashCode();
            hash = (hash * 2) + UserDN.GetHashCode();
            hash = (hash * 2) + PortNumber.GetHashCode();
            hash = (hash * 2) + UserFilter.GetHashCode();
            hash = (hash * 2) + LoginAttribute.GetHashCode();
            hash = (hash * 2) + FirstNameAttribute.GetHashCode();
            hash = (hash * 2) + SecondNameAttribute.GetHashCode();
            hash = (hash * 2) + MailAttribute.GetHashCode();
            hash = (hash * 2) + TitleAttribute.GetHashCode();
            hash = (hash * 2) + MobilePhoneAttribute.GetHashCode();
            hash = (hash * 2) + LocationAttribute.GetHashCode();
            hash = (hash * 2) + GroupMembership.GetHashCode();
            hash = (hash * 2) + GroupDN.GetHashCode();
            hash = (hash * 2) + GroupNameAttribute.GetHashCode();
            hash = (hash * 2) + GroupFilter.GetHashCode();
            hash = (hash * 2) + UserAttribute.GetHashCode();
            hash = (hash * 2) + GroupAttribute.GetHashCode();
            hash = (hash * 2) + Authentication.GetHashCode();
            hash = (hash * 2) + Login.GetHashCode();
            return(hash);
        }
Пример #5
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();
 }
Пример #6
0
        public CoaperFinder()
        {
            InitializeComponent();

            PortTextBox.Text = PortNumber.ToString();

            UriTextBox.Text = URIValue;
        }
Пример #7
0
 public SetterProperty(PortNumber portNumber, string propertyName, string displayName, byte initializeValue, bool isStatic = false)
 {
     PortNumber      = portNumber;
     PropertyName    = propertyName;
     DisplayName     = displayName;
     InitializeValue = initializeValue;
     IsStatic        = isStatic;
 }
Пример #8
0
 public void AddPropertyState(PortNumber port, string propName)
 {
     Setters.Add(new ValueSetter()
     {
         Port  = port,
         Value = new PropertyValue(propName),
     });
 }
Пример #9
0
 public void AddStaticState(PortNumber port, byte value)
 {
     Setters.Add(new ValueSetter()
     {
         Port  = port,
         Value = new StaticValue(value),
     });
 }
        } // GetNameWithUpperFirstLetter

        private string GetBody()
        {
            return(ReadIntoString("body")
                   .Replace(PortNumberMask, PortNumber.ToString())
                   .Replace(IndexFilePathMask, IndexFilePath + EntityName)
                   .Replace(SubdomainMask, GetNameWithLowerFirstLetter(EntityName) + "sapview")
                   .Replace(DomainMask, DomainName)
                   );
        }
#pragma warning disable 1591

        public bool Equals(DicomNetworkAddress other)
        {
            // AE titles are case sensitive but host names are not

            return((other != null) &&
                   HostNameOrIPAddress.Equals(other.HostNameOrIPAddress, StringComparison.InvariantCultureIgnoreCase) &&
                   PortNumber.Equals(other.PortNumber) &&
                   AETitle.Equals(other.AETitle, StringComparison.InvariantCulture));
        }
 IDictionary <string, string> IConfigurationSection.ToDictionary()
 {
     return(new Dictionary <string, string>
     {
         { "AccountName", AccountName },
         { "AccountPassword", AccountPassword },
         { "SmtpHost", SmtpHost },
         { "PortNumber", PortNumber.ToString() },
         { "UseSSL", UseSsl.ToString(CultureInfo.InvariantCulture) }
     });
 }
Пример #13
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);
        }
Пример #14
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (property_ != null)
            {
                hash ^= Property.GetHashCode();
            }
            if (PostmarkEmailSenderAddress.Length != 0)
            {
                hash ^= PostmarkEmailSenderAddress.GetHashCode();
            }
            if (PostmarkApiKey.Length != 0)
            {
                hash ^= PostmarkApiKey.GetHashCode();
            }
            if (DisableAllCorrespondence != false)
            {
                hash ^= DisableAllCorrespondence.GetHashCode();
            }
            if (SmtpEmailSenderAddress.Length != 0)
            {
                hash ^= SmtpEmailSenderAddress.GetHashCode();
            }
            if (PortNumber.Length != 0)
            {
                hash ^= PortNumber.GetHashCode();
            }
            if (IsPostmark != false)
            {
                hash ^= IsPostmark.GetHashCode();
            }
            if (ExchangeEmailSenderAddress.Length != 0)
            {
                hash ^= ExchangeEmailSenderAddress.GetHashCode();
            }
            if (ExchangeApiKey.Length != 0)
            {
                hash ^= ExchangeApiKey.GetHashCode();
            }
            return(hash);
        }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pin"></param>
        /// <returns></returns>
        public bool ReadPin(PortNumber pin)
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException("PCF8574");
            }

            byte[] writeBuffer;
            byte[] readBuffer;

            readBuffer = new byte[1];
            _initialized[Address].I2cController.Read(readBuffer);

            writeBuffer = new byte[1];
            readBuffer.CopyTo(writeBuffer, 0);

            BitArray bits = new BitArray(readBuffer);

            return(bits[(int)pin]);
        }
Пример #16
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";
        }
Пример #17
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"))
     });
 }
Пример #18
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();
 }
Пример #19
0
 public ValueSetter(PortNumber port, byte staticValue) : this(port, new StaticValue(staticValue))
 {
 }
Пример #20
0
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ (!object.ReferenceEquals(null, Hostname) ? Hostname.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ (!object.ReferenceEquals(null, PortNumber) ? PortNumber.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ (!object.ReferenceEquals(null, MacAddress) ? MacAddress.GetHashCode() : 0);
                return(hash);
            }
        }
Пример #21
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;
            }
        }
Пример #22
0
 public ValueSetter(PortNumber port, BaseValue value)
 {
     Port  = port;
     Value = value;
 }
Пример #23
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));
                }
            }
        }
Пример #24
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);
        }
Пример #25
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));
            }
        }
Пример #26
0
 public ValueSetter(PortNumber port, string propertyValue) : this(port, new PropertyValue(propertyValue))
 {
 }