public static BaseFileEntry Create(string path, AddMethod addMethod) { var fileType = PBXFileTypeHelper.FileTypeFromFileName(path); if (!IsValidFileOrFolder(path)) { return(null); } if (PBXFileTypeHelper.IsSourceCodeFile(fileType)) { return(CreateSourceEntry(path, addMethod, "")); } else if (PBXFileTypeHelper.IsFramework(fileType)) { return(CreateFrameworkEntry(path, addMethod, LinkType.Required, false)); } else if (PBXFileTypeHelper.IsLibrary(fileType)) { return(CreateStaticLibraryEntry(path, addMethod, LinkType.Required)); } else if (Directory.Exists(path) && !PBXFileTypeHelper.IsContainer(fileType)) { return(CreateFolderEntry(path, addMethod)); } else { return(CreateFileEntry(path, addMethod)); } }
public bool AddAddMethod(XElement element) { var obj = new AddMethod(Mod); obj.SetXml(element); return(AddAddMethod(obj)); }
/// <summary> /// Create expression to add instance to disposal scope /// </summary> /// <param name="scope">scope for strategy</param> /// <param name="request">request</param> /// <param name="activationConfiguration">activation configuration</param> /// <param name="result">result for instantiation</param> /// <returns></returns> public IActivationExpressionResult CreateExpression(IInjectionScope scope, IActivationExpressionRequest request, TypeActivationConfiguration activationConfiguration, IActivationExpressionResult result) { var closedActionType = typeof(Action <>).MakeGenericType(activationConfiguration.ActivationType); object disposalDelegate = null; if (closedActionType == activationConfiguration.DisposalDelegate?.GetType()) { disposalDelegate = activationConfiguration.DisposalDelegate; } MethodInfo closedGeneric; Expression[] parameterExpressions; if (disposalDelegate != null) { closedGeneric = AddMethodWithCleanup.MakeGenericMethod(activationConfiguration.ActivationType); parameterExpressions = new[] { result.Expression, Expression.Convert(Expression.Constant(disposalDelegate), closedActionType) }; } else { closedGeneric = AddMethod.MakeGenericMethod(activationConfiguration.ActivationType); parameterExpressions = new[] { result.Expression }; } var disposalCall = Expression.Call(request.DisposalScopeExpression, closedGeneric, parameterExpressions); var disposalResult = request.Services.Compiler.CreateNewResult(request, disposalCall); disposalResult.AddExpressionResult(result); return(disposalResult); }
public void AddSourceFile(string path, AddMethod addMethod, string compilerFlags = "") { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { BaseFileEntry entry = null; var fileType = PBXFileTypeHelper.FileTypeFromFileName(path); if (PBXFileTypeHelper.IsSourceCodeFile(fileType)) { entry = FileAndFolderEntryFactory.CreateSourceEntry(path, addMethod, compilerFlags); } else { Debug.LogWarning("EgoXproject: File is not a known source file type. Adding as a regular file: " + path); entry = FileAndFolderEntryFactory.Create(path, addMethod); } if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either it does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } }
public void AddFrameworkOrLibrary(string path, AddMethod addMethod, LinkType linkType) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { BaseFileEntry entry = null; var fileType = PBXFileTypeHelper.FileTypeFromFileName(path); if (PBXFileTypeHelper.IsFrameworkOrLibrary(fileType)) { entry = FileAndFolderEntryFactory.CreateFrameworkEntry(path, addMethod, linkType, false); } else { Debug.LogWarning("EgoXproject: File is not a known Framework or library file type. Adding as a regular file: " + path); entry = FileAndFolderEntryFactory.Create(path, addMethod); } if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either it does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } }
public static void Main(String[] args) { SaySomething(); Console.WriteLine(result); List <Printer> printers = new List <Printer>(); int i = 0; for (; i < 10; i++) { printers.Add(delegate { Console.WriteLine(i); }); } foreach (var printer in printers) { printer(); } testCls cls = new testCls(); PrintWith_2and4((x, y) => x * y); PrintWith_2and4((x, y) => x + y); PrintWith_2and4((x, y) => 999); AddMethod addM = new AddMethod(cls.add); addM += cls.add10; Console.WriteLine("Press any key"); Console.ReadLine(); }
public override void SetMasterDefinition(Member master) { base.SetMasterDefinition(master); AddMethod?.SetMasterDefinition(((Event)master)?.AddMethod); RemoveMethod?.SetMasterDefinition(((Event)master)?.RemoveMethod); ImplicitField?.SetMasterDefinition(((Event)master)?.ImplicitField); }
protected override void ChildSpecificAccept(IDefinitionVisitor visitor) { ArgumentUtility.CheckNotNull("visitor", visitor); visitor.Visit(this); AddMethod.Accept(visitor); RemoveMethod.Accept(visitor); }
private void InstanceMain() { AddMethod @delegate = DoAdd; Action <string> bar = DoStuff; Func <int, int, int> foo = DoAdd; }
public override void AfterPropertiesSet() { base.AfterPropertiesSet(); ParamChecker.AssertParamNotNull(AddMethod, "AddMethod"); ParamChecker.AssertParamNotNull(RemoveMethod, "RemoveMethod"); ParamChecker.AssertTrue(AddMethod.GetParameters().Length == Arguments.Length, "Parameter count does not match"); }
public static StaticLibraryEntry CreateStaticLibraryEntry(string path, AddMethod addMethod, LinkType linkType) { if (!IsValidFileOrFolder(path)) { return(null); } return(new StaticLibraryEntry(path, addMethod, linkType)); }
public static FrameworkEntry CreateFrameworkEntry(string path, AddMethod addMethod, LinkType linkType, bool embedded) { if (!IsValidFileOrFolder(path)) { return(null); } return(new FrameworkEntry(path, addMethod, linkType, embedded)); }
public static SourceFileEntry CreateSourceEntry(string path, AddMethod addMethod, string attributes) { if (!IsValidFileOrFolder(path)) { return(null); } return(new SourceFileEntry(path, addMethod, attributes)); }
public bool AddAddMethod(AddMethod obj) { if (AddMethods == null) { AddMethods = new List <AddMethod>(); } AddMethods.Add(obj); return(true); }
public static FileEntry CreateFileEntry(string path, AddMethod addMethod) { if (!IsValidFileOrFolder(path)) { return(null); } return(new FileEntry(path, addMethod)); }
public override void Implement(DynamicTypeBuilder config, TypeBuilder typeBuilder) { var addMethodIL = AddMethod.GetILGenerator(); GenerateHandlerMethods(BackingField, addMethodIL, true); var removeMethodIL = RemoveMethod.GetILGenerator(); GenerateHandlerMethods(BackingField, removeMethodIL, false); }
protected BaseFileEntry(string path, AddMethod addMethod) { if (string.IsNullOrEmpty(path)) { throw new System.ArgumentNullException((path).ToString(), "Path cannot be null"); } Path = path; Add = addMethod; SetFileName(); }
public static FolderEntry CreateFolderEntry(string path, AddMethod addMethod) { if (!IsValidFileOrFolder(path)) { return(null); } var folderEntry = new FolderEntry(path, addMethod); return(folderEntry); }
static Message() { globalMethods["+"] = new AddMethod(); globalMethods["-"] = new SubtractMethod(); globalMethods["*"] = new MultiplyMethod(); globalMethods["/"] = new DivideMethod(); globalMethods["=="] = new EqualsNativeMethod(); globalMethods["!="] = new NotEqualsNativeMethod(); // TODO put not in global, but associated with types globalMethods["new"] = new NewMethod(); }
public void SetImplementedEvent(Event decl) { ImplementedEvent = decl; UnoName = decl.DeclaringType + "." + decl.UnoName; if (AddMethod != null && decl.AddMethod != null) { AddMethod.SetImplementedMethod(decl.AddMethod); } if (RemoveMethod != null && decl.RemoveMethod != null) { RemoveMethod.SetImplementedMethod(decl.RemoveMethod); } }
public void AddMethod_AddOnePositveIntToOneNegativeInt_ResultEqualsCorrectSum() { //Arrange AddMethod add = new AddMethod(); int posInt = 2; int negInt = -1; int expected = 1; int actual = posInt + negInt; //Act add.Add(posInt, negInt); //Assert Assert.AreEqual(expected, actual); }
public void AddMethod_AddTwoPositiveInts_ResultEqualsCorrectSum() { //Arrange AddMethod add = new AddMethod(); int num1 = 1; int num2 = 1; int expected = 2; int actual = num1 + num2; //Act add.Add(num1, num2); //Assert Assert.AreEqual(expected, actual); }
void AddEntry(string path, AddMethod addMethod = AddMethod.Link) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) > -1) { return; } var entry = FileAndFolderEntryFactory.Create(path, addMethod); if (entry != null) { _entries.Add(entry); } }
internal override void AddOverride(MemberDefinitionBase member) { ArgumentUtility.CheckNotNull("member", member); var overrider = member as EventDefinition; if (overrider == null) { string message = string.Format("Member {0} cannot override event {1} - it is not an event.", member.FullName, FullName); throw new ArgumentException(message); } Overrides.Add(overrider); AddMethod.AddOverride(overrider.AddMethod); RemoveMethod.AddOverride(overrider.RemoveMethod); }
public static bool LogicLoop(bool continueRun) { // Prompt user for action Console.WriteLine("Would you like to add a customer (add), delete a customer (delete), view all customers (view), or exit (exit)?"); string programAction = Console.ReadLine(); Console.WriteLine(); // Add, View, Delete, Exit if (programAction == "add" || programAction == "Add") { // Add method AddMethod.Add(); return(continueRun); } else if (programAction == "view" || programAction == "View") { // View method ViewMethod.View(); return(continueRun); } else if (programAction == "delete" || programAction == "Delete") { // Delete method DeleteMethod.Delete(); return(continueRun); } else if (programAction == "exit" || programAction == "Exit") { // Exit program continueRun = false; return(continueRun); } else { // Show error, return to loop Console.WriteLine("Command not found."); Console.WriteLine(); return(continueRun); } }
public void AddFileOrFolder(string path, AddMethod addMethod = AddMethod.Link) { path = ProjectUtil.MakePathRelativeToProject(path); if (_entries.FindIndex(o => o.Path == path) < 0) { var entry = FileAndFolderEntryFactory.Create(path, addMethod); if (entry == null) { Debug.LogError("EgoXproject: Could not add file. Either does not exist or is on Ignore List: " + path); } else { _entries.Add(entry); } } }
public Form1() { invokeTarget = new AddMethod(loadTreeView); this.InitializeComponent(); if (Settings.Default.UserToken != "") { this.filesSystem = new FileManager(this.data); this.connectionControler = new Connections(this.filesSystem, this.filesSystem.GetLocalDeviceInstance(), this.filesSystem.syncManager, this); this.connectionRuns = this.connectionControler.RunConnection(); this.allRuniingTasks.Add(connectionRuns); loadTreeView(); } else { this.filesSystem = new FileManager(this.data, true); this.fileToolStripMenuItem.Enabled = false; } }
/// <inheritdoc /> protected override bool Sort(ref IEnumerable collection, IComparer comparer) { int count = GetCollectionSize(collection); var array = Array.CreateInstance(MemberType, count); CopyToMethod.InvokeWithParameters(collection, array, 0); Array.Sort(array, comparer); if (!array.ContentsMatch(collection)) { ClearMethod.Invoke(collection); for (int i = 0; i < count; i++) { AddMethod.InvokeWithParameter(collection, array.GetValue(i)); } return(true); } return(false); }
/// <summary> /// 构造函数 /// </summary> /// <param name="elements">线段树锁维护的元素数组</param> /// <param name="left">维护的区间的左端点</param> /// <param name="right">维护的区间的右端点</param> /// <param name="mergeMethod">区间合并方法</param> /// <param name="addMethod">区间修改方法</param> /// <param name="mulMethod">区间修改累和方法</param> /// <param name="initVal">初始值(默认为T的初始值)</param> public SegmentTree(T[] elements, int left, int right, MergeMethod mergeMethod, AddMethod addMethod, MultiplyMethod mulMethod, T initVal = default(T)) { if (right < left) { throw new ArgumentOutOfRangeException("right", "区间right<left"); } if (left < 0) { throw new ArgumentOutOfRangeException("left", "left越界"); } if (right > elements.GetUpperBound(0)) { throw new ArgumentOutOfRangeException("right", "right越界"); } lazied = false; _left = left; _right = right; merge = mergeMethod; add = addMethod; multiply = mulMethod; lazy = initValue = initVal; build(elements); }
public void RemoveAddMethod(AddMethod obj) { this.AddMethods.Remove(obj); }
public bool AddAddMethod(XElement element) { AddMethod obj = new AddMethod(this.Mod); obj.SetXML(element); return AddAddMethod(obj); }
public sealed override MethodInfo GetAddMethod(bool nonPublic) => AddMethod.FilterAccessor(nonPublic);
public bool AddAddMethod(AddMethod obj) { if (this.AddMethods == null) this.AddMethods = new List<AddMethod>(); this.AddMethods.Add(obj); return true; }