本文整理汇总了C#中Reflector类的典型用法代码示例。如果您正苦于以下问题:C# Reflector类的具体用法?C# Reflector怎么用?C# Reflector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Reflector类属于命名空间,在下文中一共展示了Reflector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Run
public override object Run(object obj, string[] parameters, IPropertyBag bag, IMarkupBase markup)
{
if (parameters == null || (parameters.Length < 2 || parameters.Length > 3))
throw new ImpressionInterpretException("Filter " + Keyword + " expects 2 or 3 parameters.", markup);
// text field to bind to
// selected value
// text field to bind to
// value field to bind to
// selected value
if (obj == null)
return null;
if (obj.GetType().GetInterface("IEnumerable") != null) {
IReflector reflector = new Reflector();
bool textOnly = parameters.Length == 2;
string textField = parameters[0];
string selectedField = textOnly ? parameters[1] : parameters[2];
StringBuilder optionBuilder = new StringBuilder();
IEnumerator en = ((IEnumerable) obj).GetEnumerator();
// " for quotes
// ' for apostrophes
// lookup the selected value
object selectedObject = bag == null ? null : reflector.Eval(bag, selectedField);
string selectedValue = selectedObject != null ? selectedObject.ToString() : null;
if (textOnly) {
while (en.MoveNext()) {
object current = en.Current;
object textObject = reflector.Eval(current, textField);
string textString = textObject != null ? textObject.ToString() : null;
string selected = (textString == selectedValue) ? " selected=\"true\"" : "";
optionBuilder.AppendFormat("<option{1}>{0}</option>", textString, selected);
}
} else {
string valueField = parameters[1];
while(en.MoveNext()) {
object current = en.Current;
object textObject = reflector.Eval(current, textField);
string textString = textObject != null ? textObject.ToString() : null;
object valueObject = reflector.Eval(current, valueField);
string valueString = valueObject != null ? valueObject.ToString() : null;
string selected = (valueString == selectedValue) ? " selected=\"true\"" : "";
optionBuilder.AppendFormat("<option value=\"{0}\"{2}>{1}</option>", valueString, textString, selected);
}
}
return optionBuilder.ToString();
}
return null;
}
开发者ID:codesoda,项目名称:Impression,代码行数:60,代码来源:HtmlOptionsFilter.cs
示例2: Main
static void Main(string[] args)
{
Rotor rL = new Rotor(FixedMechanicRotor.ROTOR_II); //II has notch F
Rotor rM = new Rotor(FixedMechanicRotor.ROTOR_IV); //IV has notch K
Rotor rR = new Rotor(FixedMechanicRotor.ROTOR_V); //V has notch A
//Following WW2 Convention, it is Left-Mid-Right e.g. II IV V
Rotor[] rotors = { rL, rM, rR };
Reflector re = new Reflector(FixedMechanicReflector.REFLECTOR_B);
Plugboard plug = new Plugboard(new String[] {
"AV", "BS", "CG", "DL", "FU", "HZ", "IN", "KM", "OW", "RX"}); //Barbarosa
WindowSetting initialSetting = new WindowSetting('B', 'L', 'A');
RingSetting ringPositions = new RingSetting(2, 21, 12);
//an example of naming hassle because Enigma is both namespace and class
Enigma.representation.Enigma enigma = new Enigma.representation.Enigma(rotors, re, plug, ringPositions, initialSetting);
string myfile = "C:\\Users\\ToshiW\\Documents\\Visual Studio 2012\\Projects\\Enigma\\Enigma\\Resources\\BarbarosaCiphertext.txt";
string input = Utility.FileToString(myfile);
//Console.WriteLine(readResult);
//Console.ReadLine();
//Let Enigma do its thing
string result = enigma.encryptString(input);
Console.WriteLine(result);
Console.ReadLine();
}
开发者ID:hardyw,项目名称:csharp-enigma,代码行数:29,代码来源:Program.cs
示例3: placeReflector
private void placeReflector(Vector3 point)
{
float x = Mathf.Round(point.x);
float z = Mathf.Round(point.z);
switch(reflector)
{
case Reflector.BOX:
placedReflector = Instantiate(reflectorPrefabBox, new Vector3(x, 1, z), Quaternion.identity) as GameObject;
break;
case Reflector.NE:
placedReflector = Instantiate(reflectorPrefabNE, new Vector3(x, 1, z), Quaternion.identity) as GameObject;
break;
case Reflector.NW:
placedReflector = Instantiate(reflectorPrefabNW, new Vector3(x, 1, z), Quaternion.identity) as GameObject;
break;
case Reflector.SE:
placedReflector = Instantiate(reflectorPrefabSE, new Vector3(x, 1, z), Quaternion.identity) as GameObject;
break;
case Reflector.SW:
placedReflector = Instantiate(reflectorPrefabSW, new Vector3(x, 1, z), Quaternion.identity) as GameObject;
break;
}
sound.playSelectSound();
refGui.blockPlaced = true;
reflector = Reflector.NONE;
removePlacedHighlight();
}
开发者ID:christopherray47,项目名称:LudumDare28,代码行数:29,代码来源:GridMouse.cs
示例4: XmlSerializerOperationBehavior
public XmlSerializerOperationBehavior(OperationDescription operation, XmlSerializerFormatAttribute attribute)
{
if (operation == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation");
#pragma warning suppress 56506 // Declaring contract cannot be null
Reflector parentReflector = new Reflector(operation.DeclaringContract.Namespace, operation.DeclaringContract.ContractType);
#pragma warning suppress 56506 // parentReflector cannot be null
_reflector = parentReflector.ReflectOperation(operation, attribute ?? new XmlSerializerFormatAttribute());
}
开发者ID:weshaggard,项目名称:wcf,代码行数:9,代码来源:XmlSerializerOperationBehavior.cs
示例5: CreateOutputOptions_should_return_expected_result
public void CreateOutputOptions_should_return_expected_result()
{
var subject = new MapReduceOperation<BsonDocument>(_collectionNamespace, _mapFunction, _reduceFunction, _resultSerializer, _messageEncoderSettings);
var subjectReflector = new Reflector(subject);
var expectedResult = new BsonDocument("inline", 1);
var result = subjectReflector.CreateOutputOptions();
result.Should().Be(expectedResult);
}
开发者ID:fir3pho3nixx,项目名称:mongo-csharp-driver,代码行数:10,代码来源:MapReduceOperationTests.cs
示例6: AddReflection
public ManualResetEvent AddReflection(Control cntrl)
{
if (cntrl == null) return null;
if (cntrl.IsDisposed) return null;
if (Exits(cntrl)) return null;
IScreener cs = new Reflector (cntrl);
IProjector pj = new Projector(cs, new Reflection(cntrl.Parent.BackColor));
this.Add(pj);
return ((Projector)pj).Wait;
}
开发者ID:kburman,项目名称:Animatrix,代码行数:10,代码来源:Animator.cs
示例7: Awake
void Awake()
{
//bulletLayer = LayerMask.NameToLayer("Bullet");
enemyLayer = LayerMask.NameToLayer("Enemy");
hero = this;
health = _maxHealth = 10;
stamina = _maxStamina = 200;
reflector = transform.Find("Reflector").GetComponent<Reflector>();
rend = GetComponent<Renderer>();
}
开发者ID:nessenbu2,项目名称:EECS494,代码行数:11,代码来源:Hero.cs
示例8: SteckerbrettM3
// TODO: Go nuts, make the signal events wire based
public SteckerbrettM3(Wheel wheel0, Wheel wheel1, Wheel wheel2, Reflector reflector)
{
_wheel0 = wheel0;
_wheel1 = wheel1;
_wheel2 = wheel2;
_reflector = reflector;
HookupWheel0();
HookupWheel1();
HookupWheel2();
HookUpReflector();
}
开发者ID:c0d3m0nky,项目名称:Enigma,代码行数:12,代码来源:SteckerbrettM3.cs
示例9: constructor_should_initialize_subject
public void constructor_should_initialize_subject()
{
var maxChunkCount = 1;
var chunkSize = 16;
var subject = new BsonChunkPool(maxChunkCount, chunkSize);
var reflector = new Reflector(subject);
subject.MaxChunkCount.Should().Be(maxChunkCount);
subject.ChunkSize.Should().Be(chunkSize);
reflector._disposed.Should().BeFalse();
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:12,代码来源:BsonChunkPoolTests.cs
示例10: AddBehaviors
private static void AddBehaviors(ContractDescription contract, bool builtInOperationBehavior)
{
Reflector reflector = new Reflector(contract.Namespace, contract.ContractType);
foreach (OperationDescription description in contract.Operations)
{
System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector reflector2 = reflector.ReflectOperation(description);
if ((reflector2 != null) && (description.DeclaringContract == contract))
{
description.Behaviors.Add(new XmlSerializerOperationBehavior(reflector2, builtInOperationBehavior));
description.Behaviors.Add(new XmlSerializerOperationGenerator(new XmlSerializerImportOptions()));
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:XmlSerializerOperationBehavior.cs
示例11: EnigmaMachine
public EnigmaMachine()
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolver);
InitializeComponent();
rotorsToolStripMenuItem_Click(null, null);
panel6.BackColor = Color.FromArgb(7, 7, 7);
left_Rotor = new Rotor("I", "EKMFLGDQVZNTOWYHXUSPAIBRCJ", 1, 17);
mid_Rotor = new Rotor("II", "AJDKSIRUXBLHWTMCQGZNPYFVOE", 1, 5);
right_Rotor = new Rotor("III", "BDFHJLCPRTXVZNYEIWGAKMUSQO", 1, 22);
extra_Rotor = new Rotor("IV", "ESOVPZJAYQUIRHXLNFTGKDCMWB", 1, 10);
reflector = new Reflector("B", "B", "YRUHQSLDPXNGOKMIEBFZCWVJAT");
DisplayPlugboard();
Display_Rotors();
}
开发者ID:jimbojetset,项目名称:EnigmaMachine,代码行数:14,代码来源:EnigmaMachine.cs
示例12: Load
public void Load(Reflector.CodeModel.IAssembly item)
{
try
{
//%SystemRoot%\Microsoft.net\Framework\v2.0.50727\mscorlib.dll
//Engine.Runtime.LoadAssembly(Assembly.LoadFile(Environment.ExpandEnvironmentVariables(item.Location)));
ThreadStart starter2 = delegate { Engine.Runtime.LoadAssembly(Assembly.LoadFile(Environment.ExpandEnvironmentVariables(item.Location))); };
new Thread(starter2).Start();
}
catch (Exception ex)
{
Console.Error.WriteLine("Unable to load assembly: " + item.Location);
}
}
开发者ID:BenHall,项目名称:TheMethodist,代码行数:14,代码来源:DLRHost.cs
示例13: CreateOutputOptions_should_return_expected_result
public void CreateOutputOptions_should_return_expected_result()
{
var subject = new MapReduceOutputToCollectionOperation(_collectionNamespace, _outputCollectionNamespace, _mapFunction, _reduceFunction, _messageEncoderSettings);
var subjectReflector = new Reflector(subject);
var expectedResult = new BsonDocument
{
{ "replace", _outputCollectionNamespace.CollectionName },
{ "db", _outputCollectionNamespace.DatabaseNamespace.DatabaseName }
};
var result = subjectReflector.CreateOutputOptions();
result.Should().Be(expectedResult);
}
开发者ID:fir3pho3nixx,项目名称:mongo-csharp-driver,代码行数:14,代码来源:MapReduceOutputToCollectionOperationTests.cs
示例14: ShowDialog
public bool ShowDialog(IntPtr hWndOwner)
{
bool flag = false;
if (Environment.OSVersion.Version.Major >= 6)
{
var r = new Reflector("System.Windows.Forms");
uint num = 0;
Type typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
object dialog = r.Call(ofd, "CreateVistaDialog");
r.Call(ofd, "OnBeforeVistaDialog", dialog);
uint options = (uint)r.CallAs(typeof(System.Windows.Forms.FileDialog), ofd, "GetOptions");
options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
r.CallAs(typeIFileDialog, dialog, "SetOptions", options);
object pfde = r.New("FileDialog.VistaDialogEvents", ofd);
object[] parameters = new object[] { pfde, num };
r.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
num = (uint)parameters[1];
try
{
int num2 = (int)r.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
flag = 0 == num2;
}
finally
{
r.CallAs(typeIFileDialog, dialog, "Unadvise", num);
GC.KeepAlive(pfde);
}
}
else
{
using (var fbd = new FolderBrowserDialog())
{
fbd.Description = this.Title;
fbd.SelectedPath = this.InitialDirectory;
fbd.ShowNewFolderButton = false;
if (fbd.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK) return false;
ofd.FileName = fbd.SelectedPath;
flag = true;
}
}
return flag;
}
开发者ID:halalfood,项目名称:WallbaseDownloader,代码行数:48,代码来源:WinDialog.cs
示例15: constructor_should_initialize_subject
public void constructor_should_initialize_subject()
{
var baseSource = Substitute.For<IBsonChunkSource>();
var maxUnpooledChunkSize = 2;
var minChunkSize = 4;
var maxChunkSize = 8;
var subject = new InputBufferChunkSource(baseSource, maxUnpooledChunkSize, minChunkSize, maxChunkSize);
var reflector = new Reflector(subject);
subject.BaseSource.Should().BeSameAs(baseSource);
subject.MaxChunkSize.Should().Be(maxChunkSize);
subject.MaxUnpooledChunkSize.Should().Be(maxUnpooledChunkSize);
subject.MinChunkSize.Should().Be(minChunkSize);
reflector._disposed.Should().BeFalse();
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:16,代码来源:InputBufferChunkSourceTests.cs
示例16: constructor_should_initialize_subject
public void constructor_should_initialize_subject()
{
var mockBaseSource = new Mock<IBsonChunkSource>();
var initialUnpooledChunkSize = 2;
var minChunkSize = 4;
var maxChunkSize = 8;
var subject = new OutputBufferChunkSource(mockBaseSource.Object, initialUnpooledChunkSize, minChunkSize, maxChunkSize);
var reflector = new Reflector(subject);
subject.BaseSource.Should().BeSameAs(mockBaseSource.Object);
subject.InitialUnpooledChunkSize.Should().Be(initialUnpooledChunkSize);
subject.MaxChunkSize.Should().Be(maxChunkSize);
subject.MinChunkSize.Should().Be(minChunkSize);
reflector._disposed.Should().BeFalse();
}
开发者ID:RavenZZ,项目名称:MDRelation,代码行数:16,代码来源:OutputBufferChunkSourceTests.cs
示例17: ShowDialog
private bool ShowDialog(IntPtr hWndOwner)
{
bool flag;
if (Environment.OSVersion.Version.Major >= 6)
{
var r = new Reflector("System.Windows.Forms");
uint num = 0;
var typeIFileDialog = r.GetType("FileDialogNative.IFileDialog");
var dialog = Reflector.Call(_ofd, "CreateVistaDialog");
Reflector.Call(_ofd, "OnBeforeVistaDialog", dialog);
var options = (uint)Reflector.CallAs(typeof(FileDialog), _ofd, "GetOptions");
options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
Reflector.CallAs(typeIFileDialog, dialog, "SetOptions", options);
var pfde = r.New("FileDialog.VistaDialogEvents", _ofd);
var parameters = new[] { pfde, num };
Reflector.CallAs2(typeIFileDialog, dialog, "Advise", parameters);
num = (uint)parameters[1];
try
{
var num2 = (int)Reflector.CallAs(typeIFileDialog, dialog, "Show", hWndOwner);
flag = 0 == num2;
}
finally
{
Reflector.CallAs(typeIFileDialog, dialog, "Unadvise", num);
GC.KeepAlive(pfde);
}
}
else
{
var fbd = new FolderBrowserDialog {
Description = Title,
SelectedPath = InitialDirectory
};
if (fbd.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK)
return false;
_ofd.FileName = fbd.SelectedPath;
return true;
}
return flag;
}
开发者ID:ttgxdinger,项目名称:Random,代码行数:45,代码来源:FolderSelectDialog.cs
示例18: constructor_should_initialize_instance
public void constructor_should_initialize_instance()
{
var channelSource = Substitute.For<IChannelSource>();
var databaseNamespace = new DatabaseNamespace("test");
var collectionNamespace = new CollectionNamespace(databaseNamespace, "test");
var query = new BsonDocument("x", 1);
var firstBatch = new BsonDocument[] { new BsonDocument("y", 2) };
var cursorId = 1L;
var batchSize = 2;
var limit = 3;
var serializer = BsonDocumentSerializer.Instance;
var messageEncoderSettings = new MessageEncoderSettings();
var maxTime = TimeSpan.FromSeconds(1);
var result = new AsyncCursor<BsonDocument>(
channelSource,
collectionNamespace,
query,
firstBatch,
cursorId,
batchSize,
limit,
serializer,
messageEncoderSettings,
maxTime);
var reflector = new Reflector(result);
reflector.BatchSize.Should().Be(batchSize);
reflector.ChannelSource.Should().Be(channelSource);
reflector.CollectionNamespace.Should().Be(collectionNamespace);
reflector.Count.Should().Be(firstBatch.Length);
reflector.CurrentBatch.Should().BeNull();
reflector.CursorId.Should().Be(cursorId);
reflector.Disposed.Should().BeFalse();
reflector.FirstBatch.Should().Equal(firstBatch);
reflector.Limit.Should().Be(limit);
reflector.MaxTime.Should().Be(maxTime);
reflector.MessageEncoderSettings.Should().BeEquivalentTo(messageEncoderSettings);
reflector.Query.Should().Be(query);
reflector.Serializer.Should().Be(serializer);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:41,代码来源:AsyncCursorTests.cs
示例19: ShowDialog
public bool ShowDialog(IntPtr hWndOwner)
{
if ((Environment.OSVersion.Version.Major >= 6) && !this.UseOldDialog)
{
Reflector reflector = new Reflector("System.Windows.Forms");
uint num = 0;
Type type = reflector.GetType("FileDialogNative.IFileDialog");
object obj2 = reflector.Call(this.ofd, "CreateVistaDialog", new object[0]);
reflector.Call(this.ofd, "OnBeforeVistaDialog", new object[] {obj2});
uint num2 = (uint) reflector.CallAs(typeof (FileDialog), this.ofd, "GetOptions", new object[0]);
num2 |= (uint) reflector.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS");
reflector.CallAs(type, obj2, "SetOptions", new object[] {num2});
object obj3 = reflector.New("FileDialog.VistaDialogEvents", new object[] {this.ofd});
object[] parameters = new object[] {obj3, num};
reflector.CallAs2(type, obj2, "Advise", parameters);
num = (uint) parameters[1];
try
{
int num3 = (int) reflector.CallAs(type, obj2, "Show", new object[] {hWndOwner});
return (0 == num3);
}
finally
{
reflector.CallAs(type, obj2, "Unadvise", new object[] {num});
GC.KeepAlive(obj3);
}
}
FolderBrowserDialogEx ex = new FolderBrowserDialogEx();
ex.Description = this.Title;
ex.SelectedPath = this.InitialDirectory;
ex.ShowNewFolderButton = true;
ex.ShowEditBox = true;
ex.ShowFullPathInEditBox = true;
if (ex.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK)
{
return false;
}
this.ofd.FileName = ex.SelectedPath;
return true;
}
开发者ID:desautel,项目名称:Sdl-Community,代码行数:40,代码来源:FolderSelect.cs
示例20: RegisterRunSeatDispatcher
public void RegisterRunSeatDispatcher(FrameworkElement el, Grid container, int rowPosition)
{
_buildSeatDispatcher = new Action<Reflector>(model =>
{
container.RowDefinitions[rowPosition].Height = new GridLength(_seatDispatcherHeight);
View.SetModel(el, model.Target);
model.SetProperty<System.Func<bool, Luna.Infrastructure.Domain.ISimpleEmployee, bool>>("TrySubmitChanged", (test, employee) =>
{
if (test == false && IsDirty == false)
{
SubmitSeatChanges(new[] { _attendances.FirstOrDefault(o => o.Profile.Equals(employee)) }, false);
}
return !IsDirty; // IsDirty means can't call UpdateSchedule
});
model.SetProperty<Action<int>>("OccupationsChanged", (i) =>
{
var index = i == -1 ? BindableAgents.IndexOf(SelectedAgent) : i;
AgentOccupations[index] = BindableAgents[index].SaftyGetProperty<IEnumerable, IWorkingAgent>(o => o.Occupations);
this.QuietlyReload(ref _agentOccupations, "AgentOccupations");
});
model.SetProperty<Action<IList<IEnumerable>>>("OccupationsReloaded", (list) =>
{
AgentOccupations = (from IWorkingAgent a in BindableAgents where a.Occupations != null select (IEnumerable)a.Occupations).ToList();
});
_seatDispatcherPresenter = model;
});
_destroySeatDispatcher = new Action(() =>
{
_seatDispatcherHeight = container.RowDefinitions[rowPosition].ActualHeight;
View.SetModel(el, null);
container.RowDefinitions[rowPosition].Height = new GridLength(0);
});
}
开发者ID:Mrding,项目名称:Ribbon,代码行数:37,代码来源:ShiftDispatcherPresenter.Action.Seating.cs
注:本文中的Reflector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论