示例#1
0
文件: FSCLI_CD.cs 项目: TheByte/sones
        private void CD_private(IGraphFSSession myIGraphFSSession, ref String myCurrentPath, String myParameter)
        {
            var _DirectoryObjectLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myParameter);

            try
            {

                if ((myIGraphFSSession).ObjectStreamExists(_DirectoryObjectLocation, FSConstants.DIRECTORYSTREAM).Value ||
                    (myIGraphFSSession).ObjectStreamExists(_DirectoryObjectLocation, FSConstants.VIRTUALDIRECTORY).Value)
                {

                    if (myCurrentPath.Equals(FSPathConstants.PathDelimiter) && _DirectoryObjectLocation.Equals("/.."))
                        myCurrentPath = FSPathConstants.PathDelimiter;

                    else
                        myCurrentPath = SimplifyObjectLocation(_DirectoryObjectLocation.ToString());

                }
                else
                    WriteLine("Sorry, this directory does not exist!");

            }

            catch (Exception e)
            {
                WriteLine(e.Message);
                WriteLine(e.StackTrace);
            }
        }
示例#2
0
        private bool AreWarpPointAnglesOk(ObjectLocation <StarSystem> start, ObjectLocation <StarSystem> end, Galaxy gal, int minAngle)
        {
            var angleOut  = NormalizeAngle(start.Location.AngleTo(end.Location));
            var angleBack = NormalizeAngle(angleOut + 180d);

            // test warp points going out
            foreach (var angle in GetWarpPointAngles(start, gal))
            {
                if (AngleIsInRangeExclusive(angleOut, angle, minAngle))
                {
                    return(false);
                }
            }

            // test warp points coming back
            foreach (var angle in GetWarpPointAngles(end, gal))
            {
                if (AngleIsInRangeExclusive(angleBack, angle, minAngle))
                {
                    return(false);
                }
            }

            return(true);
        }
        public byte Read(ObjectLocation objLocation)
        {
            byte returnValue = (byte) new Random(objLocation.Index + objLocation.ObjectPath.Length + (int) objLocation.Type).Next(256);
            //byte returnValue = 0;
            switch (objLocation.Type)
            {
                //open the appropriate type of object and read the data inside it
                case ObjectType.FileWithHeader:

                    break;
                case ObjectType.Array:

                    break;
                case ObjectType.LinkedList:

                    break;
                case ObjectType.HashTable:

                    break;
                case ObjectType.Heap:

                    break;
            }
            return returnValue;
        }
        protected void DeleteInternal(ObjectLocation objectLocation)
        {
            try
            {
                objectLocation.LastDALChange = DateTime.Now.Ticks;

                SqlCommand sqlCommand = new SqlCommand("delete from ObjectLocation where " +
                                                       "UniqueID = '" + objectLocation.UniqueID.ToString() + "';");

                sqlCommand.Connection = mSqlConnection;

                int lineRemoved = sqlCommand.ExecuteNonQuery();

                if (lineRemoved != 1)
                {
                    throw new System.ArgumentException("Delete from ObjectLocation Where UniqueID=" + objectLocation.UniqueID.ToString() + " failed", "UniqueID");
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                mSqlConnection.Close();
            }
        }
        public void ObjServiceMove(String sourceObjectPathString,
                                   String targetLocPathString,
                                   String sourceLocPathString)
        {
            // identify the object to move
            ObjectPath objPath = new ObjectPath(sourceObjectPathString);
            ObjectIdentity docToCopy = new ObjectIdentity();
            docToCopy.Value = objPath;
            docToCopy.RepositoryName = DefaultRepository;

            // identify the folder to move from
            ObjectPath fromFolderPath = new ObjectPath();
            fromFolderPath.Path = sourceLocPathString;
            ObjectIdentity fromFolderIdentity = new ObjectIdentity();
            fromFolderIdentity.Value = fromFolderPath;
            fromFolderIdentity.RepositoryName = DefaultRepository;
            ObjectLocation fromLocation = new ObjectLocation();
            fromLocation.Identity = fromFolderIdentity;

            // identify the folder to move to
            ObjectPath folderPath = new ObjectPath(targetLocPathString);
            ObjectIdentity toFolderIdentity = new ObjectIdentity();
            toFolderIdentity.Value = folderPath;
            toFolderIdentity.RepositoryName = DefaultRepository;
            ObjectLocation toLocation = new ObjectLocation();
            toLocation.Identity = toFolderIdentity;

            OperationOptions operationOptions = null;
            objectService.Move(new ObjectIdentitySet(docToCopy),
                               fromLocation,
                               toLocation,
                               new DataPackage(),
                               operationOptions);
        }
 public GraphFSError_ObjectEditionNotFound(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition)
 {
     ObjectLocation  = myObjectLocation;
     ObjectStream    = myObjectStream;
     ObjectEdition   = myObjectEdition;
     Message         = String.Format("Object edition '{0}' at location '{1}{2}{3}' not found!", ObjectEdition, ObjectLocation, FSPathConstants.PathDelimiter, ObjectStream);
 }
示例#7
0
        // returns the length of the created platform
        private PlatformObject SpawnPlatform(int localIndex, ObjectLocation location, Vector3 position, Vector3 direction, bool activateImmediately)
        {
            PlatformObject platform     = (PlatformObject)infiniteObjectManager.ObjectFromPool(localIndex, ObjectType.Platform);
            Quaternion     lookRotation = Quaternion.LookRotation(direction);

            platform.Orient(position + (direction * platformSizes[localIndex].z / 2), lookRotation);
            if (activateImmediately)
            {
                platform.Activate();
            }

            int            objectIndex     = infiniteObjectManager.LocalIndexToObjectIndex(localIndex, ObjectType.Platform);
            InfiniteObject prevTopPlatform = infiniteObjectHistory.ObjectSpawned(objectIndex, 0, location, lookRotation.eulerAngles.y, ObjectType.Platform, platform);

            // the current platform now becames the parent of the previous top platform
            if (prevTopPlatform != null)
            {
                prevTopPlatform.SetInfiniteObjectParent(platform);
            }
            else
            {
                infiniteObjectHistory.SetBottomInfiniteObject(location, false, platform);
            }
            infiniteObjectHistory.AddTotalDistance(platformSizes[localIndex].z, location, false, spawnData.section);

            return(platform);
        }
示例#8
0
        public override Exceptional Execute(AGraphDSSharp myAGraphDSSharp, ref String myCurrentPath, Dictionary<String, List<AbstractCLIOption>> myOptions, String myInputString)
        {
            if (myAGraphDSSharp == null)
                return new Exceptional(new GraphDSError("myAGraphDSSharp must not be null!"));

            var _Content        = myOptions.ElementAt(1).Value[0].Option;
            var _FileLocation   = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(2).Value[0].Option);

            if (myAGraphDSSharp.ObjectExists(_FileLocation).Value != Trinary.TRUE)
            {

                try
                {
                    AFSObject _FileObject = new FileObject() { ObjectLocation = _FileLocation, ObjectData = Encoding.UTF8.GetBytes(_Content)};
                    myAGraphDSSharp.StoreFSObject(_FileObject, true);
                }
                catch (Exception e)
                {
                    WriteLine(e.Message);
                }

            }

            else
            {

                if (myAGraphDSSharp.ObjectStreamExists(_FileLocation, FSConstants.INLINEDATA).Value)
                {

                }

            }

            return Exceptional.OK;
        }
