/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (SlingServletResourceTypes != null)
         {
             hashCode = hashCode * 59 + SlingServletResourceTypes.GetHashCode();
         }
         if (SlingServletMethods != null)
         {
             hashCode = hashCode * 59 + SlingServletMethods.GetHashCode();
         }
         if (SlingServletSelectors != null)
         {
             hashCode = hashCode * 59 + SlingServletSelectors.GetHashCode();
         }
         if (DownloadConfig != null)
         {
             hashCode = hashCode * 59 + DownloadConfig.GetHashCode();
         }
         if (ViewSelector != null)
         {
             hashCode = hashCode * 59 + ViewSelector.GetHashCode();
         }
         if (SendEmail != null)
         {
             hashCode = hashCode * 59 + SendEmail.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 2
0
 public void SetConfig(DownloadConfig config)
 {
     lock (_lockObject)
     {
         _basePath = config.BasePath;
     }
 }
        private void buttonDownload_Click(object sender, EventArgs e)
        {
            var  listDepotIDs = (List <uint>) this.listDepots.Tag;
            uint DepotID      = 0;

            if (this.listDepots.SelectedIndex >= 0)
            {
                DepotID = listDepotIDs[this.listDepots.SelectedIndex];
            }
            var  Keys        = (Dictionary <uint, SteamApps.PICSProductInfoCallback.PICSProductInfo> .KeyCollection) this.appList.Tag;
            uint AppID       = Keys.ElementAt(appList.SelectedIndex);
            var  depotsValue = ContentDownloader.Steam3.AppInfo[Keys.ElementAt(appList.SelectedIndex)].KeyValues["depots"][DepotID.ToString()];

            if (AppID == 0)
            {
                return;
            }
            //Check if there have any same depot are downloading
            //bool bHaveAnySame=false;
            foreach (DownloadRecord ConfigDr in ConfigStore.TheConfig.DownloadRecord)
            {
                if (ConfigDr.AppID == AppID && ConfigDr.DepotID == DepotID && ConfigDr.BranchName == this.comboBranches.Text)
                {
                    MessageBox.Show(Properties.Resources.SameTask);
                    return;
                }
            }
            DownloadConfig Dc = new DownloadConfig();

            Dc.AppID  = AppID;
            Dc.Branch = this.comboBranches.Text;
            Dc.DownloadManifestOnly = this.checkBox2.Checked;
            Dc.FilesToDownload      = AllowFileList;
            Dc.UsingFileList        = this.checkBox1.Checked;
            Dc.InstallDirectory     = InstallDir;
            Dc.ForceDepot           = !this.checkBox3.Checked && this.listDepots.SelectedIndex >= 0;
            Dc.MaxDownloads         = Math.Max(0, ConfigStore.TheConfig.MaxDownload);
            Dc.MaxServers           = Math.Max(0, ConfigStore.TheConfig.MaxServer);
            Dc.DownloadAllPlatforms = this.checkBox4.Checked;
            Dc.ManifestId           = PendingManifestID;
            if (Dc.ForceDepot)
            {
                Dc.DepotID = DepotID;
            }
            else
            {
                Dc.DepotID = ContentDownloader.INVALID_DEPOT_ID;
            }
            string DownloadName;

            if (Dc.ForceDepot)
            {
                DownloadName = depotsValue["name"].AsString();
            }
            else
            {
                DownloadName = ContentDownloader.Steam3.AppInfo[Keys.ElementAt(appList.SelectedIndex)].KeyValues["common"]["name"].AsString();
            }
            CreateDownloadTask(DownloadName, Dc, false, false);
        }
Exemplo n.º 4
0
        private OperationReturn DownloadImage(string file)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string requestPath = Path.Combine(ConstValue.TEMP_DIR_MEDIADATA, file);
                string savePath    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConstValue.TEMP_DIR_MEDIADATA,
                                                  file);
                DownloadConfig config = new DownloadConfig();
                config.Method      = 1;
                config.Host        = "192.168.6.15";
                config.Port        = 8081;
                config.IsAnonymous = true;
                config.RequestPath = requestPath;
                config.SavePath    = savePath;
                config.IsReplace   = true;
                optReturn          = DownloadHelper.DownloadFile(config);
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                optReturn.Data = savePath;
            }
            catch (Exception ex)
            {
                optReturn.Result    = false;
                optReturn.Code      = Defines.RET_FAIL;
                optReturn.Message   = ex.Message;
                optReturn.Exception = ex;
            }
            return(optReturn);
        }
