Esempio n. 1
0
        private void Initialise(IHelper aHelper, string aUpdateFeedLocation, int aUpdateInterval, EUpdateType aUpdateTypes, string aApplicationName, string aApplicationTarget, uint aUpdateVersion, EUpdateType aApplicationBuildType)
        {
            iHelper = aHelper;
            iApplicationBuildType = aApplicationBuildType;
            iUpdateFolder         = Path.Combine(iHelper.DataPath.FullName, "Updates");
            try
            {
                if (!Directory.Exists(iUpdateFolder))
                {
                    Directory.CreateDirectory(iUpdateFolder);
                }
            }
            catch (Exception ex)
            {
                UserLog.WriteLine("Failed to create update folder: " + ex.ToString());
            }
            iApplicationName   = aApplicationName;
            iApplicationTarget = aApplicationTarget;
            UpdateTypes        = aUpdateTypes;
            iUpdateVersion     = aUpdateVersion;

            iUpdateFeedLocation = aUpdateFeedLocation;
            iUpdateInterval     = aUpdateInterval;

            CleanupTemporaryFiles();        // do some housekeeping
        }
Esempio n. 2
0
 public DataEventArgs(EUpdateType update_type, PriceData pd, RangeI index_range, Candle candle)
 {
     UpdateType = update_type;
     PriceData  = pd;
     IndexRange = index_range;
     Candle     = candle;
 }
Esempio n. 3
0
 public AutoUpdateInfo(string aName, string aVersion, Uri aHistory, Uri aUri, EUpdateType aUpdateType, bool aIsCompatibilityFamilyUpgrade)
 {
     Name       = aName;
     Version    = aVersion;
     History    = aHistory;
     Uri        = aUri;
     UpdateType = aUpdateType;
     IsCompatibilityFamilyUpgrade = aIsCompatibilityFamilyUpgrade;
 }
Esempio n. 4
0
 public UpdateInfo(string aModel, string aType, string aVersion, string aFamily, Uri aUri, EUpdateType aUpdateType)
 {
     iModel      = aModel;
     iType       = aType;
     iVersion    = aVersion;
     iFamily     = aFamily;
     iUri        = aUri;
     iUpdateType = aUpdateType;
 }
Esempio n. 5
0
        public void SetUpdateTypes(EUpdateType aUpdateTypes)
        {
            Stop();

            lock (iLock)
            {
                iUpdateTypes = aUpdateTypes;
                iUpdateInfoList.Clear();
                iVariantInfoList.Clear();
            }

            Start();
        }
Esempio n. 6
0
        public VersionInfoReader(string aUpdateFeedUri, uint aUpdateInterval, string aApplicationDataPath, EUpdateType aUpdateTypes, FirmwareCache aCache)
        {
            iLock     = new object();
            iDisposed = false;

            iCache = aCache;

            iUpdateFeedUri       = aUpdateFeedUri;
            iUpdateInterval      = aUpdateInterval;
            iApplicationDataPath = aApplicationDataPath;
            iUpdateTypes         = aUpdateTypes;
            iTimer = new System.Threading.Timer(TimerElapsed);

            iUpdateInfoList  = new List <UpdateInfo>();
            iVariantInfoList = new List <VariantInfo>();
        }
Esempio n. 7
0
        /// <summary>
        /// Sets the EUpdateType enum value identified by controllerName.
        /// </summary>
        /// <param name="controllerName"></param>
        /// <param name="EUpdateType"></param>
        public static void SetEUpdateType(string controllerName, EUpdateType EUpdateType)
        {
            if (!active)
            {
                return;
            }

            foreach (ControllerBase controller in controllers)
            {
                if (controller.MyName == controllerName)
                {
                    controller.updateType = EUpdateType;
                }
            }

            Debug.LogError("Controller: " + controllerName + " not found!");
        }
