public ExportClassAttribute(string contractName, Type contractType) : base(contractName, contractType) { ContractHash = contractType.GetHashCode(); if (Info.BinarySearch(this).Value == null) { Info.BinaryInsert(this); } jSObjectStatic = (JSObject)Runtime.GetGlobalObject(ContractName); }
private static void Clone( object originalObject, Action <object> SetValue, Func <object, object> Copy) { if (originalObject == null) { return; } var VisitedObj = new ObjectContainer() { ObjHashCode = originalObject.GetHashCode() }; var VisitedPos = visited.BinarySearch(VisitedObj); if (VisitedPos.Index > -1) { VisitedObj = visited[VisitedPos.Index]; AtLast += () => SetValue(VisitedObj.obj); } else { visited.BinaryInsert(VisitedObj); var Obj = Copy(originalObject); SetValue(Obj); VisitedObj.obj = Obj; } }
public DirectorySnapshot FindRootDirectory(FullPathName rootPath) { var index = SortedArray.BinarySearch(_snapshot.ProjectRoots, rootPath, ProjectRootComparer); if (index >= 0) { return(_snapshot.ProjectRoots[index].Directory); } return(null); }
internal void ReadyForManageObject() { if (objects.BinarySearch(this).Index < 0) { objects.BinaryInsert(this); } //onRemoved = () => Console.WriteLine(JSHandle); //int last = GetProperty<int>("MNH"); //if(last!=1) // SetProperty("onRemoved", onRemoved); //ManagedJSObject.Invoke("onRemoved"); }
public FileName CreateFileName(DirectoryName parent, string simpleName) { var directory = FindDirectory(parent); if (directory != null) { // Note: We found the corresponding parent, we just need to check the "simple" name part of the relative name. int index = SortedArray.BinarySearch(directory.Files, simpleName, FileComparer); if (index >= 0) { return(directory.Files[index]); } } return(_previous.CreateFileName(parent, simpleName)); }
internal bool PopGapMinLen(int Len, ref Data Gap) { var Finded = GapsByLen.BinarySearch(new DataByLen() { Data = new Data() { Len = Len } }); var Index = Finded.Index; if (Index < 0) { Index = Index * -1; if (Index > GapsByLen.Length) return false; else { Gap = GapsByLen[Index - 1].Data; DeleteGap(Gap); return true; } } else { Gap = Finded.Value.Data; DeleteGap(Gap); return true; } }
internal bool PopBeforeGap(ref Data Data) { var Finded = GapsByTo.BinarySearch(new DataByTo() { Data = new Data() { To = Data.From - 1 } }); if (Finded.Index > -1) { Data = Finded.Value.Data; DeleteGap(Data); return true; } return false; }
internal bool PopNextGap(ref Data Data) { var Finded = GapsByFrom.BinarySearch(new DataByForm() { Data = new Data() { From = Data.To + 1 } }); if (Finded.Index > -1) { Data = Finded.Value.Data; DeleteGap(Data); return true; } return false; }
public bool Use(string Name) { if (RunIfNotRuning_Name == null) { RunIfNotRuning_Name = new SortedArray <string>(); } var Pos = RunIfNotRuning_Name.BinarySearch(Name).Index; if (Pos < 0) { Pos = ((Pos * -1) - 1); RunIfNotRuning_Name.Insert(Name, Pos); return(true); } else { return(false); } }
private DirectorySnapshot FindDirectory(DirectoryName name) { if (name.IsAbsoluteName) { return(FindRootDirectory(name.FullPathName)); } var parent = FindDirectory(name.Parent); if (parent == null) { return(null); } // Note: We found the corresponding parent, we just need to check the "simple" name part of the relative name. var index = SortedArray.BinarySearch(parent.DirectoryEntries, name, DirectoryNameComparer); if (index < 0) { return(null); } return(parent.DirectoryEntries[index]); }