What is a .pex file (in related to Urho2d sample)? - c#

This is what I read in:
https://github.com/xamarin/urho-samples/blob/master/FeatureSamples/Core/25_Urho2DParticles/Urho2DParticle.cs[Urho2D][1]
Line 90:
ParticleEffect2D particleEffect = cache.GetParticleEffect2D("Urho2D/sun.pex");
Does anyone have a clue on how to produce one of these particle effect and put it into a .pex file for the Urho2d engine to load?
I know it can be opened in an XML file known as ParticleEmitterConfig tag, but that is all I could find in this content.
Thanks

Related

C# - Save XML's plain text as PDF instead of converting [duplicate]

I am trying to save xml file as PDF as it is. In other words, I am trying to create PDF file that shows content of XML like a screenshot (like raw screenshot). My client somehow needs it like this. I couldn't really find the same question on stackoverflow. Is there anyway I can do this using iText or some other library?
Thank you!
First extract your text from XML file:
XmlDocument doc = new XmlDocument();
doc.Load("c:\\temp.xml");
string myText;
foreach(XmlNode node in doc.DocumentElement.ChildNodes){
myText= node.InnerText; //or loop through its children as well
}
Then create a PDF file and pass this text into it
in this case here I use PDFFlow library to create pdf documents
var DocumentBuilder.New()
.AddSection().AddParagraphToSection(myText).ToDocument()
.Build("Result.PDF");
If you load the xml in a browser you can easily save to searchable PDF
In a shell call (replace msedge with chrome if necessary)
"path to\msedge.exe" --headless --disable-gpu --print-to-pdf="out path\xml.pdf" --enable-logging "file://path to A\file.xml"
Enable logging helps as it can take a long time to process without any visual progress.
[0818/231038.640:INFO:headless_shell.cc(648)] Written to file ...\xml.pdf.
You can also add --print-to-pdf-no-header. Also if adding some style consider --run-all-compositor-stages-before-draw but I have no idea if that works for xml.
ForGet Image --screenshot as a 40 Page high XML as JPEG does NOT translate well to PDF. I tried :-)
If you want that as an image PDF then Re-Print the PDF to PDF using a command line viewer such as this since it is ONLY Print As Image output :-) also note it can in addition read the XML in Black and White (NO linting).
But have not tested how well it does XML2PDF via command line print
SumatraPDF -print-to "My Print to PDF" "path to\filename.pdf" (or xml in mono)
Note "My Print to PDF" is a promptless port you need to configure as required.

C# - Save XML file as PDF as Raw Image (not converting)

I am trying to save xml file as PDF as it is. In other words, I am trying to create PDF file that shows content of XML like a screenshot (like raw screenshot). My client somehow needs it like this. I couldn't really find the same question on stackoverflow. Is there anyway I can do this using iText or some other library?
Thank you!
First extract your text from XML file:
XmlDocument doc = new XmlDocument();
doc.Load("c:\\temp.xml");
string myText;
foreach(XmlNode node in doc.DocumentElement.ChildNodes){
myText= node.InnerText; //or loop through its children as well
}
Then create a PDF file and pass this text into it
in this case here I use PDFFlow library to create pdf documents
var DocumentBuilder.New()
.AddSection().AddParagraphToSection(myText).ToDocument()
.Build("Result.PDF");
If you load the xml in a browser you can easily save to searchable PDF
In a shell call (replace msedge with chrome if necessary)
"path to\msedge.exe" --headless --disable-gpu --print-to-pdf="out path\xml.pdf" --enable-logging "file://path to A\file.xml"
Enable logging helps as it can take a long time to process without any visual progress.
[0818/231038.640:INFO:headless_shell.cc(648)] Written to file ...\xml.pdf.
You can also add --print-to-pdf-no-header. Also if adding some style consider --run-all-compositor-stages-before-draw but I have no idea if that works for xml.
ForGet Image --screenshot as a 40 Page high XML as JPEG does NOT translate well to PDF. I tried :-)
If you want that as an image PDF then Re-Print the PDF to PDF using a command line viewer such as this since it is ONLY Print As Image output :-) also note it can in addition read the XML in Black and White (NO linting).
But have not tested how well it does XML2PDF via command line print
SumatraPDF -print-to "My Print to PDF" "path to\filename.pdf" (or xml in mono)
Note "My Print to PDF" is a promptless port you need to configure as required.

