/// <summary>
 /// Class Manipulation located in App_Code folder
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (RdBtOver.Checked == true)
     {
         Manipulation manipulation = new Manipulation(Nametxt.Text, LastNametxt.Text, DropDownList1.SelectedItem.Text, RdBtOver.Checked);
         ManipulationContainer.AppManipulations.Add(manipulation);
         Response.Redirect("DisplayData.aspx");
     }
     else LigalPass.Visible = true;
 }
Ejemplo n.º 2
0
 private void toggleMouseCursorVisibilityToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Manipulation.MouseCursorIsHidden ||
         MessageBox.Show(
             LanguageManager.Data("toggleMouseCursorVisibilityPrompt"),
             LanguageManager.Data("toggleMouseCursorVisibilityTitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
             MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         Manipulation.ToggleMouseCursorVisibility(this);
     }
 }
Ejemplo n.º 3
0
 private void toggleMouseCursorVisibilityToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Manipulation.MouseCursorIsHidden ||
         MessageBox.Show(
             "Do you really want to hide the mouse cursor?\r\n\r\nYou may have a difficult time finding the mouse again once it's hidden.\r\n\r\nIf you have enabled the global hotkey to toggle the mouse cursor visibility, you can press [Win + Scroll Lock] to toggle the mouse cursor on.\r\n\r\nAlso, exiting Borderless Gaming will immediately restore your mouse cursor.",
             "Really Hide Mouse Cursor?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
             MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         Manipulation.ToggleMouseCursorVisibility(this);
     }
 }
Ejemplo n.º 4
0
 // Called when a coroutine is completed. Executes the OnDone method if necessary, and resets default values.
 private void CoroutineComplete(Manipulation mcp, OnDone OnDoneMethod)
 {
     mcp.coroutine = null;
     wrjInstance.CleanCoroList();
     if (OnDoneMethod != null)
     {
         OnDoneMethod();
         OnDoneMethod = null;
     }
     OnDoneMethod = null;
 }
Ejemplo n.º 5
0
        /// <summary>
        ///     remove the menu, resize the window, remove border, and maximize
        /// </summary>
        public void RemoveBorder_ToSpecificRect(IntPtr hWnd, Rectangle targetFrame, Favorites.Favorite favDetails = null, Boolean overrideTimeout = false)
        {
            if (favDetails != null && favDetails.DelayBorderless == true && overrideTimeout == false)
            {
                //Wait 10 seconds before removing the border.
                Task task = new Task(() => RemoveBorder_ToSpecificRect(hWnd, targetFrame, favDetails, true));
                task.Wait(TimeSpan.FromSeconds(10));
            }
            var pd = _processDetails.FromHandle(hWnd);

            Manipulation.MakeWindowBorderless(pd, window, hWnd, targetFrame, favDetails ?? _favorites.FromProcessDetails(pd));
        }
Ejemplo n.º 6
0
 /// <summary>
 ///     remove the menu, resize the window, remove border, and maximize
 /// </summary>
 public async Task RemoveBorder_ToSpecificRect(IntPtr hWnd, Rectangle targetFrame, Favorite favDetails = null,
                                               bool overrideTimeout = false)
 {
     if (favDetails != null && favDetails.DelayBorderless && overrideTimeout == false)
     {
         //Wait 10 seconds before removing the border.
         var task = new Task(async() => await RemoveBorder_ToSpecificRect(hWnd, targetFrame, favDetails, true));
         task.Wait(TimeSpan.FromSeconds(10));
     }
     var pd = FromHandle(hWnd);
     await Manipulation.MakeWindowBorderless(pd, _form, hWnd, targetFrame, favDetails ?? Favorite.FromWindow(pd));
 }
