bulk data should be in executable
-
Hello, by rewriting a MFC App In .NET I want to declare huge bulk data, which should be placed in the exe. Because I see, with the resource techniques the access to data implemented with resource-techniques are only possible with streams, I want to prepare the data, e.g. by declaring long arrays. Have you a tip for me? Thank You Erhy
-
Erhy wrote:
Have you a tip for me?
Yes, do not do it that way. But without more detail of what problem you are actually trying to solve it is impossible to say more.
-
Hello, by rewriting a MFC App In .NET I want to declare huge bulk data, which should be placed in the exe. Because I see, with the resource techniques the access to data implemented with resource-techniques are only possible with streams, I want to prepare the data, e.g. by declaring long arrays. Have you a tip for me? Thank You Erhy
-
What "data types" are you working with? The simplest array is a bit or byte array.
"(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal
-
Hello, by rewriting a MFC App In .NET I want to declare huge bulk data, which should be placed in the exe. Because I see, with the resource techniques the access to data implemented with resource-techniques are only possible with streams, I want to prepare the data, e.g. by declaring long arrays. Have you a tip for me? Thank You Erhy
Erhy wrote:
Because I see, with the resource techniques the access to data implemented with resource-techniques are only possible with streams, I want to prepare the data, e.g. by declaring long arrays.
So presuming that the arrays do not exceed some limit in .Net itself, which you would need to test... 1. Create the array(s). 2. Write code that wraps the array(s) in a Stream. You might need several classes for 2 depending on the exact stream that you need but you can start with the 'MemoryStream' class and research it from that. I would expect that you should experiment with creating a new stream each time or attempting to keep a single instance. The former shouldn't be a problem because you are using a memory blob so the object cost is low. If there is some reason that your data is unusual you might need to create your own stream class.
-
Erhy wrote:
Because I see, with the resource techniques the access to data implemented with resource-techniques are only possible with streams, I want to prepare the data, e.g. by declaring long arrays.
So presuming that the arrays do not exceed some limit in .Net itself, which you would need to test... 1. Create the array(s). 2. Write code that wraps the array(s) in a Stream. You might need several classes for 2 depending on the exact stream that you need but you can start with the 'MemoryStream' class and research it from that. I would expect that you should experiment with creating a new stream each time or attempting to keep a single instance. The former shouldn't be a problem because you are using a memory blob so the object cost is low. If there is some reason that your data is unusual you might need to create your own stream class.
Thank you for thinking about. I want to avoid streams, because with XAudio2 the usage of pointers is necessary. XAudio2 cannot used straight with C# .NET, rather such interfaces are necessary:
[SuppressUnmanagedCodeSecurity]
[DllImport(XAudioDll, CallingConvention = CallingConvention.StdCall)]
internal static extern int XAudio2Create(IntPtr ptr, int flags, XAudio2Processor flags0); -
Thank you for thinking about. I want to avoid streams, because with XAudio2 the usage of pointers is necessary. XAudio2 cannot used straight with C# .NET, rather such interfaces are necessary:
[SuppressUnmanagedCodeSecurity]
[DllImport(XAudioDll, CallingConvention = CallingConvention.StdCall)]
internal static extern int XAudio2Create(IntPtr ptr, int flags, XAudio2Processor flags0);Not sure what you mean. You mentioned streams so I provided a solution that allows for a stream but a in process one (not file based.) With speech you are going to need to pass a large amount of binary data using some api. Any implementation is either going to do that via an array or a stream even if the exact implementation is hidden. Presumably you have an API of a library not under your control and you are using it. If it takes a stream then you pass it a stream (my in process solution.) If it takes an array then you pass an array (which you presumably already know how to create.)
-
Not sure what you mean. You mentioned streams so I provided a solution that allows for a stream but a in process one (not file based.) With speech you are going to need to pass a large amount of binary data using some api. Any implementation is either going to do that via an array or a stream even if the exact implementation is hidden. Presumably you have an API of a library not under your control and you are using it. If it takes a stream then you pass it a stream (my in process solution.) If it takes an array then you pass an array (which you presumably already know how to create.)
I hoped for using pointers in unsafe mode of C#, but I failed. Now in a test project I have 250 C# files in the form
namespace WavDatSpace
{
unsafe public static partial class WavDats
{
public static byte[] WAVEA = {
0,0,220};
}
}and with VS the building of the project needs minutes, also when I change only one file. How to do it better? Erhy
-
I hoped for using pointers in unsafe mode of C#, but I failed. Now in a test project I have 250 C# files in the form
namespace WavDatSpace
{
unsafe public static partial class WavDats
{
public static byte[] WAVEA = {
0,0,220};
}
}and with VS the building of the project needs minutes, also when I change only one file. How to do it better? Erhy
-
-
If you add a Gb worth of data, and change some code so it needs be recompiled, then yes, it will take long. If you don't want that then make sure it isn't compiled each time by splitting it into its own assembly.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
If you add a Gb worth of data, and change some code so it needs be recompiled, then yes, it will take long. If you don't want that then make sure it isn't compiled each time by splitting it into its own assembly.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)