Skip to content

Commit a028af3

Browse files
unknownunknown
authored andcommitted
MemoryMappedFile demo initial commit.
1 parent b4d71b3 commit a028af3

19 files changed

+2362
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
FileStructure - Contains the File Structure for all Memory Mapped Files
3+
Copyright (c) 2013 Dror Gluska
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public License
7+
(LGPL) as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
The terms of redistributing and/or modifying this software also
10+
include exceptions to the LGPL that facilitate static linking.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public License
18+
along with this library; if not, write to Free Software Foundation, Inc.,
19+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
21+
Change log:
22+
2013-03-15 - Initial version
23+
*/
24+
25+
using System;
26+
using System.Collections.Generic;
27+
using System.Linq;
28+
using System.Text;
29+
using System.Runtime.InteropServices;
30+
31+
namespace FileStore.DataStructure
32+
{
33+
/// <summary>
34+
/// Contains the File Structure for all Memory Mapped Files
35+
/// </summary>
36+
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 19, CharSet = CharSet.Unicode)]
37+
struct FileStructure
38+
{
39+
/// <summary>
40+
/// Structure Length
41+
/// <remarks>Saves a call to Marshal</remarks>
42+
/// </summary>
43+
public const int StructureLength = 19;
44+
45+
//Signature is split to individual bytes for speed
46+
47+
[FieldOffset(0)]
48+
public byte SignatureA;
49+
[FieldOffset(1)]
50+
public byte SignatureB;
51+
[FieldOffset(2)]
52+
public byte SignatureC;
53+
54+
/// <summary>
55+
/// Last Written Byte
56+
/// </summary>
57+
[FieldOffset(3)]
58+
public Int64 LastByte;
59+
60+
/// <summary>
61+
/// Physical File Size
62+
/// </summary>
63+
[FieldOffset(11)]
64+
public Int64 FileSize;
65+
66+
67+
}
68+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
LogicalEntry - Logical File Entry
3+
Copyright (c) 2013 Dror Gluska
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public License
7+
(LGPL) as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
The terms of redistributing and/or modifying this software also
10+
include exceptions to the LGPL that facilitate static linking.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public License
18+
along with this library; if not, write to Free Software Foundation, Inc.,
19+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
21+
Change log:
22+
2013-03-15 - Initial version
23+
*/
24+
25+
26+
using System;
27+
using System.Collections.Generic;
28+
using System.Linq;
29+
using System.Text;
30+
using System.Runtime.InteropServices;
31+
32+
namespace FileStore.DataStructure
33+
{
34+
/// <summary>
35+
/// Logical File Entry
36+
/// </summary>
37+
[StructLayout(LayoutKind.Explicit,Pack=1,Size=32, CharSet=CharSet.Unicode)]
38+
struct LogicalEntry
39+
{
40+
/// <summary>
41+
/// Structure Length
42+
/// <remarks>Saves a call to Marshal</remarks>
43+
/// </summary>
44+
public const int StructureLength = 32;
45+
46+
/// <summary>
47+
/// The Id of the Entry
48+
/// </summary>
49+
[FieldOffset(0)]
50+
public Guid Id;
51+
52+
/// <summary>
53+
/// Offset this entry is located in
54+
/// </summary>
55+
[FieldOffset(16)]
56+
public Int64 Offset;
57+
58+
/// <summary>
59+
/// Length of this entry
60+
/// </summary>
61+
[FieldOffset(24)]
62+
public Int64 Length;
63+
}
64+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{077E3E8E-D511-4AE0-84A9-6EC85A6E407B}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>FileStore</RootNamespace>
12+
<AssemblyName>FileStore</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<PlatformTarget>x86</PlatformTarget>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="System" />
36+
<Reference Include="System.Core" />
37+
<Reference Include="System.Xml.Linq" />
38+
<Reference Include="System.Data.DataSetExtensions" />
39+
<Reference Include="Microsoft.CSharp" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Xml" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
<Compile Include="DataStructure\FileStructure.cs" />
45+
<Compile Include="DataStructure\LogicalEntry.cs" />
46+
<Compile Include="FileStoreManager.cs" />
47+
<Compile Include="Mapper\Collections\VirtualViewContainer.cs" />
48+
<Compile Include="Mapper\Collections\MemoryMappedViewContainer.cs" />
49+
<Compile Include="Mapper\Collections\MemoryMappedStreamContainer.cs" />
50+
<Compile Include="Mapper\Collections\VirtualStreamContainer.cs" />
51+
<Compile Include="Mapper\MapperStatistics.cs" />
52+
<Compile Include="Mapper\VirtualStream.cs" />
53+
<Compile Include="Mapper\VirtualView.cs" />
54+
<Compile Include="Mapper\MemoryMapper.cs" />
55+
<Compile Include="Mapper\Range.cs" />
56+
<Compile Include="Properties\AssemblyInfo.cs" />
57+
</ItemGroup>
58+
<ItemGroup />
59+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
60+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
61+
Other similar extension points exist, see Microsoft.Common.targets.
62+
<Target Name="BeforeBuild">
63+
</Target>
64+
<Target Name="AfterBuild">
65+
</Target>
66+
-->
67+
</Project>

0 commit comments

Comments
 (0)