示例#9
0
 public NObjectStored(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition, ObjectRevisionID myObjectRevisionID)
 {
     ObjectLocation      = myObjectLocation;
     ObjectStream        = myObjectStream;
     ObjectEdition       = myObjectEdition;
     ObjectRevisionID    = myObjectRevisionID;
 }
示例#10
0
        // spawn a scene object at the specified location
        private SceneObject SpawnSceneObject(int localIndex, ObjectLocation location, Vector3 position, Vector3 direction, bool activateImmediately)
        {
            SceneObject scene        = (SceneObject)infiniteObjectManager.ObjectFromPool(localIndex, ObjectType.Scene);
            Quaternion  lookRotation = Quaternion.LookRotation(direction);

            scene.Orient(position + direction * sceneSizes[localIndex].z / 2, lookRotation);
            if (activateImmediately)
            {
                scene.Activate();
            }

            int            objectIndex  = infiniteObjectManager.LocalIndexToObjectIndex(localIndex, ObjectType.Scene);
            InfiniteObject prevTopScene = infiniteObjectHistory.ObjectSpawned(objectIndex, 0, location, lookRotation.eulerAngles.y, ObjectType.Scene, scene);

            // the current scene now becames the parent of the previous top scene
            if (prevTopScene != null)
            {
                prevTopScene.SetInfiniteObjectParent(scene);
            }
            else
            {
                infiniteObjectHistory.SetBottomInfiniteObject(location, true, scene);
            }

            infiniteObjectHistory.AddTotalDistance(sceneSizes[localIndex].z, location, true, spawnData.section);
            if (scene.sectionTransition)
            {
                infiniteObjectHistory.DidSpawnSectionTranition(location, true);
            }

            return(scene);
        }
示例#11
0
 public PackageFileStreamLZ4(BundleOdbBackend bundleOdbBackend, ObjectLocation objectLocation, Stream innerStream, CompressionMode compressionMode, long uncompressedStreamSize, long compressedSize)
     : base(innerStream, compressionMode, uncompressedSize: uncompressedStreamSize, compressedSize: compressedSize, disposeInnerStream: false)
 {
     this.bundleOdbBackend = bundleOdbBackend;
     this.objectLocation   = objectLocation;
     this.innerStream      = innerStream;
 }
示例#12
0
    private bool CommonLanes(ObjectLocation a, ObjectLocation b)
    {
        if (a.isBetweenLanes && b.isBetweenLanes)
        {
            // Only if they are between the same two lanes
            if (a.laneA == b.laneA && a.laneB == b.laneB)
            {
                return(true);
            }
            if (a.laneA == b.laneB && a.laneB == b.laneA)
            {
                return(true);
            }
            return(false);
        }

        if (a.laneA == b.laneA)
        {
            return(true);
        }
        if (a.isBetweenLanes && a.laneB == b.laneA)
        {
            return(true);
        }
        if (b.isBetweenLanes && b.laneB == a.laneA)
        {
            return(true);
        }

        return(false);
    }
示例#13
0
        public override Exceptional Execute(AGraphDSSharp myAGraphDSSharp, ref String myCurrentPath, Dictionary<String, List<AbstractCLIOption>> myOptions, String myInputString)
        {
            if (myAGraphDSSharp == null)
                return new Exceptional(new GraphDSError("myAGraphDSSharp must not be null!"));

            ObjectLocation _DirectoryObjectLocation = null;

            try
            {
                _DirectoryObjectLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(1).Value[0].Option);
            }
            catch (Exception e)
            {
                WriteLine(e.Message);
                return Exceptional.OK;
            }

            try
            {
                myAGraphDSSharp.CreateDirectoryObject(_DirectoryObjectLocation);
            }

            catch (Exception e)
            {
                WriteLine(e.Message);
            }

            return Exceptional.OK;
        }
示例#14
0
        public void ObjServiceCopy(String sourceObjectPathString, String targetLocPathString)
        {
            // identify the object to copy
            ObjectPath     objPath   = new ObjectPath(sourceObjectPathString);
            ObjectIdentity docToCopy = new ObjectIdentity();

            docToCopy.Value          = objPath;
            docToCopy.RepositoryName = DefaultRepository;

            // identify the folder to copy to
            ObjectPath     folderPath       = new ObjectPath(targetLocPathString);
            ObjectIdentity toFolderIdentity = new ObjectIdentity();

            toFolderIdentity.Value          = folderPath;
            toFolderIdentity.RepositoryName = DefaultRepository;
            ObjectLocation toLocation = new ObjectLocation();

            toLocation.Identity = toFolderIdentity;

            OperationOptions operationOptions = null;

            objectService.Copy(new ObjectIdentitySet(docToCopy),
                               toLocation,
                               new DataPackage(),
                               operationOptions);
        }
示例#15
0
        // spawn the platforms, obstacles, power ups, and coins
        private PlatformObject SpawnObjects(ObjectLocation location, Vector3 position, Vector3 direction, bool activateImmediately)
        {
            SetupSection(location, false);
            spawnData.turnSpawned = turnPlatform[(int)location] != null;
            int localIndex = infiniteObjectManager.GetNextObjectIndex(ObjectType.Platform, spawnData);

            if (localIndex == -1)
            {
                print("Unable to spawn platform. No platforms can be spawned based on the probability rules at distance " +
                      infiniteObjectHistory.GetTotalDistance(false) + " within section " + spawnData.section + (spawnData.sectionTransition ? (" (Transitioning from section " + spawnData.prevSection + ")") : ""));
                return(null);
            }
            PlatformObject platform = SpawnPlatform(localIndex, location, position, direction, activateImmediately);

            if (platform.CanSpawnCollidable() && Random.value >= noCollidableProbability.GetValue(infiniteObjectHistory.GetTotalDistance(false)))
            {
                // First try to spawn an obstacle. If there is any space remaining on the platform, then try to spawn a coin.
                // If there is still some space remaing, try to spawn a powerup.
                // An extension of this would be to randomize the order of ObjectType, but this way works if the probabilities
                // are setup fairly
                SpawnCollidable(ObjectType.Obstacle, position, direction, location, platform, localIndex, activateImmediately);
                if (platform.CanSpawnCollidable())
                {
                    SpawnCollidable(ObjectType.Coin, position, direction, location, platform, localIndex, activateImmediately);
                    if (platform.CanSpawnCollidable())
                    {
                        SpawnCollidable(ObjectType.PowerUp, position, direction, location, platform, localIndex, activateImmediately);
                    }
                }
            }

            return(platform);
        }
 public GraphFSError_MetadataObjectNotFound(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition)
 {
     ObjectLocation  = myObjectLocation;
     ObjectStream    = myObjectStream;
     ObjectEdition   = myObjectEdition;
     Message         = String.Format("MetadataObject at location '{0}{1}{0}{2}{0}{3}' not found!", FSPathConstants.PathDelimiter, ObjectLocation, ObjectStream, ObjectEdition);
 }
