Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. bulk data should be in executable

bulk data should be in executable

Scheduled Pinned Locked Moved Design and Architecture
csharpc++questionlearning
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Erhy

    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

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #4

    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

    E 1 Reply Last reply
    0
    • L Lost User

      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

      E Offline
      E Offline
      Erhy
      wrote on last edited by
      #5

      the data are .wav files prepared for XAudio2. The longest file has 163 KB

      1 Reply Last reply
      0
      • E Erhy

        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

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #6

        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.

        E 1 Reply Last reply
        0
        • J jschell

          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.

          E Offline
          E Offline
          Erhy
          wrote on last edited by
          #7

          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);

          J 1 Reply Last reply
          0
          • E Erhy

            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);

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #8

            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.)

            E 1 Reply Last reply
            0
            • J jschell

              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.)

              E Offline
              E Offline
              Erhy
              wrote on last edited by
              #9

              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

              L 1 Reply Last reply
              0
              • E 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

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                Move your resources to a separate project and stop building it every time.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                E 1 Reply Last reply
                0
                • L Lost User

                  Move your resources to a separate project and stop building it every time.

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  E Offline
                  E Offline
                  Erhy
                  wrote on last edited by
                  #11

                  is it possible without DLL ?

                  L 1 Reply Last reply
                  0
                  • E Erhy

                    is it possible without DLL ?

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #12

                    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)

                    E 1 Reply Last reply
                    0
                    • L Lost User

                      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)

                      E Offline
                      E Offline
                      Erhy
                      wrote on last edited by
                      #13

                      Thanks, while developing I will make an extra DLL with data and in the final version I will include the byte array with data in the body of the exe project. Erhy

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups