示例#1
0
        private static void LoadEntries(ConfigNode node, List <ToolingEntry> entries)
        {
            foreach (var entryNode in node.GetNodes("ENTRY"))
            {
                var tmp = 0f;
                if (!entryNode.TryGetValue("value", ref tmp))
                {
                    continue;
                }

                var entry = new ToolingEntry(tmp);
                LoadEntries(entryNode, entry.Children);
                entries.Add(entry);
            }
        }
示例#2
0
        public static void LoadOldDbFormat(ConfigNode node)
        {
            foreach (var c in node.GetNodes("TYPE"))
            {
                string type = c.GetValue("type");
                if (string.IsNullOrEmpty(type))
                {
                    continue;
                }

                var entries = new List <ToolingEntry>();

                foreach (var n in c.GetNodes("DIAMETER"))
                {
                    float tmp = 0f;
                    if (!n.TryGetValue("diameter", ref tmp))
                    {
                        continue;
                    }

                    var diameter = new ToolingEntry(tmp);

                    var length = n.GetNode("LENGTHS");
                    if (length != null)
                    {
                        foreach (ConfigNode.Value v in length.values)
                        {
                            if (float.TryParse(v.value, out tmp))
                            {
                                diameter.Children.Add(new ToolingEntry(tmp));
                            }
                        }
                    }

                    entries.Add(diameter);
                }

                toolings[type] = entries;
            }
        }