コード例 #1
0
ファイル: TestUtils.cs プロジェクト: hazzik/Rhino.Net
		/// <exception cref="System.IO.IOException"></exception>
		public static void AddTestsFromStream(Stream @in, IList<string> list)
		{
			Properties props = new Properties();
			props.Load(@in);
			foreach (object obj in props.Keys)
			{
				list.Add(obj.ToString());
			}
		}
コード例 #2
0
        protected override void Configure(OpenSshConfig.Host hc, Session session)
        {
            var config = new Properties();
            config["StrictHostKeyChecking"] = "no";
            config["PreferredAuthentications"] = "publickey";
            session.SetConfig(config);

            var jsch = this.GetJSch(hc, FS.DETECTED);
            jsch.AddIdentity("KeyPair", Encoding.UTF8.GetBytes(PrivateKey), Encoding.UTF8.GetBytes(PublicKey), null);
        }
コード例 #3
0
ファイル: AmazonS3.cs プロジェクト: shoff/ngit
        /// <exception cref="System.IO.FileNotFoundException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        internal static Sharpen.Properties Properties(FilePath authFile)
        {
            Sharpen.Properties p   = new Sharpen.Properties();
            FileInputStream    @in = new FileInputStream(authFile);

            try
            {
                p.Load(@in);
            }
            finally
            {
                @in.Close();
            }
            return(p);
        }
コード例 #4
0
ファイル: Session.cs プロジェクト: yayanyang/monodevelop
		public virtual void SetConfig(Properties newconf)
		{
			SetConfig((Hashtable)newconf);
		}
コード例 #5
0
		/// <exception cref="System.NotSupportedException"></exception>
		private Properties LoadProperties()
		{
			if (local.Directory != null)
			{
				FilePath propsFile = new FilePath(local.Directory, uri.GetUser());
				if (propsFile.IsFile())
				{
					return LoadPropertiesFile(propsFile);
				}
			}
			FilePath propsFile_1 = new FilePath(local.FileSystem.UserHome(), uri.GetUser());
			if (propsFile_1.IsFile())
			{
				return LoadPropertiesFile(propsFile_1);
			}
			Properties props = new Properties();
			props.SetProperty("accesskey", uri.GetUser());
			props.SetProperty("secretkey", uri.GetPass());
			return props;
		}
コード例 #6
0
 public static com.fasterxml.jackson.core.Version mavenVersionFor(java.lang.ClassLoader
     cl, string groupId, string artifactId)
 {
     // since 2.6
     Sharpen.InputStream pomProperties = cl.getResourceAsStream("META-INF/maven/" + groupId
         .replaceAll("\\.", "/") + "/" + artifactId + "/pom.properties");
     if (pomProperties != null)
     {
         try
         {
             Sharpen.Properties props = new Sharpen.Properties();
             props.load(pomProperties);
             string versionStr = props.getProperty("version");
             string pomPropertiesArtifactId = props.getProperty("artifactId");
             string pomPropertiesGroupId = props.getProperty("groupId");
             return parseVersion(versionStr, pomPropertiesGroupId, pomPropertiesArtifactId);
         }
         catch (System.IO.IOException)
         {
         }
         finally
         {
             // Ignore
             _close(pomProperties);
         }
     }
     return com.fasterxml.jackson.core.Version.unknownVersion();
 }
コード例 #7
0
ファイル: AmazonS3.cs プロジェクト: nickname100/monodevelop
		/// <exception cref="System.IO.FileNotFoundException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		internal static Sharpen.Properties Properties(FilePath authFile)
		{
			Sharpen.Properties p = new Sharpen.Properties();
			FileInputStream @in = new FileInputStream(authFile);
			try
			{
				p.Load(@in);
			}
			finally
			{
				@in.Close();
			}
			return p;
		}
コード例 #8
0
ファイル: AmazonS3.cs プロジェクト: shoff/ngit
        /// <summary>Create a new S3 client for the supplied user information.</summary>
        /// <remarks>
        /// Create a new S3 client for the supplied user information.
        /// <p>
        /// The connection properties are a subset of those supported by the popular
        /// <a href="http://jets3t.s3.amazonaws.com/index.html">jets3t</a> library.
        /// For example:
        /// <pre>
        /// # AWS Access and Secret Keys (required)
        /// accesskey: &lt;YourAWSAccessKey&gt;
        /// secretkey: &lt;YourAWSSecretKey&gt;
        /// # Access Control List setting to apply to uploads, must be one of:
        /// # PRIVATE, PUBLIC_READ (defaults to PRIVATE).
        /// acl: PRIVATE
        /// # Number of times to retry after internal error from S3.
        /// httpclient.retry-max: 3
        /// # End-to-end encryption (hides content from S3 owners)
        /// password: &lt;encryption pass-phrase&gt;
        /// crypto.algorithm: PBEWithMD5AndDES
        /// </pre>
        /// </remarks>
        /// <param name="props">connection properties.</param>
        public AmazonS3(Sharpen.Properties props)
        {
            publicKey = props.GetProperty("accesskey");
            if (publicKey == null)
            {
                throw new ArgumentException(JGitText.Get().missingAccesskey);
            }
            string secret = props.GetProperty("secretkey");

            if (secret == null)
            {
                throw new ArgumentException(JGitText.Get().missingSecretkey);
            }
            privateKey = new SecretKeySpec(Constants.EncodeASCII(secret), HMAC);
            string pacl = props.GetProperty("acl", "PRIVATE");

            if (StringUtils.EqualsIgnoreCase("PRIVATE", pacl))
            {
                acl = "private";
            }
            else
            {
                if (StringUtils.EqualsIgnoreCase("PUBLIC", pacl))
                {
                    acl = "public-read";
                }
                else
                {
                    if (StringUtils.EqualsIgnoreCase("PUBLIC-READ", pacl))
                    {
                        acl = "public-read";
                    }
                    else
                    {
                        if (StringUtils.EqualsIgnoreCase("PUBLIC_READ", pacl))
                        {
                            acl = "public-read";
                        }
                        else
                        {
                            throw new ArgumentException("Invalid acl: " + pacl);
                        }
                    }
                }
            }
            try
            {
                string cPas = props.GetProperty("password");
                if (cPas != null)
                {
                    string cAlg = props.GetProperty("crypto.algorithm");
                    if (cAlg == null)
                    {
                        cAlg = "PBEWithMD5AndDES";
                    }
                    encryption = new WalkEncryption.ObjectEncryptionV2(cAlg, cPas);
                }
                else
                {
                    encryption = WalkEncryption.NONE;
                }
            }
            catch (InvalidKeySpecException e)
            {
                throw new ArgumentException(JGitText.Get().invalidEncryption, e);
            }
            catch (NoSuchAlgorithmException e)
            {
                throw new ArgumentException(JGitText.Get().invalidEncryption, e);
            }
            maxAttempts = System.Convert.ToInt32(props.GetProperty("httpclient.retry-max", "3"
                                                                   ));
            proxySelector = ProxySelector.GetDefault();
        }