Exemplo n.º 5
0
    public void DownloadAsync()
    {
        DownloadConfig config = new DownloadConfig()
        {
            URL           = Url,
            GUID          = "TestFile",
            CacheFilePath = Application.dataPath + "/TestFile"
        };

        loader = new FileDownLoader(config)
        {
            Async = true
        };
        loader.OnComplete.AddEventListener((l) =>
        {
            Debug.Log("Complete filepath:" + loader.config.CacheFilePath);
        });
        loader.OnError.AddEventListener((l) =>
        {
            Debug.Log(loader.ErrorStr);
        });
        loader.OnCancel.AddEventListener((l) =>
        {
            Debug.Log("OnCancel");
        });
        loader.Execute();
        Debug.Log("Call End");
    }
Exemplo n.º 6
0
        /// <summary>
        /// 下载MediaUtils中的单个文件
        /// </summary>
        /// <param name="dir">存放路径</param>
        /// <param name="fileName">文件名</param>
        /// <param name="session"></param>
        /// <returns></returns>
        private static OperationReturn DownloadMediaUtilFile(string dir, string fileName, SessionInfo session)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                string         strSavePath = Path.Combine(dir, fileName);
                DownloadConfig config      = new DownloadConfig();
                config.Method      = session.AppServerInfo.SupportHttps ? 2 : 1;
                config.Host        = session.AppServerInfo.Address;
                config.Port        = session.AppServerInfo.Port;
                config.IsAnonymous = true;
                config.RequestPath = string.Format("{0}/{1}", ConstValue.TEMP_DIR_MEDIAUTILS, fileName);
                config.SavePath    = strSavePath;
                optReturn          = DownloadHelper.DownloadFile(config);
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
            }
            catch (Exception ex)
            {
                optReturn.Result    = false;
                optReturn.Code      = Defines.RET_FAIL;
                optReturn.Message   = ex.Message;
                optReturn.Exception = ex;
            }
            return(optReturn);
        }
Exemplo n.º 7
0
        public void Test_RustDownloadingWithLogger()
        {
            Directory.SetCurrentDirectory(_directory);
            _config = new DownloadConfig()
            {
                AppID = 258550,
                DownloadAllPlatforms = false,
                InstallDirectory     = ".temp",
                UsingFileList        = true,
                FilesToDownloadRegex = new List <Regex>()
                {
                    _rustFilesRegex
                },
                SavePathProcessor = SavePathProcessor
            };
            _config.OnMessageEvent        += (type, message) => Console.WriteLine($"[{type}] {message}");
            _config.OnReportProgressEvent += (message) => Console.WriteLine($"[Progress] {message}");
            var downloader = new global::DepotDownloader.DepotDownloader(_config);

            downloader.Download(true);

            downloader.ClearCache();
            Assert.IsFalse(Directory.Exists(".temp\\.DepotDownloader"));
            Directory.Delete(".temp", true);
        }
Exemplo n.º 8
0
        private static void Main(string[] args)
        {
            try
            {
                DownloadConfig _config = new DownloadConfig();
                _config.FileNameEncryptorIvHexString = "01 02 03 04 05 06 07 08 09 0a 0a 0c 0d 01 02 08";
                _config.FileNameEncryptorKey         = "DotnetDownloadConfig";
                _config.LimitDownloadSpeedKb         = 100;
                _config.DownLoadMainDirectory        = @"D:\Downloads";

                ConfigContext _configHelper = new ConfigContext();
                _configHelper.Save <DownloadConfig>(_config);

                WebApiOutputCacheConfig _apiOutputCacheConfig = new WebApiOutputCacheConfig();
                _apiOutputCacheConfig.EnableOutputCache = true;
                _configHelper.Save <WebApiOutputCacheConfig>(_apiOutputCacheConfig);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.ReadLine();
            }
        }
