Пример #1
0
        /// <summary>
        /// This controller's constructor instantiates a ReviewDAO, GameDAO, BLO, and Logger. Each has parameters found in WebConfig.
        /// </summary>
        public HomeController()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["GameGroove"].ConnectionString;
            string logPath          = ConfigurationManager.AppSettings["LogPath"];

            _ReviewDataAccess = new ReviewDAO(logPath, connectionString);
            _GameDataAccess   = new GameDAO(logPath, connectionString);
            _BusinessLogic    = new BLO(logPath);
            _Logger           = new Logger(logPath);
        }
Пример #2
0
        public void Read(FileReader reader, BLO bloFile)
        {
            FileInfo = bloFile;

            reader.SetByteOrder(true);
            reader.ReadSignature(4, "SCRN");
            string version = reader.ReadString(4, Encoding.ASCII);

            switch (version)
            {
            case "blo0": Version = 0; break;

            case "blo1": Version = 1; break;

            case "blo2": Version = 2; break;

            default:
                throw new Exception("Unknown blo version! " + version);
            }
            uint fileSize    = reader.ReadUInt32();
            uint numSections = reader.ReadUInt32();

            reader.Seek(0x10); //padding

            bool setRoot      = false;
            bool setGroupRoot = false;

            BasePane currentPane = null;
            BasePane parentPane  = null;

            this.RootGroup = new GroupPane();
            for (int i = 0; i < numSections; i++)
            {
                long pos = reader.Position;

                string Signature   = reader.ReadString(4, Encoding.ASCII);
                uint   SectionSize = reader.ReadUInt32();
                switch (Signature)
                {
                case "INF1":
                    LayoutInfo = new INF1(reader, this);
                    break;

                case "TEX1":
                    textureList = StringList.Read(reader, this);
                    break;

                case "FNT1":
                    fontList = StringList.Read(reader, this);
                    break;

                case "MAT1":
                    var mats = MAT1.ReadMaterials(reader, this);
                    foreach (var mat in mats)
                    {
                        materialList.Add(mat);
                    }
                    break;

                case "PAN1":
                {
                    var panel = new PAN1(reader, this);
                    AddPaneToTable(panel);
                    if (!setRoot)
                    {
                        RootPane = panel;
                        setRoot  = true;
                    }

                    SetPane(panel, parentPane);
                    currentPane = panel;
                }
                break;

                case "PAN2":
                {
                    var panel = new PAN2(reader, this);
                    AddPaneToTable(panel);
                    if (!setRoot)
                    {
                        RootPane = panel;
                        setRoot  = true;
                    }
                    SetPane(panel, parentPane);
                    currentPane = panel;
                }
                break;

                case "PIC1":
                {
                    var picturePanel = new PIC1(reader, this);
                    AddPaneToTable(picturePanel);

                    if (picturePanel.TextureName != string.Empty &&
                        !textureList.Contains(picturePanel.TextureName))
                    {
                        textureList.Add(picturePanel.TextureName);
                    }

                    SetPane(picturePanel, parentPane);
                    currentPane = picturePanel;
                    break;
                }

                case "PIC2":
                {
                    reader.ReadUInt32();         //pan1 magic
                    reader.ReadUInt32();         //pan1 size
                    var picturePanel = new PIC2(reader, this);
                    AddPaneToTable(picturePanel);

                    SetPane(picturePanel, parentPane);
                    currentPane = picturePanel;
                    break;
                }

                case "WIN1":
                    var windowPane = new WIN1(reader, this);
                    AddPaneToTable(windowPane);

                    SetPane(windowPane, parentPane);
                    currentPane = windowPane;
                    break;

                case "BGN1":
                    if (currentPane != null)
                    {
                        parentPane = currentPane;
                    }
                    break;

                case "END1":
                    if (parentPane != null)
                    {
                        currentPane = parentPane;
                    }
                    parentPane = currentPane.Parent;
                    break;

                case "EXT1":
                    //   reader.ReadUInt32();
                    //  reader.Align(0x20);
                    break;

                default:
                    Console.WriteLine("Unknown section!" + Signature);
                    break;
                }

                reader.SeekBegin(pos + SectionSize);
            }
        }