コード例 #1
0
 /// <summary>
 /// Unlocks all achievements either Online or Offline
 /// </summary>
 /// <param name="MinutesBetween"></param>
 /// <returns></returns>
 public bool UnlockAll(uint MinutesBetween)
 {
     if (!ParseCheck())
     {
         return(false);
     }
     if (!HasDashGPD)
     {
         return(false);
     }
     try
     {
         foreach (TitlePlayedEntry xTitle in UserGPD.TitlesPlayed)
         {
             FileEntry flent;
             GameGPD   x = ReadGame(xTitle.TitleID, out flent);
             if (x == null)
             {
                 continue;
             }
             x.UnlockAll(MinutesBetween);
             uint data1 = 0;
             uint data2 = 0;
             x.FixCredAndCount();
             if (flent.Replace(x.xIO))
             {
                 xTitle.EarnedCount   = data1;
                 xTitle.EarnedWorth   = data2;
                 xTitle.PossibleWorth = x.xCalcGSP();
                 xTitle.xUpdate();
             }
         }
         xUserGPD.UpdateGamerScore();
         xSaveDash();
         return(true);
     }
     catch { return(false); }
 }
コード例 #2
0
ファイル: DashGPD.cs プロジェクト: VictorOverX/X360
 /// <summary>
 /// Adds a game via the GPD
 /// </summary>
 /// <param name="xTitle"></param>
 /// <returns></returns>
 public bool AddGameViaGPD(GameGPD xTitle)
 {
     if (!ParseCheck())
         return false;
     if (xTitle.TitleID == 0 ||
         xTitle.TitleID == 0xFFFE07D1 || // Dash
         xTitle.TitleID == 0xFFFE07DE) // Avatar?
         return (xActive = false);
     foreach (TitlePlayedEntry x in xTitlesPlayed)
     {
         if (xTitle.TitleID != x.TitleID)
             continue;
         xActive = false;
         throw GPDExcepts.HasID;
     }
     try
     {
         string xName = xTitle.GetStringByID((long)GPDIDs.ThisTitle);
         if (xName == null)
         {
             xActive = false;
             throw GPDExcepts.NameError;
         }
         if (!xTitle.xErase())
             return (xActive = false);
         int xsize = 0x28 + ((xName.Length + 1) * 2);
         int xPosition = AllocateData(xsize);
         if (xPosition == -1)
             return (xActive = false);
         XDBFEntry xEnt = new XDBFEntry(NameSpace.Title, xTitle.TitleID, xPosition, xsize, this);
         xIO.Position = xPosition + HeaderSize;
         xIO.Write(xTitle.TitleID);
         xIO.Write((uint)xTitle.xAchievements.Count);
         xIO.Write(xTitle.xCalcUT());
         xIO.Write(xTitle.xCalcGSP());
         xIO.Write(xTitle.xCalcGST());
         xIO.Write(new byte[0x14]);
         xIO.Write(xName, StringForm.Unicode);
         xIO.Write((short)0);
         xIO.Flush();
         TitlePlayedEntry z = new TitlePlayedEntry(xEnt);
         if (!z.LoadDetails())
             return (xActive = false);
         xTitlesPlayed.Add(z);
         Setting x = xGetSetting(GPDIDs.GCardTitlesPlayed, SettingType.UInt32);
         if (x == null)
             xAddSetting((long)GPDIDs.GCardTitlesPlayed, xTitlesPlayed.Count, true, SyncType.Locale);
         else
         {
             uint xdata = (uint)x.Data;
             xdata++;
             x.Data = xdata;
             x.xUpdate(SyncType.Locale);
         }
         UpdateSync(NameSpace.Title, xTitle.TitleID, SyncType.Server);
         return (UpdateHeader() &
         !(xActive = false));
     }
     catch { return (xActive = false); }
 }