Exemplo n.º 9
0
        public bool GetResult(int imimKey, string json, DownloadConfig config, bool status)
        {
            if (!status)
            {
                var e = new SPEH_CLIM_CLM_IMIM_STTS_UPDATE_OCR
                {
                    ConnectionString  = ConnectionStringConfig <SPEH_CLIM_CLM_IMIM_STTS_UPDATE_OCR> .GetConnectionString(config.ConnectionStringDictionary),
                    pIMIM_STTS_UPDATE = new List <IMIM_STTS_UPDATE>
                    {
                        new IMIM_STTS_UPDATE {
                            IMIM_KY = imimKey
                        }
                    }

                    .ToDataTable(),
                    pSTS = ((int)ResultJsonStatus.Failed).ToString()
                };
                _commonBl.Execute(e);
                return(e.ReturnValue == 1);
            }
            var item = json.FromJson <ImageDefineJson>();

            //item.Type = "0M";
            Console.WriteLine(item.Name + "\t\t" + item.Type);

            var list = new List <IMIM_INFO_INSERT> {
                new IMIM_INFO_INSERT(imimKey, item.Type, float.Parse(item.Conf) * (float)100)
            };
            var entity = new SPEH_CLIM_CLM_IMIM_PRE_SECOND_DEFINE_OCR
            {
                ConnectionString  = ConnectionStringConfig <SPEH_CLIM_CLM_IMIM_PRE_SECOND_DEFINE_OCR> .GetConnectionString(config.ConnectionStringDictionary),
                pIMIM_INFO_INSERT = list.ToDataTable()
            };

            try
            {
                _commonBl.Execute(entity);
                return(entity.ReturnValue == 1);
            }
            catch (Exception ex)
            {
                Nlog.Info($"{config.NLogName}.json", $"getresult catch:{ex.Message}");
                var e = new SPEH_CLIM_CLM_IMIM_STTS_UPDATE_OCR
                {
                    ConnectionString  = ConnectionStringConfig <SPEH_CLIM_CLM_IMIM_STTS_UPDATE_OCR> .GetConnectionString(config.ConnectionStringDictionary),
                    pIMIM_STTS_UPDATE = new List <IMIM_STTS_UPDATE>
                    {
                        new IMIM_STTS_UPDATE {
                            IMIM_KY = imimKey
                        }
                    }

                    .ToDataTable(),
                    pSTS = ((int)ResultJsonStatus.Failed).ToString()
                };
                _commonBl.Execute(e);
                return(false);
            }
        }
Exemplo n.º 10
0
 public DownloadCommand(ILogger <DownloadCommand> logger, IFreeAgentClient client, IAuthentication <AccessTokenData> auth, DownloadConfig config)
     : base(logger)
 {
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.client = client ?? throw new ArgumentNullException(nameof(client));
     this.auth   = auth ?? throw new ArgumentNullException(nameof(auth));
     this.config = config ?? throw new ArgumentNullException(nameof(config));
 }
Exemplo n.º 11
0
        public bool SendJson(List <ImageInfo> imageInfoList, DownloadConfig config)
        {
            var batchNo = imageInfoList.Select(x => x.BatchNo).FirstOrDefault();
            var list    = imageInfoList.Cast <ImageInfoByHpList>().ToList();
            var json    = list.Select(x => new { ImKy = $"{config.SourceServerIp}{x.ImimKy}", x.SourceType, coords = x.Coords }).ToJson();

            try { File.WriteAllText($@"{config.TargetServerPath}\{config.SourceServerIp}{batchNo}\{config.SourceServerIp}{batchNo}.json", json, Encoding.Default); return(true); } catch { return(false); }
        }
Exemplo n.º 12
0
 public void SetConfig(DownloadConfig config)
 {
     lock (_lockObject)
     {
         _basePath = config.BasePath;
         _protectCacheInfoManager.ProtectedPercentage = config.ProtectedPercentage;
     }
 }
