Esempio n. 1
0
        public void CheckExtension()
        {
            if (!File.Exists(OriginalFilename))
            {
                Extension = null;
                return;
            }

            try
            {
                using Stream stream = new FileStream(OriginalFilename, FileMode.Open, FileAccess.Read, FileShare.Read);

                if (stream.Length == 0)
                {
                    Extension = null;
                    return;
                }

                var detector = DetectorService.DetectDetector(stream);
                if (detector == null || !(ProcessingFormat.IsSupportContainerFormat(detector.Extension) ||
                                          ProcessingFormat.IsSupportImageFormat(detector.Extension)))
                {
                    Extension = null;
                }
                else
                {
                    Extension = detector.Extension;
                }
            }
            catch
            {
                Extension = null;
            }
        }
Esempio n. 2
0
        public App()
        {
            DetectorService.AddDetectors(Assembly.GetEntryAssembly(), FormatCategories.Archive);
            DetectorService.AddDetectors(Assembly.GetEntryAssembly(), FormatCategories.Image);
            NativeBridge.Degra_Initialize();

            RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
        }
		public bool DoCommand(FileInfo file)
		{
			if (!File.Exists(file.OriginalFullPath))
				return false;

			using Stream stream = File.OpenRead(file.OriginalFullPath);
			var detector = DetectorService.DetectDetector(stream);

			if (detector == null)
				return false;

			file.ChangedFilename = $"{file.ChangedFilename}.{detector.Extension}";

			return true;
		}
Esempio n. 4
0
        public bool Process(FileInfo file)
        {
            if (!File.Exists(file.OriginalFullPath))
            {
                return(false);
            }

            using (Stream stream = File.OpenRead(file.OriginalFullPath))
            {
                var detector = DetectorService.DetectDetector(stream);
                if (detector == null)
                {
                    return(false);
                }
                file.ChangedFilename = $"{file.ChangedFilename}.{detector.Extension}";
            }

            return(true);
        }
Esempio n. 5
0
        public bool startService()
        {
            if (this.StartedService)
            {
                return(false);
            }

            mConn  = new UDPConnector();
            mCodec = new KLVCodec();
            mConn.Configure(mSendPort, mSendIP, mReceivePort, mReceiveIP);
            mDetectorService = new DetectorService(mConn, mCodec);

            mDetectorService.passingMessageEvent += new PassingMessageHandler(handleResponseMessage);
            if (!mDetectorService.startService())
            {
                this.StartedService = false;
                return(false);
            }

            this.StartedService = true;
            return(true);
        }
		public AddExtensionAutoCommand()
		{
			DetectorService.AddDetectors(Assembly.Load(new AssemblyName("DaramRenamer.Commands")));
		}
Esempio n. 7
0
 static AddExtensionAutomatedProcessor()
 {
     DetectorService.AddDetectors(Assembly.GetAssembly(typeof(Daramkun.DaramRenamer.IProcessor)));
 }
Esempio n. 8
0
 public WebsiteController(ILogger <WebsiteController> logger, Manager manager, IHostedServiceAccessor <DetectorService> accessor)
 {
     _logger  = logger;
     _manager = manager;
     _service = accessor.Service ?? throw new ArgumentNullException(nameof(accessor));
 }
 static AddExtensionAutomatedProcessor()
 {
     DetectorService.AddDetectors();
 }