public pMixinsCodeGeneratorResponseFileWriter(IFileWrapper fileWrapper, IFileReader fileReader, ICodeBehindFileHelper codeBehindFileHelper, IVisualStudioOpenDocumentManager visualStudioOpenDocumentManager)
 {
     _fileWrapper = fileWrapper;
     _fileReader = fileReader;
     _codeBehindFileHelper = codeBehindFileHelper;
     _visualStudioOpenDocumentManager = visualStudioOpenDocumentManager;
 }
Ejemplo n.º 2
0
 public PngOptimizer(IFileWrapper fileWrapper, IWuQuantizer wuQuantizer)
 {
     this.fileWrapper = fileWrapper;
     this.wuQuantizer = wuQuantizer;
     var dllDir = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
     optiPngLocation = string.Format("{0}\\OptiPng.exe", dllDir);
 }
Ejemplo n.º 3
0
 public DbDiskCache(IFileWrapper fileWrapper, IRRConfiguration configuration, IUriBuilder uriBuilder) : base(fileWrapper, configuration, uriBuilder, null)
 {
     RRTracer.Trace("Creating db disk cache");
     const int interval = 1000*60*5;
     timer = new Timer(PurgeOldFiles, null, 0, interval);
     _cacheLock = new ReaderWriterLockSlim();
 }
Ejemplo n.º 4
0
        public VisualStudioFileCache(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy, IFileWrapper fileWrapper, IVisualStudioOpenDocumentManager openDocumentManager)
        {
            _fileWrapper = fileWrapper;
            _openDocumentManager = openDocumentManager;

            WireUpCacheEvictionEvents(cacheEventHelper, visualStudioEventProxy);
        }
Ejemplo n.º 5
0
 public LocalDiskStore(IFileWrapper fileWrapper, IRRConfiguration configuration, IUriBuilder uriBuilder)
 {
     this.fileWrapper = fileWrapper;
     this.configuration = configuration;
     configuration.PhysicalPathChange += SetupWatcher;
     this.uriBuilder = uriBuilder;
     SetupWatcher();
 }
        public void SetUp()
        {
            _fileWrapper = MockRepository.GenerateStub<IFileWrapper>();
            _serializer = MockRepository.GenerateStub<ISerializer<Artist>>();

            _reader = new ArtistReader(_fileWrapper, _serializer);
            _writer = MockRepository.GenerateStub<IWriter<Artist>>();

            _operationOutput = new ExceptionOperationOutput();
        }
Ejemplo n.º 7
0
 public LocalDiskStore(IFileWrapper fileWrapper, IRRConfiguration configuration, IUriBuilder uriBuilder, IReductionRepository reductionRepository)
 {
     this.fileWrapper = fileWrapper;
     this.configuration = configuration;
     configuration.PhysicalPathChange += SetupWatcher;
     this.uriBuilder = uriBuilder;
     this.reductionRepository = reductionRepository;
     if(configuration.IsFullTrust)
         SetupWatcher();
 }
Ejemplo n.º 8
0
 public LessHandler(IFileWrapper fileWrapper)
 {
     this.fileWrapper = fileWrapper;
     var config = new DotlessConfiguration
     {
         CacheEnabled = false,
         Logger = typeof(LessLogger),
         Web = HttpContext.Current != null,
     };
     var engineFactory = new EngineFactory(config);
     if (HttpContext.Current == null)
         engine = engineFactory.GetEngine();
     else
         engine = engineFactory.GetEngine(new AspNetContainerFactory());
 }
Ejemplo n.º 9
0
        public Program(IDrNuRtmpStreamFactory drNuRtmpStreamFactory, IFileWrapper fileWrapper, string title, string genre, string description, Uri rtmpUri)
        {
            if (drNuRtmpStreamFactory == null) throw new ArgumentNullException("drNuRtmpStreamFactory");
            if (fileWrapper == null) throw new ArgumentNullException("fileWrapper");
            if (title == null) throw new ArgumentNullException("title");
            if (genre == null) throw new ArgumentNullException("genre");
            if (description == null) throw new ArgumentNullException("description");
            if (rtmpUri == null) throw new ArgumentNullException("rtmpUri");

            _drNuRtmpStreamFactory = drNuRtmpStreamFactory;
            _fileWrapper = fileWrapper;
            Title = title;
            Genre = genre;
            Description = description;
            RtmpUri = rtmpUri;
        }
        public WebConfigManager(
            IFileWrapper fileWrapper,
            IXmlDocumentWrapper xmlDocumentWrapper,
            string configFile = "web.config")
        {
            _fileWrapper        = fileWrapper ?? throw new ArgumentNullException(nameof(fileWrapper), "File wrapper is required");
            _xmlDocumentWrapper = xmlDocumentWrapper ?? throw new ArgumentNullException(nameof(xmlDocumentWrapper), "Xml document wrapper is required");

            if (!_fileWrapper.Exists(configFile))
            {
                throw new ArgumentNullException(nameof(configFile), "Web config file does not exist. Exiting the program.");
            }

            _configFile   = configFile;
            _configXmlDoc = _xmlDocumentWrapper.CreateXmlDocFromFile(_configFile);
            BackupConfig();
        }