示例#17
0
        public override Sector GetWarpPointSector(ObjectLocation <StarSystem> here, ObjectLocation <StarSystem> there)
        {
            var x = RandomHelper.Range(-here.Item.Radius, here.Item.Radius);
            var y = RandomHelper.Range(-here.Item.Radius, here.Item.Radius);

            return(here.Item.GetSector(x, y));
        }
示例#18
0
        /// <summary>
        /// The constructor for creating a new AccessControlObject with certain rights.
        /// </summary>
        /// <param name="myObjectLocation">the location of the AccessControlObject (constisting of the ObjectPath and ObjectName) within the file system</param>
        /// <param name="myDefaultRule">This property defines the priority of allowing and denying.</param>
        /// <param name="myAllowACL">The dictionary of rights with corresponding ACLs that allow the access to an object in the GraphFS.</param>
        /// <param name="myDenyACL">The dictionary of rights with corresponding ACLs that denies the access to an object in the GraphFS.</param>
        /// <param name="myNotificationHandling">the NotificationHandling bitfield</param>
        public AccessControlObject(ObjectLocation myObjectLocation, DefaultRuleTypes myDefaultRule, Dictionary<RightUUID, HashSet<EntityUUID>> myAllowACL, Dictionary<RightUUID, HashSet<EntityUUID>> myDenyACL, NHAccessControlObject myNotificationHandling)
        {
            if (myAllowACL == null)
                throw new ArgumentNullException("Invalid AllowACL!");

            if (myDenyACL == null)
                throw new ArgumentNullException("Invalid DenyACL!");

            _AllowACL               = myAllowACL;
            _DenyACL                = myDenyACL;
            _DefaultRule            = myDefaultRule;
            _NotificationHandling   = myNotificationHandling;

            #region calc estimated size

            #region AllowACL

            _estimatedSize += CalcACLSize(myAllowACL);

            #endregion

            #region DenyACL

            _estimatedSize += CalcACLSize(myDenyACL);

            #endregion

            _estimatedSize += EstimatedSizeConstants.EnumByte + EstimatedSizeConstants.EnumUInt64 + GetClassDefaultSize();

            #endregion
        }
        // Exceptions:
        //	System.ArgumentException:
        //		objectLocation is null when saving ObjectLocation
        public void Save(ObjectLocation objectLocation)
        {
            if (objectLocation.IsNull)
            {
                SaveInternal(objectLocation);
            }
            else
            {
                ObjectLocation upToDateObjectLocation = new ObjectLocation();

                try
                {
                    Load(upToDateObjectLocation, objectLocation.UniqueID);
                }
                catch
                {
                    SaveInternal(objectLocation);
                    return;
                }

                if (objectLocation.CompareTo(upToDateObjectLocation) != 0)
                {
                    UpdateInternal(objectLocation);
                }
            }
        }
        public byte Read(ObjectLocation objLocation)
        {
            byte returnValue = (byte)new Random(objLocation.Index + objLocation.ObjectPath.Length + (int)objLocation.Type).Next(256);

            //byte returnValue = 0;
            switch (objLocation.Type)
            {
            //open the appropriate type of object and read the data inside it
            case ObjectType.FileWithHeader:

                break;

            case ObjectType.Array:

                break;

            case ObjectType.LinkedList:

                break;

            case ObjectType.HashTable:

                break;

            case ObjectType.Heap:

                break;
            }
            return(returnValue);
        }
示例#21
0
 public byte Read(ObjectLocation objLocation)
 {
     SocketCommunicator.Send(_socket, new ReadMessage {
         ObjectLocation = objLocation
     });
     return(GetReadResponse().Value);
 }
 public GraphFSError_NoObjectRevisionsFound(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition)
 {
     ObjectLocation  = myObjectLocation;
     ObjectStream    = myObjectStream;
     ObjectEdition   = myObjectEdition;
     Message         = String.Format("No object revisions found at location '{1}{0}{2}{0}{3}'!", FSPathConstants.PathDelimiter, ObjectLocation, ObjectStream, ObjectEdition);
 }
 public GraphFSError_CouldNotSetMetadata(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition)
 {
     ObjectLocation = myObjectLocation;
     ObjectStream   = myObjectStream;
     ObjectEdition  = myObjectEdition;
     Message        = String.Format("Could not set metadata at location '{1}{0}{2}{0}{3}'!", FSPathConstants.PathDelimiter, ObjectLocation, ObjectStream, ObjectEdition);
 }
