コード例 #1
0
        public IEnumerable<SearchResult> Search(SearchQuery query, FileManager fileManager)
        {
            var repos = from dir in fileManager.DirectoryInfo.EnumerateDirectories()
                        let repoInfo = GitUtilities.GetRepoInfo(dir.FullName)
                        where repoInfo.IsGitRepo
                        select repoInfo;

            foreach (var repo in repos)
            {
                if (query.Terms.All(t => repo.Name.IndexOf(t, StringComparison.OrdinalIgnoreCase) != -1 || repo.Description.IndexOf(t, StringComparison.OrdinalIgnoreCase) != -1))
                {
                    yield return new SearchResult
                    {
                        LinkText = repo.Name,
                        ActionName = "ViewRepo",
                        ControllerName = "Browse",
                        RouteValues = new { repo = repo.Name },
                        Lines = new List<SearchLine>
                        {
                            new SearchLine { Line = repo.Description },
                        },
                    };
                }
            }
        }
コード例 #2
0
        public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper codeGeneratorHelper)
        {
            AppendNodeComment(fileManager);

            // Check condition
            this._children[0].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            // If the condition is false, jump to the else-statement (exit label if else-statement is null)
            string elseLabel = codeGeneratorHelper.GenerateNextLabel();
            fileManager.Output.Append(Macro.JumpOnFalse(elseLabel));

            // Then-statement
            this._children[1].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            // On existing else-statement jump over it
            string outLabel = null;
            if (this._children[2] != null)
            {
                outLabel = codeGeneratorHelper.GenerateNextLabel();
                fileManager.Output.Append(Macro.Jump(outLabel));
            }

            // Generate else label
            fileManager.Output.Append(Macro.Label(elseLabel));

            // Else-statement and exit label
            if (this._children[2] != null)
            {
                this._children[2].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);
                fileManager.Output.Append(Macro.Label(outLabel));
            }
        }
コード例 #3
0
ファイル: FileManagerTests.cs プロジェクト: mparsin/Elements
        public void GetTempFileNameReturnsNewFileName()
        {
            // Arrange.
            const string TempDocumentUNC = @"z:\Temp\";
            var guid1 = new Guid("{D98C2A44-FACF-4FD4-ACA8-EBBE3AD6A173}");
            var guid2 = new Guid("{28FAEA09-F87A-42F4-B7AA-18079670C428}");

            var fileManager = new FileManager();
            var systemOptions = Mock.Create<ISystemOptionsInfo>();
            Mock.Arrange(() => systemOptions.TempDocumentUNC).Returns(TempDocumentUNC);
            Mock.Arrange(() => SystemOptionsInfo.GetSystemOptionsInfo()).Returns(systemOptions);
            Mock.Arrange(() => Guid.NewGuid()).Returns(guid1).InSequence();
            Mock.Arrange(() => Guid.NewGuid()).Returns(guid2).InSequence();

            Mock.Arrange(() => Directory.Exists(TempDocumentUNC)).Returns(true);
            Mock.Arrange(() => File.Create(Arg.AnyString)).Returns(() => Mock.Create<FileStream>(Behavior.Loose));

            // Act.
            var tempFile = fileManager.GetTempFileName(null);
            var tempFileWithExtension = fileManager.GetTempFileName("tmp");

            // Assert.
            Assert.AreEqual(@"z:\Temp\D98C2A44-FACF-4FD4-ACA8-EBBE3AD6A173", tempFile);
            Assert.AreEqual(@"z:\Temp\28FAEA09-F87A-42F4-B7AA-18079670C428.tmp", tempFileWithExtension);
            Mock.Assert(() => File.Create(@"z:\Temp\D98C2A44-FACF-4FD4-ACA8-EBBE3AD6A173"), Occurs.Once());
            Mock.Assert(() => File.Create(@"z:\Temp\28FAEA09-F87A-42F4-B7AA-18079670C428.tmp"), Occurs.Once());

            // Expected exceptions.
            Mock.Arrange(() => SystemOptionsInfo.GetSystemOptionsInfo()).Returns(() => null);
            TestsHelper.VerifyThrow<SystemOptionsLoadException>(() => fileManager.GetTempFileName(null));

            Mock.Arrange(() => systemOptions.TempDocumentUNC).Returns(string.Empty);
            Mock.Arrange(() => SystemOptionsInfo.GetSystemOptionsInfo()).Returns(systemOptions);
            TestsHelper.VerifyThrow<InvalidSystemOptionsException>(() => fileManager.GetTempFileName(null));
        }
コード例 #4
0
        protected override void Initialize()
        {
            theFileManager = FileManager.Get(this);
            theInputManager = InputManager.Get(this);
            theUtilityManager = UtilityManager.Get(this);
            theTileManager = TileManager.Get(this);
            theButtonManager = ButtonManager.Get(this);
            thePlayerManager = PlayerManager.Get(this);
            theScreenManager = ScreenManager.Get(this);
            theCameraManager = CameraManager.Get(this);
            theEnemyManager = EnemyManager.Get(this);
            theProjectileManager = ProjectileManager.Get(this);
            theCollisionManager = CollisionManager.Get(this);

            theScreenManager.WorldScreen = new MainMenu();

            Player.CreatePlayer("test", new Vector2(mScreenDimensions.X / 2.0f, mScreenDimensions.Y / 2.0f), Vector2.Zero);

            TileButton.Create(new FloorCopper(), Keys.E);
            TileButton.Create(new FloorMetal(), Keys.R);
            TileButton.Create(new HardWallCopper(), Keys.T);
            TileButton.Create(new HardWallMetal(), Keys.Y);
            TileButton.Create(new WallMetal(), Keys.Q);
            TileButton.Create(new CopperWall(), Keys.W);

            EnemyButton.Create(new EnemyTurret(), Keys.F);
             //   EnemyButton.Create("Turret_Gun", Keys.F);

            theTileManager.Load("Level_1.xml");

            base.Initialize();
        }
コード例 #5
0
        public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper codeGeneratorHelper)
        {
            AppendNodeComment(fileManager);

            // Initialization assignment
            this._children[0].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            // Generate loop start label
            string startLabel = codeGeneratorHelper.GenerateNextLabel();
            fileManager.Output.Append(Macro.Label(startLabel));

            // Check condition and jump out if false
            this._children[1].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);
            string outLabel = codeGeneratorHelper.GenerateNextLabel();
            fileManager.Output.Append(Macro.JumpOnFalse(outLabel));

            // Loop body
            this._children[3].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            // Altering assignment
            this._children[2].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            // Jump back to condition check
            fileManager.Output.Append(Macro.Jump(startLabel));

            // Generate loop end label
            fileManager.Output.Append(Macro.Label(outLabel));
        }
コード例 #6
0
ファイル: FileManagerTests.cs プロジェクト: biganth/Curt
        public void Setup()
        {
            _mockData = MockComponentProvider.CreateDataProvider();
            _mockFolder = MockComponentProvider.CreateFolderProvider(Constants.FOLDER_ValidFolderProviderType);
            _mockCache = MockComponentProvider.CreateDataCacheProvider();

            _folderManager = new Mock<IFolderManager>();
            _folderPermissionController = new Mock<IFolderPermissionController>();
            _portalController = new Mock<IPortalController>();
            _folderMappingController = new Mock<IFolderMappingController>();
            _globals = new Mock<IGlobals>();
            _cbo = new Mock<ICBO>();
            _pathUtils = new Mock<IPathUtils>();

            _fileManager = new FileManager();

            FolderManager.RegisterInstance(_folderManager.Object);
            FolderPermissionControllerWrapper.RegisterInstance(_folderPermissionController.Object);
            PortalControllerWrapper.RegisterInstance(_portalController.Object);
            FolderMappingController.RegisterInstance(_folderMappingController.Object);
            TestableGlobals.SetTestableInstance(_globals.Object);
            CBOWrapper.RegisterInstance(_cbo.Object);
            PathUtils.RegisterInstance(_pathUtils.Object);

            _mockFileManager = new Mock<FileManager> { CallBase = true };

            _folderInfo = new Mock<IFolderInfo>();
            _fileInfo = new Mock<IFileInfo>();
        }
コード例 #7
0
ファイル: CommandFactory.cs プロジェクト: gilind/workshop
        public static ICommand CreateCommand(FileManager manager, string commandLine)
        {
            manager.Parser.Parse(commandLine);

            switch (manager.Parser.CommandType)
            {
                case CommandTypes.NOP:
                    return new NOPCommand(manager.Parser.Operands);
                case CommandTypes.MD:
                    return new MDCommand(manager, manager.Parser.Operands);
                case CommandTypes.CD:
                    return new CDCommand(manager, manager.Parser.Operands);
                case CommandTypes.RD:
                    return new RDCommand(manager, manager.Parser.Operands);
                case CommandTypes.DELTREE:
                    return new DELTREECommand(manager, manager.Parser.Operands);
                case CommandTypes.MF:
                    return new MFCommand(manager, manager.Parser.Operands);
                case CommandTypes.MHL:
                    return new MHLCommand(manager, manager.Parser.Operands);
                case CommandTypes.MDL:
                    return new MDLCommand(manager, manager.Parser.Operands);
                case CommandTypes.DEL:
                    return new DELCommand(manager, manager.Parser.Operands);
                case CommandTypes.COPY:
                    return new COPYCommand(manager, manager.Parser.Operands);
                case CommandTypes.MOVE:
                    return new MOVECommand(manager, manager.Parser.Operands);
                case CommandTypes.DIR:
                    return new DIRCommand(manager, manager.Parser.Operands);
                default:
                    throw new UnknownCommandException(commandLine);
            }
        }