Ejemplo n.º 7
0
 // Matches the position scale and rotation of a sibling transform.
 public Manipulation[] MatchSibling(Transform tform, Transform toTform, float duration, bool mirrorCurve = false, int loop = 0, int pingPong = 0, int mirrorPingPong = 0, bool useTimeScale = false, OnDone onDone = null)
 {
     if (tform.parent != toTform.parent)
     {
         Debug.LogWarning("Attempting to match a target that is not a sibling. No guarantee that scale, position, rotation will match.");
     }
     Manipulation[] mcpList = new Manipulation[3];
     mcpList[0] = Scale(tform, toTform.localScale, duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, onDone);
     mcpList[1] = Move(tform, toTform.localPosition, duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, false, null);
     mcpList[2] = Rotate(tform, toTform.localEulerAngles, duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, true, false, null);
     return(mcpList);
 }
Ejemplo n.º 8
0
            private IEnumerator LerpImageAlpha(Manipulation mcp, UnityEngine.UI.Image image, float to, float duration, bool mirrorCurve, int loop, int pingPong, int mirrorPingPong, bool useTimeScale, OnDone onDone)
            {
                float elapsedTime = 0;

                mcp.iterationCount++;
                Transform tform = image.transform;
                float     from  = image.color.a;

                while (elapsedTime < duration)
                {
                    yield return(new WaitForEndOfFrame());

                    if (tform == null)
                    {
                        StopAllOnTransform(tform);
                        yield break;
                    }
                    Color color = image.color;
                    elapsedTime += GetDesiredDelta(useTimeScale);
                    float scrubPos = Remap(elapsedTime, 0, duration, 0, 1);
                    if (mirrorCurve)
                    {
                        color.a = MirrorLerp(from, to, scrubPos);
                    }
                    else
                    {
                        color.a = Lerp(from, to, scrubPos);
                    }
                    image.color = color;
                }
                Color finalColor = image.color;

                finalColor.a = Lerp(from, to, 1f);
                image.color  = finalColor;
                if (pingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(LerpImageAlpha(mcp, image, from, duration, mirrorCurve, 0, --pingPong, 0, useTimeScale, onDone));
                }
                else if (mirrorPingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(LerpImageAlpha(mcp, image, from, duration, !mirrorCurve, 0, 0, --mirrorPingPong, useTimeScale, onDone));
                }
                else if (loop > 0)
                {
                    finalColor.a  = from;
                    image.color   = finalColor;
                    mcp.coroutine = UtilObject().StartCoroutine(LerpImageAlpha(mcp, image, to, duration, mirrorCurve, --loop, 0, 0, useTimeScale, onDone));
                }
                else
                {
                    CoroutineComplete(mcp, onDone);
                }
            }
Ejemplo n.º 9
0
        private async Task UncheckedRemove(Package packageToUninstall, LogHandler logCallback, ProgressHandler progressCallback)
        {
            EventHandler <ProgressReport> progressHandler = (object sender, ProgressReport e) => {
                progressCallback(null, null, e.Progress);
                logCallback(LogLevel.Verbose, string.Format("Removed {0}", e.CurrentFile));
            };
            EventHandler <ProblemReport> problemHandler = (object sender, ProblemReport e) => {
                throw e.Exception;
            };

            Manipulation.ProgressChanged += progressHandler;
            Manipulation.ProblemReport   += problemHandler;
            try {
                await Task.Run(delegate {
                    string uninstallResults = "";
                    if (Manipulation.UninstallPackage(packageToUninstall, currentDatabaseFolder, ref uninstallResults))
                    {
                        switch (packageToUninstall.PackageType)
                        {
                        case PackageType.Other:
                            DatabaseFunctions.cleanDirectory(OtherInstallationDirectory, ref uninstallResults);
                            break;

                        case PackageType.Route:
                            DatabaseFunctions.cleanDirectory(RouteInstallationDirectory, ref uninstallResults);
                            break;

                        case PackageType.Train:
                            DatabaseFunctions.cleanDirectory(TrainInstallationDirectory, ref uninstallResults);
                            break;
                        }
                        switch (packageToUninstall.PackageType)
                        {
                        case PackageType.Other:
                            Database.currentDatabase.InstalledOther.Remove(packageToUninstall);
                            break;

                        case PackageType.Route:
                            Database.currentDatabase.InstalledRoutes.Remove(packageToUninstall);
                            break;

                        case PackageType.Train:
                            Database.currentDatabase.InstalledTrains.Remove(packageToUninstall);
                            break;
                        }
                    }
                });
            } finally {
                Manipulation.ProgressChanged -= progressHandler;
                Manipulation.ProblemReport   -= problemHandler;
            }
            Database.SaveDatabase();
        }