Esempio n. 8
0
        private bool Update(EUpdateType eType)
        {
            string     hTTPData;
            JsonObject obj2;
            bool       flag = false;

            switch (eType)
            {
            case EUpdateType.EBasic:
                this.m_HTTPConnect.GetHTTPData("action=Main%2EgetBasicInfo&format=BIN", false);
                return(flag);

            case EUpdateType.EMap:
                hTTPData = this.m_HTTPConnect.GetHTTPData("action=Main%2EmapInfo&format=BIN", true);
                if (!(this.m_HTTPConnect.ErrorCode == "SUCCESS"))
                {
                    if ("NET_ERROR" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("网络连接错误");
                        return(flag);
                    }
                    if ("USER_EXPIRED" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("用户授权已过期");
                    }
                    return(flag);
                }
                obj2 = (JsonObject)JsonConvert.Import(hTTPData);
                GNations.theNations.UpdateNationCity(obj2);
                return(flag);

            case EUpdateType.ENations:
                hTTPData = this.m_HTTPConnect.GetHTTPData("action=Main%2EgetNations", true);
                if (!(this.m_HTTPConnect.ErrorCode == "SUCCESS"))
                {
                    if ("NET_ERROR" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("网络连接错误");
                        return(flag);
                    }
                    if ("USER_EXPIRED" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("用户授权已过期");
                    }
                    return(flag);
                }
                obj2 = (JsonObject)JsonConvert.Import(hTTPData);
                GNations.theNations.Update(obj2);
                return(flag);

            case EUpdateType.EUserInfo:
                this.m_HTTPConnect.GetHTTPData("action=BaseInfo%2EuserInfo", true);
                return(flag);

            case EUpdateType.EHeroList:
                this.m_HTTPConnect.GetHTTPData("action=Hero%2ElistAll", true);
                return(flag);

            case EUpdateType.EManorList:
                this.m_HTTPConnect.GetHTTPData("action=Manor%2Elist", true);
                return(flag);

            case EUpdateType.EMyInfo:
                this.m_HTTPConnect.GetHTTPData("action=Player%2EmyInfo", true);
                return(flag);

            case EUpdateType.EBattleInfo:
            {
                string strformData = string.Format("action=City%2EBattle&format=BIN&cid={0}", this.m_WorkCity.CityID);
                hTTPData = this.m_HTTPConnect.GetHTTPData(strformData, true);
                if (string.Compare(this.m_HTTPConnect.ErrorCode, "ERR_CITY_000020", true) != 0)
                {
                    if (this.m_HTTPConnect.ErrorCode == "SUCCESS")
                    {
                        obj2 = (JsonObject)JsonConvert.Import(hTTPData);
                        this.m_WorkCity.UpdateWarArmy(obj2);
                        return(flag);
                    }
                    if ("NET_ERROR" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("网络连接错误");
                        return(flag);
                    }
                    if ("USER_EXPIRED" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("用户授权已过期");
                    }
                    return(flag);
                }
                this.m_WorkCity.CityStatus = 0;
                this.m_UIInterface.CityStatusUpdated();
                this.Update(EUpdateType.ECityInfo);
                return(flag);
            }

            case EUpdateType.ECityInfo:
            {
                string str3 = string.Format("action=City%2EgetCityInner&format=BIN&cid={0}", this.m_WorkCity.CityID);
                hTTPData = this.m_HTTPConnect.GetHTTPData(str3, true);
                if (string.Compare(this.m_HTTPConnect.ErrorCode, "ERR_CITY_000021", true) != 0)
                {
                    if (this.m_bUseSpy && (string.Compare(this.m_HTTPConnect.ErrorCode, "ERR_MAIN_000026", true) == 0))
                    {
                        if (this.m_UIInterface.ShowUseSpyWarning())
                        {
                            str3     = string.Format("action=City%2Espy&goldType=1&cid={0}", this.m_WorkCity.CityID);
                            hTTPData = this.m_HTTPConnect.GetHTTPData(str3, true);
                            if (this.m_HTTPConnect.ErrorCode == "SUCCESS")
                            {
                                obj2 = (JsonObject)JsonConvert.Import(hTTPData);
                                this.m_WorkCity.UpdateSpyCity(obj2);
                            }
                            return(flag);
                        }
                        if (this.m_WorkCity.UseSpy)
                        {
                            this.m_WorkCity.ScanArmy = true;
                        }
                        return(flag);
                    }
                    if (this.m_HTTPConnect.ErrorCode == "SUCCESS")
                    {
                        obj2 = (JsonObject)JsonConvert.Import(hTTPData);
                        this.m_WorkCity.UpdateCityArmy(obj2);
                        return(flag);
                    }
                    if ("NET_ERROR" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("网络连接错误");
                        return(flag);
                    }
                    if ("USER_EXPIRED" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("用户授权已过期");
                    }
                    return(flag);
                }
                this.m_WorkCity.CityStatus = 1;
                this.m_UIInterface.CityStatusUpdated();
                this.Update(EUpdateType.EBattleInfo);
                return(flag);
            }

            case EUpdateType.ECityManorInfo:
            {
                string str4 = string.Format("action=City%2ElistManor&cid={0}", this.m_WorkCity.CityID);
                hTTPData = this.m_HTTPConnect.GetHTTPData(str4, true);
                if (!(this.m_HTTPConnect.ErrorCode == "SUCCESS"))
                {
                    if ("NET_ERROR" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("网络连接错误");
                        return(flag);
                    }
                    if ("USER_EXPIRED" == this.m_HTTPConnect.ErrorCode)
                    {
                        this.m_UIInterface.WorkMessageUpdated("用户授权已过期");
                    }
                    return(flag);
                }
                obj2 = (JsonObject)JsonConvert.Import(hTTPData);
                this.m_WorkCity.UpdateManor(obj2);
                return(flag);
            }
            }
            return(flag);
        }
