예제 #1
0
        public void Execute()
        {
            BaseConstants.SetExportPath(AppDataPath);

            ReDefine();
            for (int i = 0; i < FilmPaths.Count; i++)
            {
                var path                   = FilmPaths[i];
                var isRecongnized          = SamplePaths.Any(x => x.SameText(path));
                var exportAndIncludeSource = i != 0;

                var filmHandler = new FilmInDirHandler(exportAndIncludeSource, isRecongnized);
                filmHandler.RecusiveSearch(path);
                filmHandler.ExportJson();
            }

            var categoryAdaptor = new CatalogAdaptor(AppDataPath);

            var classificationHandler = new ClassifyDistributorHandler();

            classificationHandler.ClassifyAndExportDefines(categoryAdaptor.DistributorCats);

            var currentClassification = BaseConstants.LoadInfo <ClassificationDefine>(BaseConstants.ClassificationDefinePath);
            var phraseHandler         = new PhraseHandler();

            phraseHandler.ClassifyAndExportDefines(categoryAdaptor.FilmInfos, currentClassification);
        }
예제 #2
0
 public Context(BaseDeclares declares, BaseOperations operations, BaseSetters setters, BaseConstants constant)
 {
     Declares   = declares;
     Operations = operations;
     Setters    = setters;
     Constant   = constant;
 }
예제 #3
0
        public FilmInDirHandler(bool exportAndIncludeSource, bool isRecognizedPath)
        {
            ExportAndIncludeSource = exportAndIncludeSource;
            IsRecognizedPath       = isRecognizedPath;

            Extensions = BaseConstants.LoadInfo <Extension>(BaseConstants.ExtensionPath);
            BaseConstants.LoadInfos(BaseConstants.DistributorCatPath, DistributorCats);
        }
예제 #4
0
        public CatalogAdaptor(string path) : base()
        {
            BaseConstants.SetExportPath(path);

            FilmFileHandler           = new JsonListFileHandler <Film>(BaseConstants.FilmPath);
            DistributorCatFileHandler = new JsonListFileHandler <DistributorCat>(BaseConstants.DistributorCatPath);
            EmptyDirFileHandler       = new JsonListFileHandler <string>(BaseConstants.EmptyDirPath);

            ExtensionFileHandler            = new JsonFileHandler <Extension>(BaseConstants.ExtensionPath);
            ClassificationDefineFileHandler = new JsonFileHandler <ClassificationDefine>(BaseConstants.ClassificationDefinePath);
        }
예제 #5
0
        public void Analyze()
        {
            BaseConstants.SetExportPath(@"\\as-204te\Sway\FilmDb");

            var filmCollector = new JsonListFileHandler <Film>(BaseConstants.FilmPath);
            var films         = filmCollector.Items;

            var classDefineCollector = new JsonFileHandler <ClassificationDefine>(BaseConstants.ClassificationDefinePath);
            var classDefines         = classDefineCollector.Item;

            ClassifyFilms(films, classDefines);
        }
        public void ClassifyAndExportDefines(IList <DistributorCat> distributorCats)
        {
            var currentClassification = BaseConstants.LoadInfo <ClassificationDefine>(BaseConstants.ClassificationDefinePath);

            foreach (var item in distributorCats)
            {
                if (!currentClassification.Distributors.Any(x => x.IncludeText(item.Distributor)))
                {
                    currentClassification.Distributors.Add(item.Distributor);
                }
            }

            BusinessFunc.ExportItemToFile(currentClassification, BaseConstants.ClassificationDefinePath);
        }
예제 #7
0
        private void ReDefine()
        {
            var src = new List <DistributorCat>();

            BaseConstants.LoadInfos(BaseConstants.DistributorCatPath, src);

            var dest = new List <DistributorCat>();

            foreach (var item in src)
            {
                if (!dest.Any(x => x.Equals(item)))
                {
                    dest.Add(item);
                }
            }

            if (!src.Any(x => dest.Any(y => x.Equals(y))))
            {
                BusinessFunc.ExportListToFile(dest, BaseConstants.DistributorCatPath, false);
            }
        }
예제 #8
0
 public ClassA(BaseConstants constants)
 {
     Constants = constants;
 }
예제 #9
0
 public JsonListFileHandler(string filePath)
 {
     _FilePath = filePath;
     BaseConstants.LoadInfos(_FilePath, Items);
 }
예제 #10
0
 public JsonFileHandler(string filePath)
 {
     _FilePath = filePath;
     Item      = BaseConstants.LoadInfo <T>(_FilePath);
 }