Ejemplo n.º 10
0
        public void StopManipulation(int x, int y)
        {
            manipulation = Manipulation.None;

            Yaw      = Yaw + addYaw;
            Pitch    = MathUtil.Clamp(Pitch + addPitch, -85, 85);
            Distance = Distance * addZoom;

            addYaw   = 0;
            addPitch = 0;
            addZoom  = 1;
        }
Ejemplo n.º 11
0
        public ActionResult ResizeToWidth(int quality, int rotationDegrees, int width, string path, string originalExtension = null)
        {
            var manipulation = new Manipulation
            {
                Quality         = quality,
                Width           = width,
                ResizeMode      = ResizeMode.Max,
                RotationDegrees = rotationDegrees
            };

            return(this.ServeManipulatedImage(path, originalExtension, manipulation));
        }
Ejemplo n.º 12
0
        public void TestManipulationTurns()
        {
            State details = new State();

            Assert.AreEqual <uint>(0, Manipulation.GetTurnsRemaining(details));

            for (int i = 3; i >= 0; --i)
            {
                Manipulation.SetTurnsRemaining(details, (uint)i);
                Assert.AreEqual <uint>((uint)i, Manipulation.GetTurnsRemaining(details));
            }
        }
Ejemplo n.º 13
0
            // Being careful not to impact alpha, so this can be used simultaneously with ChangAlpha()
            private IEnumerator LerpColor(Manipulation mcp, Transform tform, Color to, float duration, bool mirrorCurve, int loop, int pingPong, int mirrorPingPong, bool useTimeScale, OnDone onDone)
            {
                float elapsedTime = 0;

                mcp.iterationCount++;
                Material mat  = tform.GetComponent <Renderer>().material;
                Color    from = mat.GetColor("_Color");

                while (elapsedTime < duration)
                {
                    yield return(new WaitForEndOfFrame());

                    if (tform == null)
                    {
                        StopAllOnTransform(tform);
                        yield break;
                    }
                    Color color = mat.GetColor("_Color");
                    elapsedTime += GetDesiredDelta(useTimeScale);
                    float scrubPos = Remap(elapsedTime, 0, duration, 0, 1);
                    if (mirrorCurve)
                    {
                        color = MirrorLerp(from, to, scrubPos);
                    }
                    else
                    {
                        color = Lerp(from, to, scrubPos);
                    }
                    mat.SetColor("_Color", new Color(color.r, color.g, color.b, mat.GetColor("_Color").a));
                }
                Color finalColor = Lerp(from, to, 1f);

                finalColor.a = mat.GetColor("_Color").a;
                mat.SetColor("_Color", finalColor);
                if (pingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(LerpColor(mcp, tform, from, duration, mirrorCurve, 0, --pingPong, 0, useTimeScale, onDone));
                }
                else if (mirrorPingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(LerpColor(mcp, tform, from, duration, !mirrorCurve, 0, 0, --mirrorPingPong, useTimeScale, onDone));
                }
                else if (loop > 0)
                {
                    mat.SetColor("_Color", from);
                    mcp.coroutine = UtilObject().StartCoroutine(LerpColor(mcp, tform, to, duration, mirrorCurve, --loop, 0, 0, useTimeScale, onDone));
                }
                else
                {
                    CoroutineComplete(mcp, onDone);
                }
            }
