本文整理汇总了C#中ResourceLocation类的典型用法代码示例。如果您正苦于以下问题:C# ResourceLocation类的具体用法?C# ResourceLocation怎么用?C# ResourceLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceLocation类属于命名空间,在下文中一共展示了ResourceLocation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddCssFileParts
/// <summary>
/// Add CSS element
/// </summary>
/// <param name="html">HTML helper</param>
/// <param name="location">A location of the script element</param>
/// <param name="part">CSS part</param>
/// <param name="pageHeadBuilder"></param>
public static void AddCssFileParts(this HtmlHelper html, ResourceLocation location, string part,
IPageHeadBuilder pageHeadBuilder = null)
{
if (pageHeadBuilder == null)
pageHeadBuilder = EngineContext.Current.Resolve<IPageHeadBuilder>();
pageHeadBuilder.AddCssFileParts(location, part);
}
开发者ID:sounj142,项目名称:aaabbb,代码行数:14,代码来源:LayoutExtensions.cs
示例2: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
ContentBinaryReader br = new ContentBinaryReader(source);
BinaryDataReader data = br.ReadBinaryData();
float xllcorner = data.GetDataSingle("xllcorner");
float yllcorner = data.GetDataSingle("yllcorner");
int width = data.GetDataInt32("width");
int height = data.GetDataInt32("height");
float[] demData = new float[height * width];
int bits = data.GetDataInt32("bits", 32);
ContentBinaryReader br2 = data.GetData("data");
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
demData[i * width + j] = br2.ReadSingle();
}
}
br2.Close();
data.Close();
Half[] demData16 = Half.ConvertToHalf(demData);
// =========================================================
BinaryDataWriter result = new BinaryDataWriter();
result.AddEntry("xllcorner", xllcorner);
result.AddEntry("yllcorner", yllcorner);
result.AddEntry("width", width);
result.AddEntry("height", height);
result.AddEntry("bits", 16);
Stream dataStream = result.AddEntryStream("data");
ContentBinaryWriter bw = new ContentBinaryWriter(dataStream);
for (int i = 0; i < demData.Length; i++)
{
bw.Write(demData16[i].InternalValue);
}
bw.Close();
bw = new ContentBinaryWriter(dest);
bw.Write(result);
bw.Close();
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:59,代码来源:TDmp32To16Converter.cs
示例3: ManifestResourceInfo
// Internal constructor used by the engine to build
// an instance of this class.
internal ManifestResourceInfo(String fileName,
Assembly assembly,
ResourceLocation location)
{
this.fileName = fileName;
this.assembly = assembly;
this.location = location;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:10,代码来源:ManifestResourceInfo.cs
示例4: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
TDMPIO srcData = new TDMPIO();
srcData.Load(source);
srcData.Bits = 12;
srcData.Save(dest.GetStream);
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:8,代码来源:TDmp32To12Converter.cs
示例5: ManifestResourceInfo
public ManifestResourceInfo(Assembly containingAssembly,
String containingFileName,
ResourceLocation resourceLocation)
{
_containingAssembly = containingAssembly;
_containingFileName = containingFileName;
_resourceLocation = resourceLocation;
}
开发者ID:ChuangYang,项目名称:coreclr,代码行数:8,代码来源:ManifestResourceInfo.cs
示例6: Convert
public unsafe override void Convert(ResourceLocation source, ResourceLocation dest)
{
const int origWidth = 64;
const int origHeight = 64;
const int Id = 'S' << 24 | 'F' << 16 | 'N' << 8 | 'T';
Font font = new Font(currentFont, FontSize);
ContentBinaryWriter bw = new ContentBinaryWriter(dest);
bw.Write(Id);
bw.Write((int)0);
bw.Write((int)byte.MaxValue);
bw.Write((int)origWidth);
bw.Write((int)origHeight);
bw.Write(FontSize);
for (char c = '\0'; c < 256; c++)
{
Bitmap bmp = new Bitmap(origWidth, origHeight);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(Color.Black);
Size size = TextRenderer.MeasureText(c.ToString(), font);
TextRenderer.DrawText(g, c.ToString(), font,
new Rectangle(0, 0, origWidth, origHeight)
, Color.White, Color.Black, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter);
g.Dispose();
BitmapData data = bmp.LockBits(new Rectangle(0, 0, origWidth, origHeight), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
byte* src = (byte*)data.Scan0;
bw.Write((ushort)c);
bw.Write(size.Width);
bw.Write(size.Height);
for (int i = 0; i < origHeight; i++)
{
for (int j = 0; j < origWidth; j++)
{
byte red = *src++;
byte gr = *src++;
byte bl = *src++;
src++;
float lum = (red * 0.3f + gr * 0.59f + bl * 0.11f);
bw.Write((byte)lum);
}
}
bmp.UnlockBits(data);
//bmp.Save(@"E:\Desktop\out\" + ((ushort)c).ToString() + ".png", ImageFormat.Png);
bmp.Dispose();
}
bw.Close();
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:58,代码来源:FontConverter.cs
示例7: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
XmlModelParser parser = new XmlModelParser();
ParsedXmlModel model = parser.Parse(source.GetStream);
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:9,代码来源:Xml2ModelConverter2.cs
示例8: AddScriptParts
public void AddScriptParts(ResourceLocation location, params string[] parts)
{
if (!_scriptParts.ContainsKey(location))
_scriptParts.Add(location, new List<string>());
if (parts != null)
foreach (string part in parts)
if (!string.IsNullOrEmpty(part))
_scriptParts[location].Add(part);
}
开发者ID:alexgonchar,项目名称:WebArsenal,代码行数:10,代码来源:PageTitleBuilder.cs
示例9: AddCssFileParts
public virtual void AddCssFileParts(ResourceLocation location, string part)
{
if (!_cssParts.ContainsKey(location))
_cssParts.Add(location, new List<string>());
if (string.IsNullOrEmpty(part))
return;
_cssParts[location].Add(part);
}
开发者ID:aumankit,项目名称:nop,代码行数:10,代码来源:PageHeadBuilder.cs
示例10: GetResourcePath
private static string GetResourcePath(string path, ResourceType type, ResourceLocation loc)
{
if (path.StartsWith("/")) {
path = path.Substring(1);
}
return string.Format("{0}{1}/{2}"
, loc == ResourceLocation.Module ? ModuleFolder : ThemeFolder
, type.ToString()
, path
);
}
开发者ID:GiscardBiamby,项目名称:Orchard-Syntax-Highlighter,代码行数:11,代码来源:ResourceManifest.cs
示例11: PAKViewer
public PAKViewer(DesignerAbstractFactory fac, ResourceLocation res)
{
InitializeComponent();
LanguageParser.ParseLanguage(DevStringTable.Instance, this);
LanguageParser.ParseLanguage(DevStringTable.Instance, listView1);
Init(fac, res);
Saved = true;
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:11,代码来源:PAKViewer.cs
示例12: AddRaw
/// <summary>
/// Adds raw, pre-compressed resource data to a cache.
/// </summary>
/// <param name="resource">The resource reference to initialize.</param>
/// <param name="location">The location where the resource should be stored.</param>
/// <param name="data">The pre-compressed data to store.</param>
public void AddRaw(ResourceReference resource, ResourceLocation location, byte[] data)
{
if (resource == null)
throw new ArgumentNullException("resource");
resource.ChangeLocation(location);
resource.DisableChecksum();
var cache = GetCache(resource);
using (var stream = cache.File.Open(FileMode.Open, FileAccess.ReadWrite))
resource.Index = cache.Cache.AddRaw(stream, data);
}
开发者ID:TheGuardians,项目名称:TagTool,代码行数:17,代码来源:ResourceDataManager.cs
示例13: AddScriptParts
public virtual void AddScriptParts(ResourceLocation location, string part, bool excludeFromBundle)
{
if (!_scriptParts.ContainsKey(location))
_scriptParts.Add(location, new List<ScriptReferenceMeta>());
if (string.IsNullOrEmpty(part))
return;
_scriptParts[location].Add(new ScriptReferenceMeta()
{
ExcludeFromBundle = excludeFromBundle,
Part = part
});
}
开发者ID:vic0626,项目名称:nas-merk,代码行数:14,代码来源:PageHeadBuilder.cs
示例14: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
Bitmap bmp = new Bitmap(512 * 10, 512 * 5);
BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
int ofsX = 0;
int ofsY = 0;
for (int i = 4; i >= 0; i--)
{
string[] files = Directory.GetFiles(Path.Combine(srcDir, "000" + i.ToString() + "\\"), "*.*");
for (int j = 0; j < 10; j++)
{
Bitmap b2 = new Bitmap(files[j]);
BitmapData d2 = b2.LockBits(new Rectangle(0, 0, b2.Width, b2.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int* src = (int*)d2.Scan0;
int* dst = (int*)data.Scan0;
for (int y = 0; y < b2.Height; y++)
{
for (int x = 0; x < b2.Width; x++)
{
dst[(y + ofsY) * bmp.Width + x + ofsX] = src[y * b2.Width + x];
}
}
ofsX += b2.Width;
if (ofsX >= bmp.Width)
{
ofsX = 0;
ofsY += b2.Height;
}
b2.UnlockBits(d2);
b2.Dispose();
}
}
bmp.UnlockBits(data);
Stream stm = dest.GetStream;
bmp.Save(stm, ImageFormat.Png);
stm.Close();
bmp.Dispose();
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:49,代码来源:ImageRemerger.cs
示例15: Initialize
public override void Initialize(string tagName, string markup, List<string> tokens)
{
base.Initialize(tagName, markup, tokens);
var parameters = markup.ParseParameters();
if (!parameters.Any()) return;
_resourceReferenceParameter = parameters.First();
if (parameters.Count() == 2 && parameters.Last().Equals("head", StringComparison.InvariantCultureIgnoreCase))
{
_location = ResourceLocation.Head;
}
}
开发者ID:Lombiq,项目名称:Orchard-Liquid-Markup,代码行数:15,代码来源:ScriptTag.cs
示例16: LoadCache
/// <summary>
/// Loads a resource cache from a file.
/// </summary>
/// <param name="location">The resource cache type.</param>
/// <param name="path">The path to the .dat file to read.</param>
/// <exception cref="System.InvalidOperationException">Thrown if the cache is already loaded.</exception>
public void LoadCache(ResourceLocation location, string path)
{
if (_loadedCaches.ContainsKey(location))
throw new InvalidOperationException("A resource cache for the " + location + " location has already been loaded.");
var file = new FileInfo(path);
using (var stream = file.OpenRead())
{
_loadedCaches[location] = new LoadedCache
{
Cache = new ResourceCache(stream),
File = file
};
}
}
开发者ID:medsouz,项目名称:HaloOnlineTagTool,代码行数:21,代码来源:ResourceDataManager.cs
示例17: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
TDMPIO src = new TDMPIO();
src.Load(source);
float[] rsd = TDmpLodGen.Resize(src.Data, src.Width, src.Height, ResizeSize, ResizeSize);
TDMPIO dst = new TDMPIO();
dst.Width = ResizeSize;
dst.Height = ResizeSize;
dst.Bits = src.Bits;
dst.Xllcorner = src.Xllcorner;
dst.Yllcorner = src.Yllcorner;
dst.XSpan = src.XSpan;
dst.YSpan = src.YSpan;
dst.Data = rsd;
dst.Save(dest.GetStream);
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:19,代码来源:TDmpResizer.cs
示例18: Convert
public unsafe override void Convert(ResourceLocation source, ResourceLocation dest)
{
Stream stm = source.GetStream;
Bitmap bmp = new Bitmap(stm);
BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
uint* src = (uint*)data.Scan0;
ulong totalR = 0;
ulong totalG = 0;
ulong totalB = 0;
for (int i = 0; i < bmp.Height; i++)
{
for (int j = 0; j < bmp.Width; j++)
{
uint clr = src[i * bmp.Width + j];
totalR += ((clr & 0x00ff0000) >> 16);
totalG += ((clr & 0x0000ff00) >> 8);
totalB += clr & 0xff;
}
}
totalR /= (ulong)(bmp.Width * bmp.Height);
totalG /= (ulong)(bmp.Width * bmp.Height);
totalB /= (ulong)(bmp.Width * bmp.Height);
StringBuilder sb = new StringBuilder(50);
sb.Append(totalR.ToString());
sb.Append(", ");
sb.Append(totalG.ToString());
sb.Append(", ");
sb.Append(totalB.ToString());
iniSect.Add(source.Name, sb.ToString());
stm.Close();
bmp.Dispose();
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:41,代码来源:TextureColorCalculator.cs
示例19: Add
/// <summary>
/// Adds a new resource to a cache.
/// </summary>
/// <param name="resource">The resource reference to initialize.</param>
/// <param name="location">The location where the resource should be stored.</param>
/// <param name="dataStream">The stream to read the resource data from.</param>
/// <exception cref="System.ArgumentNullException">resource</exception>
/// <exception cref="System.ArgumentException">The input stream is not open for reading;dataStream</exception>
public void Add(ResourceReference resource, ResourceLocation location, Stream dataStream)
{
if (resource == null)
throw new ArgumentNullException("resource");
if (!dataStream.CanRead)
throw new ArgumentException("The input stream is not open for reading", "dataStream");
resource.ChangeLocation(location);
var cache = GetCache(resource);
using (var stream = cache.File.Open(FileMode.Open, FileAccess.ReadWrite))
{
var dataSize = (int)(dataStream.Length - dataStream.Position);
var data = new byte[dataSize];
dataStream.Read(data, 0, dataSize);
uint compressedSize;
resource.Index = cache.Cache.Add(stream, data, out compressedSize);
resource.CompressedSize = compressedSize;
resource.DecompressedSize = (uint)dataSize;
resource.DisableChecksum();
}
}
开发者ID:medsouz,项目名称:HaloOnlineTagTool,代码行数:29,代码来源:ResourceDataManager.cs
示例20: GameConfiguration
public GameConfiguration(ResourceLocation fl)
: base(fl.Name, EqualityComparer<string>.Default)
{
XmlTextReader xml = new XmlTextReader(fl.GetStream);
xml.WhitespaceHandling = WhitespaceHandling.None;
int depth = xml.Depth;
GameConfigurationSection currentSection = null;
string currentAttrib = string.Empty;
while (MoveToNextElement(xml))
{
switch (xml.NodeType)
{
case XmlNodeType.Element:
case XmlNodeType.Text:
case XmlNodeType.CDATA:
switch (xml.Depth)
{
case 1:
currentSection = new GameConfigurationSection(xml.Name);
Add(xml.Name, currentSection);
break;
case 2:
currentAttrib = xml.Name;
break;
case 3:
currentSection.Add(currentAttrib, xml.ReadString());
break;
}
break;
}
}
xml.Close();
}
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:38,代码来源:GameConfiguration.cs
注:本文中的ResourceLocation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论