コード例 #8
0
ファイル: GardenGateway.cs プロジェクト: zrisher/SEGarden
        /// <summary>
        /// This only needs to be called from ComponentManager
        /// </summary>
        public override void Initialize() {
            SetDebugConditional();

            RunningOn = CurrentLocation;

            Files = new FileManager(); 
            Files.Initialize();  // logging depends on this

            Log.Info("Starting SE Garden v" + ModInfo.Version, "");

            Commands = new ChatManager();
            Commands.Initialize();

            Messages = new MessageManager();
            Messages.Initialize();

            if (ModInfo.DebugMode) {
                Specification.RunSpecTests(
                    "SEGarden",
                    new List<Specification>() {
                        new ItemCountAggregateDefinitionSpec(),
                        new ItemCountDefinitionSpec()
                    }
                );
            }

            base.Initialize();
        }
コード例 #9
0
ファイル: MainPage.xaml.cs プロジェクト: CJMarsland/xaml-sdk
		public MainPage()
		{
			InitializeComponent();

			this.fileManager = new FileManager(this.diagram);
			this.DataContext = new CarsGraphSource();
		}
コード例 #10
0
ファイル: MainPage.xaml.cs プロジェクト: CJMarsland/xaml-sdk
        public MainPage()
        {
            InitializeComponent();

            this.fileManager = new FileManager(this.diagram);
            this.toolBox.ItemsSource = new HierarchicalGalleryItemsCollection();
        }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // get id from query string
        int id = Convert.ToInt32(Request.QueryString["id"]);
        string type = Request.QueryString["type"];

        if (type == "doc")
        {
            // get document for id
            FileManager fm = new FileManager();
            Document d = fm.documentForID(id);
            Response.Write(Request.QueryString["id"]);

            Response.Clear();
            Response.Buffer = true;

            Response.ContentType = d.MIMEType;
            Response.BinaryWrite(d.fileContent);
        }
        else {
            ReportManager rm = new ReportManager();
           Report r = rm.ReportForID(id);
            Response.Write(Request.QueryString["id"]);

            Response.Clear();
            Response.Buffer = true;

            Response.ContentType = r.MIMEType;
            Response.BinaryWrite(r.FileContent);
        }
        Response.Flush();
        Response.End();
    }
コード例 #12
0
ファイル: SplashScreen.cs プロジェクト: Nerminkrus/Spel
        public override void LoadContent(ContentManager Content, InputManager inputManager)
        {
            base.LoadContent(Content, inputManager);
            if (font== null)
                font = content.Load<SpriteFont>("Font1");

            imageNumber = 0;
            fileManager = new FileManager();
            fade = new List<FadeAnimation>();
            images = new List<Texture2D>();

            fileManager.LoadContent("Load/Splash.cme", attributes, contents);

            for (int i = 0; i < attributes.Count; i++)
            {
                for (int j = 0; j < attributes[i].Count; j++)
                {
                    switch (attributes[i][j])
                    {
                        case "Image":
                            images.Add(content.Load<Texture2D>(contents[i][j]));
                            fade.Add(new FadeAnimation());
                            break;
                    }
                }
            }
            for (int i = 0; i < fade.Count; i++)
            {
                fade[i].LoadContent(content, images[i], "", new Vector2(80,60));
                fade[i].Scale = 1.25f;
                fade[i].IsActive = true;
            }
        }
コード例 #13
0
 public virtual void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper labelHelper)
 {
     foreach (var node in this._children)
     {
         if (node != null)
             node.GenerateCode(fileManager, symbolTable, labelHelper);
     }
 }
コード例 #14
0
ファイル: FileManagerTests.cs プロジェクト: PKRoma/WebGitNet
        public void GetResourceInfoTest_NoSpacesInUrl()
        {
            // Directory without spaces
            FileManager fm = new FileManager(_path);
            ResourceInfo info = fm.GetResourceInfo("mustard");

            Assert.AreEqual(ResourceType.Directory, info.Type);
        }
コード例 #15
0
ファイル: FileManagerFixture.cs プロジェクト: bnantz/NCS-V1-1
 public void Initialize()
 {
     SolutionConfigurationNode node = new SolutionConfigurationNode();
     ApplicationData applicationData = ApplicationData.FromCurrentAppDomain();
     appNode = new ApplicationConfigurationNode(applicationData.Name, applicationData);
     appNode.Load(null);
     fileManager = new FileManager(node);
 }
コード例 #16
0
        public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper labelHelper)
        {
            AppendNodeComment(fileManager);

            SyntaxTreeDeclarationNode declNode = symbolTable.GetDeclarationNodeLinkToSymbol(this.Identifier) as SyntaxTreeDeclarationNode;

            fileManager.Output.Append(Macro.LoadAccu(declNode.GetMemoryAddress()));
        }
コード例 #17
0
 static EmpDocument()
 {
     _fileManager = new FileManager<MondaiDocument>("1.1", new FileAccessor<MondaiDocument>[]
     {
         new EmpDocumentAccessor1_1(),
         new EmpDocumentAccessor1_0(),
     }, new EmpFileVersionReader());
 }
コード例 #18
0
ファイル: FileManager.cs プロジェクト: ulytea/Gladiator
 public static FileManager GetInst()
 {
     if(inst == null)
     {
         inst = new FileManager();
     }
     return inst;
 }
コード例 #19
0
        public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper codeGeneratorHelper)
        {
            AppendNodeComment(fileManager);

            this._children[0].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            fileManager.Output.Append(Macro.MonadicOperator(this._opCodeSymbol));
        }
コード例 #20
0
        public void ShouldThrowInvalidExtensionIfNotCSV()
        {
            //Arrange
            var fileManager = new FileManager();

            //Act && Assert
            Assert.Throws<InvalidExtensionException>(() => fileManager.ReadFile("filename.a"));
        }
コード例 #21
0
ファイル: FileManagerTests.cs プロジェクト: PKRoma/WebGitNet
        public void GetResourceInfoTest_SpacesInUrl()
        {
            // Directory with spaces
            FileManager fm = new FileManager(_path);
            ResourceInfo info = fm.GetResourceInfo("yellow%20pepper");

            Assert.AreEqual(ResourceType.Directory, info.Type);
        }
コード例 #22
0
ファイル: MainMenu.cs プロジェクト: CGHill/Hard-To-Find
        //Contructor
        public MainMenu()
        {
            //Open center screen
            this.StartPosition = FormStartPosition.CenterScreen;
            InitializeComponent();

            fileManager = new FileManager();
        }
コード例 #23
0
ファイル: Example.xaml.cs プロジェクト: nukolai/xaml-sdk
        public Example()
        {
            InitializeComponent();

            this.Loaded += this.OnLoaded;
            this.fileManager = new FileManager(this.diagram);
            this.DataContext = new MainViewModel();
        }
コード例 #24
0
        public SharedControllerBase()
        {
            var reposPath = WebConfigurationManager.AppSettings["RepositoriesPath"];

            this.fileManager = new FileManager(reposPath);

            this.breadCrumbs = new BreadCrumbTrail();
            ViewBag.BreadCrumbs = this.breadCrumbs;
        }
コード例 #25
0
ファイル: Command.cs プロジェクト: gilind/workshop
        public Command(FileManager manager, IPathInfo[] operands, int expectedOperandCount, CommandTypes commandType)
        {
            if (operands.Length != expectedOperandCount)
                throw new CommandFormatException(commandType.ToString());

            _manager = manager;
            _operands = operands;
            _commandType = commandType;
        }
コード例 #26
0
ファイル: FileExportForm.cs プロジェクト: CGHill/Hard-To-Find
        public FileExportForm(Form1 form1)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;

            this.form1 = form1;
            dbManager = new DatabaseManager();
            fileManager = new FileManager();
        }
コード例 #27
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            var bar = new FileManager();
            bar.Path = Services.Paths.Directory(Path);

            Controls.Add(bar.Service.Content(bar));
            Controls.Add(Service.Content(this));
        }
コード例 #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FileManager fm = new FileManager();

            GridView1.DataSource = fm.getDocuments("");
            GridView1.DataBind();
        }
    }