Ejemplo n.º 14
0
            private IEnumerator MoveWorldspace(Manipulation mcp, Transform tform, Vector3 to, float duration, bool mirrorCurve, int loop, int pingPong, int mirrorPingPong, bool useTimeScale, bool pendulum, OnDone onDone)
            {
                float elapsedTime = 0;

                mcp.iterationCount++;
                Vector3 from = tform.position;

                while (elapsedTime < duration)
                {
                    yield return(new WaitForEndOfFrame());

                    if (tform == null)
                    {
                        StopAllOnTransform(tform);
                        yield break;
                    }
                    elapsedTime += GetDesiredDelta(useTimeScale);
                    float scrubPos = Remap(elapsedTime, 0, duration, 0, 1);
                    if (mirrorCurve)
                    {
                        tform.position = MirrorLerp(from, to, scrubPos);
                    }
                    else
                    {
                        tform.position = Lerp(from, to, scrubPos);
                    }
                }
                tform.position = Lerp(from, to, 1f);

                if (pendulum && mcp.iterationCount % 2 == 0)
                {
                    from = to - from;
                }

                if (pingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(MoveWorldspace(mcp, tform, from, duration, mirrorCurve, 0, --pingPong, 0, useTimeScale, pendulum, onDone));
                }
                else if (mirrorPingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(MoveWorldspace(mcp, tform, from, duration, !mirrorCurve, 0, 0, --mirrorPingPong, useTimeScale, pendulum, onDone));
                }
                else if (loop > 0)
                {
                    tform.position = from;
                    mcp.coroutine  = UtilObject().StartCoroutine(MoveWorldspace(mcp, tform, to, duration, mirrorCurve, --loop, 0, 0, useTimeScale, pendulum, onDone));
                }
                else
                {
                    CoroutineComplete(mcp, onDone);
                }
            }
