コード例 #1
0
ファイル: Manager.cs プロジェクト: 7BF794B0/JsonDownloader
        public Manager(string PATH)
        {
            EndPointFactory   factory1         = EndPointFactory.GetInstance();
            IEndPoint         endPoint         = factory1.CreateEndPoint();
            IUrl              url              = endPoint.GetUrl(PATH);
            IDownloadStrategy downloadStrategy = endPoint.GetDownloadStrategy();

            (IStatusCode, string)result = endPoint.Download(downloadStrategy, url);

            if (result.Item1.GetStatusCode() != 0)
            {
                throw new RuntimeException("Failed to download: " + result.Item1.GetStatusCode());
            }
            else
            {
                ClassCreatorFactory factory2     = ClassCreatorFactory.GetInstance();
                IClassCreator       classCreator = factory2.CreateClassCreator();
                url.SetBody(result.Item2);
                IClassCreatorStrategy creatorStrategy = classCreator.GetClassCreatorStrategy();
                var res = classCreator.CreateClass(creatorStrategy, url);
            }
        }