Example #1
0
        internal static bool PeekAddonUpdates(int _MinutesSinceLastPeek)
        {
            VF.NetworkClient netClient = new VF.NetworkClient(g_Host, g_Port);
            netClient.WaitForConnect(TimeSpan.FromSeconds(60));
            try
            {
                {
                    VF.NetworkOutgoingMessage             newMessage = netClient.CreateMessage();
                    WLN_RequestPacket_AddonUpdateInfoPeek request    = new WLN_RequestPacket_AddonUpdateInfoPeek();
                    request.UserID               = Settings.UserID;
                    request.LauncherVersion      = StaticValues.LauncherVersion;
                    request.MinutesSinceLastPeek = _MinutesSinceLastPeek;

                    newMessage.WriteByte((byte)WLN_PacketType.Request_AddonUpdateInfoPeek);
                    newMessage.WriteClass(request);
                    netClient.SendMessage(newMessage);
                }
                WLN_ResponsePacket_AddonUpdateInfoPeek response = new WLN_ResponsePacket_AddonUpdateInfoPeek();
                if (netClient.RecvPacket_VF(WLN_PacketType.Response_AddonUpdateInfoPeek, out response) == true)
                {
                    if (response.AddonUpdatesAvailable != null)
                    {
                        return(response.AddonUpdatesAvailable.Count > 0);
                    }
                }
            }
            finally
            {
                netClient.Disconnect();
                netClient = null;
            }
            return(false);
        }
Example #2
0
        internal static List <WLN_ResponsePacket_GetNewsSince> GetNewsSince(DateTime _LastNewsDateTime, List <string> _NewsSourcesWanted)
        {
            List <WLN_ResponsePacket_GetNewsSince> newsPackets = new List <WLN_ResponsePacket_GetNewsSince>();

            VF.NetworkClient netClient = new VF.NetworkClient(g_Host, g_Port);
            netClient.WaitForConnect(TimeSpan.FromSeconds(60));
            try
            {
                {
                    VF.NetworkOutgoingMessage      newMessage = netClient.CreateMessage();
                    WLN_RequestPacket_GetNewsSince request    = new WLN_RequestPacket_GetNewsSince();
                    request.LastNewsDateTime = _LastNewsDateTime;
                    request.NewsSources      = _NewsSourcesWanted;

                    newMessage.WriteByte((byte)WLN_PacketType.Request_GetNewsSince);
                    newMessage.WriteClass(request);
                    netClient.SendMessage(newMessage);
                }
                if (netClient.RecvPacket_VF(WLN_PacketType.Response_GetNewsSince, out newsPackets) == true)
                {
                    return(newsPackets);
                }
                else
                {
                    newsPackets = new List <WLN_ResponsePacket_GetNewsSince>();
                }
            }
            catch (Exception)
            {
                newsPackets = new List <WLN_ResponsePacket_GetNewsSince>();
            }
            finally
            {
                netClient.Disconnect();
                netClient = null;
            }
            return(newsPackets);
        }
Example #3
0
        internal static List <AddonUpdateInfo> GetAddonUpdateInfos(List <string> _AddonNames, WowVersionEnum _WowVersion)
        {
            VF.NetworkClient       netClient = new VF.NetworkClient(g_Host, g_Port);
            List <AddonUpdateInfo> retList   = new List <AddonUpdateInfo>();

            try
            {
                //VF.NetworkIncommingMessage msg;
                {
                    VF.NetworkOutgoingMessage            newMessage = netClient.CreateMessage();
                    WLN_RequestPacket_AddonUpdateInfoNew request    = new WLN_RequestPacket_AddonUpdateInfoNew();
                    request.UserID          = Settings.UserID;
                    request.LauncherVersion = StaticValues.LauncherVersion;
                    request.WowVersion      = _WowVersion;
                    for (int i = 0; i < _AddonNames.Count; ++i)
                    {
                        var addonUpdateInfo = new WLN_RequestPacket_AddonUpdateInfo();
                        addonUpdateInfo.AddonName = _AddonNames[i];
                        var addonInfo = InstalledAddons.GetAddonInfo(_AddonNames[i], _WowVersion);
                        if (addonInfo != null)
                        {
                            addonUpdateInfo.CurrentVersion = addonInfo.m_VersionString;
                        }
                        else
                        {
                            addonUpdateInfo.CurrentVersion = "0.0";
                        }
                        request.Addons.Add(addonUpdateInfo);
                    }
                    newMessage.WriteByte((byte)WLN_PacketType.Request_AddonUpdateInfoNew);
                    newMessage.WriteClass(request);
                    netClient.SendMessage(newMessage);
                }
                List <WLN_ResponsePacket_AddonUpdateInfo> recvAddonUpdateInfos = null;

                if (netClient.RecvPacket_VF(WLN_PacketType.Response_AddonUpdateInfo, out recvAddonUpdateInfos) == true)
                {
                    foreach (var recvAddonUpdateInfo in recvAddonUpdateInfos)
                    {
                        if (recvAddonUpdateInfo.AddonName == "null")
                        {
                            continue;
                        }
                        AddonUpdateInfo addonUpdateInfo = new AddonUpdateInfo();
                        addonUpdateInfo.AddonName                          = recvAddonUpdateInfo.AddonName;
                        addonUpdateInfo.InstalledAddonInfo                 = InstalledAddons.GetAddonInfo(recvAddonUpdateInfo.AddonName, _WowVersion);
                        addonUpdateInfo.CurrentVersion                     = recvAddonUpdateInfo.CurrentVersion;
                        addonUpdateInfo.UpdateVersion                      = recvAddonUpdateInfo.UpdateVersion;
                        addonUpdateInfo.UpdateDescription                  = recvAddonUpdateInfo.UpdateDescription;
                        addonUpdateInfo.AddonPackageDownloadFTP            = recvAddonUpdateInfo.AddonPackageDownloadFTP;
                        addonUpdateInfo.ClearAccountSavedVariablesRequired = recvAddonUpdateInfo.ClearAccountSavedVariablesRequired;
                        addonUpdateInfo.UpdateSubmitter                    = recvAddonUpdateInfo.UpdateSubmitter;
                        addonUpdateInfo.UpdateImportance                   = recvAddonUpdateInfo.UpdateImportance;
                        addonUpdateInfo.MoreInfoSite                       = recvAddonUpdateInfo.MoreInfoSite;
                        retList.Add(addonUpdateInfo);
                    }
                }
            }
            finally
            {
                netClient.Disconnect();
            }
            return(retList);
        }