Ejemplo n.º 15
0
 /// <summary>
 /// Class Manipulation located in App_Code folder
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (RdBtOver.Checked == true)
     {
         Manipulation manipulation = new Manipulation(Nametxt.Text, LastNametxt.Text, DropDownList1.SelectedItem.Text, RdBtOver.Checked);
         ManipulationContainer.AppManipulations.Add(manipulation);
         Response.Redirect("DisplayData.aspx");
     }
     else
     {
         LigalPass.Visible = true;
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// removes manipulation with given id from DB
 /// </summary>
 /// <param name="id">manipulation id</param>
 /// <param name="folderPath">manipulation path on a disk</param>
 public static void RemoveManipulation(int?id, string folderPath)
 {
     using (var ctx = new PatientsContext())
     {
         Manipulation manipulation = ctx.Manipulations.Include(u => u.ManipulationPictures).Where(p => p.ManipulationId == id).FirstOrDefault();
         if (folderPath != "")
         {
             Directory.Delete(folderPath, true);
         }
         ctx.Manipulations.Remove(manipulation);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        ///     remove the menu, resize the window, remove border, and maximize
        /// </summary>
        public void RemoveBorder_ToSpecificScreen(IntPtr hWnd, Screen screen, Favorite favDetails = null,
                                                  bool overrideTimeout = false)
        {
            if (favDetails != null && favDetails.DelayBorderless && overrideTimeout == false)
            {
                //Wait 10 seconds before removing the border.
                var task = new Task(() => RemoveBorder_ToSpecificScreen(hWnd, screen, favDetails, true));
                task.Wait(TimeSpan.FromSeconds(10));
            }

            var pd = Processes.FromHandle(hWnd);

            Manipulation.MakeWindowBorderless(pd, _window, hWnd, screen.Bounds, favDetails ?? Favorite.FromWindow(pd));
        }
Ejemplo n.º 18
0
            private IEnumerator CrossFade(Manipulation mcp, AudioSource from, AudioSource to, float targetVol, float duration, bool mirrorCurve, int loop, int pingPong, int mirrorPingPong, bool useTimeScale, OnDone onDone)
            {
                to.volume = 0;
                float initB       = from.volume;
                float elapsedTime = 0;

                mcp.iterationCount++;
                while (elapsedTime < duration)
                {
                    yield return(new WaitForEndOfFrame());

                    if (to == null || from == null)
                    {
                        yield break;
                    }
                    elapsedTime += GetDesiredDelta(useTimeScale);
                    float scrubPos = Remap(elapsedTime, 0, duration, 0, 1);
                    if (mirrorCurve)
                    {
                        to.volume   = MirrorLerp(0, targetVol, scrubPos);
                        from.volume = MirrorLerp(initB, 0, scrubPos);
                    }
                    else
                    {
                        to.volume   = Lerp(0, targetVol, scrubPos);
                        from.volume = Lerp(initB, 0, scrubPos);
                    }
                }
                to.volume   = targetVol;
                from.volume = 0;
                if (pingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(CrossFade(mcp, to, from, targetVol, duration, mirrorCurve, 0, --pingPong, 0, useTimeScale, onDone));
                }
                else if (mirrorPingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(CrossFade(mcp, to, from, targetVol, duration, !mirrorCurve, 0, 0, --mirrorPingPong, useTimeScale, onDone));
                }
                else if (loop > 0)
                {
                    from.volume   = initB;
                    to.volume     = 0;
                    mcp.coroutine = UtilObject().StartCoroutine(CrossFade(mcp, from, to, targetVol, duration, mirrorCurve, --loop, 0, 0, useTimeScale, onDone));
                }
                else
                {
                    CoroutineComplete(mcp, onDone);
                }
            }
Ejemplo n.º 19
0
        public async Task DoInstall(Context ctx, string path, LogHandler logCallback, ProgressHandler progressCallback)
        {
            SwitchToDatabase();
            var currentPackage = Manipulation.ReadPackage(path);

            if (currentPackage == null)
            {
                throw new MalformedPackageException(ctx);
            }

            // Double-check with OpenBVE Package Manager
            List <Package> Dependancies    = Database.checkDependsReccomends(currentPackage.Dependancies.ToList());
            List <Package> Recommendations = Database.checkDependsReccomends(currentPackage.Reccomendations.ToList());

            if (Dependancies != null)
            {
                throw new MissingDependencyException(ctx, Dependancies);
            }
            if (Recommendations != null)
            {
                throw new MissingDependencyException(ctx, Recommendations);
            }

            // Remove the older one for upgrade/downgrade
            VersionInformation Info;
            Package            oldPackage = null;

            switch (currentPackage.PackageType)
            {
            case PackageType.Route:
                Info = Information.CheckVersion(currentPackage, Database.currentDatabase.InstalledRoutes, ref oldPackage);
                break;

            case PackageType.Train:
                Info = Information.CheckVersion(currentPackage, Database.currentDatabase.InstalledTrains, ref oldPackage);
                break;

            default:
                Info = Information.CheckVersion(currentPackage, Database.currentDatabase.InstalledOther, ref oldPackage);
                break;
            }
            if (Info != VersionInformation.NotFound)
            {
                // No need for dependency check there, since this is an upgrade.
                // Might break packages with version requirements, but PWPackMan should handle that
                await UncheckedRemove(oldPackage, logCallback, progressCallback);
            }
            await UncheckedInstall(currentPackage, logCallback, progressCallback);
        }
Ejemplo n.º 20
0
            public Manipulation Rotate(Transform tform, Vector3 eulerTo, float duration, bool mirrorCurve = false, int loop = 0, int pingPong = 0, int mirrorPingPong = 0, bool useTimeScale = false, bool shortestPath = true, bool pendulum = false, OnDone onDone = null)
            {
                Manipulation mcp = new Manipulation("Rotate", tform);

                if (shortestPath)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(RotateLocalQuaternionLerp(mcp, tform, tform.rotation, Quaternion.Euler(eulerTo.x, eulerTo.y, eulerTo.z), duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, pendulum, onDone));
                }
                else
                {
                    mcp.coroutine = UtilObject().StartCoroutine(RotateLocal(mcp, tform, tform.localEulerAngles, eulerTo, duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, pendulum, onDone));
                }
                UtilObject().AddToCoroList(mcp);
                return(mcp);
            }
Ejemplo n.º 21
0
        public override void OnClick(InteractableStates state, Interactable source, IMixedRealityPointer pointer = null)
        {
            base.OnClick(state, source, pointer);

            if (spawnCoro == null)
            {
                spawnCoro = Host.StartCoroutine(SpawnDatasets());
            }
            else
            {
                Host.StopCoroutine(spawnCoro);
                Manipulation.UpdatePanelVisName("No Visualization Running");
                Manipulation.UpdatePanelInfo("-- No Info --");
            }
        }
Ejemplo n.º 22
0
        public ActionResult ResizeToWidth(int quality, int rotationDegrees, int width, string pathPrefix, string path, string originalExtension = null)
        {
            var manipulation = new Manipulation
            {
                Quality         = quality,
                Width           = width,
                ResizeMode      = ResizeMode.Max,
                RotationDegrees = rotationDegrees
            };
            var relativePath = String.IsNullOrWhiteSpace(pathPrefix)
                ? path
                : pathPrefix + "/" + path;

            return(this.ServeManipulatedImage(relativePath, originalExtension, manipulation));
        }
Ejemplo n.º 23
0
            public Manipulation FadeAlpha(Transform tform, float to, float duration, bool mirrorCurve = false, int loop = 0, int pingPong = 0, int mirrorPingPong = 0, bool useTimeScale = false, OnDone onDone = null)
            {
                Manipulation mcp = new Manipulation("Alpha", tform);

                if (tform.GetComponent <UnityEngine.UI.Image>())
                {
                    mcp.coroutine = UtilObject().StartCoroutine(LerpImageAlpha(mcp, tform.GetComponent <UnityEngine.UI.Image>(), to, duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, onDone));
                }
                else
                {
                    mcp.coroutine = UtilObject().StartCoroutine(LerpAlpha(mcp, tform, to, duration, mirrorCurve, loop, pingPong, mirrorPingPong, useTimeScale, onDone));
                }
                UtilObject().AddToCoroList(mcp);
                return(mcp);
            }
Ejemplo n.º 24
0
 public void setTRS()
 {
     if (currentManipulation == Manipulation.T)
     {
         currentManipulation = Manipulation.R;
     }
     else if (currentManipulation == Manipulation.R)
     {
         currentManipulation = Manipulation.S;
     }
     else
     {
         currentManipulation = Manipulation.T;
     }
 }
Ejemplo n.º 25
0
        private void DeleteBooking_Click(object sender, EventArgs e)
        {
            try
            {
                Model.Booking       book    = new Model.Booking();
                Model.SelectBooking booking = (Model.SelectBooking)Booking.SelectedItem;
                book = Manipulation.db.Bookings.Find(booking.Booking_number);
                book.Room.Booking = "Нет";

                Manipulation.Delete <Model.Booking>(book);
                UpdateDataGrid();
                MessageBox.Show("Запись удалена!");
            }
            catch (NullReferenceException ex) { MessageBox.Show("Выберите бронь, чтобы удалить ее!"); }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Ejemplo n.º 26
0
        private void btnRestoreWindow_Click(object sender, EventArgs e)
        {
            if (lstProcesses.SelectedItem == null)
            {
                return;
            }

            var pd = (ProcessDetails)lstProcesses.SelectedItem;

            if (!pd.Manageable)
            {
                return;
            }

            Manipulation.RestoreWindow(pd);
        }
 /// <summary>
 /// Checks the connectors.
 /// </summary>
 /// <param name="element">The element.</param>
 /// <param name="parent">The parent.</param>
 private void CheckConnectors(Element element, Element parent)
 {
     if (!element.Connectors.Cast <Connector>()
         .Any(
             item =>
             (item.SupplierID.Equals(parent.ElementID) &&
              EnumTypeConverter.EqualsType(ConnectorTypes.Generalization, item.Type))))
     {
         Connector connector = Manipulation.AddConnector(parent, element, ConnectorTypes.Generalization);
         if (!object.Equals(connector, null))
         {
             connector.Stereotype = "parent";
             connector.Update();
         }
     }
 }
Ejemplo n.º 28
0
            private IEnumerator MovePath(Manipulation mcp, Transform tform, BezierPath path, float duration, bool mirrorCurve, int loop, int pingPong, int mirrorPingPong, bool useTimeScale, bool inverse, bool align, OnDone onDone)
            {
                float elapsedTime = 0;

                mcp.iterationCount++;
                while (elapsedTime < duration)
                {
                    yield return(new WaitForEndOfFrame());

                    if (tform == null)
                    {
                        StopAllOnTransform(tform);
                        yield break;
                    }
                    elapsedTime += GetDesiredDelta(useTimeScale);
                    float   scrubPos = inverse ? Remap(elapsedTime, 0, duration, 1, 0) : Remap(elapsedTime, 0, duration, 0, 1);
                    Vector3 look     = Vector3.zero;
                    if (mirrorCurve)
                    {
                        tform.position = path.GetPointOnCurve(MirrorLerp(0, 1, scrubPos), ref look);
                    }
                    else
                    {
                        tform.position = path.GetPointOnCurve(Lerp(0, 1, scrubPos), ref look);
                    }
                    if (align && look != tform.position)
                    {
                        tform.rotation = Quaternion.LookRotation(tform.position - look);
                    }
                }
                if (pingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(MovePath(mcp, tform, path, duration, mirrorCurve, 0, --pingPong, 0, useTimeScale, !inverse, align, onDone));
                }
                else if (mirrorPingPong > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(MovePath(mcp, tform, path, duration, !mirrorCurve, 0, 0, --mirrorPingPong, useTimeScale, !inverse, align, onDone));
                }
                else if (loop > 0)
                {
                    mcp.coroutine = UtilObject().StartCoroutine(MovePath(mcp, tform, path, duration, mirrorCurve, --loop, 0, 0, useTimeScale, inverse, align, onDone));
                }
                else
                {
                    CoroutineComplete(mcp, onDone);
                }
            }
Ejemplo n.º 29
0
        public ActionResult Pad(int quality, int rotationDegrees, int width, int height, string path, string originalExtension = null, string bgColor = null)
        {
            var manipulation = new Manipulation
            {
                Quality         = quality,
                Width           = width,
                Height          = height,
                ResizeMode      = ResizeMode.Pad,
                RotationDegrees = rotationDegrees
            };

            if (!String.IsNullOrWhiteSpace(bgColor))
            {
                manipulation.BackgroundColor = ColorTranslator.FromHtml($"#{bgColor}");
            }
            return(this.ServeManipulatedImage(path, originalExtension, manipulation));
        }
Ejemplo n.º 30
0
        public void TestManipulationWithTouchDoesntChangeDurability()
        {
            Manipulation manipulation = new Manipulation();
            BasicTouch   touch        = new BasicTouch();

            State state = Utility.CreateDefaultState();

            state.Durability = 20;
            State s2 = manipulation.Activate(state, true);

            Assert.AreEqual <uint>(20, s2.Durability);
            Assert.AreEqual(SynthesisStatus.IN_PROGRESS, s2.Status);

            s2 = touch.Activate(s2, true);
            Assert.AreEqual <uint>(20, s2.Durability);
            Assert.AreEqual(SynthesisStatus.IN_PROGRESS, s2.Status);
        }
Ejemplo n.º 31
0
        public void TestManipulationWithTenDurabilityBusts()
        {
            Manipulation   manipulation = new Manipulation();
            BasicSynthesis basic        = new BasicSynthesis();

            State state = Utility.CreateDefaultState();

            state.Durability = 10;
            State s2 = manipulation.Activate(state, true);

            Assert.AreEqual <uint>(10, s2.Durability);
            Assert.AreEqual(SynthesisStatus.IN_PROGRESS, s2.Status);

            s2 = basic.Activate(s2, true);
            Assert.AreEqual <uint>(0, s2.Durability);
            Assert.AreEqual(SynthesisStatus.BUSTED, s2.Status);
        }