Ejemplo n.º 1
0
        private ChainFileHandler(IFileHandler[] fileHandlerChain)
        {
            if ((object)fileHandlerChain == null)
                throw new ArgumentNullException("fileHandlerChain");

            this.fileHandlerChain = fileHandlerChain;
        }
 public FileController(IMapHandler newMapHandler, IFileView newFileView, IFileHandler newFileHandler, IValidator newValidator)
 {
     maphandler = newMapHandler;
     fileView = newFileView;
     fileHandler = newFileHandler;
     validator = newValidator;
 }
        public FileProcessor(FileProcessorEndpoint endpoint, IFileHandler handler, IFilePostProcessor postProcessor)
        {
            if (endpoint == null)
            {
                throw new ArgumentException("endpoint");
            }

            if (handler == null)
            {
                throw new ArgumentException("handler");
            }

            if (postProcessor == null)
            {
                throw new ArgumentNullException("postProcessor");
            }

            this.instanceId = Guid.Empty;
            this.Endpoint = endpoint;
            this.Handler = handler;
            this.PostProcessor = postProcessor;

            this.timer = new Timer(this.Endpoint.ScavengeInterval.TotalMilliseconds) { AutoReset = true };
            this.timer.Elapsed += this.TimerElapsed;

            this.pendingFiles = new ConcurrentQueue<string>();
            this.eventHandle = new AutoResetEvent(false);
            this.quitHandle = new ManualResetEvent(false);
            this.quitting = false;

            Logger.DebugFormat("Scavenger interval set at {0:0.0} seconds", endpoint.ScavengeInterval.TotalSeconds);
        }
Ejemplo n.º 4
0
        void Events_GetFilesRequestFinished(IFileHandler sender, Backload.Contracts.Eventing.IGetFilesRequestEventArgs e)
        {
            // Backload component has finished the internal GET handler method. 
            // Results can be found in e.Param.FileStatus or sender.FileStatus

            IFileStatus status = e.Param.FileStatus;
        }
Ejemplo n.º 5
0
 public FolderMonitor CreateFolderMonitor(string path, IFileHandler handler)
 {
     return
         container.Resolve<FolderMonitor>(
             new ParameterOverride("path", path),
             new ParameterOverride("fileHandler", handler));
 }
Ejemplo n.º 6
0
        // Executes GET requsts for all files
        private static ActionResult GetHandler(IFileHandler handler)
        {
            IFileStatus status = new FileStatus();
            using (FilesModel db = new FilesModel())
            {
                foreach (var row in db.Files)
                {
                    string url = handler.Context.Request.Url.OriginalString + "?fileName=" + row.Id.ToString();

                    IFileStatusItem file = new FileStatusItem()
                    {
                        ContentType = row.Type,
                        DeleteType = "DELETE",
                        FileName = row.Name,
                        FileSize = row.Size,
                        OriginalName = row.Original,
                        Progress = "100",
                        Success = true,
                        ThumbnailUrl = row.Preview,

                        // Set an identifier for GET and DELETE requests
                        DeleteUrl = url,
                        FileUrl = url
                    };

                    status.Files.Add(file);
                }
            }

            handler.FileStatus = status;

            // Create client plugin specific result and return an ActionResult
            IBackloadResult result = handler.Services.Core.CreatePluginResult();
            return ResultCreator.Create((IFileStatusResult)result);
        }
Ejemplo n.º 7
0
 public LateWriteFileHandler(IFileHandler fileHandler)
 {
     _fileHandler = fileHandler;
     _actions = new Queue<LateAction>();
     ToRename = new List<RenameAction>();
     ToRetag = new List<RetagAction>();
     _namesList = new List<string>();
     NameCollisions = new List<string>();
 }
        public FileContextMenuExtension()
        {
            _fileHandler = new UploadFileHandler();

             // Load the bitmap for the menu item.
             var bmp = espurl.explorer.Properties.Resources.espurl_ico;
             bmp.MakeTransparent(bmp.GetPixel(0, 0));
             this.menuBmp = bmp.GetHbitmap();
        }
Ejemplo n.º 9
0
        public PlayerJsonService(string storagePath, IFileHandler fileHandler)
        {
            _storagePath = Path.Combine(storagePath, "Players.json"); ;
            _fileHandler = fileHandler;
            // create the storage path if it does not exist
            fileHandler.CreatePathIfNotExist(storagePath);

            RefreshCache ();
        }
        public FileProducerConsumerQueue(int numberOfConsumers, IFileProcessResultHandler processResultHandler, IFileHandler fileProcessor)
            : base(numberOfConsumers)
        {
            if (processResultHandler == null) { throw new ArgumentNullException("processResultHandler"); }
            if (fileProcessor == null) { throw new ArgumentNullException("fileProcessor"); }

            this.processResultHandler = processResultHandler;
            this.fileProcessor = fileProcessor;
        }