Exemplo n.º 13
0
        static async Task MainAsync(string[] args)
        {
            if (args.GetUpperBound(0) < 2)
            {
                System.Console.WriteLine("Parametros:");
                for (int i = 0; i <= args.GetUpperBound(0); i++)
                {
                    System.Console.WriteLine($"{i}-{args[i]}");
                }
                System.Console.WriteLine("Parametros Necesarios: Usuario Password ProjectFilter(Separados por @) [Reporte=Metrics|Issues] outFile");
            }
            else
            {
                var reporteAEmitir = (args.GetUpperBound(0) > 2) ? (TipoReporte)Enum.Parse(typeof(TipoReporte), args[3]) : TipoReporte.Metrics;

                var conf = new DownloadConfig
                {
                    Usuario       = args[0],
                    Password      = args[1],
                    SonarBaseUrl  = Properties.Settings.Default.SonarBaseUrl,
                    ProjectsUrl   = Properties.Settings.Default.ProjectsUrl,
                    MetricsUrl    = Properties.Settings.Default.MetricsUrl,
                    IssuesUrl     = Properties.Settings.Default.IssuesUrl,
                    SourcesUrl    = Properties.Settings.Default.SourcesUrl,
                    ProjectFilter = args[2]
                };

                try
                {
                    switch (reporteAEmitir)
                    {
                    case TipoReporte.Issues:
                        var report = new IssuesReport.IssuesReport(conf, args);
                        await report.Download();

                        report.WriteResultHtml();
                        break;

                    default:
                        //var downloadHelper = new DownloadHelper(conf);
                        //await downloadHelper.DownloadProjects();
                        //(new MetricsReport(downloadHelper.Proyectos)).WriteResultHtml();
                        var report2 = new MetricsReport.MetricsReport(conf, args);
                        await report2.Download();

                        report2.WriteResultHtml();
                        break;
                    }
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                    //System.Console.Write(e.StackTrace);
                    System.Console.ReadKey();
                }
                //System.Console.ReadKey();
            }
        }
 public DownloaderService(CacheService cacheService, IOptions <DownloadConfig> config)
 {
     _config       = config.Value;
     _cacheService = cacheService;
     #if DEBUG
     _cpuEncodeProcUsed = Environment.ProcessorCount.ToString();
     #else
     _cpuEncodeProcUsed = Math.Min(1, Environment.ProcessorCount / 2).ToString();
     #endif
 }
