Giter Club home page Giter Club logo

Comments (14)

vfrz avatar vfrz commented on June 8, 2024 1

There is no stupid question! It requires the Color type because I wanted the users to be able to set the various color properties (node/edge color/background...) using a .NET type (converted to hex format in the compiled dot file). But since it can cause problems in some environments I might create my own color type based on the System.Drawing's one.

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024 1

yes, sorry, been hiking the last couple of days ;) works, thx a lot :D

from dotnetgraph.

vfrz avatar vfrz commented on June 8, 2024

What OS are you using? If you are not using Windows this might the problem: https://learn.microsoft.com/en-us/dotnet/api/system.drawing?view=net-6.0#remarks
You could try to resolve it by installing this nuget package: https://www.nuget.org/packages/System.Drawing.Common/

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024

I am using Win11 latest versions to compile and run the dll.
I also tried referring the System.Drawing.Common and also repacked it into the target dll, but that does not change the program to later fail on missing this dependency

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024

Is this maybe due to using .NETFramework v4.6.2 ? I am not a specialist in dotnet, but the page you linked I also found before and it mentions on .net 5 and .net 6, right?

from dotnetgraph.

vfrz avatar vfrz commented on June 8, 2024

Hum, not sure it could be because of the framework version, there is no reason .NET 4.6.2 doesn't include the Color type. Could you try to create a console application with the same framework version please? (but outside unity) so we could determine if the problem is coming from Unity.

from dotnetgraph.

vfrz avatar vfrz commented on June 8, 2024

I have just tested on a Windows machine and it works fine outside Unity, so the problem is coming from Unity.
Have you tried this already? https://stackoverflow.com/a/70217835

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024

Thanks for the answers. What I did now is to copy the System.Drawing.dll into my project and let it, together with Syste.Drawing.Common.dll get repacked to the target .dll - but this still does not change the issue I am facing...

Maybe bit stupid question: why does the DotNetGraph require colors if it will just write text files that I later will import into GraphViz or similar? The text file would not require things like a color, would it?
Can I somehow work around this need for the extra libraries to just assemble the text file?

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024

for what I am trying to do (drawing graphs of in-game objects) colorless would also be fine. Any ideas on when you might have time to do a change that does not require System.Drawing?

from dotnetgraph.

vfrz avatar vfrz commented on June 8, 2024

I've just pushed a beta version with my own color type DotColor, it is available here: https://www.nuget.org/packages/DotNetGraph/3.0.0-beta3
This is version 3.0 so it will require some changes on your side, creating graph/node/edge is a bit different and using fluent extension methods. You can check the readme file on master for some examples, it shouldn't be difficult!

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024

Very nice :)
Are you using a special StringWriter lib that supports async? I get this error copying the code from README:
Type 'System.IO.StringWriter' used in a 'await using' declaration must be implicitly convertible to 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method. Did you mean to use 'using' instead of 'await using'?

from dotnetgraph.

FelixReuthlinger avatar FelixReuthlinger commented on June 8, 2024

btw I am not sure if you really need to use the async writer, do you?
calling like this did also work (at least for a small example

var writer = new StringWriter();
directedGraph.CompileAsync(new CompilationContext(writer, new CompilationOptions()));
var result = writer.GetStringBuilder().ToString();

from dotnetgraph.

vfrz avatar vfrz commented on June 8, 2024

You don't need the await using on the string writer, this is a new feature of .net that is not in .net framework.
But you still need to await the CompileAsync method.

from dotnetgraph.

vfrz avatar vfrz commented on June 8, 2024

@FelixReuthlinger Is it all good? Can I close the issue?

from dotnetgraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.