示例#1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ProxyEnabled != null)
         {
             hashCode = hashCode * 59 + ProxyEnabled.GetHashCode();
         }
         if (ProxyHost != null)
         {
             hashCode = hashCode * 59 + ProxyHost.GetHashCode();
         }
         if (ProxyPort != null)
         {
             hashCode = hashCode * 59 + ProxyPort.GetHashCode();
         }
         if (ProxyUser != null)
         {
             hashCode = hashCode * 59 + ProxyUser.GetHashCode();
         }
         if (ProxyPassword != null)
         {
             hashCode = hashCode * 59 + ProxyPassword.GetHashCode();
         }
         if (ProxyExceptions != null)
         {
             hashCode = hashCode * 59 + ProxyExceptions.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#2
0
 /**
  * Check if current DatafeedResult contains "Keyword"
  * @params: keyword: Search keyword
  * @return: True: if it contains, False: if it doesn't contain
  * */
 public bool Find(string keyword)
 {
     if ((DatafeedID.Contains(keyword) && CheckStatus.Check_DatafeedID) ||
         (Guid.Contains(keyword) && CheckStatus.Check_Guid) ||
         (DatafeedName.Contains(keyword) && CheckStatus.Check_DatafeedName) ||
         (SecurityUsername.Contains(keyword) && CheckStatus.Check_SecurityUsername) ||
         (SecurityPassword.Contains(keyword) && CheckStatus.Check_SecurityPassword) ||
         (TransportUsername.Contains(keyword) && CheckStatus.Check_TransportUsername) ||
         (TransportPassword.Contains(keyword) && CheckStatus.Check_TransportPassword) ||
         (TransportURL.Contains(keyword) && CheckStatus.Check_TransportURL) ||
         (TransportInstance.Contains(keyword) && CheckStatus.Check_TransportInstance) ||
         (SecurityDomain.Contains(keyword) && CheckStatus.Check_SecurityDomain) ||
         (TransportDomain.Contains(keyword) && CheckStatus.Check_TransportDomain) ||
         (ProxyOption.Contains(keyword) && CheckStatus.Check_ProxyOption) ||
         (ProxyName.Contains(keyword) && CheckStatus.Check_ProxyName) ||
         (ProxyPort.Contains(keyword) && CheckStatus.Check_ProxyPort) ||
         (ProxyDomain.Contains(keyword) && CheckStatus.Check_ProxyDomain) ||
         (ProxyUserName.Contains(keyword) && CheckStatus.Check_ProxyUserName) ||
         (ProxyPassword.Contains(keyword) && CheckStatus.Check_ProxyPassword) ||
         (TransportPath.Contains(keyword) && CheckStatus.Check_TransportPath) ||
         (ConnectionString.Contains(keyword) && CheckStatus.Check_ConnectionString) ||
         (SQLQueryUsername.Contains(keyword) && CheckStatus.Check_SQLQueryUsername) ||
         (SQLQueryPassword.Contains(keyword) && CheckStatus.Check_SQLQueryPassword)
         )
     {
         return(true);
     }
     return(false);
 }
示例#3
0
 private void proxyName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         ProxyPort.Focus();
     }
 }
示例#4
0
        public static void ProxyPortTest(ProxyPort port)
        {
            var instance            = new GameIniData();
            var changedPropertyList = new List <string>();

            instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); };


            var errorOccured = false;

            try
            {
                instance.ProxyPort = port;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーが発生しないこと
            Assert.IsFalse(errorOccured);

            var setValue = instance.ProxyPort;

            // セットした値と取得した値が一致すること
            Assert.IsTrue(setValue.Equals(port));

            // 意図したとおりプロパティ変更通知が発火していること
            Assert.AreEqual(changedPropertyList.Count, 1);
            Assert.IsTrue(changedPropertyList[0].Equals(nameof(GameIniData.ProxyPort)));
        }
