本文整理汇总了C#中ResourceLocation类的典型用法代码示例。如果您正苦于以下问题:C# ResourceLocation类的具体用法?C# ResourceLocation怎么用?C# ResourceLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceLocation类属于命名空间,在下文中一共展示了ResourceLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
示例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;
}
示例4: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
TDMPIO srcData = new TDMPIO();
srcData.Load(source);
srcData.Bits = 12;
srcData.Save(dest.GetStream);
}
示例5: ManifestResourceInfo
public ManifestResourceInfo(Assembly containingAssembly,
String containingFileName,
ResourceLocation resourceLocation)
{
_containingAssembly = containingAssembly;
_containingFileName = containingFileName;
_resourceLocation = resourceLocation;
}
示例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();
}
示例7: Convert
public override void Convert(ResourceLocation source, ResourceLocation dest)
{
XmlModelParser parser = new XmlModelParser();
ParsedXmlModel model = parser.Parse(source.GetStream);
}
示例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);
}
示例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);
}
示例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
);
}
示例11: PAKViewer
public PAKViewer(DesignerAbstractFactory fac, ResourceLocation res)
{
InitializeComponent();
LanguageParser.ParseLanguage(DevStringTable.Instance, this);
LanguageParser.ParseLanguage(DevStringTable.Instance, listView1);
Init(fac, res);
Saved = true;
}
示例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);
}
示例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
});
}
示例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();
}
示例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;
}
}