本文整理汇总了C#中FileManager类的典型用法代码示例。如果您正苦于以下问题:C# FileManager类的具体用法?C# FileManager怎么用?C# FileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileManager类属于命名空间,在下文中一共展示了FileManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
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();
}
示例2: Setup
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>();
}
示例3: Initialize
/// <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();
}
示例4: MainPage
public MainPage()
{
InitializeComponent();
this.fileManager = new FileManager(this.diagram);
this.toolBox.ItemsSource = new HierarchicalGalleryItemsCollection();
}
示例5: GenerateCode
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: Initialize
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();
}
示例7: Search
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 },
},
};
}
}
}
示例8: LoadContent
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;
}
}
示例9: GetTempFileNameReturnsNewFileName
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));
}
示例10: CreateCommand
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);
}
}
示例11: GenerateCode
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));
}
}
示例12: Initialize
public void Initialize()
{
SolutionConfigurationNode node = new SolutionConfigurationNode();
ApplicationData applicationData = ApplicationData.FromCurrentAppDomain();
appNode = new ApplicationConfigurationNode(applicationData.Name, applicationData);
appNode.Load(null);
fileManager = new FileManager(node);
}
示例13: GenerateCode
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));
}
示例14: MainMenu
//Contructor
public MainMenu()
{
//Open center screen
this.StartPosition = FormStartPosition.CenterScreen;
InitializeComponent();
fileManager = new FileManager();
}
示例15: GenerateCode
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()));
}