private Spring.Util.Properties obtenerPropertiesMascara(String directorioReportesDelSistema, DBContextAdapter dbContext)
        //private ResXResourceSet obtenerPropertiesMascara(String directorioReportesDelSistema, DBContextAdapter dbContext)

        {
            concatena = new StringBuilder();
            concatena.Append(directorioReportesDelSistema);
            Spring.Util.Properties properties = null;
            // ResXResourceSet resxSet = null;
            if (!directorioReportesDelSistema.Substring(directorioReportesDelSistema.Length - 2).Contains(Path.DirectorySeparatorChar))
            {
                concatena.Append(Path.DirectorySeparatorChar);
            }
            concatena.Append(getNameFileConfigurationMask(null));
            string ubicacionFile = concatena.ToString();

            if (File.Exists(ubicacionFile))
            {
                properties = abrirPropiedad(ubicacionFile);
            }
            else
            {
                concatena = new StringBuilder();
                Assembly     assembly    = Assembly.GetExecutingAssembly();
                StreamReader inputStream = new StreamReader(assembly.GetManifestResourceStream(concatena.Append("Exitosw.Payroll.Core.util.").Append(DEFAULT_FILE).Append(".properties").ToString()));
                try
                {
                    properties = new Spring.Util.Properties();
                    properties.Load(inputStream);
                    //resxSet = new ResXResourceSet(ubicacion);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(concatena.Remove(0, concatena.Length).Append(msgError).Append("obtenerPropertiesMascara()1_Error: ").Append(ex));
                    mensajeResultado.noError   = ControlErroresEntity.buscaNoErrorPorExcepcion(ex);
                    mensajeResultado.error     = ex.GetBaseException().ToString();
                    mensajeResultado.resultado = null;
                }
            }
            //return resourcemanager;
            return(properties);
        }
 private Spring.Util.Properties abrirPropiedad(String file)
 {
     Spring.Util.Properties properties = null;
     try
     {
         var stream = new MemoryStream();
         var writer = new StreamWriter(stream);
         writer.Write(file);
         writer.Flush();
         stream.Position = 0;
         properties      = new Spring.Util.Properties();
         properties.Load(new StreamReader(stream));
     }
     catch (IOException ex)
     {
         mensajeResultado.noError   = ControlErroresEntity.buscaNoErrorPorExcepcion(ex);
         mensajeResultado.error     = ex.GetBaseException().ToString();
         mensajeResultado.resultado = null;
     }
     return(properties);
 }
        public void ListAndLoad()
        {
            Properties props = new Properties();

            props.Add("foo", "this");
            props.Add("bar", "is");
            props.Add("baz", "it");
            FileInfo file = new FileInfo("properties.test");

            try
            {
                // write 'em out...
                using (Stream cout = file.OpenWrite())
                {
                    props.List(cout);
                }
                // read 'em back in...
                using (Stream cin = file.OpenRead())
                {
                    props = new Properties();
                    props.Load(cin);
                    Assert.AreEqual(3, props.Count);
                    Assert.AreEqual("this", props.GetProperty("foo"));
                    Assert.AreEqual("is", props.GetProperty("bar"));
                    Assert.AreEqual("it", props.GetProperty("baz", "it"));
                }
            }
            finally
            {
                try
                {
                    file.Delete();
                }
                catch (IOException)
                {
                }
            }
        }
 /// <summary>
 /// Load object definitions from the specified properties file.
 /// </summary>
 /// <param name="resource">
 /// The resource descriptor for the properties file.
 /// </param>
 /// <param name="prefix">
 /// The match or filter for object definition names, e.g. 'objects.'
 /// </param>
 /// <exception cref="Spring.Objects.ObjectsException">in case of loading or parsing errors</exception>
 /// <returns>the number of object definitions found</returns>
 public int LoadObjectDefinitions(IResource resource, string prefix)
 {
     Properties props = new Properties();
     try
     {
         Stream str = resource.InputStream;
         try
         {
             props.Load(str);
         }
         finally
         {
             str.Close();
         }
         return RegisterObjectDefinitions(props, prefix, resource.Description);
     }
     catch (IOException ex)
     {
         throw new ObjectDefinitionStoreException("IOException parsing properties from " + resource, ex);
     }
 }
Esempio n. 5
0
		public void EscapedCharactersInValue()
		{
			string input = "escaped=test\\ttest";
			Stream s = new MemoryStream(Encoding.ASCII.GetBytes(input));
			Properties props = new Properties();
			props.Load(s);

			Assert.IsTrue("test\ttest".Equals(props["escaped"]));
		}
Esempio n. 6
0
		public void SeperatorEscapedWithinKey()
		{
			string input = "\\" + ":key:newvalue";
			Stream s = new MemoryStream(Encoding.ASCII.GetBytes(input));
			Properties props = new Properties();
			props.Load(s);

			Assert.IsTrue("newvalue".Equals(props[":key"]));
		}
Esempio n. 7
0
		public void Continuation()
		{
			string input = "continued = this is a long value element \\\r\nthat uses continuation \\\r\n    xxx";
			Stream s = new MemoryStream(Encoding.ASCII.GetBytes(input));
			Properties props = new Properties();
			props.Load(s);

			Assert.IsTrue("this is a long value element that uses continuation xxx".Equals(props["continued"]));
		}
Esempio n. 8
0
        public void WhitespaceProperties()
        {
            string input = "key1 =\t\nkey2:\nkey3";

            Stream s = new MemoryStream(Encoding.ASCII.GetBytes(input));
            Properties props = new Properties();
            props.Load(s);

            Assert.AreEqual(string.Empty, props["key1"], "key1 should have empty value");
            Assert.AreEqual(string.Empty, props["key2"], "key2 should have empty value");
            Assert.IsTrue(props.ContainsKey("key3"));
            Assert.IsNull(props["key3"]);
        }
Esempio n. 9
0
		public void SimpleProperties()
		{
			string input = "key1=value1\r\nkey2:value2\r\n\r\n# a comment line\r\n   leadingspace : true";
			Stream s = new MemoryStream(Encoding.ASCII.GetBytes(input));
			Properties props = new Properties();
			props.Load(s);

			Assert.IsTrue("value1".Equals(props["key1"]));
			Assert.IsTrue("value2".Equals(props["key2"]));
			Assert.IsTrue("true".Equals(props["leadingspace"]));
		}
Esempio n. 10
0
 public void ListAndLoad()
 {
     Properties props = new Properties();
     props.Add ("foo", "this");
     props.Add ("bar", "is");
     props.Add ("baz", "it");
     FileInfo file = new FileInfo ("properties.test");
     try 
     {
         // write 'em out...
         using (Stream cout = file.OpenWrite ()) 
         {
             props.List (cout);
         }
         // read 'em back in...
         using (Stream cin = file.OpenRead ()) 
         {
             props = new Properties ();
             props.Load (cin);
             Assert.AreEqual (3, props.Count);
             Assert.AreEqual ("this", props.GetProperty ("foo"));
             Assert.AreEqual ("is", props.GetProperty ("bar"));
             Assert.AreEqual ("it", props.GetProperty ("baz", "it"));
         }
     }
     finally 
     {
         try 
         {
             file.Delete ();
         } 
         catch (IOException)
         {
         }
     }
 }
 /// <summary>
 /// Initializes properties based on the specified 
 /// property file locations.
 /// </summary>
 private void InitProperties()
 {
     properties = new Properties();
     foreach (IResource location in locations)
     {
         using (Stream input = location.InputStream)
         {
             properties.Load(input);
         }
     }
 }