コード例 #29
0
        public ActionResult Events()
        {
            var fileManager = new FileManager
            {
                Width = 800,
                Height = 600,
                DisplayLanguage = "en"
            };
            fileManager.RootFolders.Add(new FileManagerRootFolder
            {
                Name = "Root Folder 1",
                Location = "~/App_Data/RootFolder1"
            });
            fileManager.RootFolders[0].AccessControls.Add(new FileManagerAccessControl
            {
                Path = @"\",
                AllowedPermissions = FileManagerPermissions.Full
            });

            //Attached event handlers should be static methods because they are raised out of the context of the host page.
            //If instance methods are attached (eg. an instance method of Page class), this would cause memory leaks.

            //Before Events which are fired before the action is started.
            //Use e.Cancel("message") within a before event handler for canceling the event and displaying a message to the user,
            //When an event is canceled, the corresponding action will be canceled and the after event will not be fired.
            fileManager.Expanding += FileManagerExpanding;
            fileManager.Listing += FileManagerListing;
            fileManager.Creating += FileManagerCreating;
            fileManager.Deleting += FileManagerDeleting;
            fileManager.Renaming += FileManagerRenaming;
            fileManager.Copying += FileManagerCopying;
            fileManager.Moving += FileManagerMoving;
            fileManager.Compressing += FileManagerCompressing;
            fileManager.Extracting += FileManagerExtracting;
            fileManager.Uploading += FileManagerUploading;
            fileManager.Downloading += FileManagerDownloading;
            fileManager.Previewing += FileManagerPreviewing;

            //After Events which are fired after the action is completed.
            fileManager.Expanded += FileManagerExpanded;
            fileManager.Listed += FileManagerListed;
            fileManager.Created += FileManagerCreated;
            fileManager.Deleted += FileManagerDeleted;
            fileManager.Renamed += FileManagerRenamed;
            fileManager.Copied += FileManagerCopied;
            fileManager.Moved += FileManagerMoved;
            fileManager.Compressed += FileManagerCompressed;
            fileManager.Extracted += FileManagerExtracted;
            fileManager.Uploaded += FileManagerUploaded;
            fileManager.Downloaded += FileManagerDownloaded;
            fileManager.Previewed += FileManagerPreviewed;
            fileManager.Failed += FileManagerFailed;

            return View(fileManager);
        }
コード例 #30
0
        public override void GenerateCode(FileManager fileManager, SymbolTable symbolTable, CodeGeneratorHelper codeGeneratorHelper)
        {
            AppendNodeComment(fileManager);
            this._children[1].GenerateCode(fileManager, symbolTable, codeGeneratorHelper);

            SyntaxTreeIdentNode identNode = this._children[0] as SyntaxTreeIdentNode;
            Symbol identSymbol = identNode.Identifier;
            SyntaxTreeDeclarationNode declNode = symbolTable.GetDeclarationNodeLinkToSymbol(identSymbol) as SyntaxTreeDeclarationNode;

            fileManager.Output.Append(Macro.StoreAccu(declNode.GetMemoryAddress()));
        }
コード例 #31
0
 private bool fileExist(string fileName, string type)
 {
     return(FileManager.fileExist(fileName, type));
 }
コード例 #32
0
        /// <summary>
        /// Opens grid with different options and checks how the open strategy is chosen
        /// </summary>
        /// <param name="filename">
        /// The filename.
        /// </param>
        /// <param name="theForm">
        /// The Form.
        /// </param>
        /// <returns>
        /// True on success
        /// </returns>
        private static bool GridOpenTest(string filename, ICallback theForm)
        {
            error = false;
            var numErrors = 0;

            if (!File.Exists(filename))
            {
                Error("Filename wasn't found: " + filename);
                return(false);
            }

            var gs = new GlobalSettings
            {
                GridProxyFormat        = tkGridProxyFormat.gpfTiffProxy,
                MinOverviewWidth       = 512,
                RasterOverviewCreation = tkRasterOverviewCreation.rocYes
            };

            var fm = new FileManager {
                GlobalCallback = theForm
            };

            Write("Working with " + filename);

            // first, let's check that overview creation/removal works correctly
            fm.ClearGdalOverviews(filename);
            var overviews = fm.HasGdalOverviews[filename];

            if (overviews)
            {
                Error("Failed to remove overviews.");
                numErrors++;
            }

            fm.BuildGdalOverviews(filename);
            overviews = fm.HasGdalOverviews[filename];
            if (!overviews)
            {
                Error("Failed to build overviews.");
                numErrors++;
            }

            fm.ClearGdalOverviews(filename);
            fm.RemoveProxyForGrid(filename);

            var hasValidProxyForGrid = fm.HasValidProxyForGrid[filename];

            Write("File has valid proxy for grid: " + hasValidProxyForGrid);

            for (var i = 0; i < 6; i++)
            {
                var strategy = tkFileOpenStrategy.fosAutoDetect;
                switch (i)
                {
                case 0:
                    Write("1. AUTO DETECT BEHAVIOR. OVERVIEWS MUST BE BUILT.");
                    strategy = tkFileOpenStrategy.fosAutoDetect;
                    break;

                case 1:
                    Write("2. EXPLICIT PROXY MODE. OVERVIEWS MUST BE IGNORED, PROXY CREATED.");
                    strategy = tkFileOpenStrategy.fosProxyForGrid;
                    break;

                case 2:
                    Write("3. AUTODETECT MODE. OVERVIEWS REMOVED. PROXY MUST BE REUSED.");
                    strategy = tkFileOpenStrategy.fosAutoDetect;
                    fm.ClearGdalOverviews(filename);
                    break;

                case 3:
                    Write("4. EXPLICIT DIRECT MODE; PROXY MUST BE IGNORED; OVERVIEWS CREATED.");
                    strategy = tkFileOpenStrategy.fosDirectGrid;
                    break;

                case 4:
                    Write("5. OVERVIEWS CREATION IS OFF; BUT FILE SIZE IS TOO SMALL FOR PROXY.");
                    strategy = tkFileOpenStrategy.fosAutoDetect;
                    fm.RemoveProxyForGrid(filename);
                    fm.ClearGdalOverviews(filename);
                    gs.MaxDirectGridSizeMb    = 100;
                    gs.RasterOverviewCreation = tkRasterOverviewCreation.rocNo;
                    break;

                case 5:
                    Write("6. OVERVIEWS CREATION IS OFF; BUT FILE SIZE IS LARGE ENOUGH FOR PROXY.");
                    strategy = tkFileOpenStrategy.fosAutoDetect;
                    gs.MaxDirectGridSizeMb = 1;
                    break;
                }

                Write("Gdal overviews: " + fm.HasGdalOverviews[filename]);
                Write("Grid proxy: " + fm.HasValidProxyForGrid[filename]);

                var img = fm.OpenRaster(filename, strategy, theForm);
                if (img == null)
                {
                    Error("Could not load raster");
                    numErrors++;
                    continue;
                }

                // Don't add the image to the map, because we're going to delete some helper files:
                img.Close();

                strategy             = fm.LastOpenStrategy;
                overviews            = fm.HasGdalOverviews[filename];
                hasValidProxyForGrid = fm.HasValidProxyForGrid[filename];
                Write("Last open strategy: " + strategy);
                Write("Gdal overviews: " + overviews);
                Write("Grid proxy: " + hasValidProxyForGrid);

                switch (i)
                {
                case 0:
                    if (!overviews)
                    {
                        Error("Failed to build overviews.");
                        numErrors++;
                    }

                    if (strategy != tkFileOpenStrategy.fosDirectGrid)
                    {
                        Error("Direct grid strategy was expected.");
                        numErrors++;
                    }

                    break;

                case 1:
                    if (!hasValidProxyForGrid)
                    {
                        Error("Failed to build proxy.");
                        numErrors++;
                    }

                    if (strategy != tkFileOpenStrategy.fosProxyForGrid)
                    {
                        Error("Proxy strategy was expected.");
                        numErrors++;
                    }

                    break;

                case 2:
                    if (overviews)
                    {
                        Error("Failed to remove overviews.");
                        numErrors++;
                    }

                    if (strategy != tkFileOpenStrategy.fosProxyForGrid)
                    {
                        Error("Proxy strategy was expected.");
                        numErrors++;
                    }

                    break;

                case 3:
                    if (strategy != tkFileOpenStrategy.fosDirectGrid)
                    {
                        Error("Direct grid strategy was expected.");
                        numErrors++;
                    }

                    if (!overviews)
                    {
                        Error("Failed to build overviews.");
                        numErrors++;
                    }

                    break;

                case 4:
                    if (overviews)
                    {
                        Error("No overviews is expected.");
                        numErrors++;
                    }

                    if (strategy != tkFileOpenStrategy.fosDirectGrid)
                    {
                        Error("Direct grid strategy was expected.");
                        numErrors++;
                    }

                    break;

                case 5:
                    if (!hasValidProxyForGrid)
                    {
                        Error("Failed to build proxy.");
                        numErrors++;
                    }

                    if (strategy != tkFileOpenStrategy.fosProxyForGrid)
                    {
                        Error("Proxy strategy was expected.");
                        numErrors++;
                    }

                    break;
                }
            }

            fm.ClearGdalOverviews(filename);
            fm.RemoveProxyForGrid(filename);

            overviews            = fm.HasGdalOverviews[filename];
            hasValidProxyForGrid = fm.HasValidProxyForGrid[filename];

            Write("Gdal overviews: " + fm.HasGdalOverviews[filename]);
            Write("Grid proxy: " + fm.HasValidProxyForGrid[filename]);
            if (hasValidProxyForGrid)
            {
                Error("Failed to remove proxy.");
                numErrors++;
            }

            if (overviews)
            {
                Error("Failed to remove overviews.");
                numErrors++;
            }

            Write(string.Format("This run had {0} errors", numErrors));
            return(numErrors == 0);
        }
コード例 #33
0
        internal virtual string GetHash(IFileInfo file)
        {
            var fileManager = new FileManager();

            return(fileManager.GetHash(file));
        }
コード例 #34
0
 public override void DoEvent(FileManager fm)
 {
     fm.dataHolder.AddDisk(DeviceId, DiskId, DiskName);
 }
コード例 #35
0
 public ManufacturersController(IManufacturerService serv)
 {
     manufacturerService = serv;
     fileManager         = new FileManager();
 }
