public FileRecordDB(IFileIO io, IGuidSource guids, ITimeStampSource timeStamps, string root) { IO = io; Guids = guids; TimeStamps = timeStamps; Root = root; }
private static void SetMinFileIO(string dir) { string dataDir = ".\\" + dir + "\\"; _fileIO = new MinTestFileIO(dataDir); FileIOFactory.SetFileIO(_fileIO); }
//int _minFilter; //int _magFilter; public AndroidTexture(AndroidGLGame glGame, string fileName) { this._glGraphics = glGame.GLGraphics; this._fileIO = glGame.FileIO; this._fileName = fileName; Load(); }
public Rectangle(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { _fileWriter = new FileIO(); Stroke = Color.Black; Points = new List <Point>(); Lines = new List <Line>(); var point1 = new Point(x1, y1); var point2 = new Point(x2, y2); var point3 = new Point(x3, y3); var point4 = new Point(x4, y4); Points.Add(point1); Points.Add(point2); Points.Add(point3); Points.Add(point4); Lines.Add(new Line(point1, point2)); Lines.Add(new Line(point2, point3)); Lines.Add(new Line(point3, point4)); Lines.Add(new Line(point4, point1)); Height = new Line(point1, point2).ComputeLength(); Width = new Line(point1, point4).ComputeLength(); ComputeCenter(); Validator.ValidateRectangle(Points, $"Attempted to create an invalid shape {GetType()}"); }
/// <inheritdoc /> public Rectangle(Point point, Size size) { _fileWriter = new FileIO(); Stroke = Color.Black; Points = new List <Point>(); Lines = new List <Line>(); var point1 = point; var point2 = new Point(point.X + size.Width, point.Y); var point3 = new Point(point.X + size.Width, point.Y + size.Height); var point4 = new Point(point.X, point.Y + size.Height); Points.Add(point1); Points.Add(point2); Points.Add(point3); Points.Add(point4); Lines.Add(new Line(point1, point2)); Lines.Add(new Line(point2, point3)); Lines.Add(new Line(point3, point4)); Lines.Add(new Line(point4, point1)); Height = new Line(point1, point2).ComputeLength(); Width = new Line(point1, point4).ComputeLength(); ComputeCenter(); Validator.ValidateRectangle(Points, $"Attempted to create an invalid shape {GetType()}"); }
/// <summary> /// Sorts the integers found in an input file and writes the sorted integers to an output file /// </summary> /// <param name="options">The command line options</param> private static List <string> SortIntegers(CommandLineOptions options) { IFileIO fileIO = serviceProvider.GetService <IFileIO>(); IIntegerFileInfoCollector integerFileInfoCollector = serviceProvider.GetService <IIntegerFileInfoCollector>(); //Find the output directory where the output file will be written string outputDirectory = fileIO.GetDirectoryFromFilePath(options.OutputFilePath); //Indicate to the user that we are retrieving information regarding the input file. This can take a long //time for very large files. DisplayInputFileInfoInProgress(); //Collect information on the input file IntegerFileInfo inputFileInfo = integerFileInfoCollector.GetIntegerFileInfo(options.InputFile, (int)options.ChunkSize); //Store the intermediate files so that they can be deleted later on List <string> intermediateFilePaths = new List <string>(); List <string> chunkFiles = CreateChunkFiles(options, inputFileInfo, outputDirectory); //Translate the file names to file paths var chunkFilePaths = chunkFiles.Select(file => Path.Combine(outputDirectory, file)).ToList(); intermediateFilePaths.AddRange(chunkFilePaths); List <string> mergeIntermediateFilePaths = MergeChunkFiles(chunkFiles, options, inputFileInfo); intermediateFilePaths.AddRange(mergeIntermediateFilePaths); return(intermediateFilePaths); }
public Form1Presenter(IView view, IImageResizer imageResizer, IImagePropertyFacade imagePropertyFacade, IFileIO fileIo) { _view = view; _imageResizer = imageResizer; _imagePropertyFacade = imagePropertyFacade; _fileIo = fileIo; }
internal static string[] ReadAllLines(string fileName, Options options) { bool traceException = options.IsTraceOn(Trace_Options.TraceExceptions); IFileIO fileIO = FileIOFactory.GetFileIO(); return(fileIO.ReadAllLines(fileName, traceException)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); bool isLandscape = this.Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape; int frameBufferWidth = isLandscape ? 960 : 540; int frameBufferHeight = isLandscape ? 540 : 960; Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth, frameBufferHeight, Bitmap.Config.Rgb565); float scaleX = (float)frameBufferWidth / this.WindowManager.DefaultDisplay.Width; float scaleY = (float)frameBufferHeight / this.WindowManager.DefaultDisplay.Height; _renderView = new AndroidFastRenderView(this, frameBuffer); _graphics = new AndroidGraphics(Assets, frameBuffer); _fileIO = new AndroidFileIO(Assets); _audio = new AndroidAudio(this); _input = new AndroidInput(this, _renderView, scaleX, scaleY); _screen = GetStartScreen(); SetContentView(_renderView); PowerManager pw = (PowerManager)GetSystemService(Context.PowerService); _wl = pw.NewWakeLock(WakeLockFlags.Full, "GLGame"); // Create your application here }
public MinerDownloader(string url, string verifyName, IMiner miner) { m_url = url; m_verifyName = verifyName; m_fileio = GetFileIOObject(); m_Miner = miner; }
Load <TThirdPartyType, TOwnedType>( ISpreadsheet spreadsheet, IFileIO <TOwnedType> pending_file_io, ICSVFile <TOwnedType> pending_file, IFileIO <TThirdPartyType> third_party_file_io, IFileIO <TOwnedType> owned_file_io, BudgetingMonths budgeting_months, DataLoadingInformation <TThirdPartyType, TOwnedType> data_loading_info, IMatcher matcher) where TThirdPartyType : ICSVRecord, new() where TOwnedType : ICSVRecord, new() { Load_pending_data(pending_file_io, pending_file, data_loading_info); Merge_budget_data(spreadsheet, pending_file, budgeting_months, data_loading_info); Merge_other_data(spreadsheet, pending_file, budgeting_months, data_loading_info); Generate_ad_hoc_data(spreadsheet, pending_file, budgeting_months, data_loading_info); Merge_unreconciled_data(spreadsheet, pending_file, data_loading_info); var reconciliator = Load_third_party_and_owned_files_into_reconciliator <TThirdPartyType, TOwnedType>( data_loading_info, third_party_file_io, owned_file_io, spreadsheet); var reconciliation_interface = Create_reconciliation_interface(data_loading_info, reconciliator, matcher); return(reconciliation_interface); }
public Data(DataType type, string fileLocation, IFileIO io) { Base64Encoding = io.ReadFileBase64(fileLocation); Type = type; AssetName = fileLocation; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(Window.FEATURE_NO_TITLE); GetWindow().SetFlags(IWindowManager_LayoutParams.FLAG_FULLSCREEN, IWindowManager_LayoutParams.FLAG_FULLSCREEN); bool isPortrait = GetResources().GetConfiguration().Orientation == Configuration.ORIENTATION_PORTRAIT; int frameBufferWidth = isPortrait ? 480 : 800; int frameBufferHeight = isPortrait ? 800 : 480; Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth, frameBufferHeight, Bitmap.Config.RGB_565); float scaleX = (float)frameBufferWidth / GetWindowManager().GetDefaultDisplay().GetWidth(); float scaleY = (float)frameBufferHeight / GetWindowManager().GetDefaultDisplay().GetHeight(); renderView = new AndroidFastRenderView(this, frameBuffer); graphics = new AndroidGraphics(GetAssets(), GetAssetsPrefix(), frameBuffer); fileIO = new AndroidFileIO(this); audio = new AndroidAudio(this); input = new AndroidInput(this, renderView, scaleX, scaleY); screen = getInitScreen(); SetContentView(renderView); PowerManager powerManager = (PowerManager)GetSystemService(Context.POWER_SERVICE); wakeLock = powerManager.NewWakeLock(PowerManager.FULL_WAKE_LOCK, "MyGame"); }
public ReferenceFinder(IFileIO fileIo, IModuleLoader loader, Action <ReferenceFinderOptions> optionsFunc) { _fileIo = fileIo; _loader = loader; _options = new ReferenceFinderOptions(); optionsFunc.Invoke(_options); }
public static IFileIO GetIOHandler() { IFileIO handler = null; handler = new IO.IsolatedStorageIO(); return(handler); }
public LogFileManager(string filePathKey, string fileNameKey) { _fileIO = new FileIO( ConfigAccess.GetValueInAppSettings(filePathKey), string.Format(ConfigAccess.GetValueInAppSettings(fileNameKey), DateTime.Now.ToString(FormatTemplate.FileDate))); _clientFeatures = new ClientFeatures(); }
public ProjectGeneration(string tempDirectory, IAssemblyNameProvider assemblyNameProvider, IFileIO fileIO, IGUIDGenerator guidGenerator) { ProjectDirectory = tempDirectory.NormalizePath(); m_ProjectName = Path.GetFileName(ProjectDirectory); m_AssemblyNameProvider = assemblyNameProvider; m_FileIOProvider = fileIO; m_GUIDProvider = guidGenerator; }
public Process() { _fileInfos = new List <FileDataInfo>(); _strings = new List <string>(); _fileIO = new FileIO(); OutputFilePath = @"C:\SRC\VSBootstrapImporter\VSBootstrapImporter.Tests\Services\files.cs"; }
public static bool Exists(string fileName, Options options) { bool traceException = options.IsTraceOn(Trace_Options.TraceExceptions); IFileIO fileIO = FileIOFactory.GetFileIO(); return(fileIO.Exists(fileName, traceException)); }
internal static Book CreateBook(BookModel model, IFileIO fileIO = null) { if (fileIO == null) { fileIO = new FileIO(); } return(new Book(model, new NullLogger(), fileIO)); }
public static void CreateDirectory(string destinationDirectory, Options options) { bool traceException = options.IsTraceOn(Trace_Options.TraceExceptions); IFileIO fileIO = FileIOFactory.GetFileIO(); fileIO.CreateDirectory(destinationDirectory, traceException); }
public ProjectGeneration(string tempDirectory, IAssemblyNameProvider assemblyNameProvider, IFileIO fileIoProvider, IGUIDGenerator guidGenerator) { ProjectDirectory = tempDirectory.Replace('\\', '/'); m_ProjectName = Path.GetFileName(ProjectDirectory); m_AssemblyNameProvider = assemblyNameProvider; m_FileIOProvider = fileIoProvider; m_GUIDGenerator = guidGenerator; }
internal static Book CreateDefaultBook(IFileIO fileIO = null) { if (fileIO == null) { fileIO = new FileIO(); } return(new Book(BookModelTests.CreateBookModel(), new NullLogger(), fileIO)); }
public void controller_initialized_with_null_fileio_fails() { ICollectionBase collectionBase = _mockHomeCollection.Object; IFileIO nullFileIO = null; _mockController = new HomeCollectionController(collectionBase, nullFileIO); Assert.IsFalse(true, "Expected the test to fail when initialized with a null object"); }
public static void OutputFile(string fileName, List <string> strings, Options options) { bool traceException = options.IsTraceOn(Trace_Options.TraceExceptions); IFileIO fileIO = FileIOFactory.GetFileIO(); fileIO.OutputFile(fileName, strings, traceException); }
public SolutionSynchronizer(string projectDirectory, ISolutionSynchronizationSettings settings, IAssemblyNameProvider assemblyNameProvider, IFileIO fileIO, IGUIDGenerator guidGenerator) { _projectDirectory = projectDirectory.ConvertSeparatorsToUnity(); _settings = settings; _projectName = Path.GetFileName(_projectDirectory); m_assemblyNameProvider = assemblyNameProvider; m_fileIOProvider = fileIO; m_GUIDProvider = guidGenerator; }
public static void CopyDirectory(string source, string destination, Options options) { bool traceException = options.IsTraceOn(Trace_Options.TraceExceptions); IFileIO fileIO = FileIOFactory.GetFileIO(); fileIO.CopyDirectory(source, destination, traceException); }
public HomeCollectionRepository(IFileIO fileIO) { // we don't have or need an existing collection to call LoadCollection if (fileIO == null) { throw new FileIOException("File IO must not be null"); } _homeCollection = null; _fileIO = fileIO; }
public HomeCollectionController(IFileIO fileIO) { // used when loading a collection with the controller if (fileIO == null) { throw new FileIOException("Injected file IO must not be null"); } _fileIO = fileIO; _homeCollection = null; _repo = null; }
/** * Constructor with a Point for center * * @param center The x-location of the center of the circle -- must be a valid point * @param radius The radius of the circle -- must be greater or equal to zero. * @throws ShapeException The exception thrown if the x, y, or z are not valid */ public Circle(Point center, double radius) { _fileWriter = new FileIO(); Stroke = Color.Black; Validator.ValidatePositiveDouble(radius, "Invalid radius"); CenterPoint = center; Radius = radius; Height = radius * 2; Width = radius * 2; }
public ProjectGeneration(string tempDirectory, IAssemblyNameProvider assemblyNameProvider, IFileIO fileIoProvider, IGUIDGenerator guidGenerator) { ProjectDirectory = FileUtility.NormalizeWindowsToUnix(tempDirectory); m_ProjectName = Path.GetFileName(ProjectDirectory); m_AssemblyNameProvider = assemblyNameProvider; m_FileIOProvider = fileIoProvider; m_GUIDGenerator = guidGenerator; SetupProjectSupportedExtensions(); }
public FileIOErrorDecorator(IFileIO fileIO, IErrorReporter errorReporter) { this.fileIO = fileIO; this.errorReporter = errorReporter; }
void SetupCrap(object sender, EventArgs e) { _migrationHelper = Mock.DynamicMock<IMigrationHelper>().OverloadFactory(); _fileIo = Mock.DynamicMock<IFileIO>().OverloadFactory(); }
public FormattedWriter(IFileIO fileIO) { this.fileIO = fileIO; }
public void Save(IFileIO fileIO) { var site = ConvertToXelement(); try { fileIO.Save(site, _id); IsDirty = false; } catch (Exception ex) { throw new ApplicationException("Error saving web site config: " + ex.Message); } }
public static ObservableCollection<WebSite> GetAllWebsites(IFileIO fileIO) { if (fileIO == null) { throw new ArgumentNullException("fileIO"); } IEnumerable<XElement> xdoc = null; try { xdoc = fileIO.GetSitesSection(); } catch (Exception ex) { throw new ApplicationException( String.Format("Error access IIS Express applicationhost config file: {0}", ex.Message)); } if (xdoc == null) { return null; } try { return new ObservableCollection<WebSite>( from site in xdoc.Descendants("site") select new WebSite( Convert.ToInt32(site.Attribute("id").Value), site.Attribute("name").Value, site.Attribute("serverAutoStart") == null ? true : Convert.ToBoolean(site.Attribute("serverAutoStart").Value), site.Element("application").Attribute("path").Value, site.Element("application").Attribute("applicationPool") == null ? string.Empty : site.Element("application").Attribute("applicationPool").Value, site.Element("application").Element("virtualDirectory").Attribute("path").Value, site.Element("application").Element("virtualDirectory").Attribute("physicalPath").Value, (BindingProtocol)Enum.Parse(typeof(BindingProtocol), site.Element("bindings").Element("binding").Attribute("protocol").Value), site.Element("bindings").Element("binding").Attribute("bindingInformation").Value, fileIO.Exists(site.Element("application").Element("virtualDirectory").Attribute("physicalPath").Value))); } catch (Exception ex) { throw new ApplicationException( String.Format("Error parsing applicationhost config file: {0}", ex.Message)); } }
public static WebSite Create(IFileIO fileIO, int id, string name, bool serverAutoStart, string applicationPath, string applicationPool, string virtualPath, string physicalPath, BindingProtocol protocol, string bindingInfo) { var dirIsValid = false; try { dirIsValid = fileIO.Exists(physicalPath); var newSite = new WebSite(id, name, serverAutoStart, applicationPath, applicationPool, virtualPath, physicalPath, protocol, bindingInfo, dirIsValid); newSite.Save(fileIO); return newSite; } catch (Exception ex) { throw new ApplicationException(string.Format("Error creating new website: {0}", ex)); } }
public DiskCachedImageService(IImageService serviceToCache) { this.serviceToCache = serviceToCache; this.cachePath = SmeedeeApp.Instance.ServiceLocator.Get<Directories>().CacheDir; this.fileReader = SmeedeeApp.Instance.ServiceLocator.Get<IFileIO>(); }
public FormattedReader(IFileIO fileIO) { this.fileIO = fileIO; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); //Hides the titlebar and sets the window to fullscreen RequestWindowFeature (WindowFeatures.NoTitle); Window.SetFlags (WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); //Create a frameBuffer for the background var rotation = WindowManager.DefaultDisplay.Rotation; bool isPortrait = rotation == SurfaceOrientation.Rotation0 || rotation == SurfaceOrientation.Rotation180; int frameBufferWidth = isPortrait ? 480 : 800; int frameBufferHeight = isPortrait ? 800 : 480; Bitmap frameBuffer = Bitmap.CreateBitmap (frameBufferWidth, frameBufferHeight, Bitmap.Config.Rgb565); //Find screen size to calculate relative size var screenSize = new Point(); WindowManager.DefaultDisplay.GetSize(screenSize); float scaleX = (float)frameBufferWidth / screenSize.X; float scaleY = (float) frameBufferHeight / screenSize.Y; //Generate classes and start-up the first screen renderView = new AndroidFastRenderView (this, frameBuffer); graphics = new AndroidGraphics (Assets, frameBuffer); fileIO = new AndroidFileIO (this); audio = new AndroidAudio (this); input = new AndroidInput (this, renderView, scaleX, scaleY); SetContentView (renderView); CurrentScreen = this.InitScreen; //Add a WakeLock to avoid the screen from going out PowerManager powerManager = (PowerManager)GetSystemService (Context.PowerService); wakeLock = powerManager.NewWakeLock (WakeLockFlags.Full, "BeerRun"); }
public void Setup() { Factory.Overrides.Clear(); _mock = new MockRepository(); _fileWrapper = _mock.DynamicMock<IFileIO>(); Factory.Overrides.Add(typeof(IFileIO).FullName, _fileWrapper); }
void SetupTests(object sender, EventArgs e) { _iMigrationHelper = Mock.StrictMock<IMigrationHelper>().OverloadFactory(); _iFileIo = Mock.StrictMock<IFileIO>().OverloadFactory(); }
public TickerOpenerViewModel(IAsyncLoadService<ITickerConverter> loadConvertersService, IFileIO fileIO) { this.dispatcher = Dispatcher.CurrentDispatcher; this.fileIO = fileIO; this.OpenCommand = new DelegateCommand(Open, () => converters.Length > 0); BeginLoadConverters(loadConvertersService); }
public void SetUp() { _mockView = MockRepository.GenerateMock<Form1Presenter.IView>(); _mockImageResizer = MockRepository.GenerateMock<IImageResizer>(); _mockImagePropertyFacade = MockRepository.GenerateMock<IImagePropertyFacade>(); _mockFileIo = MockRepository.GenerateMock<IFileIO>(); _presenter = new Form1Presenter(_mockView, _mockImageResizer, _mockImagePropertyFacade, _mockFileIo); _image1 = new Bitmap(800, 600); _mockFileIo.Stub(x => x.ImageFromFile(FullSizeImage1FullPath)).Return(_image1); _mockImagePropertyFacade.Stub(x => x.GetDateTaken(_image1)).Return(_image1DateTaken); _image2 = new Bitmap(1024, 768); _mockFileIo.Stub(x => x.ImageFromFile(FullSizeImage2FullPath)).Return(_image2); _mockImagePropertyFacade.Stub(x => x.GetDateTaken(_image2)).Return(_image2DateTaken); _mockFileIo.Stub(x => x.GetFiles(FullSizeFolderPath, "*.JPG")).Return(new[] { FullSizeImage1FullPath, FullSizeImage2FullPath }); }