Jump to content
  • Advertisement

Dave Haylett

  • Content Count

  • Joined

  • Last visited

Community Reputation

132 Neutral

About Dave Haylett

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Just to finish this thread off, I found NAudio did the job perfectly
  2. Thanks for the responses all. @LorenzoGatti My app doesn't have an installer package and so users would need to find the .exe themselves, at least for the first time. Yes, some of them will manually create a shortcut. I was just hoping for some setting in VS somewhere which I'd missed. @Endurion @Nypyren I took a look at ILMerge but I don't think I'll use it, just in case it causes difficulties.
  3. Hi. I have pulled in five NuGet packages for my Visual Studio 2017 project, however when I build the project, VS spits out 10 .DLL and .XML files in the root of the binary folder, to do with the packages. Can't I shove them into a \packages folder so the user doesn't see these ugly resources next to the .exe file? I've Googled moving the packages but the only responses seem to be around moving the installation folder of the NuGet packages on the local machine, as opposed to where VS builds them to.
  4. Dave Haylett

    Deploying and Updating my app and content

    Hi Flodihn, Thanks for your responses. I've managed to redesign my way around most of the other sticking points I had. One of which was to do away with the separate Updater program, and have the main app download the files it needs to a temporary folder, and then build a .BAT file containing delete/copy commands, shell to the batch, shut down the main app, and have the batch file restart the main app once the sync is complete. I'm sure I've seen this happen plenty of times elsewhere. I've also (hopefully) managed to avoid having to create a separate ClickOnce copy of the app, as I've managed to get the app working from a non-development machine simply by copying the contents of the Bin\Debug folder over. I'd done this before, but had neglected to check the Event Log for any errors, and assumed incorrectly that the app wasn't working because it had been copied over instead of installed "properly", when in fact it was looking for a temporary file that resided on the development machine only. Newbie mistake. This just leaves me with hosting and downloading files, which you've given me some pointers to. I'll avoid the P2P solution, as my app is very niche and I suspect will barely have a couple of hundred users.
  5. Hi all, I’ve nearly finished my C# WPF project (using VS2017) and am now thinking about deployment and managing updates. This is my first time doing this, and I wanted to run my current thinking past you to see if you can help, as I don’t think my current solution will fully work. I have drawn a quick mock-up of what’s in my head at the moment (attached). My app needs to be able to update itself, but also to add in new content once I create it (this is in the form of small .zip files, ~100kb each, and due to the volume of these files [currently 3000, hopefully expanded up to 5000 in a years’ time] I have kept these separate from my project, i.e. not as Content). I welcome comments on this decision. Due to keeping the content separate, this kind of broke my initial intention of “simply” using ClickOnce deployment, and letting Windows manage the updating for me, and so I’ve been thinking of how to manage i) initial app deployment, ii) ongoing updating of the app, iii) ongoing addition of new content. I’m currently intending to use my *free* DropBox account to host all the files, I think this is possible. Does anyone know of any better web hosting I could use? If you could refer to my attached diagram, what I’m currently thinking of is: Deploying the initial version of the app using ClickOnce by Publishing to DropBox or wherever (my project A publishing to web host D). Users can then download the Installer from here, and install on their local machines as usual. This initial installation wouldn’t have any content (the 3000 zips) and so these would be pulled down to the local machine by the below step (the initial batch of 3000 zips would only need to be downloaded the first time the app is run, after then it’d just be new content that’d be downloaded): Also, I have as a second Project in my overall Solution a small Updater app, which when run by the users will connect to DropBox and pull down an xml manifest of my project files and the content (I create this manifest myself), and synchronise any files which are newer. This Updater app will be downloaded and installed by the users too. In the diagram, I publish Updater app code C to web host G, downloadable by users. Please see below question: Question: my main app and my updater app are two separate projects under the same Visual Studio Solution. Is it possible for me to build/publish these together so that the two executables are together in the same output (in the same folder)? The reason I have them separate is so that the main project’s executable file and any resource files can be overwritten by any new files pulled down by the Updater app without the Main app being open and locking these files out. The 3000-zip Content on my PC (B in the diagram) I just manually copy over to DropBox (F), and keep these up-to-date when I create new zips. Also, whenever I update my app code, I intend (this is probably the most painful bit) to manually copy the “\bin\release” folder contents from my PC (A) over to web host (E), so that the Updater app on user’s PCs can synchronise the executable and resource files with any newer versions I have created, without the user having to download a new version of the installer, and potentially uninstall/reinstall to go from v1 to v2 of the app. This above bit I think is the least possible, as I have found out that just by moving the \bin\release\ executable and resources from one location to another on my PC, it no longer works if I double-click the .exe file, it only works from the project’s original \bin\release folder . Is this expected? In my naivety I was thinking that once the user had installed v1 of the application "properly" using ClickOnce (and therefore their PC was checked for .Net framework etc) I could then just have my Updater overwrite the .exe and other embedded resource files (like bitmaps) with updates and it’d just work. I guess this would have worked with VS2005, but not with VS2017 hey. So, after writing all that out, and thanks for reading this far, I guess that if it wasn’t for the 3000 zips, I could package all the above as ClickOnce, and let Microsoft manage the updating for me. I don’t fancy adding the 3000 zips to my project as Content [copy if newer] to enable this to happen, but I did fancy having a go at writing the standalone Updater package, which would synchronise the files between DropBox and the user’s PC, based on the xml manifest I create. Any feedback you may have would be greatly appreciated, as this community has proven invaluable to me so far
  6. Hi there, I need a simple(ish) MP3 player for my C# WPF project. Sound isn't a major player in my project, but I do need to be able to play a couple of MP3s at the same time (loaded in as Content). I'm currently using the standard MediaPlayer library just to get a placeholder in there, but it does not meet these requirements: * Looping - no matter what I try, there's always a split-second break in the sound when it comes to looping (a few of the sounds are short tune loops, and the brief pause when looping really stands out like a sore... ear...!) * Mixing - at times I need to play a couple of samples simultaneously, but I don't believe MediaPlayer can support this. Having said this I've not tried invoking more than one MediaPlayer class at the same time. Are there any suggestions? I've browsed through NuGet but I'm surprised I can't find anything really useful.
  7. Dave Haylett

    10,000 PNG files!

    Hmm ok so I'm trying DotNetZip. If I were to zip all my images up into a single file, then add that zip as a resource to my project, what I'm trying to do now is extract a single file from that zip into a MemoryStream, so I'm not touching the HDD at all, and then convert from the MemoryStream to a WriteableBitmap. Annoyingly DotNetZip doesn't appear to have the functionality to extract a single file from the zip directly to a MemoryStream. I can extract a single entry from the collection of all entries to a MemoryStream using foreach, but I don't want to have to foreach through 10,000 records until I find the filename I want each time I want to extract a single entry Any ideas? I feel like I'm making this harder work than it should be EDIT: further googling has revealed that with DotNetZip I can simply go: archive["filename.png"]! So my code now looks like this, and appears to work!: MemoryStream zipMs = new MemoryStream(); var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MyNameSpace.MyResourceFiles.MyArchive.zip"); using (ZipFile zip = ZipFile.Read(stream)) { ZipEntry entry = zip["MyImage.png"]; entry.Extract(zipMs); BitmapImage biImg = new BitmapImage(); biImg.BeginInit(); biImg.StreamSource = zipMs; biImg.EndInit(); return new WriteableBitmap(biImg); } EDIT 2: The above was way too slow, even if I rezipped the PNGs using 7zip as just Store (i.e. no further compression), however the culprit was the ZipFile.Read() line, and so I've moved this into my initialisation process and made it global. Now works like a dream! I've added a Zipfile.Dispose upon close.
  8. Dave Haylett

    10,000 PNG files!

    Hi Kylotan. I did briefly look around for options, ideally I’d need I) a front-end to allow me to easily load in new PNGs to the archive, and II) hopefully a NuGet package with functions which would allow me to pull the data through at runtime. Brain suggested PhysicsFS which sounded like a good alternative but unfortunately I couldn’t get it to work in VS2015 and the package seems a bit archaic (read C++). I did consider writing the above image packer in VBA but if anyone can think of alternatives I’d love to hear them.
  9. Dave Haylett

    10,000 PNG files!

    Hi Frob and Shaarigan. Thank you both for your guidance, and I certainly learned something new with regards GPU-friendly texture formats. In my application there is only a requirement to load up to 10 or so of these images at a time (they are blitted to a work area upon loading, and from there they make their way to the UI), and although the faster the better, a split-second delay is acceptable. After pondering over the superb advice I've been given for my query from everyone on here I think the best way for me to go is to stay with the PNGs (they are very small in size), but write a custom PAK file to load them all in one go during design time. This will total ~80mb. Some mundane processing needs to be carried out by myself whenever I add new images to the project, such as using TexturePacker to compress thumbnail versions of the new images, add some records to a SQLite db, etc. etc. and during this process I can a) stick the PNGs together into a PAK, and b) create a database table which tells my project at which byte each image is. At runtime this database is queried as part of user interaction, and so there'd be almost zero overhead to also pull back the start/length data for a given PNG when this happens. I should then be able to add this PAK to my VS project as a Resource, and write a function which can pull the data through into a WriteableBitmap; I use these commonly in my project. Then I'm back on track. Fingers crossed, and many thanks everyone, I value your input.
  10. Dave Haylett

    10,000 PNG files!

    Hi Brain (not Brian, sorry ), That's a good point. I will experiment with PhysFS tomorrow. As you can imagine the PNGs only compress down by about 4%, so I'm not gaining anything size-wise, but perhaps this option means that I can hold them all in memory in the archive without WPF uncompressing them all at runtime first (I assume this is what happens) and stealing hundreds of megs of RAM. I'll let you know how I get on. In the meantime I wonder if you have any thoughts about the other part of my problem: I also have 3000 ZIP files, totalling 500mb, which need to be dealt with in a similar way. They don't need to be held in RAM, but I need to distribute them with the project.
  11. Dave Haylett

    10,000 PNG files!

    Hey gec thanks for replying. Sorry yes this is a Windows program written in C#/WPF. It's a graphical front-end with lots of image blitting. The most common images are loaded in as Resources, but the 10,000 need to be accessed selectively as and when required, and quickly. The user can do this by flicking through a scrolling list of images. I did experiment with the sprite sheet option, using TexturePacker, however the image it produced was over 10,000 pixels square, and gave me an out-of-memory error when I tried to compile for Windows 32-bit (I don't necessarily want my app to be Win64 only). I do still use this option, but for quarter-size thumbnails of the images - they're all stuck together in a giant quilt, which I can blit from easily and quickly. It's just the standard size images that I need to manage. I do intend to use an installer, I'm just not sure how to manage the files easily as part of the project, and for them to be updated when I build new ones. Hi Brian, Thanks for the reply. That sounds interesting, however I don't think it'll be fast enough, as these images need to be selectable and blittable pretty quickly. Loading them individually from HDD does seem to work fast enough, but I don't think them being archived would be
  12. Hi all. My project is coming along wonderfully, and am starting to consider alpha deployment, and would like your advice. My project need access to 10,000 small PNG image files at runtime, each is only a few kilobytes each, which during development I used to load in directly from a fixed path on my HDD whenever one was needed (obviously not a solution for go-live), using something like this: img = new WriteableBitmap(new BitmapImage(new Uri(@screenshotsPath + filename))); The image would then be blitted onto a buffer screen, etc. etc. At a time, a few dozen would be being used. Now I'm thinking about deployment, and also when I produce an update to my app, there could be more images to add to the folders. So I'm considering the best way of a) deploying the images to the user as part of the project, and b) how to most easily handle updates to the app, whereby more images will be added. I have just experimented with adding them all as a Resource (!). This inflated the exe from 10mb to 100mb (not a major problem), increased the compile time from 3 secs to 30 secs (annoying), increased RAM usage from 500mb to 1.5gb (not a major problem either), but means that it solves my fixed directory issue, distribution issue, and update issue, simply by having the files all stuck into the executable. Here's the new code I'm using: img = BitmapFactory.FromResource("Shots/" + filename); The next thing I was going to try was to mark them as Content > Copy if Newer. This would resolve the executable size and RAM usage (and also the directory issue as well), however it seems that I'd need to highlight them all, and move them from Resource to Content. As an up-front job this isn't too bad, but as I add new images to the project, I'll need to go in and do this every time, which gets annoying, as the VS2015 default is Resource. Also, I'm not sure how this would work in terms of updates. Would something like ClickOnce deployment recognise new PNGs and install them to the users? I also have 3,000 ZIP files (~500kb each) which also need deploying and updating in the same way. These are currently read directly from my HDD until I can find a permanent solution for adding these to the project as well. Can anyone thing of a better way of doing what I'm trying to achieve? Thanks for any help folks.
  13. Hi Wessam. Thanks for your post. It has helped me get to the bottom of what the problem was! Even pasting in your above code didn't help! After stepping through some bits of my code on startup, I could see what was happening: In my Init phase what I do is create a new Image (with no fixed dimensions), and a new MainWindow, then say the Window's Content is the Image. The rest of my program blits graphics to the Image. The Image dimensions were being set from the Window dimensions once the Window was shown, so they match. For some reason, setting MainWindow.Content = Image messed up the dimensions of them both. I found that explicitly setting the Image dimensions to 1200x900 has fixed everything, as the Window's client area is now 1200x900. This was the original code (cut down a little): i = new Image(); w = new MainWindow(); w.Content = i; w.Show(); But adding this in after the first line fixes it. I don't even need a Grid or any other placeholder controls in the Window now: i.Width = 1200; i.Height = 900;
  14. I did try that in my frustration, but nope, it was always shorter and narrower. I'd like my client window to be 1200x900, but even taking the window title bar into account, it still doesn't explain why the window loses 15 pixels' width, given the window borders are only 2 or 3 pixels either side. Annoying and weird.
  15. Hi Tape_Worm, just wanted to follow up on this and say I've successfully migrated to SQLite in my project, so no more worries. The ATTACH functionality helped me join the two separate databases together which is a really nice function. Thanks again for your help.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!