コード例 #36
0
 public override IList <FileSystemItem> GetList(string selectedPath)
 {
     return(FileManager.ServerType == FtpServerType.PlayStation3
         ? FileManager.GetList(selectedPath)
         : base.GetList(selectedPath));
 }
コード例 #37
0
        private void ConnectCallback()
        {
            _doContentScanOn.Clear();
            Initialize();
            SetFavorites();
            var defaultPath = string.IsNullOrEmpty(Connection.Model.DefaultPath)
                                  ? GetDefaultDrive()
                                  : Connection.Model.DefaultPath;

            var drive = GetDriveFromPath(defaultPath);

            if (drive != null && FileManager.FolderExists(defaultPath))
            {
                PathCache.Add(drive, defaultPath);
            }
            Drive = drive ?? Drives.First();

            if (!IsContentScanTriggerAvailable)
            {
                return;
            }

            //HACK: for testing purposes only
            if (FileManager.ServerType == FtpServerType.IIS)
            {
                ScanFolders = new Dictionary <int, FsdScanPath>()
                {
                    { 1, new FsdScanPath
                      {
                          PathId    = 1,
                          Path      = "/Hdd1/Content/0000000000000000/",
                          ScanDepth = 2,
                          Drive     = "Hdd1"
                      } }
                };
                return;
            }

            var credentials = GetHttpLogin();
            var username    = credentials.UserName;
            var password    = credentials.Password;

            switch (GetScanFolders(username, password))
            {
            case HttpStatusCode.OK:
                if (!UserSettingsProvider.DisableFsdStatusPolling)
                {
                    _statusUpdateTimer.Elapsed += StatusUpdateTimerOnElapsed;
                    _statusUpdateTimer.Start();
                }
                return;

            case HttpStatusCode.Unauthorized:
                bool result;
                do
                {
                    var loginViewModel = Container.Resolve <ILoginViewModel>();
                    loginViewModel.Title    = Resx.Login;
                    loginViewModel.Message  = Resx.LoginToFreestyleDashHttpServer;
                    loginViewModel.Username = username;
                    loginViewModel.Password = password;
                    loginViewModel.IsRememberPasswordEnabled = true;

                    var login = WindowManager.ShowLoginDialog(loginViewModel);
                    if (login == null)
                    {
                        var answer = (DisableOption)WindowManager.ShowListInputDialog(Resx.DisableFsdContentScanTriggerTitle, Resx.DisableFsdContentScanTriggerMessage, DisableOption.None, GetDisableOptionList());
                        switch (answer)
                        {
                        case DisableOption.All:
                            UserSettingsProvider.FsdContentScanTrigger = FsdContentScanTrigger.Disabled;
                            break;

                        case DisableOption.Single:
                            Connection.IsHttpAccessDisabled = true;
                            break;
                        }
                        result = true;
                    }
                    else
                    {
                        username = login.Username;
                        password = login.Password;
                        var status = GetScanFolders(username, password);
                        if (status != HttpStatusCode.OK && status != HttpStatusCode.Unauthorized)
                        {
                            //TODO: handle different result then the previous one
                            result = true;
                        }
                        else
                        {
                            result = status != HttpStatusCode.Unauthorized;
                            if (result && login.RememberPassword == true)
                            {
                                Connection.HttpUsername = username;
                                Connection.HttpPassword = password;
                                EventAggregator.GetEvent <ConnectionDetailsChangedEvent>().Publish(new ConnectionDetailsChangedEventArgs(Connection));
                            }
                        }
                    }
                } while (!result);
                break;

            case HttpStatusCode.RequestTimeout:
            {
                var answer = (DisableOption)WindowManager.ShowListInputDialog(Resx.DisableFsdContentScanTriggerTitle, Resx.DisableFsdContentScanTriggerMessage, DisableOption.None, GetDisableOptionList());
                switch (answer)
                {
                case DisableOption.All:
                    UserSettingsProvider.FsdContentScanTrigger = FsdContentScanTrigger.Disabled;
                    break;

                case DisableOption.Single:
                    Connection.IsHttpAccessDisabled = true;
                    break;
                }
            }
            break;
            }
        }
コード例 #38
0
ファイル: UnitTest1.cs プロジェクト: adiradh1998/name-sorter
 public void WriteFileExceptionTest()
 {
     FileManager.writeNames(sortedTestList, "sorted-names-list.txt");
     Assert.Pass();
 }
コード例 #39
0
ファイル: Program.cs プロジェクト: oswaldor/Plume
        public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                System.Console.WriteLine("Usage: WrapperForFastLDATuning.exe <WorkerRole> <NumOfThreads> [MetricsType]");
                System.Console.WriteLine(DetailUsage);
                Environment.Exit(1);
            }

            if (!Enum.TryParse(args[0], true, out WorkerRole))
            {
                StatusMessage.Write("Unrecognized value for worker role. Exiting...");
                return;
            }

            if (!Int32.TryParse(args[1], out NumOfThreads))
            {
                StatusMessage.Write("Invalid value for number of threads. Exiting...");
                return;
            }

            if (WorkerRole == WorkerRoles.Metrics)
            {
                if (args.Length < 3)
                {
                    // By default we compute both intrinsic and extrinsic metrics.
                    MetricsType = ModelMetricTypes.Both;
                }
                else if (!Enum.TryParse(args[2], true, out MetricsType))
                {
                    StatusMessage.Write("Unrecognized value for metrics type. Exiting...");
                    return;
                }

                if (args.Length > 3)
                {
                    RunAllMetrics = args[3].Equals("all", StringComparison.OrdinalIgnoreCase);
                }
            }

            Initialize();

            // Load default LDA config as seed
            var defaultLDAConfig = LoadLDAConfig(DefaultModelConfigFile);

            // Get the folders of parameter range files and training config files.
            // Examples of folder structure: d:\ModelRepository\TuneLDAParameters\RangesOfParams
            //                               d:\ModelRepository\TuneLDAParameters\LDALearningConfigFiles
            string folderOfParamRangeFiles     = Path.Combine(ModelRepositoryPath, ProjResourceSubFolder, RangeOfParamsSubFolder);
            string folderOfTrainingConfigFiles = Path.Combine(ModelRepositoryPath, ProjResourceSubFolder, LDALearningConfigsSubFolder);

            List <string> listOfLDAConfigFilesForFeaturization = new List <string>();
            List <string> listOfLDAConfigFilesForTest          = new List <string>();

            // Generate multiple LDA configs for featurization, training and test.
            List <string> listOfLDAConfigFilesForTrain;

            if (NeedLoadLDAConfigFiles)
            {
                listOfLDAConfigFilesForTrain =
                    LDAConfigFileGenerator.LoadLDAConfigFiles(ModelRepositoryPath,
                                                              TrainingSampleName,
                                                              defaultLDAConfig,
                                                              SourceFolderOfLDAConfigFiles,
                                                              folderOfTrainingConfigFiles,
                                                              ref listOfLDAConfigFilesForFeaturization,
                                                              ref listOfLDAConfigFilesForTest);
            }
            else if (NeedLoadLDAParameterTable)
            {
                listOfLDAConfigFilesForTrain =
                    LDAConfigFileGenerator.LoadLDAParameterTable(ModelRepositoryPath,
                                                                 TrainingSampleName,
                                                                 defaultLDAConfig,
                                                                 LDAParameterTablePath,
                                                                 folderOfTrainingConfigFiles,
                                                                 ref listOfLDAConfigFilesForFeaturization,
                                                                 ref listOfLDAConfigFilesForTest);
            }
            else
            {
                listOfLDAConfigFilesForTrain =
                    LDAConfigFileGenerator.GenerateLDAConfigFiles(ModelRepositoryPath,
                                                                  folderOfParamRangeFiles,
                                                                  TrainingSampleName,
                                                                  defaultLDAConfig,
                                                                  folderOfTrainingConfigFiles,
                                                                  ref listOfLDAConfigFilesForFeaturization,
                                                                  ref listOfLDAConfigFilesForTest);
            }

            switch (WorkerRole)
            {
            case WorkerRoles.Training:
                FeaturizeSample(listOfLDAConfigFilesForFeaturization, TrainingSampleName, NumOfThreads);
                if (NeedCopyToRemote)
                {
                    CopyVocabularies(listOfLDAConfigFilesForTest.First(), RemoteModelRepositoryPath);

                    // Start a thread that:
                    // 1). monitors model directory;
                    // 2). copies models to remote model repository when they are done;
                    // 3). deletes them once copy is successful.
                    Thread newThread = new Thread(Program.CopyModels);
                    newThread.Start(NeedDeleteFromLocal);
                }
                TrainLDAModels(listOfLDAConfigFilesForTrain, listOfLDAConfigFilesForTest, NumOfThreads);
                if (NeedCopyToRemote)
                {
                    WaitForCopyThread();
                }
                break;

            case WorkerRoles.Metrics:
                if (RunAllMetrics)
                {
                    long numOfModelsMeasured = 0;
                    ComputeMetrics(listOfLDAConfigFilesForTest, NumOfThreads, MetricsType, ref numOfModelsMeasured);
                    break;
                }

                // Get common parent of individual model directories.
                string commonParentOfModelDirectories = FileManager.GetGrandparentOfFilePath(listOfLDAConfigFilesForTest.First());
                ComputeMetrics(commonParentOfModelDirectories, NumOfThreads, MetricsType);
                break;

            default:
                return;
            }

            StatusMessage.Write("Done!");
        }
