public override void DownloadUpdate(IFileLoader fileLoader)
        {
            byte[] buffer = new byte[0xffff];
            long currentPosition = UpdateSetup.Position;

            UpdateSetup.Seek(0, SeekOrigin.Begin);

            long allBytes = 0;
            while (allBytes < UpdateSetup.Length)
            {
                int readBytes = UpdateSetup.Read(buffer, 0, 0xffff);
                if (readBytes == 0)
                    break;

                lock (fileLoader)
                {
                    fileLoader.SendBytes(buffer);
                    fileLoader.Percent = (100d * allBytes / UpdateSetup.Length);
                }

                allBytes += readBytes;
            }

            UpdateSetup.Position = currentPosition;

            if (allBytes < UpdateSetup.Length)
                throw new IOException("Error while copy UpdateSetup: Cannot copy all bytes from source!");
        }
 /// <summary>
 /// Registers a file loader with the selector
 /// </summary>
 /// <param name="fileLoader"></param>
 public void Register(IFileLoader fileLoader)
 {
     if (fileLoader != null)
     {
         _fileLoaders.Add(fileLoader);
     }
 }
Example #3
0
 public void AddSqlLoader(IFileLoader sqlLoader)
 {
     if (this.GetSqlLoader(sqlLoader.GetName()) != null)
     {
         throw new DuplicateNameException("Sql Loader is already exists.");
     }
     this.SqlLoader.Add(sqlLoader);
 }
        public void AddFileLoader(IFileLoader fileLoader)
        {
            if (fileLoader == null)
            {
                throw new ArgumentNullException();
            }

            this.fileLoaders.Add(fileLoader);
        }
		/// <summary>
		/// Creates a new WixDialogDesignerLoader that will load the specified
		/// dialog id from the Wix xml.
		/// </summary>
		public WixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator = null, IFileLoader fileLoader = null)
		{
			if (designer == null) {
				throw new ArgumentNullException("designer");
			}
			
			this.designer = designer;
			this.generator = generator ?? new WixDialogDesignerGenerator(designer);
			this.fileLoader = fileLoader ?? new DefaultFileLoader();
		}
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Host"/> class.
        /// </summary>
        /// <param name="transformer">The transformer.</param>
        /// <param name="pathResolver">The path resolver.</param>
        /// <param name="fileLoader">The file loader.</param>
        internal Host(ITextTransformer transformer, IPathResolver pathResolver, IFileLoader fileLoader)
        {
            if (transformer == null) throw new ArgumentNullException("transformer");
            if (pathResolver == null) throw new ArgumentNullException("pathResolver");
            if (fileLoader == null) throw new ArgumentNullException("fileLoader");

            _transformer = transformer;
            _pathResolver = pathResolver;
            _fileLoader = fileLoader;
        }
Example #7
0
		/// <summary>
		/// Creates a new instance of the WixDocument class but overrides the 
		/// default file loading functionality of the WixDocument. 
		/// </summary>
		public WixDocument(WixProject project, IFileLoader fileLoader)
		{
			this.project = project;
			this.fileLoader = fileLoader;
			
			if (fileLoader == null) {
				throw new ArgumentNullException("fileLoader");
			}
			
			namespaceManager = new WixNamespaceManager(NameTable);			
		}
        public JsonRuleContainer(JsonSerializer serializer, string fileLocation, IFileLoader fileLoader)
        {
            var content = fileLoader.ReadAsString(fileLocation);
            
            var result = JsonConvert.DeserializeObject<JObject>(content);

            var descriptionRules = result["PointRules"]["DescriptionRules"].Select(t => t.ToObject<DescriptionRule>(serializer)).ToList();

            PointRules = new List<PointRule>(descriptionRules);

            SeriesRules = new List<SeriesRule>();
        }
		/// <summary>
		/// Creates a new WixDialogDesignerLoader that will load the specified
		/// dialog id from the Wix xml.
		/// </summary>
		public WixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator, IFileLoader fileLoader)
		{
			this.designer = designer;
			this.generator = generator;
			this.fileLoader = fileLoader;
			
			if (designer == null) {
				throw new ArgumentException("Cannot be null.", "designer");
			}
			if (generator == null) {
				throw new ArgumentException("Cannot be null.", "generator");
			}
		}
	void Start () {
		loader = GameSettingsComponent.loader;
		quick_import.options.Clear();
		
		//Automatically set the dropdown to the default file if one is present.
		default_option.CombineLatest(
			quick_import_options.ObserveCountChanged(),
			(index, count)=>{
				return Math.Min(index,count);
			}
		).Subscribe(value=>{
			quick_import.value = value;
			if (value < quick_import_options.Count)
				quick_import_options[value].rx_display_text.Subscribe(text=>{
					if (quick_import != null && quick_import.value == value)
						quick_import.captionText.text = text;
				});
		});
		
		//Keep the box synced with the loader when possible.
		loader_sub = loader.rx_filename.Subscribe((file)=>{
			foreach (QuickImportOption opt in quick_import_options){
				if (quick_import != null && opt.option_name == file){
					quick_import.captionText.text = opt.rx_display_text.Value;
				}
			}
		});
		
		select_sub = quick_import
		.SelectFromCollection(quick_import_options, (opt, index)=>{
			if (default_option.Value == 0 
				&& string.Equals(opt.option_name, "default", StringComparison.CurrentCultureIgnoreCase)){
				//If this option calls itself "default," set our default index to it.
				default_option.Value = index;
			}
			return opt.dropdown_option;
		}).Subscribe(option=>{
			data_component.current_rules = loader.load(option.option_name);
		});
		
		quick_import_options.SetRange(loader.available_files().Select(name=>new QuickImportOption(name)));
	}