Ejemplo n.º 11
0
        public GameJsonService(string storagePath, IFileHandler fileHandler)
        {
            _storagePath = storagePath;
            _fileHandler = fileHandler;

            // create the storage path if it does not exist
            fileHandler.CreatePathIfNotExist(storagePath);

            RefreshCache ();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Mantein the reference to the previous handler so we can add a new one.
 /// </summary>
 /// <param name="handler"></param>
 public void AddHandler(IFileHandler handler)
 {
     if (_firstHandler == null)
        {
        _firstHandler = handler;
        }
        else
        {
        _succesorHandler.NextHandler(handler);
        }
        _succesorHandler = handler;
 }
 public EnvironmentFileHandler(IFileHandler<Model.SPSD> control)
 {
     _control = control;
     if (_self != null)
     {
         throw new ArgumentException("EnvironmentFileHandler is a Singleton and can only instantiated once.");
     }
     _self = this;
     if (_control == null)
     {
         throw new NullReferenceException(
             "A null object was passed to the EnvironmentFileHandler. Valid objects are of type IFileHandler<Model.SPSD>");
     }
 }
Ejemplo n.º 14
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                foreach (ListViewItem item in listView1.Items)
                {
                    item.ForeColor = listView1.ForeColor;
                    item.BackColor = listView1.BackColor;
                }

                listView1.SelectedItems[0].BackColor = SystemColors.Highlight;
                listView1.SelectedItems[0].ForeColor = SystemColors.HighlightText;
                SelectedExtension = listView1.SelectedItems[0].Tag as IFileHandler;
            }
        }
Ejemplo n.º 15
0
        static HandlerList()
        {
            UnknownFileHandler = new UnknownHandler();

            AddFileHandler(new JavaHandler(), new []{ "java", "jav" });

            AddFileHandler(new AssetHandler(AssetHandler.Type.Image), new []{ "jpg", "jpeg", "gif", "png", "bmp", "ico", "icns", "tif", "tiff", "tga", "svg" });
            AddFileHandler(new AssetHandler(AssetHandler.Type.Audio), new []{ "wav", "mp3", "ogg", "flac", "aiff", "wma", "m4a", "aac", "mid", "mod" });
            AddFileHandler(new AssetHandler(AssetHandler.Type.Video), new []{ "mp4", "mkv", "mpg", "mpeg", "avi", "m4v", "mov", "wmv" });
            AddFileHandler(new AssetHandler(AssetHandler.Type.Document), new []{ "txt", "md", "rtf", "pdf", "doc", "docx", "odt" });
            AddFileHandler(new AssetHandler(AssetHandler.Type.Configuration), new []{ "json", "xml", "conf", "cfg", "ini", "yaml" });
            AddFileHandler(new AssetHandler(AssetHandler.Type.Archive), new []{ "zip", "rar", "tar", "gz", "tgz", "cab", "bz2", "bzip", "lz", "lzma", "arc", "pak" });

            AddFolderHandler(new FolderHandler());
        }
Ejemplo n.º 16
0
        public StudentService(IStudentRepository StudentRepository, IFileHandler FileHandler,
            IStudentsParentService StudentsParentService, IStudentsMedicalService StudentsMedicalService,
            IStudentsTransportService StudentsTransportService, IAcademicYearService AcademicYearService,
            IClassService ClassService, ISectionService SectionService, IBatchService BatchService,
            IAreaService AreaService)
        {
            this._StudentRepository = StudentRepository;
            this._iFileHandler = FileHandler;
            this._IStudentsParentService = StudentsParentService;
            this._IStudentsMedicalService = StudentsMedicalService;
            this._IStudentsTransportService = StudentsTransportService;

            this._AcademicYearService = AcademicYearService;
            this._ClassService = ClassService;
            this._SectionService = SectionService;
            this._BatchService = BatchService;
            this._AreaService = AreaService;
        }