示例#5
0
        public static void ToIntTest(int value)
        {
            var instance = new ProxyPort(value);

            var intValue = instance.ToInt();

            // セットした値と取得した値が一致すること
            Assert.AreEqual(intValue, value);
        }
示例#6
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendLine("PublicKey: " + PublicKey);
            sb.AppendLine("SecretKey: " + SecretKey);
            sb.AppendLine("Url: " + Url);
            sb.AppendLine("Proxy Port: " + (ProxyPort > 0 ? ProxyPort.ToString() : ""));
            sb.AppendLine("HttpMethod: " + HttpMethod);
            sb.AppendLine("HttpAcceptType: " + HttpAcceptType);

            return(sb.ToString());
        }
示例#7
0
        public static void ConstructorIntTest(int value, bool isError)
        {
            var errorOccured = false;

            try
            {
                var _ = new ProxyPort(value);
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーフラグが一致すること
            Assert.AreEqual(errorOccured, isError);
        }
示例#8
0
 public void Setting()
 {
     if (!ProxyViewShow)
     {
         ProxyViewShow = true;
         return;
     }
     else
     {
         ProxyViewShow = false;
         Config.ProxyEnable(ProxyEnable.ToString());
         Config.ProxyHost(ProxyHost);
         Config.ProxyPort(ProxyPort.ToString());
         Config.ProxyUser(ProxyUser);
         Config.ProxyPwd(ProxyPwd);
     }
 }
示例#9
0
        public async void Login()
        {
            if (ShowKeyView == Visibility.Visible)
            {
                return;
            }

            Errlabel = "";
            if (Username.IsBlank() || Password.IsBlank())
            {
                Errlabel = "Username or password is err!";
                return;
            }
            BtnLoginEnable = false;

            //Proxy
            TidalTool.PROXY = ProxyEnable ? new HttpHelper.ProxyInfo(ProxyHost, ProxyPort, ProxyUser, ProxyPwd) : null;
            Config.ProxyEnable(ProxyEnable.ToString());
            Config.ProxyHost(ProxyHost);
            Config.ProxyPort(ProxyPort.ToString());
            Config.ProxyUser(ProxyUser);
            Config.ProxyPwd(ProxyPwd);

            //Login
            bool bRet = await Task.Run(() => { return(TidalTool.login(Username, Password)); });

            if (!bRet)
            {
                Errlabel       = "Login Err! " + TidalTool.loginErrlabel;
                BtnLoginEnable = true;
                return;
            }

            if (Remember)
            {
                Config.Username(Username);
                Config.Password(Password);
            }
            BtnLoginEnable = true;

            VMMain.VMLogin = this;
            Manager.ShowWindow(VMMain);
            RequestClose();
            return;
        }
示例#10
0
        public virtual IWebProxy GetProxy()
        {
            if (!UseProxy)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(ProxyHost) || ProxyPort.GetValueOrDefault() <= 0)
            {
                return(null);
            }
            var proxy = new WebProxy(ProxyHost?.Trim(), ProxyPort.GetValueOrDefault());

            if (!String.IsNullOrEmpty(ProxyUserName))
            {
                proxy.Credentials = new NetworkCredential(ProxyUserName?.Trim(), ProxyPassword?.Trim());
            }
            return(proxy);
        }
