Example #1
0
        public static DisplayInfo GetDisplayDevices()
        {
            DisplayInfo displayDevices = new DisplayInfo();
            Match       match;

            DISPLAY_DEVICE d = new DISPLAY_DEVICE();

            d.cb = Marshal.SizeOf(d);
            for (uint id = 0; EnumDisplayDevices(null, id, ref d, 0); id++)
            {
                if (d.StateFlags.HasFlag(DisplayDeviceStateFlags.AttachedToDesktop))
                {
                    d.cb = Marshal.SizeOf(d);
                    EnumDisplayDevices(d.DeviceName, 0, ref d, 0);
                    if ((match = new Regex(@"^MONITOR\\(.*?)\\").Match(d.DeviceID)).Success)
                    {
                        var deviceID = match.Groups[1].Value;
                        if (deviceID == "Default_Monitor")
                        {
                            deviceID += getComputerID();
                        }
                        displayDevices.devices.Add(new DisplayDeviceInfo()
                        {
                            DeviceString = d.DeviceString, DeviceID = deviceID, Scaling = getDeviceScaling(deviceID)
                        });
                    }
                }
                d.cb = Marshal.SizeOf(d);
            }
            return(displayDevices);
        }
Example #2
0
        public static void AdjustDisplay(DisplayInfo displayInfo, GameInfo game = null)
        {
            if (currentGame != null && game != null) return;

            bool displayChanged = false;
            DisplayInfo current = GetDisplayDevices();
            lastDisplayInfo = new DisplayInfo();

            foreach (var device in displayInfo.devices)
            {
                if (device.Enabled && current.devices.Any(_device => device.DeviceID == _device.DeviceID) && device.Scaling != getDeviceScaling(device.DeviceID))
                {
                    lastDisplayInfo.devices.Add(new DisplayDeviceInfo() { DeviceID = device.DeviceID, Scaling = getDeviceScaling(device.DeviceID), Enabled = true });
                    if (setDeviceScaling(device.DeviceID, device.Scaling))
                    {
                        displayChanged = true;
                    }
                }
            }

            if (displayChanged)
            {
                currentGame = game;
                restartDisplayDrivers();
            }
            else
            {
                lastDisplayInfo = null;
            }
        }
Example #3
0
 public GameExecutionInfo(string _title, string _path)
 {
     Title = _title;
     isProcNEqExec = false;
     ExecPath = _path;
     ProcPath = _path;
     GenerateUID();
     displayInfo = new DisplayInfo();
 }
Example #4
0
 public static void RestoreDisplay(GameInfo game = null)
 {
     if (lastDisplayInfo != null && game == currentGame)
     {
         AdjustDisplay(lastDisplayInfo);
         lastDisplayInfo = null;
         currentGame     = null;
     }
 }
Example #5
0
 public GameExecutionInfo(string _title, string _path)
 {
     Title         = _title;
     isProcNEqExec = false;
     ExecPath      = _path;
     ProcPath      = _path;
     GenerateUID();
     displayInfo = new DisplayInfo();
 }
Example #6
0
        public GameExecutionInfo(int ESID)
        {
            erogameScapeID = ESID;
            updateInfoFromES();

            totalPlayTime = 0;
            firstPlayTime = new DateTime(0);
            lastPlayTime  = new DateTime(0);

            isProcNEqExec = false;

            GenerateUID();

            displayInfo = new DisplayInfo();
        }
Example #7
0
        public GameExecutionInfo(int ESID)
        {
            erogameScapeID = ESID;
            updateInfoFromES();

            totalPlayTime = 0;
            firstPlayTime = new DateTime(0);
            lastPlayTime = new DateTime(0);

            isProcNEqExec = false;

            GenerateUID();

            displayInfo = new DisplayInfo();
        }