Ejemplo n.º 17
0
        protected FileProcessorBase(FileProcessorEndpoint endpoint, IFileHandler handler, IFilePostProcessor postProcessor, IFileFilter additionalFilter)
        {
            if (endpoint == null)
            {
                throw new ArgumentException("endpoint");
            }

            if (handler == null)
            {
                throw new ArgumentException("handler");
            }

            if (postProcessor == null)
            {
                throw new ArgumentNullException("postProcessor");
            }

            if (additionalFilter == null)
            {
                throw new ArgumentNullException("additionalFilter");
            }

            this.instanceId = Guid.Empty;
            this.Endpoint = endpoint;
            this.Handler = handler;
            this.PostProcessor = postProcessor;
            this.AdditionalFilter = additionalFilter;
            this.scavenger = new FileScavenger(endpoint, additionalFilter, this.InstanceId);
            this.scavenger.RestartFileChecking += (o, e) => this.RestartNewFileChecking();


            this.pendingFiles = new ConcurrentQueue<string>();
            this.eventHandle = new AutoResetEvent(false);
            this.quitHandle = new ManualResetEvent(false);
            this.quitting = false;

            Logger.DebugFormat("Scavenger interval set at {0:0.0} seconds", endpoint.ScavengeInterval.TotalSeconds);
        }
Ejemplo n.º 18
0
 public FolderMonitor(string path, IFileHandler fileHandler)
 {
     this.fileHandler = fileHandler;
     this.path = path;
 }
Ejemplo n.º 19
0
 public void FileCopy(IFileHandler sourceFileHandler, string syncSourcePath, string path)
 {
 }
Ejemplo n.º 20
0
 public PostViewModelFilePathResolver(IWebHostEnvironment env, IFileHandler fileHandler)
 {
     _env         = env;
     _fileHandler = fileHandler;
 }
 public TestCodeGenDescriptor(IFileHandler fileHandler, IMessageLogger messageLogger, IPackageInstaller packageInstaller)
     : base(fileHandler, messageLogger, packageInstaller)
 {
     ClientDocUri = "https://odata.org";
 }
 protected virtual BaseCodeGenDescriptor CreateV3CodeGenDescriptor(IFileHandler fileHandler, IMessageLogger logger, IPackageInstaller packageInstaller)
 {
     return(new V3CodeGenDescriptor(fileHandler, logger, packageInstaller));
 }
Ejemplo n.º 23
0
 public ResourceHandler(IFileHandler fileHandler, JsonSerializer serializer)
 {
     _fileHandler = fileHandler;
     _serializer  = serializer;
 }
Ejemplo n.º 24
0
 private static void AddFileHandler(IFileHandler handler, IEnumerable<string> extensions)
 {
     foreach(string ext in extensions)FileHandlers.Add(ext, handler);
 }
Ejemplo n.º 25
0
 public BookRepository(IFileHandler fileHandler)
 {
     this.fileHandler = fileHandler;
     Books            = fileHandler.Load().ToList();
 }
Ejemplo n.º 26
0
 public void SetNext(IFileHandler chain)
 {
     _nextChain = chain;
 }
Ejemplo n.º 27
0
 public void RegisterFileHandler(IFileHandler fileHandler, bool canRead, bool canWrite, params string[] fileExtensions)
 {
     _fileHandlers.Add(new FileHandlerData(fileHandler, canRead, canWrite, fileExtensions));
 }
Ejemplo n.º 28
0
 public ConsoleApplication(IDictionaryService dictionaryService, IFileHandler fileHandler)
 {
     _dictionaryService = dictionaryService;
     _fileHandler       = fileHandler;
 }
Ejemplo n.º 29
0
 public ContactRepository(IFileHandler fileHandler)
 {
     _fileHandler = fileHandler;
 }
Ejemplo n.º 30
0
 public bool IsValid(IFileHandler fileHandler)
 {
     errorMessage = originalErrorMessage;
     errorMessage = string.Format(errorMessage, fileHandler.FileName);
     return(Directory.Exists(fileHandler.OutputDirectory));
 }
Ejemplo n.º 31
0
 public ScannerController(IFileHandler fileHandler, ILogger <ScannerController> logger)
 {
     _fileHandler = fileHandler;
     _logger      = logger;
 }
Ejemplo n.º 32
0
 public void MapStoreOnto(IFileHandler filehandler)
 {
     // The mapping used here is created from AddMappings() in the FileHandlerFactory
     if (filehandler.GetType() == typeof(XMLFileHandler))
         Mapper.Map(Store, ((XMLFileHandler)filehandler).Store);
 }
Ejemplo n.º 33
0
 public SourceFileTemplate(string name, Bitmap icon, IFileHandler extensionToUse, string baseSource, Action<OpenedFile> action)
     : base(name, icon, extensionToUse)
 {
     BaseSource = baseSource;
     Action = action;
 }
