public Tweak(string lebel, TweakType type, WinVer ver) { //guid = Guid.NewGuid(); Name = lebel; Type = type; winVer = ver; }
public static WinVer Parse(string Str) { WinVer winVer = new WinVer(); try { List <string> tokens = TextHelpers.SplitStr(Str, "|"); foreach (string token in tokens) { var VerVal = TextHelpers.Split2(token, "="); if (VerVal.Item1 == "minVer") { winVer.minVer = float.Parse(VerVal.Item2); } else if (VerVal.Item1 == "maxVer") { winVer.maxVer = float.Parse(VerVal.Item2); } // win 10 else if (VerVal.Item1 == "build") { winVer.build10 = int.Parse(VerVal.Item2); } else if (VerVal.Item1 == "buildMax") { winVer.build10max = int.Parse(VerVal.Item2); } else if (VerVal.Item1 == "winEd") { winVer.win10Ed = (Edition10)Enum.Parse(typeof(Edition10), VerVal.Item2); } } } catch { return(null); } return(winVer.minVer != 0.0 ? winVer : null); }
public bool Load(XmlNode tweakNode) { if (tweakNode.Name != "Tweak") { return(false); } try { foreach (XmlNode node in tweakNode.ChildNodes) { if (node.Name == "Category") { Category = node.InnerText; } else if (node.Name == "Group") { Group = node.InnerText; } else if (node.Name == "Name") { Name = node.InnerText; } else if (node.Name == "Type") { Type = (TweakType)Enum.Parse(typeof(TweakType), node.InnerText); } else if (node.Name == "Path") { Path = node.InnerText; } else if (node.Name == "Key") { Key = node.InnerText; } else if (node.Name == "Level") { usrLevel = node.InnerText.Equals("User"); } else if (node.Name == "ValueInt") { Value = int.Parse(node.InnerText); } else if (node.Name == "ValueU64") { Value = UInt64.Parse(node.InnerText); } else if (node.Name == "Value") { Value = node.InnerText; } else if (node.Name == "Platform") { winVer = WinVer.Parse(node.InnerText); } else if (node.Name == "Hint") { Hint = (Hints)Enum.Parse(typeof(Hints), node.InnerText); } else if (node.Name == "State") { State = (States)Enum.Parse(typeof(States), node.InnerText); } else if (node.Name == "FixFailed") { bool.TryParse(node.InnerText, out FixFailed); } else if (node.Name == "FixedCount") { int.TryParse(node.InnerText, out FixedCount); } else if (node.Name == "LastChange") { DateTime.TryParse(node.InnerText, out LastChangeTime); } } } catch { return(false); } return(Name != null && Type != TweakType.None && winVer != null); }
//public bool Applyed = false; public Tweak(string lebel, TweakType type, WinVer ver) { Label = lebel; Type = type; winVer = ver; }