示例#24
0
        //public TargetLocation GetObjectLocation(EZ_B.AVM.TrainedObjectsContainer.TrainedObject trainedObject)
        //{
        //    TargetLocation targetLocation = TargetLocation.Unknown;
        //    camera.CameraAVMObjectDetection.AddObject(trainedObject);

        //    var objectLocation = camera.CameraAVMObjectDetection.GetDetectedObjects(true, true);

        //    targetLocation = GetTargetLocationFromObjectLocation(objectLocation);

        //}


        private TargetLocation GetTargetLocationFromObjectLocation(ObjectLocation objectLocation)
        {
            TargetLocation targetLocation = TargetLocation.Unknown;

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Left &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Bottom)
            {
                targetLocation = TargetLocation.BottomLeft;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Bottom)
            {
                targetLocation = TargetLocation.BottomCenter;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Right &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Bottom)
            {
                targetLocation = TargetLocation.BottomRight;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Left &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Middle)
            {
                targetLocation = TargetLocation.CenterLeft;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Middle)
            {
                targetLocation = TargetLocation.CenterCenter;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Right &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Middle)
            {
                targetLocation = TargetLocation.CenterRight;
            }
            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Left &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Top)
            {
                targetLocation = TargetLocation.TopLeft;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Middle &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Top)
            {
                targetLocation = TargetLocation.TopCenter;
            }

            if (objectLocation.HorizontalLocation == ObjectLocation.HorizontalLocationEnum.Right &&
                objectLocation.VerticalLocation == ObjectLocation.VerticalLocationEnum.Top)
            {
                targetLocation = TargetLocation.TopRight;
            }

            return(targetLocation);
        }
        protected void UpdateInternal(ObjectLocation objectLocation)
        {
            try
            {
                objectLocation.LastDALChange = DateTime.Now.Ticks;

                string address1 = objectLocation.Address1;

                SqlCommand sqlCommand = new SqlCommand("Update ObjectLocation set " +
                                                       "LastDALChange='" + objectLocation.LastDALChange.ToString() + "'," +
                                                       "Address1=@Address1," +
                                                       "Address2=@Address2," +
                                                       "Address3=@Address3," +
                                                       "City=@City," +
                                                       "State=@State," +
                                                       "Zip='" + objectLocation.Zip + "'," +
                                                       "ECountry='" + objectLocation.Country.ToString() + "'," +
                                                       "Latitude='" + objectLocation.Latitude.ToString() + "'," +
                                                       "Longitude='" + objectLocation.Longitude.ToString() + "' " +
                                                       "Where UniqueID='" + objectLocation.UniqueID.ToString() + "'");

                SqlParameter sqlParameter = new SqlParameter("@Address1", SqlDbType.NVarChar);
                sqlParameter.Value = objectLocation.Address1;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter       = new SqlParameter("@Address2", SqlDbType.NVarChar);
                sqlParameter.Value = objectLocation.Address2;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter       = new SqlParameter("@Address3", SqlDbType.NVarChar);
                sqlParameter.Value = objectLocation.Address3;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter       = new SqlParameter("@City", SqlDbType.NVarChar);
                sqlParameter.Value = objectLocation.City;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlParameter       = new SqlParameter("@State", SqlDbType.NVarChar);
                sqlParameter.Value = objectLocation.State;
                sqlCommand.Parameters.Add(sqlParameter);

                sqlCommand.Connection = mSqlConnection;

                int lineInserted = sqlCommand.ExecuteNonQuery();

                if (lineInserted != 1)
                {
                    throw new System.ArgumentException("Update Into ObjectLocation Where UniqueID=" + objectLocation.UniqueID.ToString() + " failed", "UniqueID");
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
            finally
            {
                mSqlConnection.Close();
            }
        }
        public bool IsLatest(ObjectLocation objectLocation)
        {
            ObjectLocation upToDateObjectLocation = new ObjectLocation();

            Load(upToDateObjectLocation, objectLocation.UniqueID);

            return(upToDateObjectLocation.LastDALChange == objectLocation.LastDALChange);
        }
 public GraphFSError_CouldNotOverwriteRevision(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition, ObjectRevisionID myObjectRevisionID)
 {
     ObjectLocation      = myObjectLocation;
     ObjectStream        = myObjectStream;
     ObjectEdition       = myObjectEdition;
     ObjectRevisionID    = myObjectRevisionID;
     Message             = String.Format("Could not overwrite object revision '{1}{0}{2}{0}{3}{0}{4}'!", FSPathConstants.PathDelimiter, ObjectLocation, ObjectStream, ObjectEdition, ObjectRevisionID);
 }
示例#28
0
 /// <summary>
 /// The constructor.
 /// </summary>
 /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
 /// <param name="DatabaseRootPath">The database root path.</param>
 public DBTypeManager(IGraphFSSession myIGraphFS, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, DBContext dbContext)
 {
     _DBContext = dbContext;
     _UserID = myUserID;
     _DatabaseRootPath                               = myDatabaseRootPath;
     _IGraphFSSession                                = myIGraphFS;
     _ObjectLocationsOfAllUserDefinedDatabaseTypes   = LoadListOfTypeLocations(myDatabaseRootPath);
 }
示例#29
0
    public void UpdateCounter()
    {
        ObjectLocation loc = new ObjectLocation();

        RestClient.Put <ObjectLocation>(databaseURL2 + "/" + tag + ".json?auth=" + idToken, loc);

        InsertLikeDetails();
    }
示例#30
0
 private Lane GetClosestLaneFrom(ObjectLocation location)
 {
     if (!location.laneB)
     {
         return(location.laneA);
     }
     return(DistanceTo(location.laneB) < DistanceTo(location.laneA) ? location.laneB : location.laneA);
 }
 public GraphFSError_AllObjectCopiesFailed(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition, ObjectRevisionID myRevisionID)
 {
     ObjectLocation  = myObjectLocation;
     ObjectStream    = myObjectStream;
     ObjectEdition   = myObjectEdition;
     RevisionID      = myRevisionID;
     Message         = String.Format("All object copies at location '{1}{0}{2}{0}{3}{0}{4}' failed!", FSPathConstants.PathDelimiter, ObjectLocation, ObjectStream, ObjectEdition, RevisionID);
 }
示例#32
0
 private IEnumerable <double> GetWarpPointAngles(ObjectLocation <StarSystem> ssl, Galaxy gal)
 {
     foreach (var wp in ssl.Item.FindSpaceObjects <WarpPoint>())
     {
         var target = wp.TargetStarSystemLocation;
         var offset = ssl.Location.AngleTo(target.Location);
         yield return(offset);
     }
 }
示例#33
0
        public void Delete(ObjectLocation objectLocation)
        {
            if (!objectLocation.IsLoaded())
            {
                Load(objectLocation);
            }

            mObjectLocationDAL.Delete(objectLocation);
        }
示例#34
0
        public IGraphFS GetChildFS(ObjectLocation myObjectLocation)
        {
            IGraphFS _ChildFS = null;

            if (_ChildFSLookuptable.TryGetValue(myObjectLocation, out _ChildFS))
                return _ChildFS;

            return null;
        }
示例#35
0
        // the player hit a turn, start generating new objects
        public bool UpdateSpawnDirection(Vector3 newDirection, bool setMoveDirection, bool rightTurn, bool playerAboveTurn, out Vector3 turnOffset)
        {
            turnOffset = Vector3.zero;
            // Don't set the move direction above a curve because the cuve will set the direction
            if (setMoveDirection)
            {
                moveDirection = newDirection;
            }

            // don't change spawn directions if the player isn't above a turn. The game is about to be over anyway so there isn't a reason to keep generating objects
            if (!playerAboveTurn)
            {
                stopObjectSpawns = true;
                return(false);
            }

            float yAngle = Quaternion.LookRotation(newDirection).eulerAngles.y;

            if ((rightTurn && Mathf.Abs(yAngle - infiniteObjectHistory.GetObjectLocationAngle(ObjectLocation.Right)) < 0.01f) ||
                (!rightTurn && Mathf.Abs(yAngle - infiniteObjectHistory.GetObjectLocationAngle(ObjectLocation.Left)) < 0.01f))
            {
                spawnDirection    = newDirection;
                wrongMoveDistance = 0;
                ObjectLocation turnLocation = (rightTurn ? ObjectLocation.Right : ObjectLocation.Left);
                turnPlatform[(int)ObjectLocation.Center]   = turnPlatform[(int)turnLocation];
                turnPlatform[(int)ObjectLocation.Right]    = turnPlatform[(int)ObjectLocation.Left] = null;
                turnIndex[(int)ObjectLocation.Center]      = turnIndex[(int)turnLocation];
                turnScene[(int)ObjectLocation.Center]      = turnScene[(int)turnLocation];
                turnScene[(int)ObjectLocation.Right]       = turnScene[(int)ObjectLocation.Left] = null;
                sceneTurnIndex[(int)ObjectLocation.Center] = sceneTurnIndex[(int)turnLocation];

                // The center objects and the objects in the location opposite of turn are grouped together with the center object being the top most object
                for (int i = 0; i < 2; ++i)
                {
                    InfiniteObject infiniteObject = infiniteObjectHistory.GetTopInfiniteObject((turnLocation == ObjectLocation.Right ? ObjectLocation.Left : ObjectLocation.Right), i == 0);
                    // may be null if the turn only turns one direction
                    if (infiniteObject != null)
                    {
                        InfiniteObject centerObject = infiniteObjectHistory.GetBottomInfiniteObject(ObjectLocation.Center, i == 0);
                        infiniteObject.SetInfiniteObjectParent(centerObject);
                    }
                }

                infiniteObjectHistory.Turn(turnLocation);
                if (turnPlatform[(int)ObjectLocation.Center] != null)
                {
                    infiniteObjectHistory.ResetTurnCount();
                }

                turnOffset = GetTurnOffset();
                return(true);
            }

            // Set the move direction even if the turn is a curve so the infinite objects will move in the opposite direciton of the player
            moveDirection = newDirection;
            return(false);
        }
示例#36
0
    // the player has turned left or right. Replace the center values with the corresponding turn values if they aren't -1
    public void turn(ObjectLocation location)
    {
        for (int i = 0; i < objectSpawnIndex[(int)ObjectLocation.Center].Count; ++i)
        {
            lastObjectSpawnDistance[(int)ObjectLocation.Center][i] = lastObjectSpawnDistance[(int)location][i];
            if (objectSpawnIndex[(int)location][i] != -1)
            {
                objectSpawnIndex[(int)ObjectLocation.Center][i] = objectSpawnIndex[(int)location][i];
            }
        }

        for (int i = 0; i < (int)ObjectLocation.Last; ++i)
        {
            if (objectTypeSpawnIndex[(int)location][i] != -1)
            {
                objectTypeSpawnIndex[(int)ObjectLocation.Center][i] = objectTypeSpawnIndex[(int)location][i];
            }

            lastLocalIndex[(int)ObjectLocation.Center][i] = lastLocalIndex[(int)location][i];
            latestObjectTypeSpawnDistance[(int)ObjectLocation.Center][i] = latestObjectTypeSpawnDistance[(int)location][i];
        }

        totalDistance[(int)ObjectLocation.Center]      = totalDistance[(int)location];
        totalSceneDistance[(int)ObjectLocation.Center] = totalSceneDistance[(int)location];

        platformDistanceIndexMap[(int)ObjectLocation.Center] = platformDistanceIndexMap[(int)location];

        spawnedPlatformSectionTransition[(int)ObjectLocation.Center] = spawnedPlatformSectionTransition[(int)location];
        spawnedSceneSectionTransition[(int)ObjectLocation.Center]    = spawnedSceneSectionTransition[(int)location];

        // use the center location if there aren't any objects in the location across from the turn location
        ObjectLocation acrossLocation = (location == ObjectLocation.Right ? ObjectLocation.Left : ObjectLocation.Right);

        if (bottomPlatformObjectSpawned[(int)acrossLocation] == null)
        {
            acrossLocation = ObjectLocation.Center;
        }

        bottomTurnPlatformObjectSpawned = bottomPlatformObjectSpawned[(int)acrossLocation];
        bottomTurnSceneObjectSpawned    = bottomSceneObjectSpawned[(int)acrossLocation];
        topTurnPlatformObjectSpawned    = topPlatformObjectSpawned[(int)ObjectLocation.Center];
        topTurnSceneObjectSpawned       = topSceneObjectSpawned[(int)ObjectLocation.Center];

        topPlatformObjectSpawned[(int)ObjectLocation.Center]    = topPlatformObjectSpawned[(int)location];
        bottomPlatformObjectSpawned[(int)ObjectLocation.Center] = bottomPlatformObjectSpawned[(int)location];
        topSceneObjectSpawned[(int)ObjectLocation.Center]       = topSceneObjectSpawned[(int)location];
        bottomSceneObjectSpawned[(int)ObjectLocation.Center]    = bottomSceneObjectSpawned[(int)location];

        for (int i = (int)ObjectLocation.Left; i < (int)ObjectLocation.Last; ++i)
        {
            topPlatformObjectSpawned[i]    = null;
            bottomPlatformObjectSpawned[i] = null;
            topSceneObjectSpawned[i]       = null;
            bottomSceneObjectSpawned[i]    = null;
        }
    }
示例#37
0
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
        /// <param name="DatabaseRootPath">The database root path.</param>
        public DBTypeManager(IGraphFSSession myIGraphFS, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, DBContext dbContext)
        {
            _DBContext = dbContext;
            _UserID = myUserID;
            _DatabaseRootPath                               = myDatabaseRootPath;
            _IGraphFSSession                                = myIGraphFS;
            _ObjectLocationsOfAllUserDefinedDatabaseTypes   = LoadListOfTypeLocations(myDatabaseRootPath);

            dbContext.GraphAppSettings.Subscribe<ObjectsDirectoryShardsSetting>(GraphSettingChanged);
        }
        public override Sector GetWarpPointSector(ObjectLocation <StarSystem> here, ObjectLocation <StarSystem> there)
        {
            var angle      = here.Location.AngleTo(there.Location);
            var y          = Math.Sin(angle / 180d * Math.PI) * here.Item.Radius;
            var x          = Math.Cos(angle / 180d * Math.PI) * here.Item.Radius;
            var multiplier = RandomHelper.Next(here.Item.Radius / Math.Max(Math.Abs(x), Math.Abs(y)));

            x *= multiplier;
            y *= multiplier;
            return(here.Item.GetSector((int)Math.Round(x), (int)Math.Round(y)));
        }
 public void DidSpawnSectionTranition(ObjectLocation location, bool isSceneObject)
 {
     if (isSceneObject)
     {
         spawnedSceneSectionTransition[(int)location] = true;
     }
     else
     {
         spawnedPlatformSectionTransition[(int)location] = true;
     }
 }
示例#40
0
 public void setTopInfiniteObject(ObjectLocation location, bool isSceneObject, InfiniteObject infiniteObject)
 {
     if (isSceneObject)
     {
         topSceneObjectSpawned[(int)location] = infiniteObject;
     }
     else
     {
         topPlatformObjectSpawned[(int)location] = infiniteObject;
     }
 }
示例#41
0
 // Exceptions:
 //	System.ArgumentException:
 //		Load Failed
 protected void LoadInternal(ObjectLocation objectLocation)
 {
     try
     {
         mObjectLocationDAL.Load(objectLocation, objectLocation.UniqueID);
     }
     catch
     {
         throw new System.ArgumentException("Load Failed", "objectLocation");
     }
 }
示例#42
0
文件: FileObject.cs 项目: ipbi/sones
        /// <summary>
        /// A constructor used for fast deserializing
        /// </summary>
        /// <param name="myObjectLocation">the location of this object (ObjectPath and ObjectName) of the requested file within the file system</param>
        /// <param name="mySerializedData">A bunch of bytes[] containing the serialized FileObject</param>
        public FileObject(ObjectLocation myObjectLocation, Byte[] mySerializedData, IIntegrityCheck myIntegrityCheckAlgorithm, ISymmetricEncryption myEncryptionAlgorithm)
        {
            if (myObjectLocation == null || myObjectLocation.Length == 0)
                throw new ArgumentNullException("Invalid myObjectLocation!");

            if (mySerializedData == null || mySerializedData.Length == 0)
                throw new ArgumentNullException("mySerializedData must not be null or its length be zero!");

            Deserialize(mySerializedData, myIntegrityCheckAlgorithm, myEncryptionAlgorithm, false);
            _isNew = false;
        }
示例#43
0
 public void objectRemoved(ObjectLocation location, bool isSceneObject)
 {
     if (isSceneObject)
     {
         bottomSceneObjectSpawned[(int)location] = bottomSceneObjectSpawned[(int)location].getInfiniteObjectParent();
     }
     else
     {
         bottomPlatformObjectSpawned[(int)location] = bottomPlatformObjectSpawned[(int)location].getInfiniteObjectParent();
     }
 }
 // the bottom infinite object only needs to be set for the very first object at the object location.. objectRemoved will otherwise take care of making sure the
 // bottom object is correct
 public void SetBottomInfiniteObject(ObjectLocation location, bool isSceneObject, InfiniteObject infiniteObject)
 {
     if (isSceneObject)
     {
         bottomSceneObjectSpawned[(int)location] = infiniteObject;
     }
     else
     {
         bottomPlatformObjectSpawned[(int)location] = infiniteObject;
     }
 }
示例#45
0
        public DBSettingsManager(Dictionary<String, ADBSettingsBase> myReflectorSettings, Dictionary<String, ADBSettingsBase> myDBSettings, IGraphFSSession myIGraphFS, ObjectLocation mySettingsLocation)
        {
            _IGraphFSSession    = myIGraphFS;
            _DBSettingsLocation = mySettingsLocation;

            AllSettingsByName = new Dictionary<string, ADBSettingsBase>();
            AllSettingsByUUID = new Dictionary<UUID, ADBSettingsBase>();

            AddSettings(myReflectorSettings);
            AddSettings(myDBSettings);
        }
    // An object run contains many platforms strung together with collidables: obstacles, power ups, and coins. If spawnObjectRun encounters a turn,
    // it will spawn the objects in the correct direction
    public void spawnObjectRun(bool activateImmediately)
    {
        while (localDistance[(int)ObjectLocation.Center] < horizon && turnPlatform[(int)ObjectLocation.Center] == null)
        {
            PlatformObject platform = spawnObjects(ObjectLocation.Center, localDistance[(int)ObjectLocation.Center] * moveDirection + localPlatformHeight[(int)ObjectLocation.Center] * Vector3.up + turnOffset,
                                                   moveDirection, activateImmediately);
            if (platform == null)
            {
                return;
            }

            platformSpawned(platform, ObjectLocation.Center, moveDirection, Vector3.zero, activateImmediately);

            if (spawnFullLength)
            {
                spawnObjectRun(activateImmediately);
            }
        }

        if (turnPlatform[(int)ObjectLocation.Center] != null)
        {
            Vector3 turnDirection = turnPlatform[(int)ObjectLocation.Center].getTransform().right;

            // spawn the platform and scene objects for the left and right turns
            for (int i = 0; i < 2; ++i)
            {
                ObjectLocation location = (i == 0 ? ObjectLocation.Right : ObjectLocation.Left);

                bool canTurn = (location == ObjectLocation.Right && turnPlatform[(int)ObjectLocation.Center].isRightTurn) ||
                               (location == ObjectLocation.Left && turnPlatform[(int)ObjectLocation.Center].isLeftTurn);
                if (canTurn && turnPlatform[(int)location] == null)
                {
                    infiniteObjectHistory.setActiveLocation(location);
                    Vector3 centerDistance = (localDistance[(int)ObjectLocation.Center] + turnPlatform[(int)ObjectLocation.Center].turnLengthOffset) * moveDirection;
                    if (localDistance[(int)location] < horizon)
                    {
                        PlatformObject platform = spawnObjects(location, centerDistance + turnDirection * localDistance[(int)location] + localPlatformHeight[(int)location] * Vector3.up + turnOffset,
                                                               turnDirection, activateImmediately);
                        if (platform == null)
                        {
                            return;
                        }

                        platformSpawned(platform, location, turnDirection, centerDistance, activateImmediately);
                    }
                }
                turnDirection *= -1;
            }

            // reset
            infiniteObjectHistory.setActiveLocation(ObjectLocation.Center);
        }
    }
示例#47
0
        public static List <ObjectLocation> GetTrajectoryOrbit(PointF currentLocation, PointF targetLocation, double currentDirection, int speed, int iterations)
        {
            var result = GetTrajectoryApproach(currentLocation, targetLocation, currentDirection, speed, iterations);

            var previousIteration = result[result.Count - 1];

            ObjectLocation linearMotionStartPoint = null;

            // TODO: Orbit steps

            return(result);
        }
        public void Init(int objectCount)
        {
            activeObjectLocation          = ObjectLocation.Center;
            objectSpawnIndex              = new List <int> [(int)ObjectLocation.Last];
            objectTypeSpawnIndex          = new int[(int)ObjectLocation.Last][];
            lastLocalIndex                = new int[(int)ObjectLocation.Last][];
            latestObjectTypeSpawnDistance = new float[(int)ObjectLocation.Last][];
            lastObjectSpawnDistance       = new List <float> [(int)ObjectLocation.Last];

            objectLocationAngle = new float[(int)ObjectLocation.Last];

            totalDistance      = new float[(int)ObjectLocation.Last];
            totalSceneDistance = new float[(int)ObjectLocation.Last];

            platformDistanceDataMap = new PlatformDistanceDataMap[(int)ObjectLocation.Last];

            topPlatformObjectSpawned    = new InfiniteObject[(int)ObjectLocation.Last];
            bottomPlatformObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
            topSceneObjectSpawned       = new InfiniteObject[(int)ObjectLocation.Last];
            bottomSceneObjectSpawned    = new InfiniteObject[(int)ObjectLocation.Last];

            previousPlatformSection          = new int[(int)ObjectLocation.Last];
            previousSceneSection             = new int[(int)ObjectLocation.Last];
            spawnedPlatformSectionTransition = new bool[(int)ObjectLocation.Last];
            spawnedSceneSectionTransition    = new bool[(int)ObjectLocation.Last];

            for (int i = 0; i < (int)ObjectLocation.Last; ++i)
            {
                objectSpawnIndex[i]              = new List <int>();
                objectTypeSpawnIndex[i]          = new int[(int)ObjectType.Last];
                lastLocalIndex[i]                = new int[(int)ObjectType.Last];
                latestObjectTypeSpawnDistance[i] = new float[(int)ObjectType.Last];

                lastObjectSpawnDistance[i] = new List <float>();

                platformDistanceDataMap[i] = new PlatformDistanceDataMap();

                for (int j = 0; j < objectCount; ++j)
                {
                    objectSpawnIndex[i].Add(-1);
                    lastObjectSpawnDistance[i].Add(0);
                }
                for (int j = 0; j < (int)ObjectType.Last; ++j)
                {
                    objectTypeSpawnIndex[i][j]          = -1;
                    lastLocalIndex[i][j]                = -1;
                    latestObjectTypeSpawnDistance[i][j] = -1;
                }
            }

            infiniteObjectManager = InfiniteObjectManager.instance;
        }
示例#49
0
        /// <summary>
        /// The constructor for creating a new AccessControlObject with certain rights.
        /// </summary>
        /// <param name="myObjectLocation">the location of the AccessControlObject (constisting of the ObjectPath and ObjectName) within the file system</param>
        /// <param name="myDefaultRule">This property defines the priority of allowing and denying.</param>
        /// <param name="myAllowACL">The dictionary of rights with corresponding ACLs that allow the access to an object in the GraphFS.</param>
        /// <param name="myDenyACL">The dictionary of rights with corresponding ACLs that denies the access to an object in the GraphFS.</param>
        /// <param name="myNotificationHandling">the NotificationHandling bitfield</param>
        public AccessControlObject(ObjectLocation myObjectLocation, DefaultRuleTypes myDefaultRule, Dictionary<RightUUID, HashSet<EntityUUID>> myAllowACL, Dictionary<RightUUID, HashSet<EntityUUID>> myDenyACL, NHAccessControlObject myNotificationHandling)
        {
            if (myAllowACL == null)
                throw new ArgumentNullException("Invalid AllowACL!");

            if (myDenyACL == null)
                throw new ArgumentNullException("Invalid DenyACL!");

            _AllowACL               = myAllowACL;
            _DenyACL                = myDenyACL;
            _DefaultRule            = myDefaultRule;
            _NotificationHandling   = myNotificationHandling;
        }
        public GraphFSError_CreateDirectoryFailed(ObjectLocation myObjectLocation, String myMessage = null)
        {
            ObjectLocation = myObjectLocation;

            if (myMessage != null)
            {
                Message = String.Format("Creating a directory at location '{0}' failed because: {1}", ObjectLocation, myMessage);
            }
            else
            {
                Message = String.Format("Creating a directory at location '{0}' failed!", ObjectLocation);
            }
        }
示例#51
0
    public void init(int objectCount)
    {
        activeObjectLocation = ObjectLocation.Center;
        objectSpawnIndex = new List<int>[(int)ObjectLocation.Last];
        objectTypeSpawnIndex = new int[(int)ObjectLocation.Last][];
        lastLocalIndex = new int[(int)ObjectLocation.Last][];
        latestObjectTypeSpawnDistance = new float[(int)ObjectLocation.Last][];
        lastObjectSpawnDistance = new List<float>[(int)ObjectLocation.Last];

        objectLocationAngle = new float[(int)ObjectLocation.Last];

        totalDistance = new float[(int)ObjectLocation.Last];
        totalSceneDistance = new float[(int)ObjectLocation.Last];

        platformDistanceDataMap = new PlatformDistanceDataMap[(int)ObjectLocation.Last];

        topPlatformObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
        bottomPlatformObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
        topSceneObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
        bottomSceneObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];

        previousPlatformSection = new int[(int)ObjectLocation.Last];
        previousSceneSection = new int[(int)ObjectLocation.Last];
        spawnedPlatformSectionTransition = new bool[(int)ObjectLocation.Last];
        spawnedSceneSectionTransition = new bool[(int)ObjectLocation.Last];

        for (int i = 0; i < (int)ObjectLocation.Last; ++i) {
            objectSpawnIndex[i] = new List<int>();
            objectTypeSpawnIndex[i] = new int[(int)ObjectType.Last];
            lastLocalIndex[i] = new int[(int)ObjectType.Last];
            latestObjectTypeSpawnDistance[i] = new float[(int)ObjectType.Last];

            lastObjectSpawnDistance[i] = new List<float>();

            platformDistanceDataMap[i] = new PlatformDistanceDataMap();

            for (int j = 0; j < objectCount; ++j) {
                objectSpawnIndex[i].Add(-1);
                lastObjectSpawnDistance[i].Add(0);
            }
            for (int j = 0; j < (int)ObjectType.Last; ++j) {
                objectTypeSpawnIndex[i][j] = -1;
                lastLocalIndex[i][j] = -1;
                latestObjectTypeSpawnDistance[i][j] = -1;
            }
        }

        infiniteObjectManager = InfiniteObjectManager.instance;
    }
示例#52
0
        //HACK: Remove me!
        public static Exceptional RemoveObjectIfExists(this IGraphFSSession myIGraphFSSession, ObjectLocation myObjectLocation, String myObjectStream, String myObjectEdition = null, ObjectRevisionID myRevisionID = null)
        {
            var objExists = myIGraphFSSession.ObjectStreamExists(myObjectLocation, myObjectStream);

            if (objExists.Failed())
            {
                return new Exceptional(objExists);
            }

            if (objExists.Value == Trinary.TRUE)
            {
                var _RemoveObjectExceptional = myIGraphFSSession.RemoveFSObject(myObjectLocation, myObjectStream, myObjectEdition, myRevisionID);
                return _RemoveObjectExceptional;
            }

            else
                return Exceptional.OK;
        }
示例#53
0
        public override Exceptional Execute(AGraphDSSharp myAGraphDSSharp, ref String myCurrentPath, Dictionary<String, List<AbstractCLIOption>> myOptions, String myInputString)
        {
            if (myAGraphDSSharp == null)
                return new Exceptional(new GraphDSError("myAGraphDSSharp must not be null!"));

            _CancelCommand = false;

            // 1 parameter -> Print the target of the symlink
            if (myOptions.Count == 2)
            {

                var SymlinkLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(1).Value[0].Option);

                if (myAGraphDSSharp.isSymlink(SymlinkLocation).Value == Trinary.TRUE)
                    WriteLine(" -> " + myAGraphDSSharp.GetSymlink(SymlinkLocation));

                else
                    WriteLine("Symlink does not exist!");

            }

            // 2 parameters -> Create new symlink
            else
            {

                var SymlinkLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(1).Value[0].Option);
                var SymlinkTarget   = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(2).Value[0].Option);

                myAGraphDSSharp.AddSymlink(SymlinkLocation, SymlinkTarget);

                WriteLine(SymlinkLocation.ToString() + " -> " + SymlinkTarget.ToString());

            }

            return Exceptional.OK;
        }
