Merge FileFormats dll into Game and reorganise namespaces.

This commit is contained in:
Paul Chote
2014-04-16 23:19:24 +12:00
parent 5a698d612f
commit 4935266945
246 changed files with 423 additions and 922 deletions

View File

@@ -131,6 +131,7 @@ NEW:
Fixed Chinook being unable to land on tiberium.
Commando will no longer shoot at vehicles or buildings.
Engine:
The contents of OpenRA.FileFormats.dll have been merged into OpenRA.Game.exe, and namespaces reorganized.
Converted Aircraft CruiseAltitude to world coordinates.
Converted Health Radius to world coordinates.
Converted production exits to world coordinates.

View File

@@ -65,7 +65,7 @@ INSTALL_PROGRAM = $(INSTALL) -m755
INSTALL_DATA = $(INSTALL) -m644
# program targets
CORE = fileformats rcg rgl rsdl rsdl2 rnull game utility geoip irc
CORE = rcg rgl rsdl rsdl2 rnull game utility geoip irc
TOOLS = editor tsbuild ralint
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
@@ -75,12 +75,6 @@ VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev
######################## PROGRAM TARGET RULES ##########################
#
# Core binaries
fileformats_SRCS := $(shell find OpenRA.FileFormats/ -iname '*.cs')
fileformats_TARGET = OpenRA.FileFormats.dll
fileformats_KIND = library
fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Sdl.dll System.Windows.Forms.dll
PROGRAMS = fileformats
fileformats: $(fileformats_TARGET)
geoip_SRCS := $(shell find GeoIP/ -iname '*.cs')
geoip_TARGET = GeoIP.dll
@@ -92,7 +86,6 @@ geoip: $(geoip_TARGET)
game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
game_TARGET = OpenRA.Game.exe
game_KIND = winexe
game_DEPS = $(fileformats_TARGET)
game_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll $(game_DEPS) thirdparty/Tao/Tao.OpenAl.dll thirdparty/SharpFont.dll
game_FLAGS = -win32icon:OpenRA.Game/OpenRA.ico
PROGRAMS += game
@@ -101,7 +94,7 @@ game: $(game_TARGET)
irc_SRCS := $(shell find OpenRA.Irc/ -iname '*.cs')
irc_TARGET = OpenRA.Irc.dll
irc_KIND = library
irc_DEPS = $(fileformats_TARGET) $(game_TARGET)
irc_DEPS = $(game_TARGET)
irc_LIBS = $(COMMON_LIBS) $(irc_DEPS)
PROGRAMS += irc
irc: $(irc_TARGET)
@@ -110,31 +103,31 @@ irc: $(irc_TARGET)
rsdl_SRCS := $(shell find OpenRA.Renderer.SdlCommon/ -iname '*.cs')
rsdl_TARGET = OpenRA.Renderer.SdlCommon.dll
rsdl_KIND = library
rsdl_DEPS = $(fileformats_TARGET) $(game_TARGET)
rsdl_DEPS = $(game_TARGET)
rsdl_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll $(rsdl_DEPS)
rcg_SRCS := $(shell find OpenRA.Renderer.Cg/ -iname '*.cs')
rcg_TARGET = OpenRA.Renderer.Cg.dll
rcg_KIND = library
rcg_DEPS = $(fileformats_TARGET) $(game_TARGET) $(rsdl_TARGET)
rcg_DEPS = $(game_TARGET) $(rsdl_TARGET)
rcg_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll $(rcg_DEPS)
rgl_SRCS := $(shell find OpenRA.Renderer.Gl/ -iname '*.cs')
rgl_TARGET = OpenRA.Renderer.Gl.dll
rgl_KIND = library
rgl_DEPS = $(fileformats_TARGET) $(game_TARGET) $(rsdl_TARGET)
rgl_DEPS = $(game_TARGET) $(rsdl_TARGET)
rgl_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.OpenGl.dll $(rgl_DEPS)
rsdl2_SRCS := $(shell find OpenRA.Renderer.Sdl2/ -iname '*.cs')
rsdl2_TARGET = OpenRA.Renderer.Sdl2.dll
rsdl2_KIND = library
rsdl2_DEPS = $(fileformats_TARGET) $(game_TARGET) $(rsdl_TARGET) $(rgl_TARGET)
rsdl2_DEPS = $(game_TARGET) $(rsdl_TARGET) $(rgl_TARGET)
rsdl2_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.OpenGl.dll thirdparty/SDL2-CS.dll $(rsdl2_DEPS)
rnull_SRCS := $(shell find OpenRA.Renderer.Null/ -iname '*.cs')
rnull_TARGET = OpenRA.Renderer.Null.dll
rnull_KIND = library
rnull_DEPS = $(fileformats_TARGET) $(game_TARGET)
rnull_DEPS = $(game_TARGET)
rnull_LIBS = $(COMMON_LIBS) $(rnull_DEPS)
PROGRAMS += rcg rgl rsdl2 rnull rsdl
renderers: $(rcg_TARGET) $(rgl_TARGET) $(rsdl2_TARGET) $(rnull_TARGET) $(rsdl_TARGET)
@@ -142,7 +135,7 @@ renderers: $(rcg_TARGET) $(rgl_TARGET) $(rsdl2_TARGET) $(rnull_TARGET) $(rsdl_TA
##### Official Mods #####
STD_MOD_LIBS = $(fileformats_TARGET) $(game_TARGET) thirdparty/KopiLua.dll thirdparty/NLua.dll
STD_MOD_LIBS = $(game_TARGET) thirdparty/KopiLua.dll thirdparty/NLua.dll
STD_MOD_DEPS = $(STD_MOD_LIBS) $(ralint_TARGET)
# Red Alert
@@ -187,8 +180,8 @@ mod_ts: $(mod_ts_TARGET)
editor_SRCS := $(shell find OpenRA.Editor/ -iname '*.cs')
editor_TARGET = OpenRA.Editor.exe
editor_KIND = winexe
editor_DEPS = $(fileformats_TARGET) $(game_TARGET)
editor_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll System.Data.dll $(editor_DEPS)
editor_DEPS = $(game_TARGET)
editor_LIBS = System.Windows.Forms.dll System.Data.dll System.Drawing.dll $(editor_DEPS)
editor_EXTRA = -resource:OpenRA.Editor.Form1.resources -resource:OpenRA.Editor.MapSelect.resources
editor_FLAGS = -win32icon:OpenRA.Editor/OpenRA.Editor.Icon.ico
@@ -203,7 +196,7 @@ editor: OpenRA.Editor.MapSelect.resources OpenRA.Editor.Form1.resources $(editor
ralint_SRCS := $(shell find OpenRA.Lint/ -iname '*.cs')
ralint_TARGET = OpenRA.Lint.exe
ralint_KIND = exe
ralint_DEPS = $(fileformats_TARGET) $(game_TARGET)
ralint_DEPS = $(game_TARGET)
ralint_LIBS = $(COMMON_LIBS) $(ralint_DEPS)
PROGRAMS += ralint
ralint: $(ralint_TARGET)
@@ -222,7 +215,7 @@ test:
tsbuild_SRCS := $(shell find OpenRA.TilesetBuilder/ -iname '*.cs')
tsbuild_TARGET = OpenRA.TilesetBuilder.exe
tsbuild_KIND = winexe
tsbuild_DEPS = $(fileformats_TARGET) $(game_TARGET)
tsbuild_DEPS = $(game_TARGET)
tsbuild_LIBS = $(COMMON_LIBS) $(tsbuild_DEPS) System.Windows.Forms.dll
tsbuild_EXTRA = -resource:OpenRA.TilesetBuilder.FormBuilder.resources -resource:OpenRA.TilesetBuilder.FormNew.resources -resource:OpenRA.TilesetBuilder.Surface.resources
PROGRAMS += tsbuild
@@ -241,7 +234,7 @@ tsbuild: OpenRA.TilesetBuilder.FormBuilder.resources OpenRA.TilesetBuilder.FormN
utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
utility_TARGET = OpenRA.Utility.exe
utility_KIND = exe
utility_DEPS = $(fileformats_TARGET) $(game_TARGET)
utility_DEPS = $(game_TARGET)
utility_LIBS = $(COMMON_LIBS) $(utility_DEPS) thirdparty/ICSharpCode.SharpZipLib.dll System.Windows.Forms.dll
PROGRAMS += utility
utility: $(utility_TARGET)

View File

@@ -14,7 +14,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Traits;
@@ -25,7 +25,7 @@ namespace OpenRA.Editor
public Form1(string[] args)
{
InitializeComponent();
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
currentMod = args.FirstOrDefault() ?? "ra";
@@ -47,7 +47,7 @@ namespace OpenRA.Editor
currentMod = toolStripComboBox1.SelectedItem as string;
Game.modData = new ModData(currentMod);
FileSystem.LoadFromManifest(Game.modData.Manifest);
GlobalFileSystem.LoadFromManifest(Game.modData.Manifest);
Rules.LoadRules(Game.modData.Manifest, new Map());
var mod = Game.modData.Manifest.Mod;
@@ -147,11 +147,11 @@ namespace OpenRA.Editor
tileset = Rules.TileSets[map.Tileset];
tilesetRenderer = new TileSetRenderer(tileset, manifest.TileSize);
var shadowIndex = new int[] { 3, 4 };
var palette = new Palette(FileSystem.Open(tileset.Palette), shadowIndex);
var palette = new Palette(GlobalFileSystem.Open(tileset.Palette), shadowIndex);
// required for desert terrain in RA
var playerPalette = tileset.PlayerPalette ?? tileset.Palette;
var shadowedPalette = new Palette(FileSystem.Open(playerPalette), shadowIndex);
var shadowedPalette = new Palette(GlobalFileSystem.Open(playerPalette), shadowIndex);
surface1.Bind(map, tileset, tilesetRenderer, palette, shadowedPalette);

View File

@@ -166,10 +166,6 @@
<Compile Include="TileSetRenderer.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
<Name>OpenRA.FileFormats</Name>
</ProjectReference>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
<Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project>
<Name>OpenRA.Game</Name>

View File

@@ -13,6 +13,9 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Editor
@@ -48,14 +51,14 @@ namespace OpenRA.Editor
{
var image = RenderSprites.GetImage(info);
using (var s = FileSystem.OpenWithExts(image, tileset.Extensions))
using (var s = GlobalFileSystem.OpenWithExts(image, tileset.Extensions))
{
var shp = new ShpReader(s);
var bitmap = RenderShp(shp, p);
try
{
using (var s2 = FileSystem.OpenWithExts(image + "2", tileset.Extensions))
using (var s2 = GlobalFileSystem.OpenWithExts(image + "2", tileset.Extensions))
{
var shp2 = new ShpReader(s2);
var roofBitmap = RenderShp(shp2, p);
@@ -78,7 +81,7 @@ namespace OpenRA.Editor
public static ResourceTemplate RenderResourceType(ResourceTypeInfo info, string[] exts, Palette p)
{
var image = info.EditorSprite;
using (var s = FileSystem.OpenWithExts(image, exts))
using (var s = GlobalFileSystem.OpenWithExts(image, exts))
{
// TODO: Do this properly
var shp = new ShpReader(s) as ISpriteSource;

View File

@@ -14,7 +14,9 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Windows.Forms;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
using SGraphics = System.Drawing.Graphics;

View File

@@ -14,7 +14,8 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
namespace OpenRA.Editor
{
@@ -49,7 +50,7 @@ namespace OpenRA.Editor
ISpriteSource source;
if (!sourceCache.ContainsKey(filename))
{
using (var s = FileSystem.OpenWithExts(filename, exts))
using (var s = GlobalFileSystem.OpenWithExts(filename, exts))
source = SpriteSource.LoadSpriteSource(s, filename);
if (source.CacheWhenLoadingTileset)

View File

@@ -1,184 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenRA.FileFormats</RootNamespace>
<AssemblyName>OpenRA.FileFormats</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Tao.Sdl, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9c7a200e36c0094e">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.Sdl.dll</HintPath>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Evaluator.cs" />
<Compile Include="Exts.cs" />
<Compile Include="FieldLoader.cs" />
<Compile Include="FieldSaver.cs" />
<Compile Include="FileFormats\AudLoader.cs" />
<Compile Include="FileFormats\Blast.cs" />
<Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="FileFormats\CRC32.cs" />
<Compile Include="FileFormats\Format2.cs" />
<Compile Include="FileFormats\Format40.cs" />
<Compile Include="FileFormats\Format80.cs" />
<Compile Include="FileFormats\IniFile.cs" />
<Compile Include="Graphics\IGraphicsDevice.cs" />
<Compile Include="Graphics\IInputHandler.cs" />
<Compile Include="Graphics\PngLoader.cs" />
<Compile Include="Graphics\ShpReader.cs" />
<Compile Include="Graphics\Vertex.cs" />
<Compile Include="Graphics\VqaReader.cs" />
<Compile Include="InstallUtils.cs" />
<Compile Include="Manifest.cs" />
<Compile Include="Map\PlayerReference.cs" />
<Compile Include="Map\SmudgeReference.cs" />
<Compile Include="Map\TileReference.cs" />
<Compile Include="Map\TileSet.cs" />
<Compile Include="MiniYaml.cs" />
<Compile Include="Mod.cs" />
<Compile Include="PackageEntry.cs" />
<Compile Include="Palette.cs" />
<Compile Include="Platform.cs" />
<Compile Include="PlayerColorRemap.cs" />
<Compile Include="Primitives\ActionQueue.cs" />
<Compile Include="Primitives\Bits.cs" />
<Compile Include="Primitives\Cache.cs" />
<Compile Include="Primitives\Cached.cs" />
<Compile Include="Primitives\DisposableAction.cs" />
<Compile Include="Primitives\IObservableCollection.cs" />
<Compile Include="Primitives\ObservableCollection.cs" />
<Compile Include="Primitives\ObservableDictionary.cs" />
<Compile Include="Primitives\Pair.cs" />
<Compile Include="Primitives\PriorityQueue.cs" />
<Compile Include="Primitives\Set.cs" />
<Compile Include="Primitives\float2.cs" />
<Compile Include="Primitives\int2.cs" />
<Compile Include="Support\Log.cs" />
<Compile Include="Support\Stopwatch.cs" />
<Compile Include="Support\Timer.cs" />
<Compile Include="Random.cs" />
<Compile Include="TypeDictionary.cs" />
<Compile Include="WPos.cs" />
<Compile Include="WVec.cs" />
<Compile Include="WAngle.cs" />
<Compile Include="WRot.cs" />
<Compile Include="WRange.cs" />
<Compile Include="HSLColor.cs" />
<Compile Include="Graphics\ShpTSReader.cs" />
<Compile Include="FileFormats\XccLocalDatabase.cs" />
<Compile Include="FileFormats\XccGlobalDatabase.cs" />
<Compile Include="Graphics\VxlReader.cs" />
<Compile Include="Graphics\HvaReader.cs" />
<Compile Include="StreamExts.cs" />
<Compile Include="FileFormats\WavLoader.cs" />
<Compile Include="Graphics\R8Reader.cs" />
<Compile Include="Keycode.cs" />
<Compile Include="Hotkey.cs" />
<Compile Include="FileSystem\FileSystem.cs" />
<Compile Include="FileSystem\Folder.cs" />
<Compile Include="FileSystem\InstallShieldPackage.cs" />
<Compile Include="FileSystem\MixFile.cs" />
<Compile Include="FileSystem\ZipFile.cs" />
<Compile Include="FileSystem\D2kSoundResources.cs" />
<Compile Include="Graphics\SpriteSource.cs" />
<Compile Include="Graphics\TmpRAReader.cs" />
<Compile Include="Graphics\TmpTDReader.cs" />
<Compile Include="Graphics\ShpD2Reader.cs" />
<Compile Include="FileSystem\Pak.cs" />
<Compile Include="CPos.cs" />
<Compile Include="CVec.cs" />
<Compile Include="Graphics\TmpTSReader.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,349 +0,0 @@
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustContainValidXml">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustMatchElementParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VoidReturnValueMustNotBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustNotBeEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustMeetCharacterPercentage">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludedDocumentationXPathDoesNotExist">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InheritDocMustBeUsedWithInheritingClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveCopyrightText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
<Rule Name="TabsMustNotBeUsed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CurlyBracketsMustNotBeOmitted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeSeparatedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeOrderedByAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="CodeMustNotContainMultipleStatementsOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseStringEmptyForEmptyStrings">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixLocalCallsWithThis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixCallsCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustFollowComma">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
<Rules>
<Rule Name="AccessModifierMustBeDeclared">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>

View File

@@ -12,8 +12,8 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA

View File

@@ -99,13 +99,13 @@ namespace OpenRA
return ret;
}
public static T Random<T>(this IEnumerable<T> ts, Thirdparty.Random r)
public static T Random<T>(this IEnumerable<T> ts, Support.Random r)
{
var xs = ts.ToArray();
return xs[r.Next(xs.Length)];
}
public static T RandomOrDefault<T>(this IEnumerable<T> ts, Thirdparty.Random r)
public static T RandomOrDefault<T>(this IEnumerable<T> ts, Support.Random r)
{
if (!ts.Any())
return default(T);

View File

@@ -15,8 +15,10 @@ using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA.FileFormats
namespace OpenRA
{
public static class FieldLoader
{

View File

@@ -15,7 +15,7 @@ using System.Globalization;
using System.Linq;
using System.Reflection;
namespace OpenRA.FileFormats
namespace OpenRA
{
public static class FieldSaver
{

View File

@@ -18,7 +18,7 @@ using System.Net;
using System.Runtime.InteropServices;
using System.Text;
namespace OpenRA.FileFormats.Graphics
namespace OpenRA.FileFormats
{
public static class PngLoader
{

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.IO;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.FileFormats
{

View File

@@ -12,7 +12,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public class D2kSoundResources : IFolder
{
@@ -29,7 +29,7 @@ namespace OpenRA.FileFormats
this.filename = filename;
this.priority = priority;
s = FileSystem.Open(filename);
s = GlobalFileSystem.Open(filename);
s.Seek(0, SeekOrigin.Begin);
filenames = new List<string>();

View File

@@ -11,7 +11,7 @@
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public class Folder : IFolder
{

View File

@@ -13,10 +13,23 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using OpenRA.Primitives;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public static class FileSystem
public interface IFolder
{
Stream GetContent(string filename);
bool Exists(string filename);
IEnumerable<uint> ClassicHashes();
IEnumerable<uint> CrcHashes();
IEnumerable<string> AllFileNames();
void Write(Dictionary<string, byte[]> contents);
int Priority { get; }
string Name { get; }
}
public static class GlobalFileSystem
{
public static List<IFolder> MountedFolders = new List<IFolder>();
static Cache<uint, List<IFolder>> classicHashIndex = new Cache<uint, List<IFolder>>(_ => new List<IFolder>());

View File

@@ -11,8 +11,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using OpenRA.FileFormats;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public class InstallShieldPackage : IFolder
{
@@ -28,7 +29,7 @@ namespace OpenRA.FileFormats
this.filename = filename;
this.priority = priority;
filenames = new List<string>();
s = FileSystem.Open(filename);
s = GlobalFileSystem.Open(filename);
// Parse package header
BinaryReader reader = new BinaryReader(s);

View File

@@ -13,21 +13,10 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public interface IFolder
{
Stream GetContent(string filename);
bool Exists(string filename);
IEnumerable<uint> ClassicHashes();
IEnumerable<uint> CrcHashes();
IEnumerable<string> AllFileNames();
void Write(Dictionary<string, byte[]> contents);
int Priority { get; }
string Name { get; }
}
public class MixFile : IFolder
{
readonly Dictionary<uint, PackageEntry> index;
@@ -58,7 +47,7 @@ namespace OpenRA.FileFormats
this.filename = filename;
this.priority = priority;
this.type = type;
s = FileSystem.Open(filename);
s = GlobalFileSystem.Open(filename);
// Detect format type
s.Seek(0, SeekOrigin.Begin);
@@ -210,9 +199,9 @@ namespace OpenRA.FileFormats
}
}
if (FileSystem.Exists("global mix database.dat"))
if (GlobalFileSystem.Exists("global mix database.dat"))
{
var db = new XccGlobalDatabase(FileSystem.Open("global mix database.dat"));
var db = new XccGlobalDatabase(GlobalFileSystem.Open("global mix database.dat"));
foreach (var e in db.Entries)
{
var hash = PackageEntry.HashFilename(e, type);
@@ -236,7 +225,7 @@ namespace OpenRA.FileFormats
{
// Cannot modify existing mixfile - rename existing file and
// create a new one with original content plus modifications
FileSystem.Unmount(this);
GlobalFileSystem.Unmount(this);
// TODO: Add existing data to the contents list
if (index.Count > 0)

View File

@@ -12,8 +12,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using OpenRA.FileFormats;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public enum PackageHashType { Classic, CRC32 }

View File

@@ -12,7 +12,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
struct Entry
{
@@ -33,7 +33,7 @@ namespace OpenRA.FileFormats
this.filename = filename;
this.priority = priority;
index = new Dictionary<string, Entry>();
stream = FileSystem.Open(filename);
stream = GlobalFileSystem.Open(filename);
index = new Dictionary<string, Entry>();
var offset = stream.ReadUInt32();

View File

@@ -13,7 +13,7 @@ using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using SZipFile = ICSharpCode.SharpZipLib.Zip.ZipFile;
namespace OpenRA.FileFormats
namespace OpenRA.FileSystem
{
public class ZipFile : IFolder
{

View File

@@ -14,14 +14,15 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Network;
using OpenRA.Primitives;
using OpenRA.Support;
using OpenRA.Widgets;
using XRandom = OpenRA.Thirdparty.Random;
using XRandom = OpenRA.Support.Random;
namespace OpenRA
{
@@ -279,7 +280,7 @@ namespace OpenRA
{
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
Settings = new Settings(Platform.SupportDir + "settings.yaml", args);
@@ -299,7 +300,7 @@ namespace OpenRA
Settings.Server.AllowPortForward = false;
}
FileSystem.Mount("."); // Needed to access shaders
GlobalFileSystem.Mount("."); // Needed to access shaders
var renderers = new[] { Settings.Graphics.Renderer, "Sdl2", "Gl", "Cg", null };
foreach (var r in renderers)
{

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA

View File

@@ -9,6 +9,7 @@
#endregion
using OpenRA.FileFormats;
using OpenRA.FileSystem;
namespace OpenRA.GameRules
{
@@ -26,20 +27,20 @@ namespace OpenRA.GameRules
var nd = value.NodesDict;
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext;
if (!FileSystem.Exists(Filename))
if (!GlobalFileSystem.Exists(Filename))
return;
Exists = true;
Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
Length = (int)AudLoader.SoundLength(GlobalFileSystem.Open(Filename));
}
public void Reload()
{
if (!FileSystem.Exists(Filename))
if (!GlobalFileSystem.Exists(Filename))
return;
Exists = true;
Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
Length = (int)AudLoader.SoundLength(GlobalFileSystem.Open(Filename));
}
}
}

View File

@@ -11,7 +11,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -45,7 +46,7 @@ namespace OpenRA.Graphics
palette = new HardwarePalette();
foreach (var p in sequences.NodesDict["Palettes"].Nodes)
palette.AddPalette(p.Key, new Palette(FileSystem.Open(p.Value.Value), shadowIndex), false);
palette.AddPalette(p.Key, new Palette(GlobalFileSystem.Open(p.Value.Value), shadowIndex), false);
foreach (var s in sequences.NodesDict["Cursors"].Nodes)
LoadSequencesForCursor(s.Key, s.Value);

View File

@@ -10,7 +10,7 @@
using System.Drawing;
namespace OpenRA.FileFormats
namespace OpenRA.Graphics
{
public struct HSLColor
{

View File

@@ -12,7 +12,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.Traits;
namespace OpenRA.Graphics

View File

@@ -9,7 +9,6 @@
#endregion
using System.Drawing;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -9,7 +9,6 @@
#endregion
using System.Drawing;
using OpenRA.FileFormats;
using System.Collections.Generic;
namespace OpenRA.Graphics

View File

@@ -13,7 +13,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
namespace OpenRA.FileFormats
namespace OpenRA.Graphics
{
public class Palette
{

View File

@@ -12,8 +12,9 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.FileFormats
namespace OpenRA.Graphics
{
public class PlayerColorRemap : IPaletteRemap
{

View File

@@ -9,7 +9,6 @@
#endregion
using System.Drawing;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -15,8 +15,6 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.Support;
namespace OpenRA.Graphics

View File

@@ -10,8 +10,6 @@
using System;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -12,7 +12,7 @@ using System;
using System.Drawing;
using System.Drawing.Imaging;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.FileSystem;
namespace OpenRA.Graphics
{
@@ -39,7 +39,7 @@ namespace OpenRA.Graphics
public Sheet(string filename)
{
var bitmap = (Bitmap)Image.FromStream(FileSystem.Open(filename));
var bitmap = (Bitmap)Image.FromStream(GlobalFileSystem.Open(filename));
Size = bitmap.Size;
data = new byte[4*Size.Width*Size.Height];

View File

@@ -11,7 +11,6 @@
using System;
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -9,7 +9,6 @@
#endregion
using System.Drawing;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -11,8 +11,9 @@
using System;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using SharpFont;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -11,6 +11,8 @@
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -31,7 +33,7 @@ namespace OpenRA.Graphics
Sprite[] CacheSpriteFrames(string filename)
{
var stream = FileSystem.OpenWithExts(filename, exts);
var stream = GlobalFileSystem.OpenWithExts(filename, exts);
return SpriteSource.LoadSpriteSource(stream, filename).Frames
.Select(a => SheetBuilder.Add(a))
.ToArray();

View File

@@ -9,7 +9,6 @@
#endregion
using System.Drawing;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -12,8 +12,9 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
namespace OpenRA.FileFormats
namespace OpenRA.Graphics
{
public interface ISpriteFrame
{
@@ -29,6 +30,7 @@ namespace OpenRA.FileFormats
bool CacheWhenLoadingTileset { get; }
}
// TODO: Most of this should be moved into the format parsers themselves.
public enum SpriteType { Unknown, ShpTD, ShpTS, ShpD2, TmpTD, TmpRA, TmpTS, R8 }
public static class SpriteSource
{

View File

@@ -8,7 +8,6 @@
*/
#endregion
using OpenRA.FileFormats.Graphics;
using OpenRA.Traits;
namespace OpenRA.Graphics

View File

@@ -13,7 +13,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
namespace OpenRA.Graphics
{
@@ -28,7 +28,7 @@ namespace OpenRA.Graphics
ISpriteSource source;
if (!sourceCache.ContainsKey(filename))
{
using (var s = FileSystem.OpenWithExts(filename, exts))
using (var s = GlobalFileSystem.OpenWithExts(filename, exts))
source = SpriteSource.LoadSpriteSource(s, filename);
if (source.CacheWhenLoadingTileset)

View File

@@ -11,7 +11,6 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using OpenRA.FileFormats.Graphics;
namespace OpenRA.Graphics
{

View File

@@ -10,7 +10,7 @@
using System.Runtime.InteropServices;
namespace OpenRA.FileFormats.Graphics
namespace OpenRA.Graphics
{
[StructLayout(LayoutKind.Sequential)]
public struct Vertex

View File

@@ -13,7 +13,8 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.FileSystem;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{
@@ -209,8 +210,8 @@ namespace OpenRA.Graphics
Voxel LoadFile(Pair<string,string> files)
{
var vxl = new VxlReader(FileSystem.OpenWithExts(files.First, ".vxl"));
var hva = new HvaReader(FileSystem.OpenWithExts(files.Second, ".hva"));
var vxl = new VxlReader(GlobalFileSystem.OpenWithExts(files.First, ".vxl"));
var hva = new HvaReader(GlobalFileSystem.OpenWithExts(files.Second, ".hva"));
return new Voxel(this, vxl, hva);
}

View File

@@ -12,7 +12,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
namespace OpenRA.Graphics
{

View File

@@ -12,8 +12,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using OpenRA.Primitives;
namespace OpenRA.Graphics
{

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Graphics

View File

@@ -10,8 +10,9 @@
using System;
using System.Drawing;
using OpenRA.Graphics;
namespace OpenRA.FileFormats.Graphics
namespace OpenRA
{
[AttributeUsage( AttributeTargets.Assembly )]
public class RendererAttribute : Attribute

View File

@@ -14,8 +14,9 @@ using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;
using OpenRA.FileSystem;
namespace OpenRA.FileFormats
namespace OpenRA
{
public static class InstallUtils
{
@@ -43,15 +44,15 @@ namespace OpenRA.FileFormats
if (!Directory.Exists(destPath))
Directory.CreateDirectory(destPath);
if (!Directory.Exists(srcPath)) { onError("Cannot find " + package); return false; }
FileSystem.Mount(srcPath);
if (!FileSystem.Exists(package)) { onError("Cannot find " + package); return false; }
FileSystem.Mount(package);
if (!GlobalFileSystem.Exists(srcPath)) { onError("Cannot find " + package); return false; }
GlobalFileSystem.Mount(srcPath);
if (!GlobalFileSystem.Exists(package)) { onError("Cannot find " + package); return false; }
GlobalFileSystem.Mount(package);
foreach (string s in files)
{
var destFile = Path.Combine(destPath, s);
using (var sourceStream = FileSystem.Open(s))
using (var sourceStream = GlobalFileSystem.Open(s))
using (var destStream = File.Create(destFile))
{
onProgress("Extracting " + s);

View File

@@ -12,8 +12,9 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Primitives;
namespace OpenRA.FileFormats
namespace OpenRA
{
// Describes what is to be loaded in order to run a mod
public class Manifest

View File

@@ -9,7 +9,7 @@
#endregion
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA

View File

@@ -10,8 +10,9 @@
using System.Collections;
using System.Collections.Generic;
using OpenRA.Primitives;
namespace OpenRA.FileFormats
namespace OpenRA
{
public class ActorReference : IEnumerable
{

View File

@@ -15,7 +15,7 @@ using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Network;
using OpenRA.Traits;
@@ -151,7 +151,7 @@ namespace OpenRA
public Map(string path, string upgradeForMod)
{
Path = path;
Container = FileSystem.OpenPackage(path, null, int.MaxValue);
Container = GlobalFileSystem.OpenPackage(path, null, int.MaxValue);
AssertExists("map.yaml");
AssertExists("map.bin");
@@ -310,7 +310,7 @@ namespace OpenRA
Path = toPath;
// Create a new map package
Container = FileSystem.CreatePackage(Path, int.MaxValue, entries);
Container = GlobalFileSystem.CreatePackage(Path, int.MaxValue, entries);
}
// Update existing package

View File

@@ -17,8 +17,9 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA
{

View File

@@ -17,7 +17,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Widgets;

View File

@@ -8,7 +8,9 @@
*/
#endregion
namespace OpenRA.FileFormats
using OpenRA.Graphics;
namespace OpenRA
{
public class PlayerReference
{

View File

@@ -8,7 +8,7 @@
*/
#endregion
namespace OpenRA.FileFormats
namespace OpenRA
{
public struct SmudgeReference
{

View File

@@ -8,7 +8,7 @@
*/
#endregion
namespace OpenRA.FileFormats
namespace OpenRA
{
public struct TileReference<T, U>
{

View File

@@ -13,7 +13,7 @@ using System.Drawing;
using System.Linq;
using System.Reflection;
namespace OpenRA.FileFormats
namespace OpenRA
{
public class TerrainTypeInfo
{

View File

@@ -12,8 +12,9 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.FileSystem;
namespace OpenRA.FileFormats
namespace OpenRA
{
using MiniYamlNodes = List<MiniYamlNode>;
@@ -171,7 +172,7 @@ namespace OpenRA.FileFormats
public static List<MiniYamlNode> FromFileInPackage(string path)
{
StreamReader reader = new StreamReader(FileSystem.Open(path));
StreamReader reader = new StreamReader(GlobalFileSystem.Open(path));
List<string> lines = new List<string>();
while (!reader.EndOfStream)

View File

@@ -12,7 +12,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace OpenRA.FileFormats
namespace OpenRA
{
public class Mod
{

View File

@@ -12,7 +12,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Widgets;
@@ -41,9 +41,9 @@ namespace OpenRA
MapCache = new MapCache(Manifest);
// HACK: Mount only local folders so we have a half-working environment for the asset installer
FileSystem.UnmountAll();
GlobalFileSystem.UnmountAll();
foreach (var dir in Manifest.Folders)
FileSystem.Mount(dir);
GlobalFileSystem.Mount(dir);
}
public void InitializeLoaders()
@@ -113,10 +113,10 @@ namespace OpenRA
// Reinit all our assets
InitializeLoaders();
FileSystem.LoadFromManifest(Manifest);
GlobalFileSystem.LoadFromManifest(Manifest);
// Mount map package so custom assets can be used. TODO: check priority.
FileSystem.Mount(FileSystem.OpenPackage(map.Path, null, int.MaxValue));
GlobalFileSystem.Mount(GlobalFileSystem.OpenPackage(map.Path, null, int.MaxValue));
Rules.LoadRules(Manifest, map);
SpriteLoader = new SpriteLoader(Rules.TileSets[map.Tileset].Extensions, SheetBuilder);

View File

@@ -11,7 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Network
{

View File

@@ -11,7 +11,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Network
{

View File

@@ -11,7 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
namespace OpenRA.Network
{

View File

@@ -13,7 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA.Network
{

View File

@@ -13,7 +13,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using OpenRA.FileFormats;
using OpenRA.Primitives;
namespace OpenRA
{
@@ -26,8 +26,6 @@ namespace OpenRA
// All the core namespaces
var asms = typeof(Game).Assembly.GetNamespaces() // Game
.Select(c => Pair.New(typeof(Game).Assembly, c))
.Concat(typeof(Mod).Assembly.GetNamespaces() // FileFormats
.Select(c => Pair.New(typeof(Mod).Assembly, c)))
.ToList();
// Namespaces from each mod assembly

View File

@@ -78,11 +78,12 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.OpenAl.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\thirdparty\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Actor.cs" />
<Compile Include="ActorInitializer.cs" />
<Compile Include="ActorReference.cs" />
<Compile Include="Graphics\QuadRenderer.cs" />
<Compile Include="Download.cs" />
<Compile Include="Effects\DelayedAction.cs" />
@@ -92,7 +93,6 @@
<Compile Include="GameRules\ActorInfo.cs" />
<Compile Include="GameRules\MusicInfo.cs" />
<Compile Include="GameRules\Rules.cs" />
<Compile Include="GameRules\Settings.cs" />
<Compile Include="GameRules\SoundInfo.cs" />
<Compile Include="GameRules\WeaponInfo.cs" />
<Compile Include="Graphics\Animation.cs" />
@@ -119,7 +119,6 @@
<Compile Include="Graphics\WorldRenderer.cs" />
<Compile Include="Group.cs" />
<Compile Include="InputHandler.cs" />
<Compile Include="Map.cs" />
<Compile Include="ModData.cs" />
<Compile Include="Network\Connection.cs" />
<Compile Include="Network\FrameData.cs" />
@@ -228,17 +227,96 @@
<Compile Include="Traits\World\ActorMap.cs" />
<Compile Include="Widgets\HotkeyEntryWidget.cs" />
<Compile Include="Effects\MoveFlash.cs" />
<Compile Include="MapCache.cs" />
<Compile Include="MapPreview.cs" />
<Compile Include="Widgets\SpriteWidget.cs" />
<Compile Include="Widgets\SpriteSequenceWidget.cs" />
<Compile Include="Widgets\RGBASpriteWidget.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
<Project>{BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}</Project>
<Name>OpenRA.FileFormats</Name>
</ProjectReference>
<Compile Include="FileSystem\D2kSoundResources.cs" />
<Compile Include="FileSystem\Folder.cs" />
<Compile Include="FileSystem\InstallShieldPackage.cs" />
<Compile Include="FileSystem\MixFile.cs" />
<Compile Include="FileSystem\Pak.cs" />
<Compile Include="FileSystem\ZipFile.cs" />
<Compile Include="Map\PlayerReference.cs" />
<Compile Include="Map\SmudgeReference.cs" />
<Compile Include="Map\TileReference.cs" />
<Compile Include="Map\TileSet.cs" />
<Compile Include="FieldLoader.cs" />
<Compile Include="FieldSaver.cs" />
<Compile Include="InstallUtils.cs" />
<Compile Include="Manifest.cs" />
<Compile Include="IGraphicsDevice.cs" />
<Compile Include="IInputHandler.cs" />
<Compile Include="Graphics\Vertex.cs" />
<Compile Include="FileFormats\AudLoader.cs" />
<Compile Include="FileFormats\Blast.cs" />
<Compile Include="FileFormats\Blowfish.cs" />
<Compile Include="FileFormats\BlowfishKeyProvider.cs" />
<Compile Include="FileFormats\CRC32.cs" />
<Compile Include="FileFormats\Format2.cs" />
<Compile Include="FileFormats\Format40.cs" />
<Compile Include="FileFormats\Format80.cs" />
<Compile Include="FileFormats\IniFile.cs" />
<Compile Include="FileFormats\WavLoader.cs" />
<Compile Include="FileFormats\XccGlobalDatabase.cs" />
<Compile Include="FileFormats\XccLocalDatabase.cs" />
<Compile Include="FileFormats\HvaReader.cs" />
<Compile Include="FileFormats\PngLoader.cs" />
<Compile Include="FileFormats\R8Reader.cs" />
<Compile Include="FileFormats\ShpD2Reader.cs" />
<Compile Include="FileFormats\ShpReader.cs" />
<Compile Include="FileFormats\ShpTSReader.cs" />
<Compile Include="FileFormats\TmpRAReader.cs" />
<Compile Include="FileFormats\TmpTDReader.cs" />
<Compile Include="FileFormats\TmpTSReader.cs" />
<Compile Include="FileFormats\VqaReader.cs" />
<Compile Include="FileFormats\VxlReader.cs" />
<Compile Include="Primitives\ActionQueue.cs" />
<Compile Include="Primitives\Bits.cs" />
<Compile Include="Primitives\Cache.cs" />
<Compile Include="Primitives\Cached.cs" />
<Compile Include="Primitives\DisposableAction.cs" />
<Compile Include="Primitives\float2.cs" />
<Compile Include="Primitives\int2.cs" />
<Compile Include="Primitives\IObservableCollection.cs" />
<Compile Include="Primitives\ObservableCollection.cs" />
<Compile Include="Primitives\ObservableDictionary.cs" />
<Compile Include="Primitives\Pair.cs" />
<Compile Include="Primitives\PriorityQueue.cs" />
<Compile Include="Primitives\Set.cs" />
<Compile Include="Support\Log.cs" />
<Compile Include="Support\Stopwatch.cs" />
<Compile Include="Support\Timer.cs" />
<Compile Include="Exts.cs" />
<Compile Include="Hotkey.cs" />
<Compile Include="Keycode.cs" />
<Compile Include="MiniYaml.cs" />
<Compile Include="Mod.cs" />
<Compile Include="Platform.cs" />
<Compile Include="StreamExts.cs" />
<Compile Include="Map\Map.cs" />
<Compile Include="Map\MapCache.cs" />
<Compile Include="Map\MapPreview.cs" />
<Compile Include="Graphics\HSLColor.cs" />
<Compile Include="FileSystem\PackageEntry.cs" />
<Compile Include="CPos.cs" />
<Compile Include="CVec.cs" />
<Compile Include="WAngle.cs" />
<Compile Include="WPos.cs" />
<Compile Include="WRange.cs" />
<Compile Include="WRot.cs" />
<Compile Include="WVec.cs" />
<Compile Include="Primitives\TypeDictionary.cs" />
<Compile Include="Support\Random.cs" />
<Compile Include="Map\ActorInitializer.cs" />
<Compile Include="Map\ActorReference.cs" />
<Compile Include="Support\Evaluator.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Graphics\SpriteSource.cs" />
<Compile Include="Graphics\PlayerColorRemap.cs" />
<Compile Include="Graphics\Palette.cs" />
<Compile Include="FileSystem\GlobalFileSystem.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">

View File

@@ -12,6 +12,8 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Network;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA

Some files were not shown because too many files have changed in this diff Show More