Beispiel #1
0
        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);
        }
Beispiel #2
0
        public bool Restore(string state)
        {
            var           stateTemp = TextHelpers.Split2(state, "#"); // in case we want to add some more info
            List <string> State     = TextHelpers.SplitStr(stateTemp.Item1, "|", true);

            if (State.Count != dataGrid.Columns.Count)
            {
                return(false);
            }

            Hold = true;
            for (int i = 0; i < dataGrid.Columns.Count; i++)
            {
                var Column = dataGrid.Columns[i];
                if (State[i].Length == 0)
                {
                    Column.Visibility = Visibility.Collapsed;
                }
                else
                {
                    Column.Visibility = Visibility.Visible;

                    var PosWidth = TextHelpers.Split2(State[i], ";");

                    int Pos = MiscFunc.parseInt(PosWidth.Item1, -1);
                    if (Pos == -1)
                    {
                        continue;
                    }

                    Column.DisplayIndex = Pos;
                    Column.Width        = new DataGridLength(MiscFunc.parseInt(PosWidth.Item2, 50));
                }
            }
            Hold = false;

            CreateHeaderMenu();
            return(true);
        }