コード例 #40
0
 public static void MyClassCleanup()
 {
     FileManager.DeleteTestClasses();
 }
コード例 #41
0
ファイル: UnitTest1.cs プロジェクト: adiradh1998/name-sorter
        public void ReadFileTest()
        {
            List <Name> result = FileManager.readFile(filepath);

            Assert.That(result, Has.Exactly(11).Items);
        }
コード例 #42
0
        private void PrintBtn_OnClick(object sender, RoutedEventArgs e)
        {
            var invoice = InvoiceDg.SelectedItem as Invoice;

            if (invoice == null)
            {
                MessageBox.Show("Select bill", "Inforation", MessageBoxButton.OK,
                                MessageBoxImage.Information);
                return;
            }
            string[] headers      = { "Medicine", "Unit price", "Quantity", "THT", "TTC" };
            float[]  columnWidths = { 200f, 200, 200, 200f, 140f };
//            Store store;
//            using (var db = new ObjectContext())
//            {
//
//                store = db.Stores.FirstOrDefault();
//            }
//            if (store == null)
//            {
//                MessageBox.Show("Record your store's information");
//                return;
//            }
            Document     doc    = new Document(PageSize.A4, 15, 15, 15, 15);
            MemoryStream stream = new MemoryStream();

            PdfWriter.GetInstance(doc, stream).CloseStream = false;
            doc.Open();

            PdfPTable tblHeader = new PdfPTable(3);

            tblHeader.WidthPercentage = 100;

            PdfPCell leftCell = new PdfPCell();

            leftCell.Border = 0;

            iTextSharp.text.Paragraph paragraph = new iTextSharp.text.Paragraph($"Maaz Medical Store Bill",
                                                                                FontFactory.GetFont("Calibri", 18, BaseColor.BLACK));

            paragraph.Alignment = Element.ALIGN_LEFT;
            leftCell.AddElement(paragraph);
            leftCell.AddElement(new Paragraph("N°: " + invoice.InvoiceNumber));
            leftCell.AddElement(new Paragraph("Date: " + invoice.CreatedAt));
            PdfPCell rightCell = new PdfPCell();

            rightCell.Border = 0;
//            var prg = new Paragraph(store.StoreName,
//                FontFactory.GetFont("Calibri", 12, BaseColor.BLACK));
//            rightCell.AddElement(prg);
//            prg = new Paragraph("NRC: " + store.NRC,
//                FontFactory.GetFont("Calibri", 12, BaseColor.BLACK));
//            rightCell.AddElement(prg);
//            prg = new Paragraph("NIF: " + store.NIF,
//                FontFactory.GetFont("Calibri", 12, BaseColor.BLACK));
//            rightCell.AddElement(prg);
//            prg = new Paragraph(store.City,
//                FontFactory.GetFont("Calibri", 12, BaseColor.BLACK));
//            rightCell.AddElement(prg);
            PdfPCell emptyCell = new PdfPCell();

            emptyCell.Border = 0;
            tblHeader.AddCell(leftCell);
            tblHeader.AddCell(emptyCell);
            tblHeader.AddCell(rightCell);
            doc.Add(tblHeader);

            iTextSharp.text.Paragraph p = new iTextSharp.text.Paragraph(new Chunk(new iTextSharp.text.pdf.draw.LineSeparator(0.0F, 100.0F, BaseColor.BLACK, Element.ALIGN_LEFT, 1)));
            // call the below to add the line when required.
            doc.Add(p);
            doc.Add(new Chunk(Environment.NewLine));
            PdfPTable table = new PdfPTable(2);

            table.WidthPercentage = 90;
            var bodyLeftCell = new PdfPCell();

            bodyLeftCell.Border = 0;
            bodyLeftCell.AddElement(new Paragraph("Patient:" + invoice.Patient.Name));
            bodyLeftCell.AddElement(new Paragraph("Phone No:" + invoice.Patient.Tel));
            bodyLeftCell.AddElement(new Paragraph("Address:" + invoice.Patient.Address));
            bodyLeftCell.AddElement(new Paragraph("City:" + invoice.Patient.City));

            var bodyRightCell = new PdfPCell();

            bodyRightCell.Border = 0;
            table.AddCell(bodyLeftCell);
            // table.AddCell(emptyCell);
            table.AddCell(bodyRightCell);
            table.DefaultCell.Border = 0;;

            doc.Add(table);
            doc.Add(new Chunk(Environment.NewLine));
            p.Alignment = Element.ALIGN_CENTER;


            doc.Add(new Chunk(Environment.NewLine));
            doc.Add(new Chunk(Environment.NewLine));
            PdfPTable pTable = new PdfPTable(headers.Length);

            pTable.WidthPercentage = 100;
            pTable.SetWidths(columnWidths);
            foreach (string t in headers)
            {
                var cell = new PdfPCell(new Phrase(t, FontFactory.GetFont("Calibri", 14, BaseColor.BLACK)))
                {
                    HorizontalAlignment = Element.ALIGN_CENTER,
                    BackgroundColor     = BaseColor.LIGHT_GRAY
                };


                pTable.AddCell(cell);
            }
            using (var db = new ObjectContext())
            {
                foreach (var invoiceItem in db.InvoiceItems.Include(x => x.Medicine).Where(x => x.InvoiceId == invoice.Id))
                {
                    pTable.AddCell(ItextSharpHelper.Cell(invoiceItem.Medicine.Name, BaseColor.BLACK));
                    pTable.AddCell(ItextSharpHelper.Cell(invoiceItem.UnitPrice.ToString("F"), BaseColor.BLACK));
                    pTable.AddCell(ItextSharpHelper.Cell(invoiceItem.Qnt.ToString(), BaseColor.BLACK));
                    pTable.AddCell(ItextSharpHelper.Cell(invoiceItem.THT.ToString(CultureInfo.InvariantCulture), BaseColor.BLACK));
                    pTable.AddCell(ItextSharpHelper.Cell(invoiceItem.TTC.ToString(CultureInfo.InvariantCulture), BaseColor.BLACK));
                }
            }
            doc.Add(p);
            doc.Add(new Chunk(Environment.NewLine));

            doc.Add(pTable);
            doc.Add(new Chunk(Environment.NewLine));

            doc.Add(new Chunk(Environment.NewLine));
            PdfPTable table2 = new PdfPTable(3);

            table2.WidthPercentage = 90;

            table2.AddCell(ItextSharpHelper.LeftCell("", BaseColor.DARK_GRAY));

            table2.AddCell(ItextSharpHelper.LeftCell("", BaseColor.DARK_GRAY));
            var cell1 = new PdfPCell();
            var tt    = new Paragraph("TOTAL: " + invoice.TTC.ToString(CultureInfo.InvariantCulture) + " PKR.",
                                      FontFactory.GetFont("Calibri", 16, BaseColor.BLACK));
            var pp  = new Paragraph("Paid Amount: " + invoice.PaidAmmount.ToString(CultureInfo.InvariantCulture) + " PKR.", FontFactory.GetFont("Calibri", 12, BaseColor.BLACK));
            var ppp = new Paragraph("Rest: " + invoice.Left.ToString(CultureInfo.InvariantCulture) + " PKR.", FontFactory.GetFont("Calibri", 12, BaseColor.BLACK));

            cell1.Border = 0;
            cell1.AddElement(tt);
            cell1.AddElement(pp);
            cell1.AddElement(ppp);
            table2.AddCell(cell1);
            table2.DefaultCell.Border = 0;;

            doc.Add(table2);
            doc.Close();
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.DefaultExt = ".pdf";
            dlg.Filter     = "pdf documents (.pdf)|*.pdf";
            if (dlg.ShowDialog() != true)
            {
                return;
            }

            string filename = dlg.FileName;

            FileManager.SavePdfFile(stream, filename);
        }
コード例 #43
0
        public void Move(string moveToName, string moveToPath, string moveFromFullPath)
        {
            var moveToFullPath = CreateFilePath(moveToName, moveToPath);

            FileManager.Move(moveFromFullPath, moveToFullPath);
        }
コード例 #44
0
 public Stream GetFile(string name, string path)
 {
     return(FileManager.GetFile(CreateFilePath(name, path)));
 }
コード例 #45
0
ファイル: Designer.cs プロジェクト: ajupov/conceptual-graphs
 public void SaveFile(string fileName, FileExtensionType type)
 {
     FileManager.Save(fileName, Document.GetDocument(), type);
 }