示例#54
0
        static void Main(string[] args)
        {
            DataManager dm = new DataManager(11000);
            dm.Start();
            dm.GetLocation();

            DMLocation dmLocation = new DMLocation("127.0.0.1:11000");//(@"db://[fe80::a91e:3a94:e27a:9035%13]:11000");
            ObjectLocation objectLocation0 = new ObjectLocation(ObjectType.FileWithHeader, @"C:\DB\arrayName.db", 0);
            ObjectLocation objectLocation1 = new ObjectLocation(ObjectType.FileWithHeader, @"C:\DB\arrayName.db", 1);
            DataLocation dataLocation0 = new DataLocation(dmLocation, objectLocation0);
            DataLocation dataLocation1 = new DataLocation(dmLocation, objectLocation1);

            //First transaction
            Transaction t = new Transaction();
            t.Begin();

            t.Write(dataLocation0, 42);
            t.Write(dataLocation1, 77);
            Console.WriteLine("Read: " + t.Read(dataLocation0));
            Console.WriteLine("Read: " + t.Read(dataLocation1));

            //Second transaction
            Transaction t2 = new Transaction();
            t2.Begin();
            t2.Write(dataLocation1, 99);
            Console.WriteLine("Read: " + t2.Read(dataLocation1));

            t.End();

            t2.End();

            dm.Stop();

            Console.WriteLine("Press Enter....");
            Console.ReadLine();
        }
