Beispiel #1
0
 //TODO consider removing this.
 public async Task <string> SetupPathLeaseCondition(PathClient path, string leaseId, string garbageLeaseId)
 {
     Models.DataLakeLease lease = null;
     if (leaseId == ReceivedLeaseId || leaseId == garbageLeaseId)
     {
         lease = await InstrumentClient(path.GetDataLakeLeaseClient(Recording.Random.NewGuid().ToString())).AcquireAsync(DataLakeLeaseClient.InfiniteLeaseDuration);
     }
     return(leaseId == ReceivedLeaseId ? lease.LeaseId : leaseId);
 }
Beispiel #2
0
        //TODO consider removing this.
        public async Task <string> SetupPathMatchCondition(PathClient path, string match)
        {
            if (match == ReceivedETag)
            {
                Response <PathProperties> headers = await path.GetPropertiesAsync();

                return(headers.Value.ETag.ToString());
            }
            else
            {
                return(match);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLakeLeaseClient"/> class.
 /// </summary>
 /// <param name="client">
 /// A <see cref="PathClient"/> representing the path being leased.
 /// </param>
 /// <param name="leaseId">
 /// An optional lease ID.  If no lease ID is provided, a random lease
 /// ID will be created.
 /// </param>
 public static DataLakeLeaseClient GetDataLakeLeaseClient(
     this PathClient client,
     string leaseId = null) =>
 new DataLakeLeaseClient(client, leaseId);
Beispiel #4
0
        public void ExportClient()
        {
            var        filename = "Assets/art/game/fish/Track/fishpath.json";
            TextWriter tw       = new StreamWriter(filename);

            try
            {
                var index = 0;
                tw.Write("[");
                tw.WriteLine();
                for (int i = 0; i < this._allPath.transform.childCount; i++)
                {
                    var child = this._allPath.transform.GetChild(i);
                    if (child && child.name == (i + 1).ToString())
                    {
                        if (index > 0)
                        {
                            tw.Write(",");
                            tw.WriteLine();
                        }

                        var path = child.GetComponent <DOTweenPath>();
                        if (path == null)
                        {
                            continue;
                        }
                        float distance = 0f;
                        for (int j = 2; j < path.path.wpLengths.Length; j++)
                        {
                            distance += path.path.wpLengths[j];
                        }

                        List <MovePoint3> movePoint3s = new List <MovePoint3>();
                        for (var j = 0; j < path.wps.Count; j++)
                        {
//                        if (path.wps[j] == Vector3.zero && j == 0)
//                        {
//                            continue;
//                        }
                            movePoint3s.Add(new MovePoint3 {
                                x = path.wps[j].x, y = path.wps[j].y, z = Math.Abs(path.wps[j].z) < 0.000001f?this._allPath.transform.localPosition.z:path.wps[j].z
                            });
                        }

                        var o = new PathClient
                        {
                            id       = path.name, distance = distance,
                            position = movePoint3s,
                        };
                        string jsonStr = JsonMapper.ToJson(o);
                        tw.Write(jsonStr);
                        index++;
                    }
                }

                tw.WriteLine();
                tw.Write("]");
                tw.Flush();
            }
            catch (Exception)
            {
            }
            finally
            {
                tw.Close();
            }
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLakeLeaseClient"/>  class.
 /// </summary>
 /// <param name="client">
 /// A <see cref="BlobClient"/> representing the blob being leased.
 /// </param>
 /// <param name="leaseId">
 /// An optional lease ID.  If no lease ID is provided, a random lease
 /// ID will be created.
 /// </param>
 public DataLakeLeaseClient(PathClient client, string leaseId = null)
 {
     _blobLeaseClient = new Blobs.Specialized.BlobLeaseClient(client.BlobClient, leaseId);
 }