Ejemplo n.º 11
0
 public ScriptLoader(
     IFileWrapper file,
     IDirectoryWrapper directory,
     IProjectFileAnalyzer projectFileAnalyzer,
     IScriptAnalyzer scriptAnalyzer,
     IBuildScriptLocator buildScriptLocator,
     INugetPackageResolver nugetPackageResolver,
     ILogger <ScriptLoader> log)
 {
     _file                = file;
     _directory           = directory;
     _projectFileAnalyzer = projectFileAnalyzer;
     _scriptAnalyzer      = scriptAnalyzer;
     _log = log;
     _buildScriptLocator   = buildScriptLocator;
     _nugetPackageResolver = nugetPackageResolver;
 }
Ejemplo n.º 12
0
 public PipelineStrategy(
     IStepMediator stepMediator, IEncodeWebClient webClient,
     IEncodeCreatorFactory creatorFactory, IFfmpeg ffmpeg,
     IWatchDogTimer watchDogTimer, IFileSystem fileSystem,
     ITempFileManager tempFileManager, IPortalBackendSettings settings,
     IFileWrapper fileWrapper)
 {
     _stepMediator    = stepMediator;
     _webClient       = webClient;
     _creatorFactory  = creatorFactory;
     _ffmpeg          = ffmpeg;
     _watchDogTimer   = watchDogTimer;
     _fileSystem      = fileSystem;
     _tempFileManager = tempFileManager;
     _settings        = settings;
     _fileWrapper     = fileWrapper;
 }