示例#55
0
        public Exceptional<UndefinedAttributesStream> LoadUndefinedAttributes(ObjectLocation myAttributeLocation)
        {
            #region data

            UndefinedAttributesStream retAttributes = null;

            #endregion

            var existExcept = _IGraphFSSession.ObjectStreamExists(myAttributeLocation, DBConstants.UNDEFATTRIBUTESSTREAM);

            if (existExcept.Failed())
                return new Exceptional<UndefinedAttributesStream>(existExcept);

            if (existExcept.Value == Trinary.TRUE)
            {
                var loadException = _IGraphFSSession.GetFSObject<UndefinedAttributesStream>(myAttributeLocation, DBConstants.UNDEFATTRIBUTESSTREAM, null, null, 0, false);

                if (loadException.Failed())
                    return new Exceptional<UndefinedAttributesStream>(loadException);

                retAttributes = loadException.Value;

            }
            else
                retAttributes = new UndefinedAttributesStream(myAttributeLocation);

            return new Exceptional<UndefinedAttributesStream>(retAttributes);
        }
示例#56
0
        public Exceptional<DBObjectStream> LoadDBObject(ObjectLocation myObjectLocation)
        {
            var _DBExceptional        = new Exceptional<DBObjectStream>();
            var _GetObjectExceptional = _IGraphFSSession.GetFSObject<DBObjectStream>(myObjectLocation, DBConstants.DBOBJECTSTREAM, null, null, 0, false);

            if (_GetObjectExceptional == null || _GetObjectExceptional.Failed() || _GetObjectExceptional.Value == null)
            {
                return _GetObjectExceptional.Convert<DBObjectStream>().PushIErrorT(new Error_LoadObject(myObjectLocation));
            }

            _DBExceptional.Value = _GetObjectExceptional.Value;
            return _DBExceptional;
        }
