Esempio n. 1
0
 /// <summary>
 /// 获取更新信息
 /// </summary>
 /// <param name="updateInfo">更新信息</param>
 private void onGet(asynchronousMethod.returnValue <tableVersion.updateInfo> updateInfo)
 {
     if (updateInfo.IsReturn && update(updateInfo))
     {
         try
         {
             getUpdate(Version, onUpdate);
             return;
         }
         catch (Exception error)
         {
             log.Error.Add(error, null, false);
         }
     }
     Version.Time = 0;
     fastCSharp.threading.timerTask.Default.Add(tryGet, date.NowSecond.AddSeconds(2));
 }
Esempio n. 2
0
            /// <summary>
            /// 更新表格版本
            /// </summary>
            /// <param name="updateInfo">更新信息</param>
            /// <returns>是否成功</returns>
            private unsafe bool update(asynchronousMethod.returnValue <tableVersion.updateInfo> updateInfo)
            {
                if (updateInfo.Value.Tables == null)
                {
                    if (updateInfo.Value.Version != 0)
                    {
                        if (updateInfo.Value.Table >= count)
                        {
                            newVersions(updateInfo.Value.Table + 1);
                        }
                        Versions[updateInfo.Value.Table] = updateInfo.Value.Version;
                        Version.Version = updateInfo.Value.Version;
                        return(true);
                    }
                    return(false);
                }
                if (updateInfo.Value.Table > count)
                {
                    newVersions(updateInfo.Value.Table);
                }
                ulong maxVersion = Version.Version;

                fixed(int *tableFixed = updateInfo.Value.Tables)
                fixed(ulong *versionFixed = updateInfo.Value.Versions)
                {
                    ulong *versionRead = versionFixed + updateInfo.Value.Versions.Length;

                    for (int *table = tableFixed + updateInfo.Value.Tables.Length; table != tableFixed; Versions[*--table] = *versionRead)
                    {
                        if (*--versionRead > maxVersion)
                        {
                            maxVersion = *versionRead;
                        }
                    }
                }
                Version.Version = maxVersion;
                return(true);
            }