Example #1
0
        public static bool CheckVersion(FormatsNode versionNode, FormatsType Type, FormatsVersion Version)
        {
            if (versionNode == null || versionNode.Attributes.Count != 3)
            {
                Debug.WriteLine("Invalid version node");
                return(false);
            }

            string keyword          = versionNode.Attributes[0];
            int    typeAttribute    = int.Parse(versionNode.Attributes[1]);
            int    versionAttribute = int.Parse(versionNode.Attributes[2]);

            if (keyword != "Version")
            {
                Debug.WriteLine("Invalid keyword, expected 'Version', found {0}", keyword);
                return(false);
            }

            if (typeAttribute != (int)Type)
            {
                Debug.WriteLine("Invalid type, expected {0}, found {1}", Type, typeAttribute);
                return(false);
            }

            if (versionAttribute != (int)Version)
            {
                Debug.WriteLine("Invalid version, expected {0}, found {1}", Version, versionAttribute);
                return(false);
            }

            return(true);
        }
Example #2
0
        public IStringFormat GetFormat(FormatsType type)
        {
            switch (type)
            {
            case FormatsType.FormatHash:
                return(new FormatHash());

            case FormatsType.FormatForwardSlash:
                return(new FormatForwardSlash());

            case FormatsType.FormatDots:
                return(new FormatDots());

            default:
                throw new NotSupportedException();
            }
        }