Esempio n. 9
0
        public AutoUpdate(IHelper aHelper, string aUpdateFeedLocation, int aUpdateInterval, EUpdateType aUpdateTypes, uint aUpdateVersion)
        {
            AutoUpdate.EUpdateType currentBuildType = AutoUpdate.EUpdateType.Stable;
            if (aHelper.Product.Contains("(NightlyBuild)"))
            {
                currentBuildType = AutoUpdate.EUpdateType.Nightly;
            }
            else if (aHelper.Product.Contains("(Beta)"))
            {
                currentBuildType = AutoUpdate.EUpdateType.Beta;
            }
            else if (aHelper.Product.Contains("(Development)"))
            {
                currentBuildType = AutoUpdate.EUpdateType.Development;
            }

            string applicationTarget = string.Empty;

            switch (SystemInfo.Platform)
            {
            case PlatformId.Win32NT:
            case PlatformId.Win32S:
            case PlatformId.Win32Windows:
                applicationTarget = kTargetWindows;
                break;

            case PlatformId.MacOSX:
                applicationTarget = kTargetMacOsX;
                break;

            case PlatformId.IOS:
                applicationTarget = kTargetIos;
                break;

            case PlatformId.WinCE:
                applicationTarget = kTargetWindowsCe;
                break;

            default:
                Assert.Check(false);
                break;
            }

            Initialise(aHelper, aUpdateFeedLocation, aUpdateInterval, aUpdateTypes, aHelper.Title, applicationTarget, aUpdateVersion, currentBuildType);
        }
Esempio n. 10
0
 public AutoUpdate(IHelper aHelper, string aUpdateFeedLocation, int aUpdateInterval, EUpdateType aUpdateTypes, string aApplicationName, string aApplicationTarget, uint aUpdateVersion, EUpdateType aApplicationBuildType)
 {
     Initialise(aHelper, aUpdateFeedLocation, aUpdateInterval, aUpdateTypes, aApplicationName, aApplicationTarget, aUpdateVersion, aApplicationBuildType);
 }