Ejemplo n.º 13
0
 public PipelineStrategy(
     IStepMediator stepMediator, IEncodeWebClient webClient,
     IEncodeCreatorFactory creatorFactory, IFfmpeg ffmpeg,
     IWatchDogTimer watchDogTimer, IFileSystem fileSystem,
     ITempFileManager tempFileManager, IPortalBackendSettings settings,
     IFileWrapper fileWrapper)
 {
     _stepMediator = stepMediator;
     _webClient = webClient;
     _creatorFactory = creatorFactory;
     _ffmpeg = ffmpeg;
     _watchDogTimer = watchDogTimer;
     _fileSystem = fileSystem;
     _tempFileManager = tempFileManager;
     _settings = settings;
     _fileWrapper = fileWrapper;
 }
 public ConfigManagerSettings(
     string buildPath,
     string transformConfigPath,
     string sourceConfigPath,
     IConfigurationRoot sourceConfigRoot,
     IFileWrapper fileWrapper,
     IXmlDocumentWrapper xmlDocumentWrapper,
     ILogger logger)
 {
     BuildPath           = buildPath;
     TransformConfigPath = transformConfigPath;
     SourceConfigPath    = sourceConfigPath;
     SourceConfigRoot    = sourceConfigRoot;
     FileWrapper         = fileWrapper;
     XmlDocumentWrapper  = xmlDocumentWrapper;
     Logger = logger;
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Is called by SimPe (through the Wrapper) when the Panel is going to be displayed, so
        /// you should updatet the Data displayed by the Panel with the Attributes stored in the
        /// passed Wrapper.
        /// </summary>
        /// <param name="wrapper">The Attributes of this Wrapper have to be displayed</param>
        public void UpdateGUI(IFileWrapper wrapper)
        {
            Lifo wrp = (Lifo)wrapper;

            form.wrapper = wrp;

            form.cbitem.Items.Clear();
            foreach (LevelInfo id in wrp.Blocks)
            {
                form.cbitem.Items.Add(id);
            }

            if (form.cbitem.Items.Count >= 0)
            {
                form.cbitem.SelectedIndex = 0;
            }
        }
Ejemplo n.º 16
0
        public void SearchFilesMethod()
        {
            Mock <IProcess> processorDependency = new Mock <IProcess>();

            IFileWrapper fileWrapperDependency =
                Mock.Of <IFileWrapper>(d => d.GetFiles("") == new string[1] {
                @"D:\Main\First\Test.txt"
            });

            var sut = new DirectoryProcessor(processorDependency.Object, fileWrapperDependency).GetFiles("");

            var list = new List <string>();

            list.AddRange(sut.Result);

            Assert.IsTrue(list.Contains(@"D:\Main\First\Test.txt"));
        }
Ejemplo n.º 17
0
        public UserSettings(IFileWrapper file, IDirectoryWrapper directory)
        {
            this.file      = file;
            this.directory = directory;

            if (file.Exists(Filename))
            {
                data = JsonConvert.DeserializeObject <UserSettingsData>(file.ReadAllText(Filename));
            }
            else
            {
                data = new UserSettingsData();
            }

            GameStartedCount++;

            Save();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Called by the AbstractWrapper when the file should be displayed to the user.
        /// </summary>
        /// <param name="wrp">Reference to the wrapper to be displayed.</param>
        public void UpdateGUI(IFileWrapper wrp)
        {
            wrapper = (Trcn)wrp;
            WrapperChanged(wrapper, null);
            pjse_banner1.SiblingEnabled = wrapper.SiblingResource(Bcon.Bcontype) != null;

            internalchg = true;
            updateLists();
            internalchg = false;

            setIndex(lvTrcnItem.Items.Count > 0 ? 0 : -1);

            if (!setHandler)
            {
                wrapper.WrapperChanged += new System.EventHandler(this.WrapperChanged);
                setHandler              = true;
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Is called by SimPe (through the Wrapper) when the Panel is going to be displayed, so
        /// you should updatet the Data displayed by the Panel with the Attributes stored in the
        /// passed Wrapper.
        /// </summary>
        /// <param name="wrapper">The Attributes of this Wrapper have to be displayed</param>
        public void UpdateGUI(IFileWrapper wrapper)
        {
            FileTable.FileIndex.Load();
            form.wrapper = (IFileWrapperSaveExtension)wrapper;

            RefFile mywrapper = (RefFile)wrapper;

            form.llcommit.Enabled = false;
            form.lldelete.Enabled = false;
            form.btup.Enabled     = false;
            form.btdown.Enabled   = false;
            form.miRem.Enabled    = false;
            form.lblist.Items.Clear();
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in mywrapper.Items)
            {
                form.lblist.Items.Add(pfd);
            }
        }
Ejemplo n.º 20
0
        private IDirectoryWrapperFactory SimulateSqlFiles(
            string path,
            List <List <List <string> > > sqlData, IFileWrapper fileWrapper,
            List <IDirectoryInfoWrapper> sqlDirectories)
        {
            var directoryFactory = Substitute.For <IDirectoryWrapperFactory>();

            // Get each directory
            foreach (var directory in sqlData)
            {
                var sqlFileList = new List <IFileInfoWrapper>();
                var sqlDir      = Substitute.For <IDirectoryInfoWrapper>();

                // Get each SQL file in that directory
                foreach (var file in directory)
                {
                    var fileName = file[0];
                    var filePath = $"{file[1]}{fileName}";
                    var content  = file[2];

                    var sqlFile1 = Substitute.For <IFileInfoWrapper>();
                    sqlFile1.FullName.Returns(filePath);

                    fileWrapper.ReadAllText(filePath)
                    .Returns(content);

                    sqlFileList.Add(sqlFile1);
                }

                // Fill the directory with those files
                sqlDir.GetFiles("*.sql").Returns(sqlFileList);
                sqlDirectories.Add(sqlDir);
            }

            var directoryWrapper = Substitute.For <IDirectoryWrapper>();

            directoryWrapper.GetDirectories("*Stored Procedures*")
            .Returns(sqlDirectories);

            directoryFactory.CreateDirectoryWrapper(path)
            .Returns(directoryWrapper);

            return(directoryFactory);
        }
Ejemplo n.º 21
0
        public FileReaderAsync(IVisualStudioOpenDocumentManager openDocumentManager, IFileWrapper fileWrapper, FilePath filename)
        {
            _fileName = filename;
            _openDocumentManager = openDocumentManager;

            _readFileTask = new TaskFactory().StartNew(() =>
            {
                try
                {
                    _log.DebugFormat("Reading File [{0}]", filename);

                    _fileContents = fileWrapper.ReadAllText(filename);
                }
                catch (Exception e)
                {
                    _fileReadException = e;
                }
            });
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Is called by SimPe (through the Wrapper) when the Panel is going to be displayed, so
        /// you should updatet the Data displayed by the Panel with the Attributes stored in the
        /// passed Wrapper.
        /// </summary>
        /// <remarks>attr.Tag is used to let TextChanged event handlers know the change is being
        /// made internally rather than by the users.</remarks>
        /// <param name="wrp">The Attributes of this Wrapper have to be displayed</param>
        public void UpdateGUI(IFileWrapper wrp)
        {
            wrapper = (CompressedFileList)wrp;

            lbformat.Text = wrapper.IndexType.ToString();

            lbclst.Items.Clear();
            foreach (ClstItem i in wrapper.Items)
            {
                if (i != null)
                {
                    lbclst.Items.Add(i);
                }
                else
                {
                    lbclst.Items.Add("Error");
                }
            }
        }
Ejemplo n.º 23
0
 public CommandExecutorInteractive(
     CommandArguments args,
     IScriptProvider scriptProvider,
     IFlubuSession flubuSession,
     IScriptProperties scriptProperties,
     IFlubuCommandParser parser,
     IFileWrapper fileWrapper,
     IBuildScriptLocator buildScriptLocator,
     ILogger <CommandExecutorInteractive> log)
 {
     _args               = args;
     _scriptProvider     = scriptProvider;
     _flubuSession       = flubuSession;
     _scriptProperties   = scriptProperties;
     _parser             = parser;
     _fileWrapper        = fileWrapper;
     _buildScriptLocator = buildScriptLocator;
     _log = log;
 }
Ejemplo n.º 24
0
        public void Init()
        {
            _mockFileInfo = Substitute.For <IFileInfoWrapper>();
            _mockFileInfo.Name.Returns("fileInfoName");
            _mockFileInfo.FullName.Returns("fullFileName");
            _mockFileInfo.CreationTime.Returns(new DateTime(2020, 12, 31));
            _mockFileInfo.Extension.Returns(".txt");

            _mockConsole = Substitute.For <IConsoleWrapper>();

            _mockFile = Substitute.For <IFileWrapper>();
            _mockFile.ReadAllText(_mockFileInfo.Name).Returns("5545");

            _mockDirectory = Substitute.For <IDirectoryWrapper>();
            _mockDirectory.CreateDirectory(_mockFileInfo.Name);
            _mockDirectory.GetCreationTime(_mockFileInfo.CreationTime.ToString(CultureInfo.InvariantCulture));

            _target = new TxtHandler(_mockFile, _mockFileInfo, _mockConsole, _mockDirectory);
        }
Ejemplo n.º 25
0
        public FileReaderAsync(IVisualStudioOpenDocumentManager openDocumentManager, IFileWrapper fileWrapper, FilePath filename)
        {
            _fileName            = filename;
            _openDocumentManager = openDocumentManager;

            _readFileTask = new TaskFactory().StartNew(() =>
            {
                try
                {
                    _log.DebugFormat("Reading File [{0}]", filename);

                    _fileContents = fileWrapper.ReadAllText(filename);
                }
                catch (Exception e)
                {
                    _fileReadException = e;
                }
            });
        }
Ejemplo n.º 26
0
        internal SqlFileScanner(IFileWrapper fileWrapper,
                                IXmlStreamWrapperFactory xmlWriterWrapperFactory,
                                IDirectoryWrapperFactory directoryWrapperFactory,
                                IHtmlReportGenerator htmlReportGenerator,
                                IParamReportComparer paramReportComparer,
                                IReturnReportComparer returnReportComparer)
        {
            _fileWrapper = fileWrapper;

            _sqlParameterReportWriter =
                new SqlReportWriter(xmlWriterWrapperFactory, _fileWrapper);

            _directoryFactory     = directoryWrapperFactory;
            _htmlReportGenerator  = htmlReportGenerator;
            _paramReportComparer  = paramReportComparer;
            _returnReportComparer = returnReportComparer;

            _sqlReport = new SqlReport();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Called by the AbstractWrapper when the file should be displayed to the user.
        /// </summary>
        /// <param name="wrp">Reference to the wrapper to be displayed.</param>
        public void UpdateGUI(IFileWrapper wrp)
        {
            wrapper = (Objf)wrp;
            WrapperChanged(wrapper, null);

            internalchg = true;

            this.lvObjfItem.Items.Clear();
            bool parm = false;

            // There appears to be no clean way to handle a "new" resource being created in the wrapper
            // so this is in here.  Yuck.
            if (wrapper.Count == 0)
            {
                int max = pjse.BhavWiz.readStr(pjse.GS.BhavStr.OBJFDescs).Count;
                for (int i = 0; i < max; i++)
                {
                    wrapper.Add(new ObjfItem(wrapper));
                }
            }

            for (ushort i = 0; i < wrapper.Count; i++)
            {
                this.lvObjfItem.Items.Add(new ListViewItem(
                                              new string[] {
                    pjse.BhavWiz.readStr(pjse.GS.BhavStr.OBJFDescs, i)
                    , pjse.BhavWiz.bhavName(wrapper, wrapper[i].Action, ref parm)
                    , pjse.BhavWiz.bhavName(wrapper, wrapper[i].Guardian, ref parm)
                }
                                              ));
            }

            internalchg = false;

            lvObjfItem.Items[0].Selected = true;

            if (!setHandler)
            {
                wrapper.WrapperChanged += new System.EventHandler(this.WrapperChanged);
                setHandler              = true;
            }
        }
Ejemplo n.º 28
0
        public LessHandler(IFileWrapper fileWrapper)
        {
            this.fileWrapper = fileWrapper;
            var config = new DotlessConfiguration
            {
                CacheEnabled = false,
                Logger       = typeof(LessLogger),
                Web          = HttpContext.Current != null,
            };
            var engineFactory = new EngineFactory(config);

            if (HttpContext.Current == null)
            {
                engine = engineFactory.GetEngine();
            }
            else
            {
                engine = engineFactory.GetEngine(new AspNetContainerFactory());
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Called by the AbstractWrapper when the file should be displayed to the user.
        /// </summary>
        /// <param name="wrp">Reference to the wrapper to be displayed.</param>
        public void UpdateGUI(IFileWrapper wrp)
        {
            wrapper = (TPRP)wrp;
            WrapperChanged(wrapper, null);
            pjse_banner1.SiblingEnabled = wrapper.SiblingResource(Bhav.Bhavtype) != null;

            if (!wrapper.TextOnly)
            {
                internalchg = true;
                updateLists();
                internalchg = false;

                setTab(InitialTab);
            }

            if (!setHandler)
            {
                wrapper.WrapperChanged += new System.EventHandler(this.WrapperChanged);
                setHandler              = true;
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Called by the AbstractWrapper when the file should be displayed to the user.
        /// </summary>
        /// <param name="wrp">Reference to the wrapper to be displayed.</param>
        public void UpdateGUI(IFileWrapper wrp)
        {
            wrapper = (Bcon)wrp;
            WrapperChanged(wrapper, null);
            pjse_banner1.SiblingEnabled = wrapper.SiblingResource(Trcn.Trcntype) != null;

            internalchg = true;
            updateLists();
            internalchg = false;

            setIndex(lvConstants.Items.Count > 0 ? 0 : -1);

            //tbFilename.Enabled = cbFlag.Enabled = tbValueHex.Enabled = tbValueDec.Enabled = !isPopup;
            btnClose.Visible = isPopup;

            if (!setHandler)
            {
                wrapper.WrapperChanged += new System.EventHandler(this.WrapperChanged);
                setHandler              = true;
            }
        }
Ejemplo n.º 31
0
        private const int MAX_PHOTO_SIZE_IN_BYTES = 30 * 1024 * 1024; // 30 MB

        public UploadApiController(
            IPathUtil pathUtil,
            IDirectoryWrapper directoryWrapper,
            IFileHelper fileHelper,
            IFileWrapper fileWrapper,
            IPhotoService photoService,
            IAlbumService albumService,
            ICryptoProvider cryptoProvider,
            IPhotoProcessor photoProcessor,
            ICollageProcessor collageProcessor)
        {
            _pathUtil         = pathUtil;
            _directoryWrapper = directoryWrapper;
            _fileHelper       = fileHelper;
            _fileWrapper      = fileWrapper;
            _photoService     = photoService;
            _albumService     = albumService;
            _cryptoProvider   = cryptoProvider;
            _photoProcessor   = photoProcessor;
            _collageProcessor = collageProcessor;
        }
        public void UpdateCardsDB(string newContent)
        {
            string         fileName      = ".\\Resources\\cards.json";
            IFileWrapper   fileWrapper   = trackerfactory.GetService <IFileWrapper>();
            ICardsDatabase cardsDatabase = trackerfactory.GetService <ICardsDatabase>();

            string backupFileName = string.Format("{0}_{1}{2}",
                                                  Path.GetFileNameWithoutExtension(fileName),
                                                  cardsDatabase.Version,
                                                  Path.GetExtension(fileName)); //includes .

            backupFileName = Path.Combine(Path.GetDirectoryName(fileName), backupFileName);

            if (fileWrapper.Exists(backupFileName))
            {
                fileWrapper.Delete(backupFileName);
            }
            fileWrapper.Move(fileName, backupFileName);

            fileWrapper.WriteAllText(fileName, newContent);
            trackerfactory.GetService <ICardsDatabase>().RealoadDB();
        }
Ejemplo n.º 33
0
        public void TestMethod1()
        {
            string[] dir = new string[1];
            dir[0] = @"D:\Main\First";

            IFileWrapper fileWrapperDependency =
                Mock.Of <IFileWrapper>(d => d.GetDirectiry("") == dir);
            var currentDirectory = fileWrapperDependency.GetDirectiry("");

            var sut = new MainProcessor(new ProccessReversed1(),
                                        fileWrapperDependency).GetDirectories("");

            var result = sut.Result;

            List <string> list = new List <string>();

            foreach (var item in result)
            {
                list.Add(item);
            }

            Assert.IsTrue(list.Contains(@"D:\Main\First"));
        }
Ejemplo n.º 34
0
        public override void MainSetup()
        {
            TestSpecificKernel = KernelFactory.BuildDefaultKernelForTests();

            EventProxy = TestSpecificKernel.Get<IVisualStudioEventProxy>()
                //This is important, if the casting isn't done, then EventProxy isn't returned via IoC
                as TestVisualStudioEventProxy;

            _MockFileWrapper = BuildMockFileReader();
            TestSpecificKernel.Rebind<IFileWrapper>().ToMethod(c => _MockFileWrapper);

            _MockMicrosoftBuildProjectLoader = BuildMockMicrosoftBuildProjectLoader();
            TestSpecificKernel.Rebind<IMicrosoftBuildProjectLoader>().ToMethod(c => _MockMicrosoftBuildProjectLoader);

            _MockCodeBehindFileHelper = BuildMockCodeBehindFileHelper();
            TestSpecificKernel.Rebind<ICodeBehindFileHelper>().ToMethod(c => _MockCodeBehindFileHelper);

            _MockSolution = new MockSolution();

            //Set solution context
            TestSpecificKernel.Get<ISolutionContext>().SolutionFileName =
                _MockSolution.FileName;
        }
Ejemplo n.º 35
0
 public LessHandler(IFileWrapper fileWrapper)
 {
     this.fileWrapper = fileWrapper;
     var config = new DotlessConfiguration
     {
         CacheEnabled = false,
         Logger = typeof(LessLogger),
         Web = HttpContext.Current != null,
     };
     if (HttpContext.Current == null)
         engine = new EngineFactory(config).GetEngine();
     else
     {
         var dotLessAssembly = Assembly.GetAssembly(typeof (ContainerFactory));
         var factoryType = dotLessAssembly.GetType("dotless.Core.AspNetContainerFactory");
         var fac = (ContainerFactory)(factoryType.InvokeMember("", BindingFlags.CreateInstance, null, null, null));
         var locator = factoryType.InvokeMember("GetContainer", BindingFlags.InvokeMethod, null, fac, new object[] {config});
         engine =
             (ILessEngine)
             (dotLessAssembly.GetType("Microsoft.Practices.ServiceLocation.IServiceLocator").InvokeMember(
                 "GetInstance", BindingFlags.InvokeMethod, null, locator, new object[] {typeof (ILessEngine)}));
     }
 }
        public void BackupDatabase(IWrapperProvider wrapperProvider, string path)
        {
            IPathWrapper      pathWrapper      = wrapperProvider.GetWrapper <IPathWrapper>();
            IDirectoryWrapper directoryWrapper = wrapperProvider.GetWrapper <IDirectoryWrapper>();
            IFileWrapper      fileWrapper      = wrapperProvider.GetWrapper <IFileWrapper>();
            //copy data.xml to data.xml.bak
            //copy data.xml to data_date.bak - it will override last dayily backup. first run of day will create new one
            string backupFileName = pathWrapper.GetFileNameWithoutExtension(path) + DateTime.Now.ToString("yyyyMMdd");
            string backupPath     = pathWrapper.Combine(
                pathWrapper.GetDirectoryName(path),
                backupFileName);

            backupPath = pathWrapper.ChangeExtension(backupPath, pathWrapper.GetExtension(path));

            bool backupExists = File.Exists(backupPath);

            File.Copy(path, backupPath, true);

            if (!backupExists)
            {
                ManageBackups(path, pathWrapper, directoryWrapper, fileWrapper);
            }
        }
        public void ManageBackups(
            string path,
            IPathWrapper pathWrapper,
            IDirectoryWrapper directoryWrapper,
            IFileWrapper fileWrapper)
        {
            string dataFileFilter = Path.ChangeExtension(
                string.Format("{0}*", Path.GetFileNameWithoutExtension(DataFile)),
                Path.GetExtension(DataFile));
            var backupFiles = directoryWrapper.EnumerateFiles(
                pathWrapper.GetDirectoryName(path),
                dataFileFilter).Where(f => f != FullDataFilePath).OrderByDescending(f => f);
            //first save of day - delete old backups
            int backupcount = backupFiles.Count();
            int skipfiles   = 7; //backups to keep

            if (backupcount > skipfiles)
            {
                foreach (string s in backupFiles.Skip(skipfiles))
                {
                    fileWrapper.Delete(s);
                }
            }
        }
Ejemplo n.º 38
0
        private bool Sys_Write()
        {
            // get fd index
            UInt64 fd_index = RBX;

            if (fd_index >= (UInt64)FDCount)
            {
                Terminate(ErrorCode.OutOfBounds); return(false);
            }

            // get fd
            IFileWrapper fd = FileDescriptors[fd_index];

            if (fd == null)
            {
                Terminate(ErrorCode.FDNotInUse); return(false);
            }

            // make sure we can write
            if (!fd.CanWrite())
            {
                Terminate(ErrorCode.FilePermissions); return(false);
            }

            // make sure we're in bounds
            if (RCX >= MemorySize || RDX >= MemorySize || RCX + RDX > MemorySize)
            {
                Terminate(ErrorCode.OutOfBounds); return(false);
            }

            // attempt to write from memory to the file - success = num written, fail = -1
            try { RAX = (UInt64)fd.Write(Memory, (int)RCX, (int)RDX); }
            catch (Exception) { RAX = ~(UInt64)0; }

            return(true);
        }
Ejemplo n.º 39
0
        public void UpdateGUI(IFileWrapper wrp)
        {
            wrapper = (XWNTWrapper)wrp;
            WrapperChanged(wrapper, null);

            internalchg = true;

            lbWant.Text             = wrapper["folder"].Value + " / " + wrapper["nodeText"].Value + " (" + wrapper["objectType"].Value + ")";
            cbVersion.SelectedIndex = XWNTWrapper.ValidVersions.IndexOf(wrapper.Version);

            lvWants.Items.Clear();
            foreach (XWNTItem xi in wrapper)
            {
                if (!xi.Key.StartsWith("<"))
                {
                    lvWants.Items.Add(new ListViewItem(new string[] { xi.Key, xi.Stype, xi.Value, }));
                }
            }

            internalchg = false;

            if (lvWants.Items.Count > 0)
            {
                lvWants.Items[0].Selected = true;
            }
            else
            {
                lvWants_SelectedIndexChanged(null, null);
            }

            if (!setHandler)
            {
                wrapper.WrapperChanged += new System.EventHandler(this.WrapperChanged);
                setHandler              = true;
            }
        }
Ejemplo n.º 40
0
        public override void MainSetup()
        {
            TestSpecificKernel = KernelFactory.BuildDefaultKernelForTests();

            EventProxy = TestSpecificKernel.Get <IVisualStudioEventProxy>()
                         //This is important, if the casting isn't done, then EventProxy isn't returned via IoC
                         as TestVisualStudioEventProxy;

            _MockFileWrapper = BuildMockFileReader();
            TestSpecificKernel.Rebind <IFileWrapper>().ToMethod(c => _MockFileWrapper);

            _MockMicrosoftBuildProjectLoader = BuildMockMicrosoftBuildProjectLoader();
            TestSpecificKernel.Rebind <IMicrosoftBuildProjectLoader>().ToMethod(c => _MockMicrosoftBuildProjectLoader);

            _MockCodeBehindFileHelper = BuildMockCodeBehindFileHelper();
            TestSpecificKernel.Rebind <ICodeBehindFileHelper>().ToMethod(c => _MockCodeBehindFileHelper);


            _MockSolution = new MockSolution();

            //Set solution context
            TestSpecificKernel.Get <ISolutionContext>().SolutionFileName =
                _MockSolution.FileName;
        }
Ejemplo n.º 41
0
 public DecompressionPresenter(IFileWrapper fileWrapper, IDecoderFactory decoderFactory)
 {
     this.fileWrapper = fileWrapper;
     this.decoderFactory = decoderFactory;
 }
Ejemplo n.º 42
0
 public IOWrapper(IFileWrapper fileWrapper, IDirectoryWrapper directoryWrapper)
 {
     Assert.IsNotNull(fileWrapper, "fileWrapper");
     Assert.IsNotNull(directoryWrapper, "directoryWrapper");
 }
 public void SetUp()
 {
     _fileWrapper = MockRepository.GenerateStub<IFileWrapper>();
     _serializer = MockRepository.GenerateStub<ISerializer<Artist>>();
 }
Ejemplo n.º 44
0
 public FullSort(IFileWrapper input, TextWriter output)
 {
     this.input = input;
     this.output = output;
 }
Ejemplo n.º 45
0
 public SolutionFileReader(IFileReader fileReader, IFileWrapper fileWrapper)
 {
     _fileReader = fileReader;
     _fileWrapper = fileWrapper;
 }
Ejemplo n.º 46
0
 public TextFileLogger(LogType logVerbosity, IFileWrapper fileWrapper)
 {
     this.LogVerbosity = logVerbosity;
     this.fileWrapper = fileWrapper;
 }
Ejemplo n.º 47
0
 public CompressionPresenter(IFileWrapper fileWrapper, IEncoderFactory encoderFactory)
 {
     this.fileWrapper = fileWrapper;
     this.encoderFactory = encoderFactory;
 }
Ejemplo n.º 48
0
 public RepositoryService(IDeserializer deserializer, IFileWrapper fileWrapper, IConfigReader configReader)
 {
     _deserializer = deserializer;
     _fileWrapper = fileWrapper;
     _configReader = configReader;
 }
Ejemplo n.º 49
0
 public DbDiskCache(IFileWrapper fileWrapper, IRRConfiguration configuration, IUriBuilder uriBuilder)
     : base(fileWrapper, configuration, uriBuilder)
 {
     const int interval = 1000*60*5;
     timer = new Timer(PurgeOldFiles, null, 0, interval);
 }
Ejemplo n.º 50
0
 public FakeLocalDiskStore(IFileWrapper fileWrapper, IRRConfiguration configuration, IUriBuilder uriBuilder, IReductionRepository reductionRepository)
     : base(fileWrapper, configuration, uriBuilder, reductionRepository)
 {
 }
Ejemplo n.º 51
0
 public WordService(IFileWrapper fileWrapper)
 {
     _fileWrapper = fileWrapper;
 }
Ejemplo n.º 52
0
 public Program(IFileWrapper fw, ISort sorter, TextWriter tw)
 {
     this.filewrapper = fw;
     this.sorter = sorter;
     this.writer = tw;
 }
Ejemplo n.º 53
0
 public WordReporter(IFileWrapper fileWrapper)
 {
     _fileWrapper = fileWrapper;
 }
 public WordDictionaryTests()
 {
     _dictionaryPreprocessService = Substitute.For <IDictionaryPreprocessService>();
     _fileWrapper = Substitute.For <IFileWrapper>();
     _sut         = new WordDictionaryService(_fileWrapper, _dictionaryPreprocessService);
 }
Ejemplo n.º 55
0
 public LessHandler(IFileWrapper fileWrapper)
 {
     this.fileWrapper = fileWrapper;
 }
Ejemplo n.º 56
0
 public JsonRepository(IFileWrapper fileWrapper)
 {
     this.fileWrapper = fileWrapper;
 }
Ejemplo n.º 57
0
 public DocumentService(IDeserializer deserializer, IConfigReader configReader, IFileWrapper fileWrapper)
 {
     _deserializer = deserializer;
     _configReader = configReader;
     _fileWrapper = fileWrapper;
 }