示例#11
0
        /// <summary>
        /// Returns true if OrgApacheHttpProxyconfiguratorProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheHttpProxyconfiguratorProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheHttpProxyconfiguratorProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProxyEnabled == other.ProxyEnabled ||
                     ProxyEnabled != null &&
                     ProxyEnabled.Equals(other.ProxyEnabled)
                     ) &&
                 (
                     ProxyHost == other.ProxyHost ||
                     ProxyHost != null &&
                     ProxyHost.Equals(other.ProxyHost)
                 ) &&
                 (
                     ProxyPort == other.ProxyPort ||
                     ProxyPort != null &&
                     ProxyPort.Equals(other.ProxyPort)
                 ) &&
                 (
                     ProxyUser == other.ProxyUser ||
                     ProxyUser != null &&
                     ProxyUser.Equals(other.ProxyUser)
                 ) &&
                 (
                     ProxyPassword == other.ProxyPassword ||
                     ProxyPassword != null &&
                     ProxyPassword.Equals(other.ProxyPassword)
                 ) &&
                 (
                     ProxyExceptions == other.ProxyExceptions ||
                     ProxyExceptions != null &&
                     ProxyExceptions.Equals(other.ProxyExceptions)
                 ));
        }
        protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var activityTimeout     = TimeoutMS.Get(context);
            var host                = Host.Get(context);
            var port                = Port.Get(context);
            var username            = Username.Get(context);
            var password            = Password.Get(context);
            var shellExpectedPrompt = ShellExpectedPrompt.Get(context);
            var proxyHost           = ProxyHost.Get(context);
            var proxyPort           = ProxyPort.Get(context);
            var proxyUsername       = ProxyUsername.Get(context);
            var proxyPassword       = ProxyPassword.Get(context);

            // Set a timeout on the execution
            var task = ExecuteWithTimeout(context, cancellationToken);

            if (await Task.WhenAny(task, Task.Delay(activityTimeout, cancellationToken)) != task)
            {
                throw new TimeoutException(Resources.Timeout_Error);
            }

            if (task.Exception != null)
            {
                throw task.Exception;
            }

            _objectContainer.Add(sshClient);
            _objectContainer.Add(currentShellStream);
            _objectContainer.Add(expectedPromptRegex);

            return((ctx) => {
                // Schedule child activities
                if (Body != null)
                {
                    ctx.ScheduleAction <IObjectContainer>(Body, _objectContainer, OnCompleted, OnFaulted);
                }
            });
        }
