JSON-Parser for Unity3D and Flash - c#

currently i am implementing an application in Unity3D (C#) that will be exported to Flash and WebPlayer Version.
The Application uses JSON to communicate with the server.
My question is: is there any JSON-Parser that works in Unity WebPlayer AND Flash??
i tried MiniJSON Flash Version already. After spending hours to make it to a clean export it decodes JSON in UnityWebPlayer but returns NULL in Flash.
Is there any other way to parse a JSON string in Unity WebPlayer and Flash? Or is there another JSON-Parser that works in Flash too?
I really searched a lot but either the people provide links to MiniJSON or suggest to wait for Unity3D version 4.0.
I even tried the Proxy-Class feature of unity3D but couldnt get to run it on Flash side. Maybe someone could provide an example for it?
Thanks very much

I use LitJSON for Unity and had no problems when I built a web player version for testing purposes a while ago. I have no experience with Flash player but according to this presentation Unity and Flash, the best of both worlds! - Unite presentation slides page 18 ff. it should do the job.

No JSON library written in C# is likely to work with Unity's flash export (if you want strongly typed objects on the client side) because some key .net reflection pieces are not supported, even in the official 4.0 release. I asked Unity to sanction a supported JSON parser that could be used across desktop, web player and flash and it just didn't happen for this release.
I ended up using native AS3 stringify and parse methods on the client side and JSON.net on the server side. The tricky part is compensating for the name mangling that Unity does when it converts your C# to ActionScript. I was able to make this work without hard coding by using some of the standard ways to override parsing and serializing JSON strings, using a lot of describeType(). Since JSON.net is supported in their web player, I was able to use some #if FLASH pragmas to get both working well depending on build target.
So....it is possible, and perhaps I've done much of the hard work for you. If you want some examples let me know.
-Tray Weeds

Try this: https://github.com/ironmagma/jsonparse
It is completly written in UnityScript. Probably it helps and works in Flash Export. But i did not test it.

Related

How to send data from iOS to C# using "remoting" library?

// question
I have an existing c# program that uses Microsoft .net's "remoting" SDK.
I want to send some data from a new iOS app to this c# program.
The existing c# program is huge (with existing clients) and I am not sure if rewriting the entire thing in asmx is a good idea.
I have looked at other online sources, they all say no, but some mentioned Xamarin (wfc server).
Xamarin.Forms Connection to Wcf Service from iOS
I don't mind converting to iOS app to Xamarin, but just want to get some expert opinion before going ahead.
I am also open to other options as well.
Thank you very much for you help.
// what I have tried
I have looked at various stack-overflow posts & online sources and tried to use regular soap request instead, but I realized that this requires restructuring of entire c# codebase.
I would like to know if there is a smarter way to do this.
// update
I've tried Xamarin and it keeps crashing for some reason... when I try to use .dll reference.

Is there a good way of extracting data from GUI on Windows OS using python libraries?

I'm currently working on a project which requires me to extract data from GUI on Windows OS - say I need to extract content such as the URL in my browser or the name of the attachment on Gmail.
I have already tried LDTP/Cobra, however it's pretty slow - each request can take up to 5 seconds and I need this library to be reasonably fast. Besides that, the LDTP/Cobra is pretty outdated and the latest MSI file doesn't work with python 3.* unless you modify the library itself.
I've been also researching the pywin API, however, it seems that you can't really extract anything with FindWindowEx and WM_GETTEXT method anymore, but I might be wrong.
My question is - is there any other library that would allow me to extract basically anything from a given Window? Maybe I'm missing an important part of the mentioned libraries? Ideally, I'm looking for a python library, but if there is no other way I could try and write some C# code.

Can't load Mono.CSharp.dll in either Unity3D or a C# project

I'm working on an online video game project using Unity3D for the clients, and C# servers.
I'm trying to use some code eval for a specific feature, but I can't get it to work.
I went with Mono, because it seemed to be one of the lightest and one of the simplest. I installed Mono and got the "Mono.CSharp.dll" for .Net 4.6 from "Mono\lib\mono\4.6-api". (Both Unity and my servers are configured to use this version of .Net). I dropped it in the Unity assets, and referenced it on my servers.
But I have errors on both Unity and the servers. In Unity there is :
Loading script assembly "Assets/Scripts/Common/References/Mono.CSharp.dll" failed!
And there is an exception on the servers (my IDE is in French so I can't really copy/paste it), but it basically tells me it can't use Reference Assemblies for build, but only for reflection.
To describe the feature I want to create (because you'll maybe have a better solution), I want to be able to create spells from an external tool. Spells are made of SpellEffects. Let's say there is a SpellEffect called DealDamage, constructor takes an int (for the damage amount). I want to be able to write "DealDamage(50)" on my external tool, then take the string, and build a new DealDamage(50) from it.
I know I could find a way to interpret some code by myself, but it would be a lot more work for a far less flexible system.
It was really hard to find any help online for this problem, so as a last hope I'm turning to you.
I'm not exactly sure why you're trying to import Mono into Unity. It's already included in the installation package. If you want to make a modular spell builder, just create a regular application with your preferred language, in your preferred IDE, and save all of your spells as a JSON or XML file, and then import those into Unity. On the Unity side, just build a class to parse the files.
To get you started, take a look at the JSON.Net library. You can serialize your files into C# classes with it.

PHP (HTML5) based Windows Software

Is it possible to make from a HTML5-APP (PHP,SQLITE,HTML,CSS,JS) a installable Windows Software in c#?
The software must start PHP (5.4), and must just load the document-root in the webbrowser object.
In theory it should work without problems. But what about protecting this code? Is it possible to protect at least the PHP part? Will ioncube or zend-guard work on PHP 5.4's embeded server? And is it possible to hide the shell window, which will open everytime, when i start the PHP Webserver via cmd?
Or do you know an alternate, how i can make a software from a HTML-5 (with PHP) App?
Your choosing the wrong language. PHP, HTML, JS, CSS and SQLLite are separate technologies.
I'd suggest writing the app in another language capable of producing an executable like C / C++ (and one that can plug into to SQLITE fairly easy).
If you want to create a installer out of HTML5-APP (PHP,SQLITE,HTML,CSS,JS) , take a look at bitnami package, it may solve your problem, if you have any explicit reason to use C#, and then you have see its library or namespace which may give you installer capability. However your question is unclear, can be be more clear?
You can embed a Chrome browser in C# using the CefSharp project. You would also need to embed some webserver (php built-in webserver might work, but it's single threaded so it might be an issue).
If it doesn't necessarily need to be C#, then take a look at the PHP Desktop project that is using C++ to embed a Chrome engine, a multithreaded webserver Mongoose and a PHP interpreter. Sources can be protected using many available php encoders, see the KnowledgeBase wiki page on the project site for details.

Using Mapnik in .net environment

Has anybody used Mapnik for rendering Maps from .net c# environment? I would like to use it to render maps in a desktop application developed under .net4. I found it the best open source map renderer tool, much more better, than the well known sharpmap, dotspatial (...). The 'only' problem is that it was written in C++ and Python and does not have a trivial way to use it from C#.
Do you know any .net Mapnik wrappers? Do you know any sample code?
I've just published my attempts in C# bindings.
They are available at: http://sourceforge.net/projects/mapniknet/
Some good new about Mapnik-.Net integration:
"Another thing that will help Windows developers is a way to use Mapnik from .Net languages. Although a full .Net wrapper is too much work besides all the other issues, hopefully I can make a meaningful start and open the door for .Net developers to leverage Mapnik in their applications."
Source: Mapnik homepage http://mapnik.org/news/2011/jun/09/gsoc_2011_windows_build_system_introduction/
NET-Mapnik
You might want to give this a try. Its pretty recent and has a simple example with options to create vector tiles.
https://github.com/kernelsanders/NET-Mapnik
So, finally I hacked it. Not a nice solution, but it works at least. In nutshell it operates in the following way:
developed a python script, which takes parameters as command line arguments. (using python api of mapnik)
call this python script by shell fom c# code (Process)
after map image has been generated, I show it in SharpMap as a background layer
In case of any map refresh (zoom, pan) I regenerate 'mapnik map layer'. I have also some kind of cache, in which I can store generated maps, so I can make tricks by using earlier generated map images or pre-generate them (e.g. generate maps for the next zoom level when user uses zoom tool). I also use some asynchron calls to do this, so I can create 1-3 map images paralelly.
The weak part of this solution is the communication between python and c# modules. I could not find better than command line arguments + shell.
My solution works, mapnik is fast, can genarate my maps less than a sec.
If you have any advice on .net - python communication (NO ironpython, it is not suitable for manik api), pls write it here. Thx.
Do you know about TAO Project?
It is a .Net project that takes unmanaged opengle library to .Net Managed Form by calling DllIMport() in C#.
You must do it for Mapnik, simaliar to TAOFramework.net

Categories

Resources