コード例 #1
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (UseSSL.Expression != null)
            {
                targetCommand.AddParameter("UseSSL", UseSSL.Get(context));
            }

            if (Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }

            if (SkipNetworkProfileCheck.Expression != null)
            {
                targetCommand.AddParameter("SkipNetworkProfileCheck", SkipNetworkProfileCheck.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: bauermaximilian/Vistava
        public void ToXml(XmlWriter writer)
        {
            writer.WriteStartDocument();
            writer.WriteStartElement(XmlNodeRoot);
            writer.WriteAttributeString(XmlNodeVersion,
                                        Assembly.GetExecutingAssembly().GetName().Version.ToString(2));
            {
                writer.WriteElementString(XmlNodeAutoStartServer,
                                          AutoStartServer.ToString());
                writer.WriteElementString(XmlNodeShowBalloonTips,
                                          ShowBalloonTips.ToString());
                writer.WriteElementString(XmlNodePort, Port.ToString());
                writer.WriteElementString(XmlNodeSsl, UseSSL.ToString());
                writer.WriteStartElement(XmlNodeAccounts);

                foreach (Account account in accounts.Values)
                {
                    account.ToXml(writer);
                }

                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteEndDocument();
        }
コード例 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Username.Length != 0)
            {
                hash ^= Username.GetHashCode();
            }
            if (Password.Length != 0)
            {
                hash ^= Password.GetHashCode();
            }
            if (UseSSL != false)
            {
                hash ^= UseSSL.GetHashCode();
            }
            if (BuildConfigurationId.Length != 0)
            {
                hash ^= BuildConfigurationId.GetHashCode();
            }
            if (Branch.Length != 0)
            {
                hash ^= Branch.GetHashCode();
            }
            return(hash);
        }
コード例 #4
0
		/// <summary>
		/// default constructor. It initializes all the values.
		/// </summary>
		/// <param name="webAddress"><see cref="WebAddress"/></param>
		/// <param name="context"><see cref="Context"/></param>
		/// <param name="ssl">optional parameter, defaults to off
		/// 	<see cref="UseSSL" /></param>
		/// <param name="port">optional parameter, defaults to null (default port)
		/// <see cref="Port"/></param>
		public PaymentServerUrlBuilder(string webAddress, string context="", UseSSL ssl=UseSSL.off, int? port=null)
		{
			if(String.IsNullOrWhiteSpace(webAddress)) throw new ArgumentNullException(webAddress);
			
			this.SSL = ssl;
			this.Port = port;
			this.WebAddress = webAddress;
			this.Context=context;
		}
コード例 #5
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Authentication.Expression != null)
            {
                targetCommand.AddParameter("Authentication", Authentication.Get(context));
            }

            if ((ComputerName.Expression != null) && (PSRemotingBehavior.Get(context) != RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", ComputerName.Get(context));
            }

            if (Port.Expression != null)
            {
                targetCommand.AddParameter("Port", Port.Get(context));
            }

            if (UseSSL.Expression != null)
            {
                targetCommand.AddParameter("UseSSL", UseSSL.Get(context));
            }

            if (ApplicationName.Expression != null)
            {
                targetCommand.AddParameter("ApplicationName", ApplicationName.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if (CertificateThumbprint.Expression != null)
            {
                targetCommand.AddParameter("CertificateThumbprint", CertificateThumbprint.Get(context));
            }

            if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", PSComputerName.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
コード例 #6
0
        /// <summary>
        /// default constructor. It initializes all the values.
        /// </summary>
        /// <param name="webAddress"><see cref="WebAddress"/></param>
        /// <param name="context"><see cref="Context"/></param>
        /// <param name="ssl">optional parameter, defaults to off
        ///     <see cref="UseSSL" /></param>
        /// <param name="port">optional parameter, defaults to null (default port)
        /// <see cref="Port"/></param>
        public PaymentServerUrlBuilder(string webAddress, string context = "", UseSSL ssl = UseSSL.off, int?port = null)
        {
            if (String.IsNullOrWhiteSpace(webAddress))
            {
                throw new ArgumentNullException(webAddress);
            }

            this.SSL        = ssl;
            this.Port       = port;
            this.WebAddress = webAddress;
            this.Context    = context;
        }
コード例 #7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Server:").Append(Server.ToString()).Append("\n");
            sb.Append("Recipient:").Append(Recipient.ToString()).Append("\n");
            sb.Append("Subject:").Append(Subject.ToString()).Append("\n");
            sb.Append("UserName:"******"\n");
            sb.Append("Password:"******"\n");
            sb.Append("Port:").Append(Port.ToString()).Append("\n");
            sb.Append("UseSSL:").Append(UseSSL.ToString()).Append("\n");
            sb.Append("CompanyName:").Append(CompanyName.ToString()).Append("\n");
            sb.Append("TimeOut:").Append(TimeOut.ToString()).Append("\n");

            return(sb.ToString());
        }
コード例 #8
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (ApplicationName.Expression != null)
            {
                targetCommand.AddParameter("ApplicationName", ApplicationName.Get(context));
            }

            if (BasePropertiesOnly.Expression != null)
            {
                targetCommand.AddParameter("BasePropertiesOnly", BasePropertiesOnly.Get(context));
            }

            if ((ComputerName.Expression != null) && (PSRemotingBehavior.Get(context) != RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", ComputerName.Get(context));
            }

            if (ConnectionURI.Expression != null)
            {
                targetCommand.AddParameter("ConnectionURI", ConnectionURI.Get(context));
            }

            if (Dialect.Expression != null)
            {
                targetCommand.AddParameter("Dialect", Dialect.Get(context));
            }

            if (Enumerate.Expression != null)
            {
                targetCommand.AddParameter("Enumerate", Enumerate.Get(context));
            }

            if (Filter.Expression != null)
            {
                targetCommand.AddParameter("Filter", Filter.Get(context));
            }

            if (Fragment.Expression != null)
            {
                targetCommand.AddParameter("Fragment", Fragment.Get(context));
            }

            if (OptionSet.Expression != null)
            {
                targetCommand.AddParameter("OptionSet", OptionSet.Get(context));
            }

            if (Port.Expression != null)
            {
                targetCommand.AddParameter("Port", Port.Get(context));
            }

            if (Associations.Expression != null)
            {
                targetCommand.AddParameter("Associations", Associations.Get(context));
            }

            if (ResourceURI.Expression != null)
            {
                targetCommand.AddParameter("ResourceURI", ResourceURI.Get(context));
            }

            if (ReturnType.Expression != null)
            {
                targetCommand.AddParameter("ReturnType", ReturnType.Get(context));
            }

            if (SelectorSet.Expression != null)
            {
                targetCommand.AddParameter("SelectorSet", SelectorSet.Get(context));
            }

            if (SessionOption.Expression != null)
            {
                targetCommand.AddParameter("SessionOption", SessionOption.Get(context));
            }

            if (Shallow.Expression != null)
            {
                targetCommand.AddParameter("Shallow", Shallow.Get(context));
            }

            if (UseSSL.Expression != null)
            {
                targetCommand.AddParameter("UseSSL", UseSSL.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if (Authentication.Expression != null)
            {
                targetCommand.AddParameter("Authentication", Authentication.Get(context));
            }

            if (CertificateThumbprint.Expression != null)
            {
                targetCommand.AddParameter("CertificateThumbprint", CertificateThumbprint.Get(context));
            }

            if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", PSComputerName.Get(context));
            }

            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
コード例 #9
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (ComputerName.Expression != null)
            {
                targetCommand.AddParameter("ComputerName", ComputerName.Get(context));
            }

            if (ApplicationName.Expression != null)
            {
                targetCommand.AddParameter("ApplicationName", ApplicationName.Get(context));
            }

            if (ConnectionUri.Expression != null)
            {
                targetCommand.AddParameter("ConnectionUri", ConnectionUri.Get(context));
            }

            if (ConfigurationName.Expression != null)
            {
                targetCommand.AddParameter("ConfigurationName", ConfigurationName.Get(context));
            }

            if (AllowRedirection.Expression != null)
            {
                targetCommand.AddParameter("AllowRedirection", AllowRedirection.Get(context));
            }

            if (Name.Expression != null)
            {
                targetCommand.AddParameter("Name", Name.Get(context));
            }

            if (InstanceId.Expression != null)
            {
                targetCommand.AddParameter("InstanceId", InstanceId.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if (Authentication.Expression != null)
            {
                targetCommand.AddParameter("Authentication", Authentication.Get(context));
            }

            if (CertificateThumbprint.Expression != null)
            {
                targetCommand.AddParameter("CertificateThumbprint", CertificateThumbprint.Get(context));
            }

            if (Port.Expression != null)
            {
                targetCommand.AddParameter("Port", Port.Get(context));
            }

            if (UseSSL.Expression != null)
            {
                targetCommand.AddParameter("UseSSL", UseSSL.Get(context));
            }

            if (ThrottleLimit.Expression != null)
            {
                targetCommand.AddParameter("ThrottleLimit", ThrottleLimit.Get(context));
            }

            if (State.Expression != null)
            {
                targetCommand.AddParameter("State", State.Get(context));
            }

            if (SessionOption.Expression != null)
            {
                targetCommand.AddParameter("SessionOption", SessionOption.Get(context));
            }

            if (PSSessionId.Expression != null)
            {
                targetCommand.AddParameter("Id", PSSessionId.Get(context));
            }

            if (ContainerId.Expression != null)
            {
                targetCommand.AddParameter("ContainerId", ContainerId.Get(context));
            }

            if (VMId.Expression != null)
            {
                targetCommand.AddParameter("VMId", VMId.Get(context));
            }

            if (VMName.Expression != null)
            {
                targetCommand.AddParameter("VMName", VMName.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
コード例 #10
0
        /// <param name="preferUserSettings">when true - means that user tokens/parameters will be used instead of license(admin)
        /// to retrieve information from API</param>
        public virtual Dictionary <string, object> GetLMSSettings(dynamic settings, LmsUserParameters userParameters = null,
                                                                  bool preferUserSettings = false)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            switch (LmsProviderId)
            {
            case (int)LmsProviderEnum.Canvas:
//                        LmsLicenseSettingNames.CanvasOAuthId,
//                        LmsLicenseSettingNames.CanvasOAuthKey


                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                if (userParameters != null)
                {
                    result.Add(LmsUserSettingNames.Token,
                               preferUserSettings ? userParameters.LmsUser.Token : AdminUser?.Token);
                    result.Add(LmsUserSettingNames.CourseId, userParameters.Course);
                }
                else
                {
                    result.Add(LmsUserSettingNames.Token, AdminUser?.Token);
                }
                //result.Add(LmsUserSettingNames.RefreshToken, session.RefreshToken);
                break;

            case (int)LmsProviderEnum.AgilixBuzz:
                result.Add(LmsLicenseSettingNames.BuzzAdminUsername, AdminUser?.Username);
                result.Add(LmsLicenseSettingNames.BuzzAdminPassword, AdminUser?.Password);
                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                break;

            case (int)LmsProviderEnum.Schoology:
                result.Add(LmsLicenseSettingNames.SchoologyConsumerKey, GetSetting <string>(LmsLicenseSettingNames.SchoologyConsumerKey));
                result.Add(LmsLicenseSettingNames.SchoologyConsumerSecret, GetSetting <string>(LmsLicenseSettingNames.SchoologyConsumerSecret));
                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                break;

            case (int)LmsProviderEnum.Blackboard:
                var enableProxy = EnableProxyToolMode.GetValueOrDefault();
                result.Add(LmsLicenseSettingNames.UseSSL, UseSSL.GetValueOrDefault());
                result.Add(LmsLicenseSettingNames.BlackBoardEnableProxyToolMode, enableProxy);
                if (enableProxy)
                {
                    string defaultToolRegistrationPassword = settings?.InitialBBPassword;
                    string toolPassword = string.IsNullOrWhiteSpace(ProxyToolSharedPassword)
                            ? defaultToolRegistrationPassword
                            : ProxyToolSharedPassword;
                    result.Add(LmsLicenseSettingNames.BlackBoardProxyToolPassword, toolPassword);
                }
                else
                {
                    result.Add(LmsLicenseSettingNames.AdminUsername, AdminUser?.Username);
                    result.Add(LmsLicenseSettingNames.AdminPassword, AdminUser?.Password);
                }

                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);

                //result.Add(LmsLicenseSettingNames.BlackBoardUseSSL, true);

                if (userParameters != null)
                {
                    result.Add(LmsUserSettingNames.Token, userParameters.Wstoken);    //todo: separate setting?
                    result.Add(LmsUserSettingNames.CourseId, userParameters.Course);
                    result.Add(LmsUserSettingNames.CourseName, userParameters.CourseName);
                }

                break;

            case (int)LmsProviderEnum.Bridge:
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                result.Add(LmsLicenseSettingNames.BridgeApiTokenKey,
                           GetSetting <string>(LmsLicenseSettingNames.BridgeApiTokenKey));
                result.Add(LmsLicenseSettingNames.BridgeApiTokenSecret,
                           GetSetting <string>(LmsLicenseSettingNames.BridgeApiTokenSecret));
                break;

            case (int)LmsProviderEnum.Brightspace:
                result.Add(LmsUserSettingNames.Token, AdminUser?.Token);
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                result.Add(LmsLicenseSettingNames.LicenseId, Id);
                var keys = GetApiKeys(this, (string)settings.BrightspaceAppId,
                                      (string)settings.BrightspaceAppKey);
                result.Add(LmsLicenseSettingNames.BrigthSpaceAppId, keys.Key);
                result.Add(LmsLicenseSettingNames.BrigthSpaceAppKey, keys.Value);
                result.Add(LmsLicenseSettingNames.BrightSpaceAllowAdminAdditionToCourse, true);
                break;

            case (int)LmsProviderEnum.Moodle:
                result.Add(LmsLicenseSettingNames.MoodleCoreServiceToken, GetSetting <string>(LmsLicenseSettingNames.MoodleCoreServiceToken));
                result.Add(LmsLicenseSettingNames.MoodleQuizServiceToken, GetSetting <string>(LmsLicenseSettingNames.MoodleQuizServiceToken));
                result.Add(LmsLicenseSettingNames.UseSSL, UseSSL.GetValueOrDefault());
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                if (AdminUser != null)
                {
                    result.Add(LmsLicenseSettingNames.AdminUsername, AdminUser.Username);
                    result.Add(LmsLicenseSettingNames.AdminPassword, AdminUser.Password);
                }
                if (userParameters != null)
                {
                    result.Add(LmsUserSettingNames.CourseId, userParameters.Course);
                    result.Add(LmsUserSettingNames.SessionId, userParameters.Id);
                }
                break;

            case (int)LmsProviderEnum.Haiku:
                result.Add(LmsLicenseSettingNames.HaikuConsumerKey, GetSetting <string>(LmsLicenseSettingNames.HaikuConsumerKey));
                result.Add(LmsLicenseSettingNames.HaikuConsumerSecret, GetSetting <string>(LmsLicenseSettingNames.HaikuConsumerSecret));
                result.Add(LmsLicenseSettingNames.HaikuToken, GetSetting <string>(LmsLicenseSettingNames.HaikuToken));
                result.Add(LmsLicenseSettingNames.HaikuTokenSecret, GetSetting <string>(LmsLicenseSettingNames.HaikuTokenSecret));
                result.Add(LmsLicenseSettingNames.UseSSL, UseSSL.GetValueOrDefault());
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                break;

            case (int)LmsProviderEnum.Sakai:
                result.Add(LmsLicenseSettingNames.LicenseKey, ConsumerKey);
                result.Add(LmsLicenseSettingNames.LicenseSecret, SharedSecret);
                result.Add(LmsLicenseSettingNames.LanguageId, LanguageId);
                result.Add(LmsLicenseSettingNames.UseSSL, UseSSL.GetValueOrDefault());
                result.Add(LmsLicenseSettingNames.LmsDomain, LmsDomain);
                if (AdminUser != null)
                {
                    result.Add(LmsLicenseSettingNames.AdminUsername, AdminUser.Username);
                    result.Add(LmsLicenseSettingNames.AdminPassword, AdminUser.Password);
                }
                if (userParameters != null)
                {
                    result.Add(LmsUserSettingNames.CourseId, userParameters.Course);
                    result.Add(LmsUserSettingNames.CourseName, userParameters.CourseName);
                    result.Add(LmsUserSettingNames.SessionId, userParameters.Id);
                    result.Add(LmsUserSettingNames.UserId, userParameters.LmsUser.UserId);
                    result.Add(LmsUserSettingNames.Username, userParameters.LmsUser.Username);
                }
                break;

            default:
                throw new NotImplementedException($"LmsProviderId {LmsProviderId} is not implemented.");
            }

            return(result);
        }