コード例 #46
0
        private void Page_Load(object sender, EventArgs e)
        {
            //PortalSettings ps = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
            PortalSettings ps = Utility.GetPortalSettings(PortalId);

            Response.ContentType     = "text/xml";
            Response.ContentEncoding = Encoding.UTF8;

            var sw = new StringWriter(CultureInfo.InvariantCulture);
            var wr = new XmlTextWriter(sw);

            wr.WriteStartElement("rss");
            wr.WriteAttributeString("version", "2.0");
            wr.WriteAttributeString("xmlns:wfw", "http://wellformedweb.org/CommentAPI/");
            wr.WriteAttributeString("xmlns:slash", "http://purl.org/rss/1.0/modules/slash/");
            wr.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/");
            wr.WriteAttributeString("xmlns:trackback", "http://madskills.com/public/xml/rss/module/trackback/");

            wr.WriteStartElement("channel");
            wr.WriteElementString("title", ps.PortalName);
            if (ps.PortalAlias.HTTPAlias.IndexOf("http://", StringComparison.OrdinalIgnoreCase) == -1)
            {
                wr.WriteElementString("link", "http://" + ps.PortalAlias.HTTPAlias);
            }
            else
            {
                wr.WriteElementString("link", ps.PortalAlias.HTTPAlias);
            }
            wr.WriteElementString("description", "RSS Feed for " + ps.PortalName);
            wr.WriteElementString("ttl", "120");

            //TODO: look into options for how to display the "Title" of the RSS feed
            var dt = new DataTable {
                Locale = CultureInfo.InvariantCulture
            };

            if (DisplayType == "ItemListing" || DisplayType == null)
            {
                dt = ItemId == -1 ? DataProvider.Instance().GetMostRecent(ItemTypeId, NumberOfItems, PortalId) : DataProvider.Instance().GetMostRecentByCategoryId(ItemId, ItemTypeId, NumberOfItems, PortalId);
            }
            else if (DisplayType == "CategoryFeature")
            {
                DataSet ds = DataProvider.Instance().GetParentItems(ItemId, PortalId, RelationshipTypeId);
                dt = ds.Tables[0];
            }
            else if (DisplayType == "TagFeed")
            {
                if (AllowTags && _tagQuery != null && _tagQuery.Count > 0)
                {
                    string tagCacheKey = Utility.CacheKeyPublishTag + PortalId + ItemTypeId.ToString(CultureInfo.InvariantCulture) + _qsTags;
                    // +"PageId";
                    dt = DataCache.GetCache(tagCacheKey) as DataTable;
                    if (dt == null)
                    {
                        //ToDo: we need to make getitemsfromtags use the numberofitems value
                        dt = Tag.GetItemsFromTags(PortalId, _tagQuery);
                        //TODO: we should sort the tags
                        //TODO: should we set a 5 minute cache on RSS?
                        DataCache.SetCache(tagCacheKey, dt, DateTime.Now.AddMinutes(5));
                        Utility.AddCacheKey(tagCacheKey, PortalId);
                    }
                }
            }
            if (dt != null)
            {
                DataView dv = dt.DefaultView;
                if (dv.Table.Columns.IndexOf("dateColumn") > 0)
                {
                    dv.Table.Columns.Add("dateColumn", typeof(DateTime));
                    foreach (DataRowView dr in dv)
                    {
                        dr["dateColumn"] = Convert.ToDateTime(dr["startdate"]);
                    }

                    dv.Sort = " dateColumn desc ";
                }

                for (int i = 0; i < dv.Count; i++)
                {
                    //DataRow r = dt.Rows[i];
                    DataRow r = dv[i].Row;
                    wr.WriteStartElement("item");

                    //				wr.WriteElementString("slash:comments", objArticle.CommentCount.ToString());
                    //                wr.WriteElementString("wfw:commentRss", "http://" & Request.Url.Host & Me.ResolveUrl("RssComments.aspx?TabID=" & m_tabID & "&ModuleID=" & m_moduleID & "&ArticleID=" & objArticle.ArticleID.ToString()).Replace(" ", "%20"));
                    //                wr.WriteElementString("trackback:ping", "http://" & Request.Url.Host & Me.ResolveUrl("Tracking/Trackback.aspx?ArticleID=" & objArticle.ArticleID.ToString() & "&PortalID=" & _portalSettings.PortalId.ToString() & "&TabID=" & _portalSettings.ActiveTab.TabID.ToString()).Replace(" ", "%20"));

                    string title       = String.Empty,
                           description = String.Empty,
                           childItemId = String.Empty,
                           thumbnail   = String.Empty,
                           guid        = String.Empty,
                           author      = string.Empty;

                    DateTime startDate = DateTime.MinValue;

                    if (DisplayType == null || string.Equals(DisplayType, "ItemListing", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(DisplayType, "TagFeed", StringComparison.OrdinalIgnoreCase))
                    {
                        title       = r["ChildName"].ToString();
                        description = r["ChildDescription"].ToString();
                        childItemId = r["ChilditemId"].ToString();
                        guid        = r["itemVersionIdentifier"].ToString();
                        startDate   = (DateTime)r["StartDate"];
                        thumbnail   = r["Thumbnail"].ToString();
                        author      = r["Author"].ToString();

                        //UserController uc = new UserController();
                        //UserInfo ui = uc.GetUser(PortalId, Convert.ToInt32(r["AuthorUserId"].ToString()));
                        //if(ui!=null)
                        //author = ui.DisplayName;
                    }
                    else if (string.Equals(DisplayType, "CategoryFeature", StringComparison.OrdinalIgnoreCase))
                    {
                        title       = r["Name"].ToString();
                        description = r["Description"].ToString();
                        childItemId = r["itemId"].ToString();
                        guid        = r["itemVersionIdentifier"].ToString();
                        startDate   = (DateTime)r["StartDate"];
                        thumbnail   = r["Thumbnail"].ToString();
                        author      = r["Author"].ToString();

                        //UserController uc = new UserController();
                        //UserInfo ui = uc.GetUser(PortalId, Convert.ToInt32(r["AuthorUserId"].ToString()));
                        //if (ui != null)
                        //author = ui.DisplayName;
                    }

                    if (!Uri.IsWellFormedUriString(thumbnail, UriKind.Absolute) && thumbnail != string.Empty)
                    {
                        var thumnailLink = new Uri(Request.Url, ps.HomeDirectory + thumbnail);
                        thumbnail = thumnailLink.ToString();
                    }

                    wr.WriteElementString("title", title);

                    //if the item isn't disabled add the link
                    if (!Utility.IsDisabled(Convert.ToInt32(childItemId, CultureInfo.InvariantCulture), PortalId))
                    {
                        wr.WriteElementString("link", Utility.GetItemLinkUrl(childItemId, PortalId));
                    }

                    //wr.WriteElementString("description", Utility.StripTags(this.Server.HtmlDecode(description)));
                    description = Utility.ReplaceTokens(description);
                    wr.WriteElementString("description", Server.HtmlDecode(description));
                    //wr.WriteElementString("author", Utility.StripTags(this.Server.HtmlDecode(author)));
                    wr.WriteElementString("thumbnail", thumbnail);

                    wr.WriteElementString("dc:creator", author);

                    wr.WriteElementString("pubDate", startDate.ToUniversalTime().ToString("r", CultureInfo.InvariantCulture));

                    //file attachment enclosure
                    ItemVersionSetting attachmentSetting = ItemVersionSetting.GetItemVersionSetting(Convert.ToInt32(r["ItemVersionId"].ToString()), "ArticleSettings", "ArticleAttachment", PortalId);
                    if (attachmentSetting != null)
                    {
                        if (attachmentSetting.PropertyValue.Length > 7)
                        {
                            //var fileController = new FileController();
                            var fileManager = new FileManager();
                            int fileId      = Convert.ToInt32(attachmentSetting.PropertyValue.Substring(7));

                            var    fi      = fileManager.GetFile(fileId); //fileController.GetFileById(fileId, PortalId);
                            string fileurl = "http://" + PortalSettings.PortalAlias.HTTPAlias + PortalSettings.HomeDirectory + fi.Folder + fi.FileName;
                            wr.WriteStartElement("enclosure");
                            wr.WriteAttributeString("url", fileurl);
                            wr.WriteAttributeString("length", fi.Size.ToString());
                            wr.WriteAttributeString("type", fi.ContentType);
                            wr.WriteEndElement();
                        }
                    }

                    wr.WriteStartElement("guid");

                    wr.WriteAttributeString("isPermaLink", "false");

                    wr.WriteString(guid);
                    //wr.WriteString(itemVersionId);


                    wr.WriteEndElement();

                    wr.WriteEndElement();
                }
            }

            wr.WriteEndElement();
            wr.WriteEndElement();
            Response.Write(sw.ToString());
        }
コード例 #47
0
 public override void Refresh(bool refreshCache, Action callback)
 {
     FileManager.ClearListingCache();
     base.Refresh(refreshCache, callback);
 }
コード例 #48
0
 static GeoSource()
 {
     _manager = new FileManager();
 }
コード例 #49
0
 public void Shutdown()
 {
     FileManager.Shutdown();
     CloseCommand.Execute();
 }
コード例 #50
0
    private void Start()
    {
        contacts = FileManager <Contacts> .Load(Constant.kFileName);

        LoadData();
    }
コード例 #51
0
 private ResumeCapability Connect()
 {
     return(FileManager.Connect(Connection.Model, true, OnGetListingDataReceived));
 }
コード例 #52
0
ファイル: Contact.cs プロジェクト: stijnbernards/Examen
        public override void Init(HttpListenerContext ctx = null)
        {
            HTMLFile baseFile  = FileManager.LoadFile("base.html");
            HTMLFile panelFile = FileManager.LoadFile("blocks/panel.html");

            panelFile.AddData(new Dictionary <string, object>()
            {
                { "header", "Contact" },
                { "form", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus consequat quam quis tellus mattis, ac malesuada felis laoreet. Curabitur velit lorem, ullamcorper non commodo ac, tristique id ipsum. Vestibulum posuere est vitae arcu auctor, eu dapibus felis aliquet. Nullam pellentesque turpis in dui scelerisque condimentum. Donec rhoncus eu eros vel eleifend. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed tincidunt elit a sagittis pharetra.<br> Vestibulum et tempor arcu, nec hendrerit tortor. In hac habitasse platea dictumst. Pellentesque et mi id diam finibus volutpat at in sapien. Quisque gravida neque sed lacus congue volutpat.<br> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam tempus magna sed nisl dictum, vel semper lectus euismod. Integer in enim a quam feugiat imperdiet sed nec urna. Sed accumsan vulputate lectus, a tincidunt nisl dapibus sed." + FileManager.LoadFile("blocks/contact.html").GetData() }
            });

            baseFile.AddData(new Dictionary <string, object>()
            {
                //{"car_1", new string[] {"hoi", DataSet.ToHTMLForm(Dataset)}}
                { "register", GetUrl("register") },
                { "login", GetUrl("login") },
                { "content", panelFile.GetData() }
            });

            if (ctx.Request.Cookies["guid"] != null &&
                Sessions.sessions.ContainsKey(
                    (from s in Sessions.sessions where s.Value.Item2 == ctx.Request.Cookies["guid"].Value select s.Key)
                    .First()))
            {
                baseFile.AddData(new Dictionary <string, object>()
                {
                    { "account", GetUrl("myaccount") }
                });
            }

            LoadBootStrap();
            this.AddCss("styles.css");

            this.response    = baseFile.GetData();
            this.ContentType = Constants.CONTENT_HTML;
        }
コード例 #53
0
 public DiskAddEv(MyDisk d, FileManager fm)
 {
     DeviceId = fm.dataHolder.GetDevice(d).Id;
     DiskId   = d.Id;
     DiskName = d.Name;
 }
コード例 #54
0
 public MainWindowViewModel(FileManager fileManager)
 {
     _fileManager = fileManager;
     Files        = new ObservableCollection <FileViewModel>();
     LogMessages  = new ObservableCollection <LogMessageViewModel>();
 }
コード例 #55
0
ファイル: Program.cs プロジェクト: NileshMagan/StreamWatcher
        static void Main(string[] args)
        {
            // Extract constants from app.config
            string targetUrl                = ConfigurationManager.AppSettings["targetUrl"];
            string browserLocation          = ConfigurationManager.AppSettings["browserLocation"];
            string browserComparisonEnabled = ConfigurationManager.AppSettings["browserComparisonEnabled"];
            string browserNameComparison    = ConfigurationManager.AppSettings["browserNameComparison"];
            string propertiesFileName       = ConfigurationManager.AppSettings["propertiesFileName"];

            // Get path to chromium
            string currentDirectory  = Directory.GetCurrentDirectory();
            string chromiumDirectory = Path.Combine(currentDirectory, browserLocation);

            // Create file information
            string propertiiesFilePath = Path.Combine(currentDirectory, propertiesFileName);

            FileManager.CreateFile(propertiiesFilePath);

            // Launch target url
            Console.WriteLine("Launching myDahlia's stream");
            Process process = OpenUrl(chromiumDirectory, targetUrl);

            // Store process information
            ProcessProperties propertiesToStore = new ProcessProperties {
                processId   = process.Id,
                processName = process.ProcessName
            };

            FileManager.WritePropertiesIntoFile(propertiesToStore, propertiiesFilePath);

            while (true)
            {
                ConsoleKeyInfo result = Console.ReadKey(true);
                if (result.Key == ConsoleKey.Escape)
                {
                    break;
                }
                {
                    // Read properties from file
                    // Create file information
                    string            propertiiesFilePath2 = Path.Combine(currentDirectory, propertiesFileName);
                    ProcessProperties processProperties    = FileManager.ReadPropertiesFromFile(propertiiesFilePath2);

                    // Get process information back and validate it
                    Process browserProcess = Process.GetProcessById(processProperties.processId);
                    if (browserComparisonEnabled.Equals("true"))
                    {
                        // Validate by checking if the process name is the same as the one found earlier
                        if (browserNameComparison.Equals(processProperties.processName))
                        {
                            browserProcess.Kill(true);
                            Console.WriteLine("Killed process: " + processProperties.processName);
                        }
                    }
                    else
                    {
                        browserProcess.Kill(true);
                        Console.WriteLine("Killed process: " + processProperties.processName);
                    }
                }
            }
        }
コード例 #56
0
        private async void Player_MediaEnded(MediaPlayer sender, object args)
        {
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                PlayingSound.Repetitions--;

                if (PlayingSound.Repetitions <= 0)
                {
                    await RemovePlayingSoundAsync();
                }
                else
                {
                    await FileManager.SetRepetitionsOfPlayingSoundAsync(PlayingSound.Uuid, PlayingSound.Repetitions);
                }

                if (PlayingSound.Repetitions >= 0 && PlayingSound.MediaPlayer != null)
                {
                    if (PlayingSound.Sounds.Count > 1) // Multiple Sounds in the list
                    {
                        // If randomly is true, shuffle sounds
                        if (PlayingSound.Randomly)
                        {
                            Random random = new Random();

                            // Copy old lists and use them to be able to remove entries
                            MediaPlaybackList oldMediaPlaybackList = new MediaPlaybackList();
                            List <Sound> oldSoundsList             = new List <Sound>();

                            foreach (var item in ((MediaPlaybackList)PlayingSound.MediaPlayer.Source).Items)
                            {
                                oldMediaPlaybackList.Items.Add(item);
                            }
                            foreach (var item in PlayingSound.Sounds)
                            {
                                oldSoundsList.Add(item);
                            }

                            MediaPlaybackList newMediaPlaybackList = new MediaPlaybackList();
                            List <Sound> newSoundsList             = new List <Sound>();

                            // Add items to new lists in random order
                            for (int i = 0; i < PlayingSound.Sounds.Count; i++)
                            {
                                int randomNumber = random.Next(oldSoundsList.Count);
                                newSoundsList.Add(oldSoundsList.ElementAt(randomNumber));
                                newMediaPlaybackList.Items.Add(oldMediaPlaybackList.Items.ElementAt(randomNumber));

                                oldSoundsList.RemoveAt(randomNumber);
                                oldMediaPlaybackList.Items.RemoveAt(randomNumber);
                            }

                            // Replace the old lists with the new ones
                            ((MediaPlaybackList)PlayingSound.MediaPlayer.Source).Items.Clear();
                            foreach (var item in newMediaPlaybackList.Items)
                            {
                                ((MediaPlaybackList)PlayingSound.MediaPlayer.Source).Items.Add(item);
                            }

                            PlayingSound.Sounds.Clear();
                            foreach (var item in newSoundsList)
                            {
                                PlayingSound.Sounds.Add(item);
                            }

                            // Update PlayingSound in the Database
                            await FileManager.SetSoundsListOfPlayingSoundAsync(PlayingSound.Uuid, newSoundsList);
                        }

                        ((MediaPlaybackList)PlayingSound.MediaPlayer.Source).MoveTo(0);
                        await FileManager.SetCurrentOfPlayingSoundAsync(PlayingSound.Uuid, 0);
                    }
                    PlayingSound.MediaPlayer.Play();
                }
            });
        }