Exemplo n.º 15
0
        public List <ImageInfo> FindData(DownloadConfig config)
        {
            var list = _commonBl.QuerySingle <SPEH_CLIM_CLM_IMAGE_FIRST_SEND_LIST_OCR, SPEH_CLIM_CLM_IMAGE_FIRST_SEND_LIST_OCR_RESULT>(new SPEH_CLIM_CLM_IMAGE_FIRST_SEND_LIST_OCR
            {
                ConnectionString = ConnectionStringConfig <SPEH_CLIM_CLM_IMAGE_FIRST_SEND_LIST_OCR> .GetConnectionString(config.ConnectionStringDictionary)
            });
            var guid = Math.Abs(Guid.NewGuid().GetHashCode());

            return(list.Select(x => new ImageInfoByDefine(x.IMIM_KY, $"{x.CLNT_BATCH_ID}_{guid}", x.IMIM_PATH_NAME)).Cast <ImageInfo>().ToList());
        }
        public void CreateDownloadTask(string DownloadName, DownloadConfig Dc, bool AdvancedConfig, bool IsRestore)
        {
            DownloadProgressBar Dpb = new DownloadProgressBar();

            Dc.OnReportProgressEvent   += Dpb.OnDownloadProgress;
            Dc.OnDownloadFinishedEvent += Dpb.OnDownloadFinished;
            Dc.OnStateChangedEvent     += Dpb.OnStateChanged;
            var TargetDownloader = new ContentDownloader();

            Program.DownloaderInstances.Add(TargetDownloader);
            Dpb.RestartDownload          += TargetDownloader.RestartDownload;
            Dpb.StopDownload             += TargetDownloader.StopDownload;
            Dpb.CancelDownload           += this.CancelDownload;
            Dpb.OnDownloadFinishedReport += this.OnDownloadFinished;
            Dpb.InitDownloading(DownloadName, Dc.AppID, Dc.DepotID, Dc.Branch);
            this.panelDownloading.Controls.Add(Dpb);
            RegroupDownloadProgressControl();
            if (!IsRestore)
            {
                DownloadRecord Dr = new DownloadRecord();
                Dr.AppID          = Dc.AppID;
                Dr.DepotID        = Dc.DepotID;
                Dr.BranchName     = Dc.Branch;
                Dr.FileToDownload = AllowFileList;
                Dr.InstallDir     = InstallDir;
                Dr.NoForceDepot   = !Dc.ForceDepot;
                Dr.DownloadName   = DownloadName;
                Dr.MaxDownload    = Dc.MaxDownloads;
                Dr.MaxServer      = Dc.MaxServers;
                Dr.AllPlatforms   = Dc.DownloadAllPlatforms;
                Dr.AdvancedConfig = AdvancedConfig;
                Dr.ManifestID     = Dc.ManifestId;
                if (Dc.FilesToDownloadRegex != null)
                {
                    Dr.FileRegex = new List <string>();
                    foreach (System.Text.RegularExpressions.Regex Fileregex in Dc.FilesToDownloadRegex)
                    {
                        Dr.FileRegex.Add(Fileregex.ToString());
                    }
                }
                ConfigStore.TheConfig.DownloadRecord.Add(Dr);
                ConfigStore.Save();
            }
            TargetDownloader.Config = Dc;
            if (!IsRestore)
            {
                TargetDownloader.RestartDownload();
            }
            else
            {
                Dpb.Downloading = false;
            }
        }
 public SteamDepotDownloaderForm()
 {
     InitializeComponent();
     UbpRDelegate = new UpdateBetaPasswordRecordDelegate(UpdateBetaPasswordRecord);
     //Load Download record.
     foreach (DownloadRecord Dr in ConfigStore.TheConfig.DownloadRecord)
     {
         DownloadConfig Dc = new DownloadConfig();
         Dc.AppID      = Dr.AppID;
         Dc.ForceDepot = !Dr.NoForceDepot;
         if (Dc.ForceDepot)
         {
             Dc.DepotID = Dr.DepotID;
         }
         else
         {
             Dc.DepotID = ContentDownloader.INVALID_DEPOT_ID;
         }
         Dc.Branch = Dr.BranchName;
         Dc.DownloadManifestOnly = false;
         Dc.FilesToDownload      = Dr.FileToDownload;
         Dc.UsingFileList        = Dr.FileToDownload == null?false:true;
         Dc.InstallDirectory     = Dr.InstallDir;
         Dc.FilesToDownloadRegex = new List <System.Text.RegularExpressions.Regex>();
         Dc.DownloadAllPlatforms = Dr.AllPlatforms;
         if (Dr.AdvancedConfig)
         {
             Dc.MaxDownloads = Dr.MaxDownload;
             Dc.MaxServers   = Dr.MaxServer;
             Dc.ManifestId   = Dr.ManifestID;
         }
         else
         {
             Dc.MaxDownloads = ConfigStore.TheConfig.MaxDownload;
             Dc.MaxServers   = ConfigStore.TheConfig.MaxServer;
             Dc.ManifestId   = ContentDownloader.INVALID_MANIFEST_ID;
         }
         if (Dr.FileRegex != null)
         {
             foreach (string regex in Dr.FileRegex)
             {
                 try
                 {
                     Dc.FilesToDownloadRegex.Add(new System.Text.RegularExpressions.Regex(
                                                     regex, System.Text.RegularExpressions.RegexOptions.Compiled | System.Text.RegularExpressions.RegexOptions.IgnoreCase));
                 }
                 catch { };
             }
         }
         CreateDownloadTask(Dr.DownloadName, Dc, Dr.AdvancedConfig, true);
     }
 }
Exemplo n.º 18
0
        public bool SendImage(List <ImageInfo> imageInfoList, DownloadConfig config)
        {
            var batchNo = imageInfoList.Select(x => x.BatchNo).FirstOrDefault();
            var list    = imageInfoList.Cast <ImageInfoByHpList>().ToList();

            var entity = new SPEH_IMDI_IMAGE_DETAIL_INFO_SENT_STS_UPDATE_OCR
            {
                ConnectionString = ConnectionStringConfig <SPEH_IMDI_IMAGE_DETAIL_INFO_SENT_STS_UPDATE_OCR> .GetConnectionString(config.ConnectionStringDictionary),
                pIMIM_KY_LIST    = list.Select(x => new Entites.HpList.TableType.KY_LIST(x.ImimKy)).ToList().ToDataTable(),
                pSTS             = ((int)ResultJsonStatus.Success).ToString()
            };

            _commonBl.Execute(entity);
            return(entity.ReturnValue == 1);
        }