Ejemplo n.º 34
0
        InkParser(string str, string inkFilename = null, InkParser rootParser = null, IFileHandler fileHandler = null) : base(str)
        {
            _filename = inkFilename;
            RegisterExpressionOperators();
            GenerateStatementLevelRules();

            // Built in handler for all standard parse errors and warnings
            this.errorHandler = OnStringParserError;

            // The above parse errors are then formatted as strings and passed
            // to the Ink.ErrorHandler, or it throws an exception

            _fileHandler = fileHandler ?? new CurrentDirectoryFileHandler();

            if (rootParser == null)
            {
                _rootParser = this;

                _openFilenames = new HashSet <string> ();

                if (inkFilename != null)
                {
                    var fullRootInkPath = _fileHandler.ResolveInkFilename(inkFilename);
                    _openFilenames.Add(fullRootInkPath);
                }
            }
            else
            {
                _rootParser = rootParser;
            }
        }
Ejemplo n.º 35
0
 public XmlDataService(IFileHandler fileHandler, IDefaultService defaultService)
 {
     FileHandler    = fileHandler;
     DefaultService = defaultService;
 }
Ejemplo n.º 36
0
 public IconRepository(IIconDownloader iconDownloader, IFileHandler fileHandler, IGravatarUrlBuilder gravatarUrlBuilder)
 {
     this.iconDownloader     = iconDownloader;
     this.fileHandler        = fileHandler;
     this.gravatarUrlBuilder = gravatarUrlBuilder;
 }
Ejemplo n.º 37
0
        /// <summary>
        /// 导出CSV文件
        /// </summary>
        /// <param name="fileHanlder">文件信息</param>
        /// <param name="fileName">文件信息</param>
        /// <param name="columns">列头</param>
        /// <param name="sql">查询语句</param>
        /// <param name="namedParameters">参数</param>
        protected void ExportCSV(IFileHandler fileHanlder, string fileName, Dictionary <string, string> columns, string sql, dynamic namedParameters = null)
        {
            List <string> csvRows = new List <string>();
            StringBuilder sb      = new StringBuilder();
            var           length  = 0;

            foreach (var item in columns)
            {
                sb.AppendFormat("\"{0}\"", item.Value.Replace("\n", ""));
                if (length < columns.Count - 1)
                {
                    sb.Append(",");
                }

                length++;
            }
            sb.AppendLine();
            using (var fs = fileHanlder.OpenFile(fileName, FileMode.OpenOrCreate))
            {
                fileHanlder.Append(fs, Encoding.Default.GetBytes(sb.ToString()));
                length = 0;
                sb.Clear();
                using (DbDataReader reader = dbContext.DbHelper.ExecuteReader(sql, namedParameters, false))
                {
                    var count = 0;
                    while (reader.Read())
                    {
                        foreach (var item in columns)
                        {
                            var index = reader.GetOrdinal(item.Key);
                            if (!reader.IsDBNull(index))
                            {
                                string value = reader.GetValue(index).ToString();
                                if (reader.GetFieldType(index) == typeof(String))
                                {
                                    //If double quotes are used in value, ensure each are replaced but 2.
                                    if (value.IndexOf("\"") >= 0)
                                    {
                                        value = value.Replace("\"", "\"\"");
                                    }

                                    //If separtor are is in value, ensure it is put in double quotes.
                                    if (value.IndexOf(",") >= 0)
                                    {
                                        value = "\"" + value + "\"";
                                    }
                                }
                                sb.Append(value);
                            }
                            if (length < columns.Count - 1)
                            {
                                sb.Append(",");
                            }

                            length++;
                        }

                        if (count > 60000)
                        {
                            sb.AppendLine();
                            fileHanlder.Append(fs, Encoding.Default.GetBytes(sb.ToString()));
                            count = 0;
                            sb.Clear();
                        }
                        else
                        {
                            sb.AppendLine();
                            count++;
                        }

                        length = 0;
                    }

                    reader.Close();
                }
                if (sb.Length > 0)
                {
                    fileHanlder.Append(fs, Encoding.Default.GetBytes(sb.ToString()));
                }
            }
        }
 public FileProcessorHelper(FileProcessorEndpoint endpoint, IFileHandler handler, IFilePostProcessor postProcessor)
     : base(endpoint, handler, postProcessor)
 {
 }
 protected virtual BaseCodeGenDescriptor CreateV4CodeGenDescriptor(IFileHandler fileHandler, IMessageLogger logger, IPackageInstaller packageInstaller)
 {
     return(new V4CodeGenDescriptor(fileHandler, logger, packageInstaller, new ODataT4CodeGeneratorFactory()));
 }