コード例 #57
0
        /// <summary>
        /// Analyzes raster file, displaying possible open strategies
        /// </summary>
        /// <param name="filename">
        /// The path.
        /// </param>
        /// <param name="theForm">
        /// The the Form.
        /// </param>
        /// <returns>
        /// True on success
        /// </returns>
        private static bool AnalyzeFiles(string filename, Form1 theForm)
        {
            error = false;

            // running check for all files with such extensions
            var manager = new FileManager();

            var count = 0;

            // getting list of extension for images and grids
            var img    = new Image();
            var filter = img.CdlgFilter.Replace("*.", string.Empty);
            var dict   = filter.Split(new[] { '|' }).ToDictionary(item => item);

            var grid = new Grid();

            filter = grid.CdlgFilter.Replace("*.", string.Empty);
            var dict2 = filter.Split(new[] { '|' }).ToDictionary(item => item);

            dict = dict.Keys.Union(dict2.Keys).ToDictionary(item => item);

            var notSupportedExtensions = new HashSet <string>();

            if (File.Exists(filename))
            {
                var extension = Path.GetExtension(filename);
                if (extension != null)
                {
                    var ext = extension.Substring(1).ToLower();

                    if (dict.ContainsKey(ext))
                    {
                        Write(string.Format("{0}. Filename: {1}", count++, Path.GetFileName(filename)));
                        Write(string.Format("Is supported: {0}", manager.IsSupported[filename]));
                        Write(string.Format("Is RGB image: {0}", manager.IsRgbImage[filename]));
                        Write(string.Format("Is grid: {0}", manager.IsGrid[filename]));
                        Write(string.Format("DEFAULT OPEN STRATEGY: {0}", manager.OpenStrategy[filename]));
                        Write(
                            string.Format(
                                "Can open as RGB image: {0}",
                                manager.CanOpenAs[filename, tkFileOpenStrategy.fosRgbImage]));
                        Write(
                            string.Format(
                                "Can open as direct grid: {0}",
                                manager.CanOpenAs[filename, tkFileOpenStrategy.fosDirectGrid]));
                        Write(
                            string.Format(
                                "Can open as proxy grid: {0}",
                                manager.CanOpenAs[filename, tkFileOpenStrategy.fosProxyForGrid]));
                        Write(string.Format("------------------------------------------"));

                        Write(string.Format(string.Empty));

                        // TODO: try to open with these strategies
                        var rst = manager.OpenRaster(filename, tkFileOpenStrategy.fosAutoDetect, theForm);
                        if (rst != null)
                        {
                            MyAxMap.Clear();
                            MyAxMap.Tiles.Visible = false;
                            if (MyAxMap.AddLayer(rst, true) == -1)
                            {
                                Error("Cannot add the raster file to the map");
                            }
                        }
                        else
                        {
                            Error("Cannot load the raster file");
                        }
                    }
                    else
                    {
                        if (!notSupportedExtensions.Contains(ext))
                        {
                            notSupportedExtensions.Add(ext);
                        }
                    }
                }
            }
            else
            {
                Error(filename + " does not exists.");
            }

            if (notSupportedExtensions.Any())
            {
                Write("The following extensions, are among common dialog filters:");
                foreach (var extension in notSupportedExtensions.ToList())
                {
                    Write(extension);
                }
            }

            return(!error);
        }