Append DataVizualisation Chart Control to text file

I'm developing a system that takes data input from textboxes, and on a button click, saves these values to the respective listbox ready to be written to a text file once the process is complete.
The next stage has been using this data to create graphs, which has gone successfully but I'm now looking for a way to add these onto the end of my text file so it's all included in one place.
I originally tried it like this (included in the total 'saveToFile' function):
consoleFile.WriteLine(chartBP.Text); //chart title
chartBP.SaveImage((fileName), System.Drawing.Imaging.ImageFormat.Jpeg);
consoleFile.WriteLine("\n\n");
This appeared to work ok but threw a run-time error stating that the file could not be accessed because it was being used by another process.
I don't think I'm far off where I need to be, but I don't have enough experience with charts to know what to try next.
Does anyone have any idea how to make this work, or another method that wouldn't produce the error?
Any help is greatly appreciated!
If your problem is just to get rid of the exception, then you could do this:
consoleFile.WriteLine(chartBP.Text);
consoleFile.Close();
FileStream imgFile = File.Open(filename, FileMode.Append);
chartBP.SaveImage(imgFile, ChartImageFormat.Jpeg);
imgFile.Close();
consoleFile = new StreamWriter(filename, true);
consoleFile.WriteLine("\n\n");
consoleFile.Close();
But remember, you're not going to see any images in your text file, just a messy stream of characters corresponding to the binary image, displayed as text.

Listing extended tags in files with Tagliib

I am working with .flac audio files that use extended tags for a bit of magic. There is a tag called ReleaseGuid. I want to be able to list the contents or create the tag if it doesn't exist. I have done the prerequisite beating of my head against the wall for three days now. I have found a way to add a usertextinformation frame...although I don't see the value just the Owner. Please help me figure this out.
The following are lines of code that at least compile and seem to do something.
I need to get this to the point where I can add the needed tag.
File objFile = TagLib.File.Create(path);
TagLib.Id3v2.Tag id3v2tag = (TagLib.Id3v2.Tag)objFile.GetTag TagLib.TagTypes.Id3v2, true);
if (id3v2tag != null)
{
// Get the private frame, create if necessary.
PrivateFrame frame = PrivateFrame.Get(id3v2tag, "Mytag", true);
frame.PrivateData = System.Text.Encoding.Unicode.GetBytes "MyInfo");
id3v2tag.AddFrame(frame);
}
I have used mp3tag to see the tags I am needing by clicking on "extended tags".
Which type of tags would these be if I can add them using mp3tag? How do I read/write them using taglib?
To search for the tag type, you can open the (.flac) audio file in a texteditor like Notepad++ and search for your 'ReleaseGuid'. In front of this ID you will see the type like TXXX or PRIV or COMM.
Or you can have a look into the documentation (source code?) of the program who writes this 'ReleaseGuid' in your audio files.

File not found Exception.. But it's there

Hey this is going to be one of those dumb questions. I am trying to pick up a file on my local system and I keep getting a FileNotFoundException thrown.
Someone set me straight please :)
if( File.Exists(#"C:\logs\hw-healthways-prod_2009-08-26.tar"))
{
Console.WriteLine("Yay");
}
else
{
throw new FileNotFoundException();
}
Tried moving the file into the same location as the executing application and did the following:
if( File.Exists("hw-healthways-prod_2009-08-26.tar"))
Same thing.
Then I made a random txt file and parked it there too.. "me.txt"
And it works?! So you thing the file name is the problem?
Try doing Directory.GetFiles(#"C:\logs"). It's possible that the file in question has odd characters that are getting interpreted one way by Windows Explorer (presumably where you're reading "the file's property" from?) but a different way by the .NET Framework. This can happen if you have UTF-8 characters in the filename (perhaps an en dash?).
May be the name of the file is "hw-healthways-prod_2009-08-26.tar.tar" instead of "hw-healthways-prod_2009-08-26.tar", I had this problem because by default the extension files are hidden on windows
You may want to check your file permissions. Your computer may not have permission to the file.
C:\logs\hw-healthways-prod_2009-08-26.tar should be C:\\logs\\hw-healthways-prod_2009-08-26.tar. \ means the next character is an escape character.

Categories