Ejemplo n.º 40
0
 public FileDataSource(IFilePathProvider filePathProvider, IFileHandler fileHandler)
 {
     FilePathProvider = filePathProvider;
     FileHandler      = fileHandler;
 }
 public CustomFileProcessor(FileProcessorEndpoint endpoint, IFileHandler handler, IFilePostProcessor postProcessor)
     : base(endpoint, handler, postProcessor)
 {
 }
Ejemplo n.º 42
0
 public void SetNext(IFileHandler chain)
 {
     _nextChain = chain;
 }
Ejemplo n.º 43
0
 public SourceFileTemplate(string name, Bitmap icon, IFileHandler extensionToUse, string baseSource)
     : this(name, icon, extensionToUse, baseSource, (f) => { })
 {
 }
Ejemplo n.º 44
0
 public InkParser(string str, string filenameForMetadata = null, IFileHandler fileHandler = null)
     : this(str, filenameForMetadata, null, fileHandler)
 {
 }
Ejemplo n.º 45
0
 void Events_GetFilesRequestStarted(IFileHandler sender, Backload.Contracts.Eventing.IGetFilesRequestEventArgs e)
 {
     // Backload component has started the internal GET handler method. 
     string searchPath = e.Param.SearchPath;
 }
Ejemplo n.º 46
0
 public SourceFileTemplate(string name, Bitmap icon, IFileHandler extensionToUse, string baseSource, Action <OpenedFile> action)
     : base(name, icon, extensionToUse)
 {
     BaseSource = baseSource;
     Action     = action;
 }
Ejemplo n.º 47
0
 public NetAstFileTemplate(string name, string objectName, Bitmap icon, IFileHandler extensionToUse, CodeCompileUnit compileUnit)
     : base(name, icon, extensionToUse)
 {
     ObjectName = objectName;
     CompileUnit = compileUnit;
 }
 /// <summary>
 /// instantaites and object of XmlidxindexSpecification
 /// </summary>
 /// <param name="xmlFile">XmlFile-Path</param>
 /// <param name="fileHandler">object for FileSystem operations</param>
 public XmlIdxIndexSpecification(string xmlFile, IFileHandler fileHandler) : base(xmlFile, fileHandler)
 {
 }
Ejemplo n.º 49
0
 public SourceFileTemplate(string name, Bitmap icon, IFileHandler extensionToUse, string baseSource)
     : this(name, icon, extensionToUse, baseSource, (f) => { })
 {
 }
Ejemplo n.º 50
0
 public VdbDbDefTreeNode(ITreeNode parent, IFileHandler fhandler)
     : base(parent, fhandler)
 {
 }
Ejemplo n.º 51
0
 public void NextHandler(IFileHandler handler)
 {
     _nextHandler = handler;
 }
Ejemplo n.º 52
0
 public JobTreeNode(ITreeNode parent, IFileHandler fhandler)
     : base(parent, fhandler)
 {
     m_jobconn = new JobConnection(fhandler.FileObject.DataDiskPath);
 }
Ejemplo n.º 53
0
 void Events_IncomingRequestStarted(IFileHandler sender, Backload.Contracts.Eventing.IIncomingRequestEventArgs e)
 {
     // Backload environment is ready
 }
Ejemplo n.º 54
0
 public OrionReader(string filepath, IFileHandler fileHandler)
 {
     m_filepath    = filepath;
     m_fileHandler = fileHandler;
 }
Ejemplo n.º 55
0
 public V3CodeGenDescriptor(IFileHandler fileHandler, IMessageLogger logger, IPackageInstaller packageInstaller)
     : base(fileHandler, logger, packageInstaller)
 {
     this.ClientNuGetPackageName = Common.Constants.V3ClientNuGetPackage;
     this.ClientDocUri           = Common.Constants.V3DocUri;
 }
Ejemplo n.º 56
0
 public InvoiceStore(IAppConfiguration config, IFileHandler handler)
 {
     this.config      = config;
     this.fileHandler = handler;
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Contructor
 /// </summary>
 public FileHandlerController()
 {
     // Create and initialize the handler
     _handler = Backload.FileHandler.Create();
     _handler.Init(new HttpRequestWrapper(HttpContext.Current.Request));
 }
Ejemplo n.º 58
0
 public void FileCopyBack(string path, IFileHandler contentFileHandler, string contentPath)
 {
 }
 public void AddFileHandler(IFileHandler handler)
 {
     _fileHandlers.Add(handler);
 }
Ejemplo n.º 60
0
 public StepFileGenerator(IFileHandler handler)
 {
     _handler = handler;
 }