Example #11
0
 public Parser()
 {
     _fileLoader = new FileLoader();
     _parsingService = new ParsingService();
 }
 public XmlProfileRetriever(IFileLoader fileLoader)
 {
     _fileLoader = fileLoader;
 }
Example #13
0
 public Tager(IFileLoader fileLoader)
 {
     _fileLoader = fileLoader;
     _currentFile = null;
 }
Example #14
0
 public ProductRepository2()
 {
     loader = new FileLoader();
 }
Example #15
0
 public abstract void DownloadUpdate(IFileLoader fileLoader);
Example #16
0
 internal FileParser(IFileLoader loader, Dictionary<FileType, IParsingService> services = null)
 {
     _fileLoader = loader;
     _services = services ?? GetDefaultServices();
 }
Example #17
0
 public static void RegisterLoader(IFileLoader loader)
 {
     _Loaders.Add(loader);
 }
Example #18
0
 public ProductRepository(IFileLoader loader, IProductMapper mapper)
 {
     this.loader = loader;
     this.mapper = mapper;
 }
Example #19
0
 public ProductRepository3()
 {
     loader = new FileLoader();
     mapper = new ProductsMapper();
 }
Example #20
0
 public TokenFilter(IEnumerable<Token> tokens, CompilerDefines compilerDefines,
     IFileLoader fileLoader)
 {
     _tokens = tokens;
     _compilerDefines = compilerDefines.Clone();
     _fileLoader = fileLoader;
     _directiveTypes =
         new Dictionary<string, DirectiveType>(StringComparer.InvariantCultureIgnoreCase);
     // Conditional-compilation directives
     _directiveTypes["IF"] = DirectiveType.If;
     _directiveTypes["IFDEF"] = DirectiveType.If;
     _directiveTypes["IFNDEF"] = DirectiveType.If;
     _directiveTypes["IFOPT"] = DirectiveType.If;
     _directiveTypes["IFNOPT"] = DirectiveType.If;
     _directiveTypes["ELSE"] = DirectiveType.Else;
     _directiveTypes["ELSEIF"] = DirectiveType.ElseIf;
     _directiveTypes["ENDIF"] = DirectiveType.EndIf;
     _directiveTypes["IFEND"] = DirectiveType.EndIf;
     // Delphi compiler directives
     _directiveTypes["ALIGN"] = DirectiveType.Ignored;
     _directiveTypes["APPTYPE"] = DirectiveType.Ignored;
     _directiveTypes["ASSERTIONS"] = DirectiveType.Ignored;
     _directiveTypes["AUTOBOX"] = DirectiveType.Ignored;
     _directiveTypes["BOOLEVAL"] = DirectiveType.Ignored;
     _directiveTypes["DEBUGINFO"] = DirectiveType.Ignored;
     _directiveTypes["DEFINE"] = DirectiveType.Define;
     _directiveTypes["DEFINITIONINFO"] = DirectiveType.Ignored;
     _directiveTypes["DENYPACKAGEUNIT"] = DirectiveType.Ignored;
     _directiveTypes["DESCRIPTION"] = DirectiveType.Ignored;
     _directiveTypes["DESIGNONLY"] = DirectiveType.Ignored;
     _directiveTypes["ENDREGION"] = DirectiveType.Ignored;
     _directiveTypes["EXTENDEDSYNTAX"] = DirectiveType.Ignored;
     _directiveTypes["EXTENSION"] = DirectiveType.Ignored;
     _directiveTypes["FINITEFLOAT"] = DirectiveType.Ignored;
     _directiveTypes["HINTS"] = DirectiveType.Ignored;
     _directiveTypes["I"] = DirectiveType.PossibleInclude;
     _directiveTypes["IMAGEBASE"] = DirectiveType.Ignored;
     _directiveTypes["IMPLICITBUILD"] = DirectiveType.Ignored;
     _directiveTypes["IMPORTEDDATA"] = DirectiveType.Ignored;
     _directiveTypes["INCLUDE"] = DirectiveType.Include;
     _directiveTypes["INLINE"] = DirectiveType.Ignored; // undocumented
     _directiveTypes["IOCHECKS"] = DirectiveType.Ignored;
     _directiveTypes["LIBPREFIX"] = DirectiveType.Ignored;
     _directiveTypes["LIBSUFFIX"] = DirectiveType.Ignored;
     _directiveTypes["LIBVERSION"] = DirectiveType.Ignored;
     _directiveTypes["LINK"] = DirectiveType.Ignored;
     _directiveTypes["LOCALSYMBOLS"] = DirectiveType.Ignored;
     _directiveTypes["LONGSTRINGS"] = DirectiveType.Ignored;
     _directiveTypes["MAXSTACKSIZE"] = DirectiveType.Ignored;
     _directiveTypes["MESSAGE"] = DirectiveType.Ignored;
     _directiveTypes["METHODINFO"] = DirectiveType.Ignored;
     _directiveTypes["MINENUMSIZE"] = DirectiveType.Ignored;
     _directiveTypes["MINSTACKSIZE"] = DirectiveType.Ignored;
     _directiveTypes["OBJEXPORTALL"] = DirectiveType.Ignored;
     _directiveTypes["OPENSTRINGS"] = DirectiveType.Ignored;
     _directiveTypes["OPTIMIZATION"] = DirectiveType.Ignored;
     _directiveTypes["OVERFLOWCHECKS"] = DirectiveType.Ignored;
     _directiveTypes["RANGECHECKS"] = DirectiveType.Ignored;
     _directiveTypes["REALCOMPATIBILITY"] = DirectiveType.Ignored;
     _directiveTypes["REFERENCEINFO"] = DirectiveType.Ignored;
     _directiveTypes["REGION"] = DirectiveType.Ignored;
     _directiveTypes["RESOURCE"] = DirectiveType.Ignored;
     _directiveTypes["RESOURCERESERVE"] = DirectiveType.Ignored;
     _directiveTypes["RUNONLY"] = DirectiveType.Ignored;
     _directiveTypes["SAFEDIVIDE"] = DirectiveType.Ignored;
     _directiveTypes["SETPEFLAGS"] = DirectiveType.Ignored;
     _directiveTypes["SOPREFIX"] = DirectiveType.Ignored; // undocumented
     _directiveTypes["SOSUFFIX"] = DirectiveType.Ignored; // undocumented
     _directiveTypes["SOVERSION"] = DirectiveType.Ignored; // undocumented
     _directiveTypes["STACKCHECKS"] = DirectiveType.Ignored; // undocumented
     _directiveTypes["STACKFRAMES"] = DirectiveType.Ignored;
     _directiveTypes["TYPEDADDRESS"] = DirectiveType.Ignored;
     _directiveTypes["TYPEINFO"] = DirectiveType.Ignored;
     _directiveTypes["UNDEF"] = DirectiveType.Undefine;
     _directiveTypes["UNSAFECODE"] = DirectiveType.Ignored;
     _directiveTypes["VARPROPSETTER"] = DirectiveType.Ignored; // undocumented
     _directiveTypes["VARSTRINGCHECKS"] = DirectiveType.Ignored;
     _directiveTypes["WARN"] = DirectiveType.Ignored;
     _directiveTypes["WARNINGS"] = DirectiveType.Ignored;
     _directiveTypes["WEAKPACKAGEUNIT"] = DirectiveType.Ignored;
     _directiveTypes["WRITEABLECONST"] = DirectiveType.Ignored;
     // Directives for generation of C++Builder .hpp files
     _directiveTypes["EXTERNALSYM"] = DirectiveType.Ignored;
     _directiveTypes["HPPEMIT"] = DirectiveType.Ignored;
     _directiveTypes["NODEFINE"] = DirectiveType.Ignored;
     _directiveTypes["NOINCLUDE"] = DirectiveType.Ignored;
 }
Example #21
0
 public ModelLoader(IFileLoader fileLoader, ILogger logger)
 {
     _fileLoader = fileLoader;
     _logger = logger;
 }
Example #22
0
 internal Parser(IFileLoader fileLoader, IParsingService parsingService)
 {
     _fileLoader = fileLoader;
     _parsingService = parsingService;
 }