Exemplo n.º 19
0
        public static async Task Download(IEnumerable <DownloadItem> items, DownloadConfig config = null)
        {
            // config ??= new DownloadConfig();
            //
            // var handle = new HttpClientHandler
            // {
            //     AllowAutoRedirect = config.AutoRedirect
            // };
            // var client = new HttpClient(handle);
            // client.DefaultRequestHeaders.UserAgent.Add(config.UserAgent);
            //
            // //Task.Factory.StartNew()
            //

            throw new NotImplementedException("Not now, use another one");
        }
Exemplo n.º 20
0
        public static async Task Download(DownloadItem item, DownloadConfig config = null)
        {
            config ??= new DownloadConfig();

            var handle = new HttpClientHandler
            {
                AllowAutoRedirect = config.AutoRedirect
            };
            var client = new HttpClient(handle);

            client.DefaultRequestHeaders.UserAgent.Add(config.UserAgent);

            var response = await client.GetAsync(item.Url, HttpCompletionOption.ResponseHeadersRead);

            if (config.AutoRedirect)
            {
                if (response.StatusCode == HttpStatusCode.Redirect)
                {
                    response = await client.GetAsync(response.Headers.Location, HttpCompletionOption.ResponseHeadersRead);
                }
            }

            response.EnsureSuccessStatusCode();

            var stream = await response.Content.ReadAsStreamAsync();

            var buffer        = new byte[8192];
            var contentLength = response.Content.Headers.ContentLength;
            var info          = new DownloadInfo {
                TotalBytesToReceive = contentLength
            };

            config.Progress.Report(info);

            var re = new List <byte>();
            int byteReader;

            while ((byteReader = await stream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false)) > 0)
            {
                re.AddRange(buffer.Take(byteReader));

                info.BytesReceived += byteReader;
                config.Progress.Report(info);
            }

            await File.WriteAllBytesAsync(item.File.FullName, re.ToArray());
        }