示例#13
0
        public static void CastProxyPortToIntTest(int value)
        {
            var castValue = 0;

            var instance = new ProxyPort(value);

            var errorOccured = false;

            try
            {
                castValue = instance;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーが発生しないこと
            Assert.IsFalse(errorOccured);

            // 元の値と一致すること
            Assert.AreEqual(castValue, value);
        }
示例#14
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", PocketLadioInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", PocketLadioInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("StationList");
                foreach (Station station in StationList.GetStationList())
                {
                    writer.WriteStartElement("Station");
                    writer.WriteAttributeString("id", station.Id);
                    writer.WriteAttributeString("name", station.Name);
                    writer.WriteAttributeString("kind", station.Kind.ToString());
                    writer.WriteEndElement(); // End of Station
                }
                writer.WriteEndElement();     // End of StationList

                writer.WriteStartElement("FilterEnable");
                writer.WriteAttributeString("enable", FilterEnable.ToString());
                writer.WriteEndElement(); // End of FilterEnable

                writer.WriteStartElement("HeadlineTimer");
                writer.WriteAttributeString("check", HeadlineTimerCheck.ToString());
                writer.WriteAttributeString("millsecond", HeadlineTimerMillSecond.ToString());
                writer.WriteEndElement(); // End of HeadlineTimer

                writer.WriteStartElement("MediaPlayerPath");
                writer.WriteAttributeString("path", MediaPlayerPath);
                writer.WriteEndElement(); // End of MediaPlayerPath

                writer.WriteStartElement("BrowserPath");
                writer.WriteAttributeString("path", BrowserPath);
                writer.WriteEndElement(); // End of BrowserPath

                writer.WriteStartElement("PlayListSave");
                writer.WriteAttributeString("save", PlayListSave.ToString());
                writer.WriteEndElement(); // End of PlayListSave

                writer.WriteStartElement("HeadlineListBoxFont");
                writer.WriteAttributeString("change", HeadlineListBoxFontSizeChange.ToString());
                writer.WriteAttributeString("size", HeadlineListBoxFontSize.ToString());
                writer.WriteEndElement(); // End of HeadlineListBoxFont

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }
示例#15
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", TwitterAwayInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", TwitterAwayInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("User");
                writer.WriteAttributeString("name", UserName);
                writer.WriteAttributeString("password", Password);
                writer.WriteEndElement(); // End of User

                writer.WriteStartElement("CheckList");
                writer.WriteAttributeString("list", CheckList.ToString());
                writer.WriteEndElement(); // End of CheckList

                writer.WriteStartElement("UpdateTimer");
                writer.WriteAttributeString("check", UpdateTimerCheck.ToString());
                writer.WriteAttributeString("millsecond", UpdateTimerMillSecond.ToString());
                writer.WriteEndElement(); // End of UpdateTimer

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteStartElement("TwitterListViewColumnWidth");
                writer.WriteAttributeString("name", TwitterListViewNameColumnWidth.ToString());
                writer.WriteAttributeString("doing", TwitterListViewDoingColumnWidth.ToString());
                writer.WriteAttributeString("date", TwitterListViewDateColumnWidth.ToString());
                writer.WriteEndElement(); // End of TwitterListViewColumnWidth

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            catch (IOException)
            {
                throw;
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }
示例#16
0
        public Dictionary <string, AttributeValue> GetFields(bool includeKeys = false)
        {
            var fields = new Dictionary <string, AttributeValue>();

            if (includeKeys)
            {
                fields.Add(DEPLOYMENT_ID_PROPERTY_NAME, new AttributeValue(DeploymentId));
                fields.Add(SILO_IDENTITY_PROPERTY_NAME, new AttributeValue(SiloIdentity));
            }

            if (!string.IsNullOrWhiteSpace(Address))
            {
                fields.Add(ADDRESS_PROPERTY_NAME, new AttributeValue(Address));
            }

            fields.Add(PORT_PROPERTY_NAME, new AttributeValue {
                N = Port.ToString()
            });
            fields.Add(GENERATION_PROPERTY_NAME, new AttributeValue {
                N = Generation.ToString()
            });

            if (!string.IsNullOrWhiteSpace(HostName))
            {
                fields.Add(HOSTNAME_PROPERTY_NAME, new AttributeValue(HostName));
            }

            fields.Add(STATUS_PROPERTY_NAME, new AttributeValue {
                N = Status.ToString()
            });
            fields.Add(PROXY_PORT_PROPERTY_NAME, new AttributeValue {
                N = ProxyPort.ToString()
            });

            if (!string.IsNullOrWhiteSpace(SiloName))
            {
                fields.Add(SILO_NAME_PROPERTY_NAME, new AttributeValue(SiloName));
            }

            if (!string.IsNullOrWhiteSpace(SuspectingSilos))
            {
                fields.Add(SUSPECTING_SILOS_PROPERTY_NAME, new AttributeValue(SuspectingSilos));
            }

            if (!string.IsNullOrWhiteSpace(SuspectingTimes))
            {
                fields.Add(SUSPECTING_TIMES_PROPERTY_NAME, new AttributeValue(SuspectingTimes));
            }

            if (!string.IsNullOrWhiteSpace(StartTime))
            {
                fields.Add(START_TIME_PROPERTY_NAME, new AttributeValue(StartTime));
            }

            if (!string.IsNullOrWhiteSpace(IAmAliveTime))
            {
                fields.Add(I_AM_ALIVE_TIME_PROPERTY_NAME, new AttributeValue(IAmAliveTime));
            }

            fields.Add(MEMBERSHIP_VERSION_PROPERTY_NAME, new AttributeValue {
                N = MembershipVersion.ToString()
            });

            fields.Add(ETAG_PROPERTY_NAME, new AttributeValue {
                N = ETag.ToString()
            });
            return(fields);
        }
