sowelu 1 Posted May 4, 2020 Share Posted May 4, 2020 How to get saved path from code? Link to comment Share on other sites More sharing options...
TheSmokie 242 Posted May 5, 2020 Share Posted May 5, 2020 Hello @sowelu, I need some more info on what your trying to do, Link to comment Share on other sites More sharing options...
sowelu 1 Posted May 5, 2020 Author Share Posted May 5, 2020 I want get list of Vecror3 points from file. File have been recorded with Gatherer. Link to comment Share on other sites More sharing options...
TheSmokie 242 Posted May 5, 2020 Share Posted May 5, 2020 Open the file with notepad++ Link to comment Share on other sites More sharing options...
sowelu 1 Posted May 5, 2020 Author Share Posted May 5, 2020 I need it with C# code for plugin. Link to comment Share on other sites More sharing options...
TheSmokie 242 Posted May 5, 2020 Share Posted May 5, 2020 Want to pm me your discord and we can jump into a chat? Link to comment Share on other sites More sharing options...
sowelu 1 Posted May 5, 2020 Author Share Posted May 5, 2020 I think there should be function for .xml path parsing. Link to comment Share on other sites More sharing options...
sowelu 1 Posted May 5, 2020 Author Share Posted May 5, 2020 Found old code. Have fixed some errors. Seems working now. public List<Vector3> GetPathFromXml(string path) { List<Vector3> xpath = new List<Vector3>(); try { FileStream fs = new FileStream(path, FileMode.Open); StreamReader stream = new StreamReader(fs, Encoding.UTF8); string content = stream.ReadToEnd(); XmlDocument doc = new XmlDocument(); doc.LoadXml(content); var result = doc.GetElementsByTagName("Vectors3"); var item = result.Item(0); foreach (XmlNode n in item.ChildNodes) { var X = n.Attributes[0].Value; var Y = n.Attributes[1].Value; var Z = n.Attributes[2].Value; string type = n.Attributes.Count == 3 ? "None" : n.Attributes[3].Value; Vector3 v3 = new Vector3(float.Parse(X), float.Parse(Y), float.Parse(Z), type); xpath.Add(v3); } Logging.WriteError(" Xml file parsed !" + path); } catch (Exception e) { Logging.WriteError(e.ToString()); } if (xpath.Count == 0) Logging.WriteError("No points in path"); return xpath; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now