示例#1
0
        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);
            }
        }
示例#2
0
        public object CreateClass(IClassCreatorStrategy strategy, IUrl url)
        {
            object result = strategy.CreateClass(url);

            return(result);
        }