Exemplo n.º 21
0
        public List <ImageInfo> FindData(DownloadConfig config)
        {
            var list = _commonBl.QuerySingle <SPEH_CLID_CLM_IMAGE_DETAIL_SEND_LIST_OCR, SPEH_CLID_CLM_IMAGE_DETAIL_SEND_LIST_OCR_RESULT>(new SPEH_CLID_CLM_IMAGE_DETAIL_SEND_LIST_OCR
            {
                ConnectionString = ConnectionStringConfig <SPEH_CLID_CLM_IMAGE_DETAIL_SEND_LIST_OCR> .GetConnectionString(config.ConnectionStringDictionary)
            });
            var guid = Math.Abs(Guid.NewGuid().GetHashCode());

            return(list.Select(x => new ImageInfoByHpList(x.IMIM_KY, $"{x.CLNT_BATCH_ID}_{guid}", x.CLIM_NAME_PATH, x.HPHP_ID, x.SYSV_SOURCE_TYPE, x.IMMI_COORDINATE_INFO)).Cast <ImageInfo>().ToList());
            //return new List<ImageInfo>
            //{
            //    new ImageInfoByIvInput(163446466,"AAA","http://pic2prod-10011668.image.myqcloud.com/d1a90e78-bde6-4e28-a2ef-b9a7a24f5bd1","HPID","TYPE"),
            //    new ImageInfoByIvInput(163446467,"AAA","http://pic2prod-10011668.image.myqcloud.com/0678D730-9784-46DE-BD0D-6ACD79B1E679.jpg","HPID","TYPE"),
            //    new ImageInfoByIvInput(163446468,"AAA","http://pic2prod-10011668.image.myqcloud.com/BE4C7FC6-E9F7-4602-99BC-E8F2226EC7C1.jpg","HPID","TYPE"),
            //    new ImageInfoByIvInput(163446469,"AAA","http://pic2prod-10011668.image.myqcloud.com/f538c8c7-266c-43dc-965f-160b3ffa1554","HPID","TYPE"),
            //    new ImageInfoByIvInput(163446470,"AAA","http://pic2prod-10011668.image.myqcloud.com/c45e960f-a370-4e5d-adc0-798215742450","HPID","TYPE"),
            //    new ImageInfoByIvInput(163446471,"AAA","http://pic2prod-10011668.image.myqcloud.com/39817656-1354-494A-9768-4F44791241C8.jpg","HPID","TYPE")
            //};
        }
        /// <summary>
        /// Returns true if ComDayCqDamCoreImplServletResourceCollectionServletProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqDamCoreImplServletResourceCollectionServletProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqDamCoreImplServletResourceCollectionServletProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     SlingServletResourceTypes == other.SlingServletResourceTypes ||
                     SlingServletResourceTypes != null &&
                     SlingServletResourceTypes.Equals(other.SlingServletResourceTypes)
                     ) &&
                 (
                     SlingServletMethods == other.SlingServletMethods ||
                     SlingServletMethods != null &&
                     SlingServletMethods.Equals(other.SlingServletMethods)
                 ) &&
                 (
                     SlingServletSelectors == other.SlingServletSelectors ||
                     SlingServletSelectors != null &&
                     SlingServletSelectors.Equals(other.SlingServletSelectors)
                 ) &&
                 (
                     DownloadConfig == other.DownloadConfig ||
                     DownloadConfig != null &&
                     DownloadConfig.Equals(other.DownloadConfig)
                 ) &&
                 (
                     ViewSelector == other.ViewSelector ||
                     ViewSelector != null &&
                     ViewSelector.Equals(other.ViewSelector)
                 ) &&
                 (
                     SendEmail == other.SendEmail ||
                     SendEmail != null &&
                     SendEmail.Equals(other.SendEmail)
                 ));
        }
Exemplo n.º 23
0
        public bool SendImage(List <ImageInfo> imageInfoList, DownloadConfig config)
        {
            var list = imageInfoList.Cast <ImageInfoByDefine>().Select(x => new IMIM_STTS_UPDATE {
                IMIM_KY = x.ImimKy
            }).ToList();

            if (list.Count == 0)
            {
                return(false);
            }
            var entity = new SPEH_CLIM_CLM_IMIM_STTS_UPDATE_OCR
            {
                ConnectionString  = ConnectionStringConfig <SPEH_CLIM_CLM_IMIM_STTS_UPDATE_OCR> .GetConnectionString(config.ConnectionStringDictionary),
                pIMIM_STTS_UPDATE = list.ToDataTable(),
                pSTS = ((int)ResultJsonStatus.Success).ToString()
            };

            _commonBl.Execute(entity);
            return(entity.ReturnValue == 1);
        }
Exemplo n.º 24
0
    public void Download()
    {
        DownloadConfig config = new DownloadConfig()
        {
            URL           = Url,
            GUID          = "TestFile",
            CacheFilePath = Application.dataPath + "/TestFile"
        };

        downLoader = new FileDownLoader(config);
        downLoader.OnError.AddEventListener((l) =>
        {
            Debug.Log(l.ErrorStr);
        });
        downLoader.OnComplete.AddEventListener((l) =>
        {
            Debug.Log("Complete filepath:" + (l as FileDownLoader).config.CacheFilePath);
        });
        downLoader.Execute();
        Debug.Log("Call End");
    }
Exemplo n.º 25
0
        public Config()
        {
            string downloadConfigPath = Directory.GetCurrentDirectory() + "\\novel_download_config.json";

            if (File.Exists(downloadConfigPath))
            {
                using (var reader = new StreamReader(downloadConfigPath))
                {
                    string txt = reader.ReadToEnd();
                    DLConfig = JsonConvert.DeserializeObject <DownloadConfig>(txt);
                }
            }
            else
            {
                Console.WriteLine(string.Format("{0} not found", downloadConfigPath));
                DLConfig = new DownloadConfig()
                {
                    UrlIndexPath     = string.Empty,
                    DownloadFilePath = string.Empty
                };
            }
        }