Example #8
0
        public GameExecutionInfo(string _uid, string _title, string _brand, bool _isNukige, int _esid, DateTime _saleday,
                                 int _playtime, DateTime _firstplay, DateTime _lastplay,
                                 bool _pne, string _procpath, string _execpath, DisplayInfo _displayInfo,
                                 bool _cleared, string _comment, string _commentDate, string _latestUpdate)
        {
            uid            = _uid;
            title          = _title;
            brand          = _brand;
            isNukige       = _isNukige;
            erogameScapeID = _esid;
            saleDay        = _saleday;

            totalPlayTime = _playtime;
            firstPlayTime = _firstplay;
            lastPlayTime  = _lastplay;

            isProcNEqExec = _pne;
            procPath      = _procpath;
            execPath      = _execpath;

            displayInfo = _displayInfo;

            cleared = _cleared;
            comment = _comment;

            if (_commentDate != "")
            {
                commentDate = DateTime.ParseExact(_commentDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            }
            else
            {
                commentDate = DateTime.Parse("1970-01-01");
            }

            if (_latestUpdate != "")
            {
                latestUpdate = DateTime.ParseExact(_latestUpdate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            }
            else
            {
                latestUpdate = DateTime.Parse("1970-01-01");
            }
        }
Example #9
0
        public GameExecutionInfo(string _uid, string _title, string _brand, int _esid, DateTime _saleday,
                                 int _playtime, DateTime _firstplay, DateTime _lastplay,
                                 bool _pne, string _procpath, string _execpath, DisplayInfo _displayInfo)
        {
            uid            = _uid;
            title          = _title;
            brand          = _brand;
            erogameScapeID = _esid;
            saleDay        = _saleday;

            totalPlayTime = _playtime;
            firstPlayTime = _firstplay;
            lastPlayTime  = _lastplay;

            isProcNEqExec = _pne;
            procPath      = _procpath;
            execPath      = _execpath;

            displayInfo = _displayInfo;
        }
Example #10
0
        public void Set(GameExecutionInfo t)
        {
            Title          = t.Title;
            Brand          = t.Brand;
            SaleDay        = t.SaleDay;
            ErogameScapeID = t.ErogameScapeID;

            TotalPlayTime = t.TotalPlayTime;
            FirstPlayTime = t.FirstPlayTime;
            LastPlayTime  = t.LastPlayTime;

            IsProcNEqExec = t.IsProcNEqExec;
            IsPathExist   = t.IsPathExist;
            ExecPath      = t.ExecPath;
            ProcPath      = t.ProcPath;
            Status        = t.Status;
            DisplayInfo   = t.DisplayInfo;

            uid = t.uid;
        }
Example #11
0
        public GameExecutionInfo(string _uid,string _title,string _brand,int _esid,DateTime _saleday,
			int _playtime,DateTime _firstplay,DateTime _lastplay,
			bool _pne,string _procpath,string _execpath, DisplayInfo _displayInfo)
        {
            uid = _uid;
            title = _title;
            brand = _brand;
            erogameScapeID = _esid;
            saleDay = _saleday;

            totalPlayTime = _playtime;
            firstPlayTime = _firstplay;
            lastPlayTime = _lastplay;

            isProcNEqExec = _pne;
            procPath = _procpath;
            execPath = _execpath;

            displayInfo = _displayInfo;
        }
Example #12
0
        public DisplayInfo LoadGameDisplayInfo(string UID)
        {
            DisplayInfo displayInfo = new DisplayInfo();

            using (SQLiteCommand command = conn.CreateCommand()) {
                command.CommandText = "SELECT * FROM gamedisplayinfo WHERE uid = @uid";
                command.Parameters.AddWithValue("@uid", UID);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    displayInfo.devices.Add(new DisplayDeviceInfo()
                    {
                        DeviceID = reader["device_id"].ToString(),
                        Scaling  = int.Parse(reader["scaling"].ToString()),
                        Enabled  = reader["enabled"].ToString() == "1" ? true : false
                    });
                }
            }

            return(displayInfo);
        }
Example #13
0
        public static void AdjustDisplay(DisplayInfo displayInfo, GameInfo game = null)
        {
            if (currentGame != null && game != null)
            {
                return;
            }

            bool        displayChanged = false;
            DisplayInfo current        = GetDisplayDevices();

            lastDisplayInfo = new DisplayInfo();

            foreach (var device in displayInfo.devices)
            {
                if (device.Enabled && current.devices.Any(_device => device.DeviceID == _device.DeviceID) && device.Scaling != getDeviceScaling(device.DeviceID))
                {
                    lastDisplayInfo.devices.Add(new DisplayDeviceInfo()
                    {
                        DeviceID = device.DeviceID, Scaling = getDeviceScaling(device.DeviceID), Enabled = true
                    });
                    if (setDeviceScaling(device.DeviceID, device.Scaling))
                    {
                        displayChanged = true;
                    }
                }
            }

            if (displayChanged)
            {
                currentGame = game;
                restartDisplayDrivers();
            }
            else
            {
                lastDisplayInfo = null;
            }
        }
Example #14
0
 public GameExecutionInfo()
 {
     isProcNEqExec = false;
     displayInfo   = new DisplayInfo();
 }
Example #15
0
        public DisplayInfo LoadGameDisplayInfo(string UID)
        {
            DisplayInfo displayInfo = new DisplayInfo();

            using (SQLiteCommand command = conn.CreateCommand())
            {
                command.CommandText = "SELECT * FROM gamedisplayinfo WHERE uid = @uid";
                command.Parameters.AddWithValue("@uid", UID);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    displayInfo.devices.Add(new DisplayDeviceInfo() {
                        DeviceID = reader["device_id"].ToString(),
                        Scaling = int.Parse(reader["scaling"].ToString()),
                        Enabled = reader["enabled"].ToString() == "1" ? true : false
                    });
                }
            }

            return displayInfo;
        }
Example #16
0
 public GameExecutionInfo()
 {
     isProcNEqExec = false;
     displayInfo = new DisplayInfo();
 }
Example #17
0
        public static DisplayInfo GetDisplayDevices()
        {
            DisplayInfo displayDevices = new DisplayInfo();
            Match match;

            DISPLAY_DEVICE d = new DISPLAY_DEVICE();
            d.cb = Marshal.SizeOf(d);
            for (uint id = 0; EnumDisplayDevices(null, id, ref d, 0); id++)
            {
                if (d.StateFlags.HasFlag(DisplayDeviceStateFlags.AttachedToDesktop))
                {
                    d.cb = Marshal.SizeOf(d);
                    EnumDisplayDevices(d.DeviceName, 0, ref d, 0);
                    if ((match = new Regex(@"^MONITOR\\(.*?)\\").Match(d.DeviceID)).Success)
                    {
                        var deviceID = match.Groups[1].Value;
                        if (deviceID == "Default_Monitor") deviceID += getComputerID();
                        displayDevices.devices.Add(new DisplayDeviceInfo() { DeviceString = d.DeviceString, DeviceID = deviceID, Scaling = getDeviceScaling(deviceID) });
                    }
                }
                d.cb = Marshal.SizeOf(d);
            }
            return displayDevices;
        }
Example #18
0
 public static void RestoreDisplay(GameInfo game = null)
 {
     if (lastDisplayInfo != null && game == currentGame)
     {
         AdjustDisplay(lastDisplayInfo);
         lastDisplayInfo = null;
         currentGame = null;
     }
 }