示例#57
0
        public Exceptional<BackwardEdgeStream> LoadBackwardEdge(ObjectLocation myEdgeLocation)
        {
            #region data

            BackwardEdgeStream retDBBackwardEdge = null;

            #endregion

            var existExcept = _IGraphFSSession.ObjectStreamExists(myEdgeLocation, DBConstants.DBBACKWARDEDGESTREAM);

            if (existExcept.Failed())
                return new Exceptional<BackwardEdgeStream>(existExcept);

            if (existExcept.Value == Trinary.TRUE)
            {
                var loadException = _IGraphFSSession.GetFSObject<BackwardEdgeStream>(myEdgeLocation, DBConstants.DBBACKWARDEDGESTREAM, null, null, 0, false);

                if (loadException.Failed())
                    return new Exceptional<BackwardEdgeStream>(loadException);

                retDBBackwardEdge = loadException.Value;
            }
            else
            {
                retDBBackwardEdge = new BackwardEdgeStream(myEdgeLocation);
            }

            return new Exceptional<BackwardEdgeStream>(retDBBackwardEdge);
        }
示例#58
0
文件: DBContext.cs 项目: ipbi/sones
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="myIGraphDBSession">The filesystem where the information is stored.</param>
        /// <param name="DatabaseRootPath">The database root path.</param>
        public DBContext(IGraphFSSession graphFSSession, ObjectLocation myDatabaseRootPath, EntityUUID myUserID, Dictionary<String, ADBSettingsBase> myDBSettings, Boolean myRebuildIndices, DBPluginManager myDBPluginManager, DBSessionSettings sessionSettings = null)
        {
            _DBPluginManager    = myDBPluginManager;

            _DBTypeManager      = new TypeManagement.DBTypeManager(graphFSSession, myDatabaseRootPath, myUserID, myDBSettings, this);
            _DBSettingsManager  = new DBSettingsManager(_DBPluginManager.Settings, myDBSettings, graphFSSession, new ObjectLocation(myDatabaseRootPath.Name, DBConstants.DBSettingsLocation));
            _DBObjectManager    = new DBObjectManager(this, graphFSSession);
            _DBIndexManager     = new DBIndexManager(graphFSSession, this);
            _SessionSettings    = sessionSettings;
            _DBObjectCache      = _DBObjectManager.GetSimpleDBObjectCache(this);
            _IGraphFSSession    = graphFSSession;

            //init types
            var initExcept = _DBTypeManager.Init(graphFSSession, myDatabaseRootPath, myRebuildIndices);

            if (initExcept.Failed())
            {
                throw new GraphDBException(initExcept.IErrors);
            }
        }
 public GraphFSError_ObjectStreamNotFound(ObjectLocation myObjectLocation, String myObjectStream)
 {
     ObjectLocation  = myObjectLocation;
     ObjectStream    = myObjectStream;
     Message         = String.Format("Object stream '{0}' at location '{1}' not found!", ObjectStream, ObjectLocation);
 }
示例#60
0
        public void SaveAs(ObjectLocation myObjectLocation, String myObjectStream, String myObjectEditon, ObjectRevisionID myObjectRevisionID)
        {
            if (myObjectLocation == null || myObjectLocation.Length < FSPathConstants.PathDelimiter.Length)
                throw new ArgumentNullException("myObjectLocation must not be null or its length be zero!");

            if (myObjectStream == null || myObjectStream.Length == 0)
                throw new ArgumentNullException("myObjectStream must not be null or its length be zero!");

            if (myObjectEditon == null || myObjectEditon.Length == 0)
                throw new ArgumentNullException("myObjectEditon must not be null or its length be zero!");

            if (myObjectRevisionID == null)
                throw new ArgumentNullException("myObjectRevisionID must not be null!");

            if (_IGraphFSSessionReference != null && _IGraphFSSessionReference.IsAlive)
            {

                ObjectLocatorReference.ObjectLocationSetter = myObjectLocation;
                _ObjectStream       = myObjectStream;
                _ObjectEdition      = myObjectEditon;
                _ObjectRevisionID   = myObjectRevisionID;

                Save();

            }
        }