示例#17
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", PodcasCoInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", PodcasCoInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("StationList");
                foreach (Station station in StationList.GetStationList())
                {
                    writer.WriteStartElement("Station");
                    writer.WriteAttributeString("id", station.Id);
                    writer.WriteAttributeString("name", station.Name);
                    writer.WriteAttributeString("kind", station.Kind.ToString());
                    writer.WriteAttributeString("startupDownload", station.StartupDownload.ToString());
                    writer.WriteAttributeString("startupDownloadNum", station.StartupDownloadNum.ToString());
                    writer.WriteAttributeString("startupDelete", station.StartupDelete.ToString());
                    writer.WriteAttributeString("startupDeleteRemainDay", station.StartupDeleteRemainDay.ToString());
                    writer.WriteEndElement(); // End of Station
                }
                writer.WriteEndElement();     // End of StationList

                writer.WriteStartElement("PodcastClipDirectoryPath");
                writer.WriteAttributeString("path", PodcastClipDirectoryPath);
                writer.WriteEndElement(); // End of PodcastClipDirectoryPath

                writer.WriteStartElement("MediaPlayerPath");
                writer.WriteAttributeString("path", MediaPlayerPath);
                writer.WriteEndElement(); // End of MediaPlayerPath

                writer.WriteStartElement("BrowserPath");
                writer.WriteAttributeString("path", BrowserPath);
                writer.WriteEndElement(); // End of BrowserPath

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteStartElement("ChannelSort");
                writer.WriteAttributeString("sort", ChannelSort.ToString());
                writer.WriteEndElement(); // End of ChannelSort

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }
        private async Task ExecuteWithTimeout(NativeActivityContext context, CancellationToken cancellationToken = default)
        {
            var sshPassword   = new NetworkCredential("", Password.Get(context)).Password;
            var proxyPassword = new NetworkCredential("", ProxyPassword.Get(context)).Password;
            var sshTimeout    = TimeSpan.FromMilliseconds(SSHTimeoutMS.Get(context));

            ConnectionInfo connectionInfo;

            if (!string.IsNullOrEmpty(ProxyHost.Get(context)))         // Proxy defined
            {
                if (!string.IsNullOrEmpty(ProxyUsername.Get(context))) // Proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Encoding.UTF8.GetBytes(sshPassword), ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context), ProxyUsername.Get(context), proxyPassword);
                }
                else // No proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), sshPassword, ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context));
                }
            }
            else // No Proxy defined
            {
                connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), sshPassword);
            }

            connectionInfo.Timeout = sshTimeout;

            sshClient = new SshClient(connectionInfo);
            sshClient.Connect();

            if (ShellExpectedPrompt.Expression != null)
            {
                var terminalMode = new Dictionary <TerminalModes, uint>
                {
                    { TerminalModes.ECHO, 53 }
                };

                expectedPromptRegex = new Regex(ShellExpectedPrompt.Get(context), RegexOptions.Compiled);
                currentShellStream  = sshClient.CreateShellStream("UiPathTeam.SSHConnector.Shell", 0, 0, 0, 0, 4096, terminalMode);
                var welcomeMessage = SSHHelpers.Expect(currentShellStream, expectedPromptRegex, string.Empty, sshTimeout);
                ShellWelcomeMessage.Set(context, welcomeMessage);
            }
        }
