public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { var xSpeed = req.Params.XSpeed; var ySpeed = req.Params.YSpeed; var x = Utils.GetScreeenWidth() / 2; var y = 970;//Utils.GetScreenHeight() / 2; var result = new Result(); try { result.Value = inputGen.Drag(x, y, x + xSpeed, y + ySpeed); } catch (TimeoutException te) { Log.Debug(te.ToString()); result.Status = 44; result.Value = false; } catch (Exception e) { Log.Debug(e.ToString()); result.Value = false; } return(result); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: Drag"); var elementId = req.Params.ElementId; var xSpeed = req.Params.XSpeed; var ySpeed = req.Params.YSpeed; var result = new Result(); try { var geometry = objectList.Get(elementId)?.Geometry; var x = geometry.CenterX; var y = geometry.CenterY; result.Value = inputGen.Drag(x, y, x + xSpeed, y + ySpeed); } catch (TimeoutException te) { Log.Debug(te.ToString()); result.Status = 44; result.Value = false; } catch (Exception e) { Log.Debug(e.ToString()); result.Value = false; } return(result); }
public IChangeEvents ConvertChangeEvents(string changeLogToken, IObjectList objectList) { if (objectList == null) { return(null); } ChangeEvents result = new ChangeEvents(); result.LatestChangeLogToken = changeLogToken; result.ChangeEventList = new List <IChangeEvent>(); if (objectList.Objects != null) { foreach (IObjectData objectData in objectList.Objects) { if (objectData == null) { continue; } result.ChangeEventList.Add(ConvertChangeEvent(objectData)); } } result.HasMoreItems = objectList.HasMoreItems; result.TotalNumItems = objectList.NumItems; return(result); }
public IItemEnumerable <IQueryResult> Query(string statement, bool searchAllVersions, IOperationContext context) { IDiscoveryService service = Binding.GetDiscoveryService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IQueryResult> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the data IObjectList resultList = service.Query(RepositoryId, statement, searchAllVersions, ctxt.IncludeAllowableActions, ctxt.IncludeRelationships, ctxt.RenditionFilterString, maxNumItems, skipCount, null); // convert query results IList <IQueryResult> page = new List <IQueryResult>(); if (resultList.Objects != null) { foreach (IObjectData objectData in resultList.Objects) { if (objectData == null) { continue; } page.Add(ObjectFactory.ConvertQueryResult(objectData)); } } return(new PageFetcher <IQueryResult> .Page <IQueryResult>(page, resultList.NumItems, resultList.HasMoreItems)); }; return(new CollectionEnumerable <IQueryResult>(new PageFetcher <IQueryResult>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: Click"); var elementId = req.Params.ElementId; var result = new Result(); try { var geometry = objectList.Get(elementId)?.Geometry; #if WATCH Log.Debug($"geometry X:{geometry.X}, Y:{geometry.Y}, Width:{geometry.Width}, Height:{geometry.Height}"); #endif result.Value = inputGen.Click(geometry.CenterX, geometry.CenterY); } catch (TimeoutException te) { Log.Debug(te.ToString()); result.Status = 44; result.Value = false; } catch (Exception e) { Log.Debug(e.ToString()); result.Value = false; } return(result); }
public IItemEnumerable <IDocument> GetCheckedOutDocs(IOperationContext context) { INavigationService service = Binding.GetNavigationService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IDocument> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // get all checked out documents IObjectList checkedOutDocs = service.GetCheckedOutDocs(RepositoryId, null, ctxt.FilterString, ctxt.OrderBy, ctxt.IncludeAllowableActions, ctxt.IncludeRelationships, ctxt.RenditionFilterString, maxNumItems, skipCount, null); // convert objects IList <IDocument> page = new List <IDocument>(); if (checkedOutDocs.Objects != null) { foreach (IObjectData objectData in checkedOutDocs.Objects) { IDocument doc = ObjectFactory.ConvertObject(objectData, ctxt) as IDocument; if (doc == null) { // should not happen... continue; } page.Add(doc); } } return(new PageFetcher <IDocument> .Page <IDocument>(page, checkedOutDocs.NumItems, checkedOutDocs.HasMoreItems)); }; return(new CollectionEnumerable <IDocument>(new PageFetcher <IDocument>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
private void Delete() { IObjectList <Company> allCompanies = siaqodb.LoadAll <Company>(); //delete object in database( in memory will still be available until GC will take it) siaqodb.Delete(allCompanies[0]); int count = siaqodb.Count <Company>(); }
void SetUpUpdateable(string name, IObjectList generableObject, string materialName, Vector3 scale) { GameObject container = new GameObject(name + "Container"); foreach (var item in generableObject.ObjectList) { PrepateUpdateableObjects(item, container, materialName, scale); } }
void SetUp(string name, IObjectList objectList, string materialName) { GameObject container = new GameObject(name + "Container"); int id = 0; foreach (var item in objectList.ObjectList) { PrepateGameObject(item, container, id, materialName); id++; } }
//siaqodb support as members of a storable class following types: //********************************************************************** //int,uint,short,string,ushort,byte,sbyte,long,ulong,float,double,decimal,char, //bool,TimeSpan,DateTime,Guid, enum //************************************************************************ public void Run() { Siaqodb siaqodb = SiaqodbFactoryExample.GetInstance(); //clear all objects of Type BigClass created by previous run of app siaqodb.DropType <BigClass>(); siaqodb.StoreObject(new BigClass()); IObjectList <BigClass> list = siaqodb.LoadAll <BigClass>(); }
public IChangeEvents GetContentChanges(string changeLogToken, bool includeProperties, long maxNumItems, IOperationContext context) { lock (sessionLock) { IObjectList objectList = Binding.GetDiscoveryService().GetContentChanges(RepositoryId, ref changeLogToken, includeProperties, context.FilterString, context.IncludePolicies, context.IncludeAcls, maxNumItems, null); return(ObjectFactory.ConvertChangeEvents(changeLogToken, objectList)); } }
private void Delete(Siaqodb siaqodb) { IObjectList <Company> allCompanies = siaqodb.LoadAll <Company>(); //delete object in database( in memory will still be available until GC will take it) siaqodb.Delete(allCompanies[0]); int count = siaqodb.Count <Company>(); Log("actual number of companies after delete:" + count.ToString()); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: GetDisplayed"); var elementId = req.Params.ElementId; var result = new Result(); var element = objectList.Get(elementId); result.Value = (element != null) ? true : false; return(result); }
public async Task <IList <T> > ToListAsync() { if (oList == null) { if (expression == null) { oList = await siaqodb.LoadAllAsync <T>(); } else { oList = await siaqodb.LoadAsync <T>(this.expression); } } return(oList); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: GetLocation"); var elementId = req.Params.ElementId; var result = new Result(); var geometry = objectList.Get(elementId)?.Geometry; if (geometry != null) { result.Value = new Result.Location(geometry.X, geometry.Y); } return(result); }
private static void ProcessDependencies(IObjectList <ObjectDependency, ObjectReference> dependencies, OperationType op) { var retained = ProcessDependencies(dependencies.Header, dependencies, op); if (retained == null) { DeleteDependencies(dependencies.Header.TypeId, dependencies.Header.ObjectId); } else { dependencies.Clear(); dependencies.AddRange(retained); } }
public IEnumerator <T> GetEnumerator() { if (oList == null) { if (expression == null) { oList = siaqodb.LoadAll <T>(); } else { oList = siaqodb.Load <T>(this.expression); } } return(oList.GetEnumerator()); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: GetText"); var elementId = req.Params.ElementId; var result = new Result(); var value = objectList.Get(elementId)?.Text; if (value != null) { result.Value = value; } return(result); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: SetAttribute"); var elementId = req.Params.ElementId; var propertyName = req.Params.Attribute; var newValue = req.Params.Value; var result = new Result(); var ret = objectList.Get(elementId)?.SetPropertyValue(propertyName, newValue); if (ret == true) { result.Value = ret; } return(result); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: SetText"); var elementId = req.Params.ElementId; var newValue = req.Params.Text; var replace = req.Params.Replace; var result = new Result(); if (string.IsNullOrEmpty(elementId)) { var focused = objectList.GetFocusedElementIds(); foreach (var id in focused) { if (objectList.Get(id)?.HasProperty("Text") == true) { elementId = id; } } Log.Debug("Find last focused element to set text : " + elementId); } if (string.IsNullOrEmpty(elementId)) { Log.Debug("There is no element to set Text"); return(result); } var oldValue = objectList.Get(elementId)?.GetPropertyValue("Text"); if (!replace) { newValue = oldValue + newValue; } var ret = objectList.Get(elementId)?.SetPropertyValue("Text", newValue); if (ret == true) { result.Value = ret; } return(result); }
//siaqodb support as members of a storable class following basic/primitive types: //********************************************************************** //int,uint,short,string,ushort,byte,sbyte,long,ulong,float,double,decimal,char, //bool,TimeSpan,DateTime,Guid, enum //************************************************************************ //siaqodb support as members of a storable class also nested objects,arrays, IList and Dictionary<T,V> public void Run() { Siaqodb siaqodb = SiaqodbFactoryExample.GetInstance(); //clear all objects of Type BigClass created by previous run of app siaqodb.DropType <BigClass>(); BigClass big = new BigClass(); big.employees = new List <Employee>(new Employee[] { new Employee() }); big.nestedObject = new BigClass(); big.myDictionary = new Dictionary <int, string>(); big.myDictionary.Add(1, "test"); big.listOfComplexObjects = new List <BigClass>(new BigClass[] { new BigClass() }); siaqodb.StoreObject(big); IObjectList <BigClass> list = siaqodb.LoadAll <BigClass>(); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: GetSize"); var elementId = req.Params.ElementId; var result = new Result(); var geometry = objectList.Get(elementId)?.Geometry; if (geometry != null) { result.Value = new Result.Size(geometry.Width, geometry.Height); } else { result.Value = new Result.Size(); } return(result); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: TouchMove"); var elementId = req.Params.ElementId; var xDown = req.Params.XDown; var yDown = req.Params.YDown; var xUp = req.Params.XUp; var yUp = req.Params.YUp; var steps = req.Params.Steps; var result = new Result(); try { if (!String.IsNullOrEmpty(elementId)) { var geometry = objectList.Get(elementId).Geometry; result.Value = inputGen.TouchMove(geometry.CenterX, geometry.CenterY, xUp, yUp, steps); } else if ((xDown > 0) && (yDown > 0) && (xUp > 0) && (yUp > 0)) { result.Value = inputGen.TouchMove(xDown, yDown, xUp, yUp, steps); } else { Log.Debug("Invalid values"); } } catch (TimeoutException te) { Log.Debug(te.ToString()); result.Status = 44; result.Value = false; } catch (Exception e) { Log.Debug(e.ToString()); result.Value = false; } return(result); }
public void Run() { Siaqodb siaqodb = SiaqodbFactoryExample.GetInstance(); siaqodb.DropType <AttUsage>(); AttUsage at = new AttUsage(); at.anotherInt = 100; at.SetInt(20); at.SetString("very long string"); at.UniqueField = 10; siaqodb.StoreObject(at); IObjectList <AttUsage> list = siaqodb.LoadAll <AttUsage>(); foreach (AttUsage a in list) { if (a.GetInt() == 0) { Log("Memeber was ignored by siaqodb!"); } } AttUsage at1 = new AttUsage(); at1.anotherInt = 100; at1.SetInt(20); at1.SetString("very long string"); //try to violate constraint at1.UniqueField = 10; try { siaqodb.StoreObject(at1); } catch (UniqueConstraintException ex) { Log("A unique contraint attempt to be violated!"); } }
public IItemEnumerable <IRelationship> GetRelationships(IObjectId objectId, bool includeSubRelationshipTypes, RelationshipDirection?relationshipDirection, IObjectType type, IOperationContext context) { if (objectId == null || objectId.Id == null) { throw new ArgumentException("Invalid object id!"); } string id = objectId.Id; string typeId = (type == null ? null : type.Id); IRelationshipService service = Binding.GetRelationshipService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IRelationship> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the relationships IObjectList relList = service.GetObjectRelationships(RepositoryId, id, includeSubRelationshipTypes, relationshipDirection, typeId, ctxt.FilterString, ctxt.IncludeAllowableActions, maxNumItems, skipCount, null); // convert relationship objects IList <IRelationship> page = new List <IRelationship>(); if (relList.Objects != null) { foreach (IObjectData rod in relList.Objects) { IRelationship relationship = GetObject(CreateObjectId(rod.Id), ctxt) as IRelationship; if (relationship == null) { throw new CmisRuntimeException("Repository returned an object that is not a relationship!"); } page.Add(relationship); } } return(new PageFetcher <IRelationship> .Page <IRelationship>(page, relList.NumItems, relList.HasMoreItems)); }; return(new CollectionEnumerable <IRelationship>(new PageFetcher <IRelationship>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: TouchDown"); var elementId = req.Params.ElementId; int x = req.Params.X; int y = req.Params.Y; var result = new Result(); try { if (!String.IsNullOrEmpty(elementId)) { var geometry = objectList.Get(elementId)?.Geometry; result.Value = inputGen.TouchDown(geometry.CenterX, geometry.CenterY); } else if ((x > 0) && (y > 0)) { result.Value = inputGen.TouchDown(x, y); } else { Log.Debug("Invalid values"); } } catch (TimeoutException te) { Log.Debug(te.ToString()); result.Status = 44; result.Value = false; } catch (Exception e) { Log.Debug(e.ToString()); result.Value = false; } return(result); }
private void LoadAndUpdate(Siaqodb siaqodb) { var query = from Company comp in siaqodb where comp.Name.StartsWith("First") select comp; Log("Following companies has name that starts with 'First' string"); foreach (var e in query) { e.Address = "Address changed"; siaqodb.StoreObject(e);//update will occur } siaqodb.Flush(); //load all objects of type Company from DB IObjectList <Company> allCompanies = siaqodb.LoadAll <Company>(); foreach (Company comp in allCompanies) { //see address of FirstCompany is updated } }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { var strategy = req.Params.Strategy; var elementId = req.Params.ElementId; Log.Debug("Run: Find with " + strategy); var result = new Result(); List <Result.Element> list = new List <Result.Element>(); if (strategy == "automationId") { var obj = objectList.Get(elementId); if (obj != null) { list.Add(new Result.Element(elementId)); } } else if (strategy == "focused") { var ids = objectList.GetFocusedElementIds(); foreach (var id in ids) { list.Add(new Result.Element(id)); } } else { var ids = objectList.GetIdsByName(elementId); foreach (var id in ids) { list.Add(new Result.Element(id)); } } result.Value = list; return(result); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { Log.Debug("Run: GetAttribute"); var elementId = req.Params.ElementId; var propertyName = req.Params.Attribute; var result = new Result(); var value = objectList.Get(elementId)?.GetPropertyValue(propertyName); if (value != null) { result.Value = value.ToString(); Log.Debug(elementId + " element have " + propertyName + " property."); } else { Log.Debug(elementId + " element does not have " + propertyName + " property."); } return(result); }
public Result Run(Request req, IObjectList objectList, IInputGenerator inputGen) { var key = req.Params.Key; var result = new Result(); try { result.Value = inputGen.PressKey(key); } catch (TimeoutException te) { Log.Debug(te.ToString()); result.Status = 44; result.Value = false; } catch (Exception e) { Log.Debug(e.ToString()); result.Value = false; } return(result); }