MonoGame.Extended.Content Extension can’t find SpriteFactory file - c#

I am at a complete loss, there seems to be a stark lack of up-to-date documentation about how to load a spritesheet from SpriteFactory with the Extended Content.Load<>() extension. I have tried following all of the other posts on here about how to do it but whenever I do:
var spriteSheet = Content.Load(“sheet.sf”, new JsonContentLoader());
MonoGame constantly tells me it could not find the file, yet I have added it to the /Content directory and I can see it get converted to an .xnb in the build folder, so I am totally confused how it could be not finding the file.
I have added the necessary headers for Content, Sprites, and Serialization so this line should work yet for some reason Content can’t find the file. I have also already made sure I added a reference to the MonoGame.Extended.Content.Pipeline.dll in the Content.mgcb file so everthing is already setup it’s just getting Content to actually find the file.
Does anyone have any idea why it may not be able to find the file? I am on day 3 and my wife is already packing her bags I’ve complained so much about this.
Thank you!

Related

How can Unity ignore FMOD Cache files when syncing with PlasticSCM?

My dev team is having an issue when trying to add certain files to the ignore.conf file for PlasticSCM. When we try to add the FMODStudioCache.asset and fmod_editor.log, among other FMOD related files, to this config file, they just continue to appear in Unity when receiving pushes and readying a push locally.
It has become very annoying to deal with because it doesn't seem to work as it is intended to. See below the lines we have tried to prevent it from showing up.
**/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset
**/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset
fmod_editor.log
# Ignore the Cache folder since it is updated locally.
/[Aa]ssets/Plugins/FMOD/Cache/*
[Aa]ssets/Plugins/FMOD/Cache/*
Assets/Plugins/FMOD/Cache/*
Image link of Unity PlasticSCM with
Sorry, I don't have enough posts yet so it makes me use a link above!
Has anyone found a solution to this? We have tried to even add the files to the hidden config file too and that doesn't work either... Thanks in advance !
Edit: Spelling error in question.

C# BadImageFormatException when saving data using Microsoft.Xna.Framework.Content.Pipeline

First question on here and I am feeling pretty stumped, I've searched around but couldn't find something that I could apply to my situations, any help or direction to a prior question would be appreciated.
I'm receiving an error when trying to create some new files from my form. I'm following a guide at XNA Game Programming Academy (xnagpa_net/xna4rpg_php), I'm up to step 14 but I believe this started happening earlier and I hadn't noticed it yet.
Screenshot of Error
Please have a look at the above error and give me any tips.
My code for RpgEditor.FormMain.cs is here, it says something about line 128 which relates to;
if (Directory.Exists(gamePath))
throw new Exception("Selected directory already exists.");
I'm not sure why though, because I'm creating a brand new folder/directory when I am attempting to save the data.
If it helps, the subdirectories are being created by the process but I recieve that error and no files inside.
edit: I've downloaded the example project on his site and it's working fine with that, so I don't believe it's an issue with my system configuration.. must be a project setting or line of code somewhere..
To fix this I had to change the configuration settings.
It was set to AnyCPU but I had to change to x86.
The setting wasn't there originally, I had to create new and copy settings from AnyCPU.
Why this works I don't know, but it does :)

Load Raw Content from Unknown Directory

In my current game, modding is a HUGE part of the game. It took me a while to develop a good system of loading modded content into the game, but I finally settled on a method, and I would like to keep it if possible.
How I'm handling modded content
In the game's content folder (C:/Users/username/4X), there is a Mods folder. Each mod will have it's own folder inside of the Mod directory. The game goes through a file (Rather, it will. I haven't implemented it yet), and figures out which Mod directories that it's going to load. After it's figured that out, it loads all of the content into the game (I can explain in more detail if its pertinent to the topic, I just don't wan't to use up space on unnecessary things).
So what's your problem?
Well, the mods will all have raw resources (.fbx, .wav, .mp3), and since I can't load anything but XNB files, I have absolutely no idea how to load the mod's content. Well, I take it back, I've been thinking of a few solutions but I really don't know which is more practical, or if there is a better way of doing this.
First, I thought about borrowing some code from the Pipeline application, and building all of the mod's content the first time it was loaded, but I don't fully understand the Pipeline's code, and I didn't want to mess up something by partially implementing it.
Next, I thought about requiring mod creators to use the Pipeline to build their content before they release their mods, but that seemed kind of unprofessional, since I want to have a Mod Creation Engine that has all of the tools bundled together. Which brings me back to using some of the Pipeline's code and embedding it in the engine, but then I have the same issue as my last idea.
And finally, I thought about just loading raw content. But there's an obvious flaw with that idea.
So I guess what I'm asking is:
How can I load raw content? That is, content that hasn't been built into XNB Files
If not, how can I start learning about the code that makes the Pipeline application tick, since I'll probably have to use some of it's code?
You can actually load some raw content directly with MonoGame. For example:
var texture = Content.Load<Texture2D>("raw.png")`
should work if you've got the PNG file in the Content directory and set it's properties to Content / Copy if newer.
However, please note that this will only work for some content and some platforms. I know PNG files work, WAV files work (but they must be mono 44khz I believe) and I'm pretty sure I got MP3 files to work once.
You'll probably run into issues with FBX files and sprite fonts. There's nothing stopping you from bypassing the content manager and loading these yourself though. I've done this before with great success.
Oh, and the other thing I should mention, take a look at the TitleContainer.OpenStream method. This is a way to read a file without writing the platform specific code yourself.

How to merge 2 zip files together into 1 zip

I am trying to make a custom launcher for Minecraft in C# but I have come across a bump.
I want to add something into it, Minecraft Forge, but the only way I could think of is to change the extension of minecraft.jar to minecraft.zip, extract the contents of the Minecraft Forge.zip and the minecraft.zip into the same folder and then zip that entire folder up into minecraft.jar.
However minecraft.jar has a file named aux.class so whenever my extract script (Made in java) tries to extract it, it simply says:
Unable to find file G:\Programming\C#\Console\Forge Installer\Forge Installer\bin\Debug\Merge\aux.class.
The only other way I can think of is to merge minecraft_forge.zip into minecraft.zip, I have spent around 2 hours looking on Google (watch as someone sees it within a couple of minutes) but it always shows me results for "How to zip multiple files", "How to make a zip file in C#" etc.
So I have come here looking for my answer, sorry if this is a lot to read but I always see comments on here saying "You didn't give enough information for us to help you with".
EDIT: The question in case it wasn't clear is: How am I able to put the contents of minecraft_forge.zip into minecraft.zip?
In your case, if you cannot unzip the files due to OS limitations, you need to "skip" unzipping temporary files to zip them. Instead, only handle input & output streams, as suggested in the answers found here: How can I add entries to an existing zip file in Java?
As you pointed out, "aux" is a protected keyword within windows and it does not matter what the file suffix may be; windows won't let you use it. Here are a couple of threads that discusses this in general.
Ref 1: Windows reserved words.
Ref 2: Windows reserved words.
If you are typing in commands to perform the copy or unzip, there is a chance you can get this to work by using a path prefix of the following \\.\ or \\?\. When I tested this, it worked with either a single or double back-slash following the period or question mark. Such that the following work:
\\.\c:\paths\etc
\\.\\c:\paths\etc
\\?\c:\path\etc
\\?\\c:\path\etc
I used the following command to test this. When trying to rename through windows explorer it gave a "The specified device name is invalid." error message. From the command line it worked just fine. I should point out, that once you create these files, you will have to manually delete them using the same technique. Windows Explorer reports that these text files which have a size of 0 bytes "is too large for the destination file system", ie... the recycle bin.
rename "\.\c:\temp\New Text Document.txt" aux.txt
del "\.\c:\temp\aux.txt"
As far as copying directly from zip or jar files, I tried this myself and it appeared to work. I used 7-zip and opened the jars directly using the "open archive..." windows explorer context menu. I then dragged-and-dropped the contents from forge.jar to the minecraft jar file. Since it is the minecraft jar file with the offending file name the chance of needing to create a temporary file on the filesystem is reduced. I did see someone mention that 7-zip may extract to a temporary file when copying between jars and zips.
7-zip reference on copying between archives
I should point out that my copy of minecraft jar (minecraft_server.1.8.7.jar) did not contain a file named aux.class. I also did not try to use the jar after the copy/merge. Nor did I spend too much time trying to figure out how well it merged the two contents since it appears like there may be a conflict with com\google\common\base\ since there are similar class name but with different $ variable suffixes on them.
I hope these two possible suggestions could give you some room to work with to find a solution for your needs... if you're still looking.

How to Move or Copy/Paste Files on Android

I've searched through the internet for how to move or copy'n'paste files on an Android device programmatically, but i found nothing up to now. what i wish to do is, that my application copies or moves a SQLite Database from the internal sdcard to the app folder in /data/data/example. i would be pleased if someone could explain my how to do that or give me a link to somewhere it gets explained.
A quick search on Stackoverflow turns out two questions with helpful answers:
How to make a copy of a file in android?
Android file copy
Basically, they suggest to read the contents of one file and write those to another file. You can do the same with monodroid.

Categories