示例#1
0
        void LogReplay(LogEntry log)
        {
            switch (log.Type)
            {
            case LogType.CreateDirectory:
                CreateDirectoryInternal(log.Path, new DateTime(log.UtcTicks, DateTimeKind.Utc));
                break;

            case LogType.DeleteDirectory:
                DeleteDirectoryInternal(log.Path);
                break;

            case LogType.CreateFile:
                SegmentID[] segments = new SegmentID[log.Segments == null ? 0 : log.Segments.Length];
                for (int i = 0; i < segments.Length; ++i)
                {
                    segments [i] = new SegmentID(log.Segments [i]);
                }
                FileEntry newEntry;
                CreateFileInternal(log.Path, segments, log.Size, new DateTime(log.UtcTicks, DateTimeKind.Utc), out newEntry);
                break;

            case LogType.DeleteFile:
                FileEntry entry;
                DeleteFileInternal(log.Path, out entry);
                break;

            default:
                throw new FormatException();
            }
        }
示例#2
0
    public void SelectSegment(SegmentID id)
    {
        ShowLoader();
        PlayFabAdminAPI.GetPlayersInSegment(new GetPlayersInSegmentRequest {
            SegmentId = id.segmentID
        },
                                            result => {
            Debug.Log("GOT SEGMENT PLAYERS OK: " + result.ToJson().ToString());
            foreach (var playerProfile in result.PlayerProfiles)
            {
                GameObject newPlayerButton = Instantiate(playerButton,
                                                         Vector3.zero, Quaternion.identity,
                                                         playerButton.transform.parent) as GameObject;

                PlayerID identity  = newPlayerButton.GetComponent <PlayerID>();
                identity.avatarURL = playerProfile.AvatarUrl;
                if (playerProfile.BannedUntil.HasValue)
                {
                    identity.bannedUntil = playerProfile.BannedUntil.Value.ToLocalTime().ToString();
                }
                else
                {
                    identity.bannedUntil = "N/A";
                }
                identity.creationDate = playerProfile.Created.Value.ToLocalTime().ToString();
                identity.lastLogin    = playerProfile.LastLogin.Value.ToLocalTime().ToString();
                identity.displayName  = playerProfile.DisplayName;
                foreach (var location in playerProfile.Locations)
                {
                    identity.location = location.Value.City + ", " +
                                        location.Value.CountryCode;
                    identity.latLong = location.Value.Latitude + "," +
                                       location.Value.Longitude;
                }
                string currencies = "";
                foreach (var currency in playerProfile.VirtualCurrencyBalances)
                {
                    currencies += "\n" + currency.Key + ": " + currency.Value;
                }
                identity.currencies     = currencies;
                identity.originPlatform = playerProfile.Origination.Value.ToString();
                identity.playerID       = playerProfile.PlayerId;
                identity.nameText.text  = playerProfile.DisplayName;
                newPlayerButton.SetActive(true);
            }
            DestroySegmentWindow();
            playerWindow.SetActive(true);
            HideLoader();
        },
                                            error => {
            HideLoader();
            Debug.LogError("ERROR GETTING SEGMENT PLAYERS: " + error.GenerateErrorReport());
            Inform(error.ErrorMessage);
        });
    }
示例#3
0
        void AppendSegment(string path, byte[] seg, uint size)
        {
            var segId = new SegmentID(seg);
            var log   = new OpLog(OpLogType.AppendBlock, path, DateTime.UtcNow, new SegmentInfo[] {
                new SegmentInfo(segId, size)
            });

            using (var wrlock = rwlock.WriteLock()) {
                AppendLog(log);
                ReplayAppendBlock(path, log.Time, log.Segments);
            }
        }
示例#4
0
            internal void AddSegment(SegmentID id, long newSize)
            {
                lock (this) {
                    var         old  = this.Segments;
                    SegmentID[] list = new SegmentID[old.Length + 1];
                    Array.Copy(old, 0, list, 0, old.Length);
                    list [old.Length] = id;

                    this.Size     = newSize;
                    this.Segments = list;
                }
            }
示例#5
0
 public void ReadFrom(BinaryReader reader)
 {
     OpType   = (OpLogType)reader.ReadByte();
     Path     = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadInt32()));
     Time     = new DateTime(reader.ReadInt64(), DateTimeKind.Utc);
     Segments = new SegmentInfo[reader.ReadByte()];
     for (int i = 0; i < Segments.Length; ++i)
     {
         var segId   = new SegmentID(reader);
         var segSize = reader.ReadUInt32();
         Segments[i] = new SegmentInfo(segId, segSize);
     }
 }
示例#6
0
 public void AppendSegment(SegmentID id, uint size)
 {
     if (size == 0)
     {
         throw new ArgumentException();
     }
     lock (this) {
         var newSegments = new List <SegmentInfo> (Segments);
         newSegments.Add(new SegmentInfo(id, size));
         Segments = newSegments.ToArray();
         Size    += size;
     }
 }
示例#7
0
 public void GetSegments()
 {
     ShowLoader();
     PlayFabAdminAPI.GetAllSegments(new GetAllSegmentsRequest(),
                                    result => {
         Debug.Log("GOT ALL SEGMENTS OK: " + result.ToJson().ToString());
         foreach (var segment in result.Segments)
         {
             GameObject newSegmentButton = Instantiate(segmentButton, Vector3.zero, Quaternion.identity, segmentButton.transform.parent) as GameObject;
             SegmentID identity          = newSegmentButton.GetComponent <SegmentID>();
             identity.segmentID          = segment.Id;
             identity.nameText.text      = segment.Name;
             newSegmentButton.SetActive(true);
         }
         segmentWindow.SetActive(true);
         HideLoader();
     },
                                    error => {
         HideLoader();
         Debug.LogError("ERROR GETTING SEGMENTS: " + error.GenerateErrorReport());
         Inform(error.ErrorMessage);
     });
 }
示例#8
0
 public SegmentInfo(SegmentID id, uint size)
 {
     ID    = id;
     _size = size;
 }
示例#9
0
 public override int GetHashCode()
 {
     return(SegmentID.GetHashCode());
 }
示例#10
0
 public override int GetHashCode()
 {
     return(SegmentID.GetHashCode() ^ BeginKnoop.GetHashCode() ^ EindKnoop.GetHashCode() ^ Vertices.GetHashCode());
 }