コード例 #1
0
        // ReSharper disable once UnusedMember.Global
        public static void Send_FileHash(List <SVR_AniDB_File> aniFiles)
        {
            //if (!ServerSettings.Instance.WebCache.XRefFileEpisode_Send) return;

            string uri = $@"http://{azureHostBaseAddress}/api/FileHash";

            List <Azure_FileHash_Request> inputs = new List <Azure_FileHash_Request>();

            // send a max of 25 at a time
            foreach (SVR_AniDB_File aniFile in aniFiles)
            {
                Azure_FileHash_Request input = aniFile.ToHashRequest();
                if (inputs.Count < 25)
                {
                    inputs.Add(input);
                }
                else
                {
                    string json = JSONHelper.Serialize(inputs);
                    SendData(uri, json, "POST");
                    inputs.Clear();
                }
            }

            if (inputs.Count > 0)
            {
                string json = JSONHelper.Serialize(inputs);
                SendData(uri, json, "POST");
            }
        }
コード例 #2
0
        public static void Send_FileHash(List <SVR_VideoLocal> locals)
        {
            //if (!ServerSettings.WebCache_XRefFileEpisode_Send) return;

            string uri = string.Format(@"http://{0}/api/FileHash", azureHostBaseAddress);

            List <Azure_FileHash_Request> inputs = new List <Azure_FileHash_Request>();

            // send a max of 25 at a time
            foreach (SVR_VideoLocal v in locals)
            {
                Azure_FileHash_Request input = v.ToHashRequest();
                if (inputs.Count < 25)
                {
                    inputs.Add(input);
                }
                else
                {
                    string json = JSONHelper.Serialize <List <Azure_FileHash_Request> >(inputs);
                    SendData(uri, json, "POST");
                    inputs.Clear();
                }
            }

            if (inputs.Count > 0)
            {
                string json = JSONHelper.Serialize <List <Azure_FileHash_Request> >(inputs);
                SendData(uri, json, "POST");
            }
        }
コード例 #3
0
        public static Azure_FileHash_Request ToHashRequest(this SVR_VideoLocal vl)
        {
            Azure_FileHash_Request r = new Azure_FileHash_Request
            {
                ED2K     = vl.Hash,
                CRC32    = vl.CRC32,
                MD5      = vl.MD5,
                SHA1     = vl.SHA1,
                FileSize = vl.FileSize,
                Username = Constants.AnonWebCacheUsername,
                AuthGUID = string.Empty
            };

            return(r);
        }
コード例 #4
0
        public static Azure_FileHash_Request ToHashRequest(this AniDB_File anifile)
        {
            Azure_FileHash_Request r = new Azure_FileHash_Request
            {
                ED2K     = anifile.Hash,
                CRC32    = anifile.CRC,
                MD5      = anifile.MD5,
                SHA1     = anifile.SHA1,
                FileSize = anifile.FileSize,
                Username = Constants.AnonWebCacheUsername,
                AuthGUID = string.Empty
            };

            return(r);
        }
コード例 #5
0
        public static Azure_FileHash_Request ToHashRequest(this SVR_VideoLocal vl)
        {
            Azure_FileHash_Request r = new Azure_FileHash_Request
            {
                ED2K     = vl.Hash,
                CRC32    = vl.CRC32,
                MD5      = vl.MD5,
                SHA1     = vl.SHA1,
                FileSize = vl.FileSize
            };

            r.Username = ServerSettings.AniDB_Username;
            if (ServerSettings.WebCache_Anonymous)
            {
                r.Username = Constants.AnonWebCacheUsername;
            }
            r.AuthGUID = string.IsNullOrEmpty(ServerSettings.WebCacheAuthKey) ? string.Empty : ServerSettings.WebCacheAuthKey;

            return(r);
        }
コード例 #6
0
        public static Azure_FileHash_Request ToHashRequest(this AniDB_File anifile)
        {
            Azure_FileHash_Request r = new Azure_FileHash_Request
            {
                ED2K     = anifile.Hash,
                CRC32    = anifile.CRC,
                MD5      = anifile.MD5,
                SHA1     = anifile.SHA1,
                FileSize = anifile.FileSize
            };

            r.Username = ServerSettings.AniDB_Username;
            if (ServerSettings.WebCache_Anonymous)
            {
                r.Username = Constants.AnonWebCacheUsername;
            }
            r.AuthGUID = string.IsNullOrEmpty(ServerSettings.WebCacheAuthKey) ? string.Empty : ServerSettings.WebCacheAuthKey;

            return(r);
        }