Esempio n. 1
0
        private DateTime GetLastChangedTime(string filespaceId, string path)
        {
            Log.LogDebug("GetLastChangedTime: filespaceId={0}, path={1}", filespaceId, path);

            try
            {
                var lastDirChangeParams = new LastDirChangeParams
                {
                    filespaceid = filespaceId,
                    path        = path,
                    recursive   = true
                };
                var result = ExecuteRequest(Ticket, Method.GET, "/tcc/LastDirChange", lastDirChangeParams,
                                            typeof(LastDirChangeResult));
                if (result is LastDirChangeResult lastDirChangeResult)
                {
                    if (lastDirChangeResult.success)
                    {
                        return(lastDirChangeResult.lastUpdatedDateTime);
                    }
                    CheckForInvalidTicket(lastDirChangeResult, "GetLastChangedTime");
                }
                else
                {
                    Log.LogError("Null result from GetLastChangedTime for filespaceId={0}, path={1}", filespaceId, path);
                }
            }
            catch (Exception ex)
            {
                Log.LogError("Failed to get last time tag files added to folder: {0}", ex.Message);
            }

            return(DateTime.MinValue);
        }
Esempio n. 2
0
        public async Task <DateTime> GetLastChangedTime(string filespaceId, string path)
        {
            Log.LogDebug("GetLastChangedTime: filespaceId={0}, path={1}", filespaceId, path);

            try
            {
                var lastDirChangeParams = new LastDirChangeParams
                {
                    filespaceid = filespaceId,
                    path        = path,
                    recursive   = true
                };
                var lastDirChangeResult =
                    await ExecuteRequest <LastDirChangeResult>(Ticket, "LastDirChange", lastDirChangeParams);

                if (lastDirChangeResult != null)
                {
                    if (lastDirChangeResult.success)
                    {
                        return(lastDirChangeResult.lastUpdatedDateTime);
                    }
                    CheckForInvalidTicket(lastDirChangeResult, "GetLastChangedTime");
                }
                else
                {
                    Log.LogError("Null result from GetLastChangedTime for filespaceId={0}, path={1}", filespaceId,
                                 path);
                }
            }
            catch (Exception ex)
            {
                Log.LogError(ex, "Failed to get last time tag files added to folder");
            }
            return(DateTime.MinValue);
        }