コード例 #58
0
        public IEnumerable <FileManager> AddFiles([FromBody] FileManager fileManager)
        {
            try
            {
                fileManager.DistrictId     = base.CurrentUser.DistrictId;
                fileManager.OrganizationId = base.CurrentUser.OrganizationId == "-1" ? null : base.CurrentUser.OrganizationId;
                fileManager.UserId         = base.CurrentUser.Id;
                var Files = _service.AddFiles(fileManager);

                // Audit Log
                if (fileManager.FileType == "2")
                {
                    // Audit Log
                    var audit = new AuditLog
                    {
                        UserId         = CurrentUser.Id,
                        EntityId       = fileManager.UserId.ToString(),
                        EntityType     = AuditLogs.EntityType.User,
                        ActionType     = AuditLogs.ActionType.TGuideForAdmin,
                        PostValue      = Serializer.Serialize(fileManager),
                        DistrictId     = CurrentUser.DistrictId,
                        OrganizationId = CurrentUser.OrganizationId == "-1" ? null : CurrentUser.OrganizationId
                    };
                    _audit.InsertAuditLog(audit);
                }
                else if (fileManager.FileType == "3")
                {
                    // Audit Log
                    var audit = new AuditLog
                    {
                        UserId         = CurrentUser.Id,
                        EntityId       = fileManager.UserId.ToString(),
                        EntityType     = AuditLogs.EntityType.User,
                        ActionType     = AuditLogs.ActionType.TGuideForStaff,
                        PostValue      = Serializer.Serialize(fileManager),
                        DistrictId     = CurrentUser.DistrictId,
                        OrganizationId = CurrentUser.OrganizationId == "-1" ? null : CurrentUser.OrganizationId
                    };
                    _audit.InsertAuditLog(audit);
                }
                else if (fileManager.FileType == "4")
                {
                    // Audit Log
                    var audit = new AuditLog
                    {
                        UserId         = CurrentUser.Id,
                        EntityId       = fileManager.UserId.ToString(),
                        EntityType     = AuditLogs.EntityType.User,
                        ActionType     = AuditLogs.ActionType.TGuideForSub,
                        PostValue      = Serializer.Serialize(fileManager),
                        DistrictId     = CurrentUser.DistrictId,
                        OrganizationId = CurrentUser.OrganizationId == "-1" ? null : CurrentUser.OrganizationId
                    };
                    _audit.InsertAuditLog(audit);
                }
                else
                {
                    // Audit Log
                    var audit = new AuditLog
                    {
                        UserId         = CurrentUser.Id,
                        EntityId       = fileManager.UserId.ToString(),
                        EntityType     = AuditLogs.EntityType.User,
                        ActionType     = AuditLogs.ActionType.SubstituteFile,
                        PostValue      = Serializer.Serialize(fileManager),
                        DistrictId     = CurrentUser.DistrictId,
                        OrganizationId = CurrentUser.OrganizationId == "-1" ? null : CurrentUser.OrganizationId
                    };
                    _audit.InsertAuditLog(audit);
                }
                return(Files);
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return(null);
        }
コード例 #59
0
ファイル: App.xaml.cs プロジェクト: lasnevadas/TiTsEd
        void Initialize()
        {
            ExceptionBox box;

            foreach (string xmlFile in XmlData.Files.All)
            {
                var xmlResult = XmlData.LoadXml(xmlFile);
                switch (xmlResult)
                {
                case XmlLoadingResult.Success:
                    break;

                case XmlLoadingResult.InvalidFile:
                    box         = new ExceptionBox();
                    box.Title   = "Fatal error";
                    box.Message = "The " + xmlFile + " file is out of date. Did you replace the bundled XML?";
                    box.Path    = Environment.CurrentDirectory;
                    box.ShowDialog(ExceptionBoxButtons.Quit);
                    Shutdown();
                    return;

                case XmlLoadingResult.MissingFile:
                    box         = new ExceptionBox();
                    box.Title   = "Fatal error";
                    box.Message = "The " + xmlFile + " file could not be found. Did you try to run the program from the archive without extracting all the files first?";
                    box.Path    = Environment.CurrentDirectory;
                    box.ShowDialog(ExceptionBoxButtons.Quit);
                    Shutdown();
                    return;

                case XmlLoadingResult.NoPermission:
                    box         = new ExceptionBox();
                    box.Title   = "Fatal error";
                    box.Message = "The " + xmlFile + " file was already in use or this application does not have permission to read from the folder where it is located.";
                    box.Path    = Environment.CurrentDirectory;
                    box.ShowDialog(ExceptionBoxButtons.Quit);
                    Shutdown();
                    return;

                default:
                    throw new NotImplementedException();
                }
            }

            VM.Create();
            FileManager.BuildPaths();
            var directories = FileManager.GetDirectories().ToArray(); // Load all on startup to check for errors
            var result      = ExceptionBoxResult.Continue;

            switch (FileManager.Result)
            {
            case FileEnumerationResult.NoPermission:
                box           = new ExceptionBox();
                box.Title     = "Could not scan some folders.";
                box.Message   = "TiTsEd did not get permission to read a folder or file.\nSome files will not be displayed in the Open/Save menus.";
                box.Path      = FileManager.ResultPath;
                box.IsWarning = true;
                result        = box.ShowDialog(ExceptionBoxButtons.Quit, ExceptionBoxButtons.Continue);
                break;

            case FileEnumerationResult.Unreadable:
                box           = new ExceptionBox();
                box.Title     = "Could not read some folders.";
                box.Message   = "TiTsEd could not read a folder or file.\nSome files will not be displayed in the Open/Save menus.";
                box.Path      = FileManager.ResultPath;
                box.IsWarning = true;
                result        = box.ShowDialog(ExceptionBoxButtons.Quit, ExceptionBoxButtons.Continue);
                break;
            }
            if (result == ExceptionBoxResult.Quit)
            {
                Shutdown();
                return;
            }

#if DEBUG
            var file = AutoLoad(directories);
            //new AmfFile("e:\\plainObject.sol").TestSerialization();
            //new AmfFile("e:\\unicode.sol").TestSerialization();
            //DebugStatuses(file);
            //RunSerializationTest(set);
            //ParsePerks();
            //ImportStatuses();
            //ImportFlags();
#endif
        }
コード例 #60
0
        // This replaces ObjectFinder.GetReferencedFileSaveFromFile - if any changes are made here, make the changes there too
        public ReferencedFileSave GetReferencedFile(string fileName)
        {
            ////////////////Early Out//////////////////////////////////
            var invalidPathChars = Path.GetInvalidPathChars();

            if (invalidPathChars.Any(item => fileName.Contains(item)))
            {
                // This isn't a RFS, because it's got a bad path. Early out here so that FileManager.IsRelative doesn't throw an exception
                return(null);
            }

            //////////////End Early Out////////////////////////////////


            fileName = fileName.ToLower();

            if (FileManager.IsRelative(fileName))
            {
                fileName = GlueCommands.GetAbsoluteFileName(fileName, isContent: true);
            }

            fileName = FileManager.Standardize(fileName).ToLower();


            if (GlueProject != null)
            {
                foreach (ScreenSave screenSave in GlueProject.Screens)
                {
                    foreach (ReferencedFileSave rfs in screenSave.ReferencedFiles)
                    {
                        string absoluteRfsFile = FileManager.Standardize(GlueCommands.GetAbsoluteFileName(rfs)).ToLower();

                        if (absoluteRfsFile == fileName)
                        {
                            return(rfs);
                        }
                    }
                }

                lock (GlueProject.Entities)
                {
                    foreach (EntitySave entitySave in GlueProject.Entities)
                    {
                        foreach (ReferencedFileSave rfs in entitySave.ReferencedFiles)
                        {
                            string absoluteRfsFile = FileManager.Standardize(GlueCommands.GetAbsoluteFileName(rfs)).ToLower();

                            if (absoluteRfsFile == fileName)
                            {
                                return(rfs);
                            }
                        }
                    }
                }

                foreach (ReferencedFileSave rfs in GlueProject.GlobalFiles)
                {
                    string absoluteRfsFile = FileManager.Standardize(GlueCommands.GetAbsoluteFileName(rfs)).ToLower();

                    if (absoluteRfsFile == fileName)
                    {
                        return(rfs);
                    }
                }
            }

            return(null);
        }