示例#19
0
        /**
         *  Replace DatafeedResult with keyword.
         *  @params: keyword: Search Keyword, replaceText: Text for Replace
         *  @return: Replace keyword count
         * */
        public int Replace(string keyword, string replaceText)
        {
            int replaceCount = 0;

            if (DatafeedID.Contains(keyword) && CheckStatus.Check_DatafeedID)
            {
                DatafeedID    = DatafeedID.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (Guid.Contains(keyword) && CheckStatus.Check_Guid)
            {
                Guid          = Guid.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (DatafeedName.Contains(keyword) && CheckStatus.Check_DatafeedName)
            {
                DatafeedName  = DatafeedName.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (SecurityUsername.Contains(keyword) && CheckStatus.Check_SecurityUsername)
            {
                SecurityUsername = SecurityUsername.Replace(keyword, replaceText);
                replaceCount    += 1;
            }
            if (SecurityPassword.Contains(keyword) && CheckStatus.Check_SecurityPassword)
            {
                SecurityPassword = SecurityPassword.Replace(keyword, replaceText);
                replaceCount    += 1;
            }
            if (TransportUsername.Contains(keyword) && CheckStatus.Check_TransportUsername)
            {
                TransportUsername = TransportUsername.Replace(keyword, replaceText);
                replaceCount     += 1;
            }
            if (TransportPassword.Contains(keyword) && CheckStatus.Check_TransportPassword)
            {
                TransportPassword = TransportPassword.Replace(keyword, replaceText);
                replaceCount     += 1;
            }
            if (TransportURL.Contains(keyword) && CheckStatus.Check_TransportURL)
            {
                TransportURL  = TransportURL.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (TransportInstance.Contains(keyword) && CheckStatus.Check_TransportInstance)
            {
                TransportInstance = TransportInstance.Replace(keyword, replaceText);
                replaceCount     += 1;
            }
            if (SecurityDomain.Contains(keyword) && CheckStatus.Check_SecurityDomain)
            {
                SecurityDomain = SecurityDomain.Replace(keyword, replaceText);
                replaceCount  += 1;
            }
            if (TransportDomain.Contains(keyword) && CheckStatus.Check_TransportDomain)
            {
                TransportDomain = TransportDomain.Replace(keyword, replaceText);
                replaceCount   += 1;
            }
            if (ProxyOption.Contains(keyword) && CheckStatus.Check_ProxyOption)
            {
                ProxyOption   = ProxyOption.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (ProxyName.Contains(keyword) && CheckStatus.Check_ProxyName)
            {
                ProxyName     = ProxyName.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (ProxyPort.Contains(keyword) && CheckStatus.Check_ProxyPort)
            {
                ProxyPort     = ProxyPort.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (ProxyDomain.Contains(keyword) && CheckStatus.Check_ProxyDomain)
            {
                ProxyDomain   = ProxyDomain.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (ProxyUserName.Contains(keyword) && CheckStatus.Check_ProxyUserName)
            {
                ProxyUserName = ProxyUserName.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (ProxyPassword.Contains(keyword) && CheckStatus.Check_ProxyPassword)
            {
                ProxyPassword = ProxyPassword.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (TransportPath.Contains(keyword) && CheckStatus.Check_TransportPath)
            {
                TransportPath = TransportPath.Replace(keyword, replaceText);
                replaceCount += 1;
            }
            if (ConnectionString.Contains(keyword) && CheckStatus.Check_ConnectionString)
            {
                ConnectionString = ConnectionString.Replace(keyword, replaceText);
                replaceCount    += 1;
            }
            if (SQLQueryUsername.Contains(keyword) && CheckStatus.Check_SQLQueryUsername)
            {
                SQLQueryUsername = SQLQueryUsername.Replace(keyword, replaceText);
                replaceCount    += 1;
            }
            if (SQLQueryPassword.Contains(keyword) && CheckStatus.Check_SQLQueryPassword)
            {
                SQLQueryPassword = SQLQueryPassword.Replace(keyword, replaceText);
                replaceCount    += 1;
            }

            return(replaceCount);
        }
示例#20
0
        protected override void Execute(NativeActivityContext context)
        {
            if (!string.IsNullOrEmpty(ProxyHost.Get(context)))         // Proxy defined
            {
                if (!string.IsNullOrEmpty(ProxyUsername.Get(context))) // Proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Encoding.UTF8.GetBytes(Password.Get(context)), ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context), ProxyUsername.Get(context), ProxyPassword.Get(context));
                }
                else // No proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Password.Get(context), ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context));
                }
            }
            else // No Proxy defined
            {
                connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Password.Get(context));
            }

            sshClient = new SshClient(connectionInfo);
            sshClient.Connect();

            if (Body != null)
            {
                //scheduling the execution of the child activities
                // and passing the value of the delegate argument
                context.ScheduleAction(Body, sshClient, OnCompleted, OnFaulted);
            }
        }