private KnifeDef GetKnifeFullDef(string knife, KnifeMode mode) { RawNode node = null; string modeKey = KnifeUtils.GetKnifeModeKey(mode); var knifeNode = m_knivesSettings.GetNode(knife); var modesNode = knifeNode.GetNode("modes"); if (modesNode.CheckKey(modeKey)) { var modeNode = modesNode.GetNode(modeKey); node = modeNode.WithFallback(knifeNode); } else { throw new InvalidOperationException("Knife " + knife + " not support " + mode + " mode"); } var modesSettings = m_settings.GetNode("modes"); if (modesSettings.CheckKey(modeKey)) { node = node.WithFallback(modesSettings.GetNode(modeKey)); } if (modesSettings.CheckKey("default")) { node = node.WithFallback(modesSettings.GetNode("default")); } return(new KnifeDef(knife, mode, node)); }