Example #1
0
        public void Copiar(string carpeta, System.Resources.ResourceManager rMgr)
        {
            if (_listaCopiados.Contains(rMgr))
            {
                return;
            }
            else
            {
                _listaCopiados.Add(rMgr);
            }

            List <string> listaReportes = GetListaReportes();

            if (!Directory.Exists(carpeta))
            {
                Directory.CreateDirectory(carpeta);
            }

            System.Resources.ResourceSet r = rMgr.GetResourceSet(System.Threading.Thread.CurrentThread.CurrentCulture, true, true);

            foreach (string nombreReporte in listaReportes)
            {
                string archivoReporte = Path.Combine(carpeta, nombreReporte + ".rpt");
                byte[] bytesReporte   = (byte[])r.GetObject(nombreReporte);
                if (bytesReporte != null)
                {
                    if (File.Exists(archivoReporte))
                    {
                        File.Delete(archivoReporte);
                    }
                    File.WriteAllBytes(archivoReporte, bytesReporte);
                }
            }
        }
Example #2
0
        /// <include file='doc\Localizer.uex' path='docs/doc[@for="LocalizationExtenderProvider.LocalizationExtenderProvider"]/*' />
        /// <devdoc>
        /// <para>Initializes a new instance of the <see cref='System.ComponentModel.Design.LocalizationExtenderProvider'/> class using the
        ///    specified service provider and base component.</para>
        /// </devdoc>
        public LocalizationExtenderProvider(ISite serviceProvider, IComponent baseComponent)
        {
            this.serviceProvider = (IServiceProvider)serviceProvider;
            this.baseComponent   = baseComponent;

            if (serviceProvider != null)
            {
                IExtenderProviderService es = (IExtenderProviderService)serviceProvider.GetService(typeof(IExtenderProviderService));
                if (es != null)
                {
                    es.AddExtenderProvider(this);
                }
            }
            language = CultureInfo.InvariantCulture;

            //We need to check to see if our baseComponent has its localizable value persisted into
            //the resource file.  If so, we'll want to "inherit" this value for our baseComponent.
            //This enables us to create Inherited forms and inherit the  localizable props from the base.
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(baseComponent.GetType());
            if (resources != null)
            {
                System.Resources.ResourceSet rSet = resources.GetResourceSet(language, true, false);
                if (rSet != null)
                {
                    object objLocalizable = rSet.GetObject("$this.Localizable");
                    if (objLocalizable is bool)
                    {
                        defaultLocalizable = (bool)objLocalizable;
                        this.localizable   = defaultLocalizable;
                    }
                }
            }
        }
Example #3
0
            /// <summary>
            /// Using Project Resources and gets all byte[] data
            /// </summary>
            public static void CompileShaders()
            {
                // v5
                //string vertexProfile    = "vs_5_0";
                //string pixelProfile     = "ps_5_0";

                // v4
                string vertexProfile = "vs_4_0_level_9_1";
                string pixelProfile  = "ps_4_0_level_9_1";

                string shadersCode = "";

                System.Resources.ResourceSet rsrcSet = Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
                foreach (System.Collections.DictionaryEntry entry in rsrcSet)
                {
                    if (entry.Value is byte[])
                    {
                        byte[] byteCode = ShaderBytecode.Compile((byte[])rsrcSet.GetObject(entry.Key.ToString()), "main", entry.Key.ToString() == "VertexShader" ? pixelProfile : vertexProfile, ShaderFlags.Debug);

                        shadersCode += $"{{ \"{entry.Key.ToString()}\", new byte[] {{ {byteCode[0]}";
                        for (int i = 1; i < byteCode.Length; i++)
                        {
                            shadersCode += $",{byteCode[i]}";
                        }
                        shadersCode += $" }}}},\r\n";
                    }
                }

                File.WriteAllText(@"Shaders.cs", shadersCode);
            }