Exemplo n.º 26
0
        static async Task MainAsync(string[] args)
        {
            if (args.GetUpperBound(0) < 2)
            {
                System.Console.WriteLine("Parametros:");
                for (int i = 0; i <= args.GetUpperBound(0); i++)
                {
                    System.Console.WriteLine($"{i}-{args[i]}");
                }
                System.Console.WriteLine("Parametros Necesarios: Usuario Password ProjectFilter(Separados por @)");
            }
            else
            {
                var conf = new DownloadConfig
                {
                    Usuario       = args[0],
                    Password      = args[1],
                    SonarBaseUrl  = Properties.Settings.Default.SonarBaseUrl,
                    ProjectsUrl   = Properties.Settings.Default.ProjectsUrl,
                    MetricsUrl    = Properties.Settings.Default.MetricsUrl,
                    ProjectFilter = args[2]
                };
                var Downloadhelper = new DownloadHelper(conf);

                try
                {
                    await Downloadhelper.DownloadProjects();

                    WriteResultHtml(Downloadhelper.Proyectos);
                }
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                    System.Console.Write(e.StackTrace);
                }
                //System.Console.ReadKey();
            }
        }
Exemplo n.º 27
0
        public void Test_RustDownloading()
        {
            Directory.SetCurrentDirectory(_directory);
            _config = new DownloadConfig()
            {
                AppID = 258550,
                DownloadAllPlatforms = false,
                InstallDirectory     = ".temp",
                UsingFileList        = true,
                FilesToDownloadRegex = new List <Regex>()
                {
                    _rustFilesRegex
                },
                SavePathProcessor = SavePathProcessor,
            };
            var downloader = new global::DepotDownloader.DepotDownloader(_config);

            downloader.Download(true);

            downloader.ClearCache();
            Assert.IsFalse(Directory.Exists(".temp\\.DepotDownloader"));
            Directory.Delete(".temp", true);
        }
Exemplo n.º 28
0
        public OperationReturn DownloadFileToLocal(string fileName)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string path = string.Empty;
                optReturn.Data = path;
                if (Session == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = RET_NO_SESSION;
                    optReturn.Message = string.Format("SessionInfo is null");
                    return(optReturn);
                }
                if (string.IsNullOrEmpty(fileName))
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_STRING_EMPTY;
                    optReturn.Message = string.Format("FileName is empty");
                    return(optReturn);
                }
                //录屏文件的播放要借助MediaUtils,如果本地没有,需要从服务器上下载
                optReturn = Utils.DownloadMediaUtils(Session);
                //optReturn = DownloadMediaUtils();
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), ConstValue.TEMP_PATH_MEDIADATA);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                path           = Path.Combine(path, string.Format("{0}_{1}", Session.SessionID, fileName));
                optReturn.Data = path;
                //如果已经存在,无需重复下载
                if (!File.Exists(path))
                {
                    DownloadConfig config = new DownloadConfig();
                    config.Method      = Session.AppServerInfo.SupportHttps ? 2 : 1;
                    config.Host        = Session.AppServerInfo.Address;
                    config.Port        = Session.AppServerInfo.Port;
                    config.IsAnonymous = true;
                    config.RequestPath = string.Format("{0}/{1}", ConstValue.TEMP_DIR_MEDIADATA,
                                                       fileName);
                    config.SavePath = path;
                    optReturn       = DownloadHelper.DownloadFile(config);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    optReturn.Data = path;
                }
                OnDebug("DownloadLocal", string.Format("Download end.\t{0}", path));
            }
            catch (Exception ex)
            {
                optReturn.Result    = false;
                optReturn.Code      = Defines.RET_FAIL;
                optReturn.Message   = ex.Message;
                optReturn.Exception = ex;
            }
            return(optReturn);
        }
 public MetricsReportDownloader(DownloadConfig config)
 {
     Config = config;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Downloads and prepares dataset for reading.
 /// </summary>
 /// <param name="download_dir">
 /// directory where downloaded files are stored.
 /// </param>
 /// <param name="download_config">
 /// further configuration for downloading and preparing dataset.
 /// </param>
 public void download_and_prepare(string download_dir = null, DownloadConfig download_config = null)
 {
 }