コード例 #1
0
        private static String GetKey(Mode mode, BinaryReader rdr, out Mode newMode)
        {
            newMode = mode;

            // these strings are null-terminated
            String retval = rdr.ReadSZString();

            if (mode == Mode.StringFileInfoOrVarFileInfo)
            {
                if (retval == "StringFileInfo")
                {
                    newMode = Mode.StringFileInfo;
                }
                else if (retval == "VarFileInfo")
                {
                    newMode = Mode.VarFileInfo;
                }
                else
                {
                    throw new ResourceDataException("Invalid Key Name");
                }
            }

            return(retval);
        }
コード例 #2
0
        private static Mode GetNextMode(Mode mode)
        {
            switch (mode)
            {
            case Mode.Root:
                return(Mode.StringFileInfoOrVarFileInfo);

            case Mode.StringFileInfo:
                return(Mode.StringTable);

            case Mode.StringTable:
                return(Mode.String);

            case Mode.String:
                return(Mode.None);

            case Mode.VarFileInfo:
                return(Mode.Var);

            case Mode.Var:
                return(Mode.None);

            default:
                throw new ResourceDataException("GetNextMode, invalid mode");
            }
        }
コード例 #3
0
        public override String ToString()
        {
            String ret = Mode.ToString() + " - " + Key;

            if (Value != null)
            {
                ret += " : " + Value.ToString();
            }

            return(ret);
        }
コード例 #4
0
        private VersionItem GetFirstItem(VersionItem parent, Mode mode)
        {
            if (parent.Mode == mode)
            {
                return(parent);
            }

            foreach (VersionItem item in parent.Children)
            {
                if (item.Mode == mode)
                {
                    return(item);
                }

                VersionItem match = GetFirstItem(item, mode);
                if (match != null)
                {
                    return(match);
                }
            }

            return(null);
        }