Beispiel #1
0
        /// <summary>
        /// Get symbol
        /// </summary>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static string ToSymbol(this CompareMode mode)
        {
            switch (mode)
            {
            case CompareMode.Less:
                return("<");

            case CompareMode.LessEqual:
                return("<=");

            case CompareMode.Equal:
                return("==");

            case CompareMode.GreatEqual:
                return(">=");

            case CompareMode.Great:
                return(">");

            case CompareMode.NotEqual:
                return("!=");

            default:
                return(null);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 实例化 <see cref="FreeDomRangeField{TPrimitive}"/>
 /// </summary>
 /// <param name="min">最小值</param>
 /// <param name="max">最大值</param>
 /// <param name="minCompareMode">最小值比较模式</param>
 /// <param name="maxCompareMode">最大值比较模式</param>
 public FreeDomRangeField(TPrimitive?min, TPrimitive?max, CompareMode minCompareMode, CompareMode maxCompareMode)
 {
     m_min          = min;
     m_max          = max;
     MinCompareMode = minCompareMode;
     MaxCompareMode = maxCompareMode;
 }
 public SelectionCriteria(Operator criteriaType, string attributeName, object attributeValue)
 {
     m_Type           = criteriaType;
     m_AttributeName  = attributeName;
     m_AttributeValue = attributeValue;
     m_CompareMode    = CompareMode.Compare;
 }
        private static IDatabaseExpression GetFilterSql(IEnumerable <SortSetting> items,
                                                        CompareMode ascSymbol, CompareMode descSymbol, CompareMode idSymbol)
        {
            if (items == null)
            {
                return(null);
            }

            var prevOrders = new List <IDatabaseExpression>();

            var filters = items
                          .SelectMany(x => x.Property.GetSortColumns()
                                      .Select(s => new SortFilterContainer
            {
                Column = s, Symbol = x.IsDescending ? descSymbol : ascSymbol
            }))
                          .Append(new SortFilterContainer
            {
                Column = FileProperty.Id.GetSortColumns().First(), Symbol = idSymbol
            })
                          .Select((x, c) =>
            {
                var symbol    = x.Symbol;
                var reference = new DatabaseReference($"@C{c}");

                var str = DatabaseExpression.Compare(x.Column, symbol, reference);
                var fil = DatabaseExpression.And(prevOrders.Append(str).ToArray());
                prevOrders.Add(DatabaseExpression.AreEqual(x.Column, reference));

                return(fil);
            })
                          .ToArray();

            return(DatabaseExpression.Or(filters.ToArray()));
        }
Beispiel #5
0
        public Filter(string pattern, CampareType type = CampareType.WildCard, CompareMode mode = CompareMode.CaseIgnore)
        {
            Pattern = pattern;
            if (pattern == null)
            {
                return;
            }

            var regexOptions = RegexOptions.None;

            if (mode == CompareMode.CaseIgnore)
            {
                regexOptions = RegexOptions.IgnoreCase;
            }

            switch (type)
            {
            default:
            case CampareType.WildCard:
                if (pattern.Contains("*") || pattern.Contains("?"))
                {
                    _pattern = new Regex($"^{Regex.Escape(pattern).Replace(@"\?", ".").Replace(@"\*", ".*")}$", regexOptions);
                }
                else
                {
                    _text = pattern;
                }
                break;

            case CampareType.Regex:
                _pattern = new Regex(pattern, regexOptions);
                break;
            }
        }
 public SelectionCriteria(Operator criteriaType, AttributeMap attribute, object attributeValue)
 {
     m_Type           = criteriaType;
     m_Attribute      = attribute;
     m_AttributeValue = attributeValue;
     m_CompareMode    = CompareMode.Compare;
 }
        private void hideComparisonGrid(object sender, TappedRoutedEventArgs e)
        {
            switch (compareMode)
            {
            case CompareMode.Full:
                Storyboards.DissapearRight(comparisonGrid, collapseComparisonGrid);
                break;

            case CompareMode.Compare1:
                compareTransition = true;
                compareMode       = CompareMode.Full;
                Storyboards.MoveToXAndFadeOut(compare1left, AppearTime, -App.Width / 2, fadeInCompareChart);
                Storyboards.MoveToXAndFadeOut(compare1right, AppearTime, App.Width / 2, null);
                break;

            case CompareMode.Compare2:
                compareTransition = true;
                compareMode       = CompareMode.Full;
                Storyboards.MoveToXAndFadeOut(compare2left1, AppearTime, -App.Width / 2, fadeInCompareChart);
                Storyboards.MoveToXAndFadeOut(compare2rleft2, AppearTime, -App.Width / 2, null);
                Storyboards.MoveToXAndFadeOut(compare2right1, AppearTime, App.Width / 2, null);
                Storyboards.MoveToXAndFadeOut(compare2right2, AppearTime, App.Width / 2, null);
                Storyboards.MoveToXAndFadeOut(compare2right3, AppearTime, App.Width / 2, null);
                Storyboards.MoveToXAndFadeOut(compare2right4, AppearTime, App.Width / 2, null);
                break;
            }
        }
Beispiel #8
0
 public SamplerCreateInfo(
     MinFilter minFilter,
     MagFilter magFilter,
     bool seamlessCubemap,
     AddressMode addressU,
     AddressMode addressV,
     AddressMode addressP,
     CompareMode compareMode,
     CompareOp compareOp,
     ColorF borderColor,
     float minLod,
     float maxLod,
     float mipLodBias,
     float maxAnisotropy)
 {
     MinFilter       = minFilter;
     MagFilter       = magFilter;
     SeamlessCubemap = seamlessCubemap;
     AddressU        = addressU;
     AddressV        = addressV;
     AddressP        = addressP;
     CompareMode     = compareMode;
     CompareOp       = compareOp;
     BorderColor     = borderColor;
     MinLod          = minLod;
     MaxLod          = maxLod;
     MipLodBias      = mipLodBias;
     MaxAnisotropy   = maxAnisotropy;
 }
 public SelectionCriteria(Operator criteriaType, int length, AttributeMap attribute)
 {
     m_Type           = criteriaType;
     m_Attribute      = attribute;
     m_AttributeValue = length;
     m_CompareMode    = CompareMode.CompareFieldLen;
 }
 public SelectionCriteria(Operator criteriaType, AttributeMap attribute, AttributeMap Toatrribute)
 {
     m_Type           = criteriaType;
     m_Attribute      = attribute;
     m_ToAtrributeMap = Toatrribute;
     m_CompareMode    = CompareMode.CompareField;
 }
 public SensitiveIntValue(CompareMode compareMode, int value, int triggerValue)
 {
     this.value        = value;
     this.triggerValue = triggerValue;
     compareFunc       = CompareFunc.GetCompareIntFunc(compareMode);
     Triggered         = new UnityEvent();
 }
Beispiel #12
0
 public FieldComparisonDependency(BuildComponent.ComponentType first, string fieldFirst, BuildComponent.ComponentType second, string fieldSecond, CompareMode mode)
 {
     FirstType       = first;
     SecondType      = second;
     FirstFieldName  = fieldFirst;
     SecondFieldName = fieldSecond;
     Mode            = mode;
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="TypeMemberSelectionRule" /> class.
        /// </summary>
        /// <param name="type">The type to compare with the type of given members.</param>
        /// <param name="selectionMode">The selection mode to apply.</param>
        /// <param name="compareMode">The compare mode to apply.</param>
        /// <param name="name">The name of the rule.</param>
        /// <param name="description">The description of the rule.</param>
        public TypeMemberSelectionRule( Type type, MemberSelectionMode selectionMode, CompareMode compareMode, String name = null, String description = null )
            : base(name, description)
        {
            type.ThrowIfNull( nameof( type ) );

            _type = type;
            _selectionMode = selectionMode;
            _compareMode = compareMode;
        }
        static bool ParamStringMet(string parameter, Dictionary <string, CustomParameter> paramsCheck, out string paramName, out string valueString, out object paramValue, out bool paramFound)
        {
            paramValue = null;
            CompareMode     compareMode = GetCompareMode(parameter, out paramName, out valueString);
            CustomParameter check;

            paramFound = paramsCheck.TryGetValue(paramName, out check);
            return(paramFound && MatchesParameter(check, compareMode, valueString, out paramValue));
        }
 public SelectionCriteria(Operator criteriaType, AttributeMap attribute, int start, int length, object attributeValue, string clause)
 {
     m_Type             = criteriaType;
     m_Attribute        = attribute;
     m_Substring        = new Substring(start, length);
     m_Substring.Clause = clause;
     m_AttributeValue   = attributeValue;
     m_CompareMode      = CompareMode.CompareSubstring;
 }
Beispiel #16
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TypeMemberSelectionRule" /> class.
        /// </summary>
        /// <param name="type">The type to compare with the type of given members.</param>
        /// <param name="selectionMode">The selection mode to apply.</param>
        /// <param name="compareMode">The compare mode to apply.</param>
        /// <param name="name">The name of the rule.</param>
        /// <param name="description">The description of the rule.</param>
        public TypeMemberSelectionRule([NotNull] Type type, MemberSelectionMode selectionMode, CompareMode compareMode, String name = null, String description = null)
            : base(name, description)
        {
            type.ThrowIfNull(nameof(type));

            _type          = type;
            _selectionMode = selectionMode;
            _compareMode   = compareMode;
        }
 public Comparer(CompareMode compareMode)
 {
     comparer = compareMode switch
     {
         CompareMode.SeasonAverage => (left, right) => left.PlayerForm !.SeasonAverage.CompareTo(right.PlayerForm !.SeasonAverage),
         CompareMode.PlayerForm => (left, right) => left.PlayerForm !.Last5Average.CompareTo(right.PlayerForm !.Last5Average),
         _ => throw new ArgumentOutOfRangeException(nameof(compareMode), compareMode, null),
     };
 }
Beispiel #18
0
        private bool Compare(T item1, T item2, CompareMode compareMode)
        {
            if (compareMode == CompareMode.LessThan)
            {
                return(item1.CompareTo(item2) >= 0);
            }

            return(item1.CompareTo(item2) <= 0);
        }
 private void compare365And2016(object sender, TappedRoutedEventArgs e)
 {
     if (compareTransition)
     {
         return;
     }
     compareTransition = true;
     compareMode       = CompareMode.Compare2;
     Storyboards.FadeOut(comparisonChart, FadeTime, showCompare2);
 }
        protected static CompareMode GetModeType(string sVal)
        {
            CompareMode c = CompareMode.LT;

            if (!String.IsNullOrEmpty(sVal))
            {
                c = (CompareMode)Enum.Parse(typeof(CompareMode), sVal, true);
            }
            return(c);
        }
 private void compareHomeAndPersonal(object sender, TappedRoutedEventArgs e)
 {
     if (compareTransition)
     {
         return;
     }
     compareTransition = true;
     compareMode       = CompareMode.Compare1;
     Storyboards.FadeOut(comparisonChart, FadeTime, showCompare1);
 }
Beispiel #22
0
        public static string GetSymbol(this CompareMode property)
        {
            string result;

            if (symbols.TryGetValue(property, out result))
            {
                return(result);
            }
            return("");
        }
Beispiel #23
0
 /// <summary>
 /// 単一条件の検索を開始
 /// </summary>
 /// <param name="property"></param>
 /// <param name="reference"></param>
 /// <param name="mode"></param>
 public bool StartNewSearch(FileProperty property, object reference, CompareMode mode)
 {
     return(this.StartNewSearch(
                new UnitSearch()
     {
         Property = property,
         Reference = reference,
         Mode = mode,
     }
                ));
 }
Beispiel #24
0
        // TODO: move interactive preview to another class
        public override void OnPreviewSettings()
        {
            var options = nodeWithPreviews.Select(n => n.name).ToArray();

            if (options.Length == 0)
            {
                EditorGUILayout.PrefixLabel("Nothing Selected");
                return;
            }

            if (GUILayout.Button(MixtureEditorUtils.fitIcon, EditorStyles.toolbarButton, buttonLayout))
            {
                Fit();
            }

            GUILayout.Space(2);

            if (!lockFirstPreview)
            {
                firstLockedPreviewTarget = nodeWithPreviews.FirstOrDefault();
            }
            if (!lockSecondPreview)
            {
                if (lockFirstPreview)
                {
                    secondLockedPreviewTarget = nodeWithPreviews.FirstOrDefault();
                }
                else
                {
                    secondLockedPreviewTarget = nodeWithPreviews.Count > 1 ? nodeWithPreviews[1] : nodeWithPreviews.FirstOrDefault();
                }
            }

            GUILayout.Label(firstLockedPreviewTarget.name, EditorStyles.toolbarButton);
            lockFirstPreview = GUILayout.Toggle(lockFirstPreview, GetLockIcon(lockFirstPreview), EditorStyles.toolbarButton, buttonLayout);
            if (compareEnabled)
            {
                var style = EditorStyles.toolbarButton;
                style.alignment = TextAnchor.MiddleLeft;
                compareMode     = (CompareMode)EditorGUILayout.Popup((int)compareMode, new string[] { " 1  -  Side By Side", " 2  -  Onion Skin", " 3  -  Difference", " 4  -  Swap" }, style, buttonLayout, GUILayout.Width(24));
                GUILayout.Label(secondLockedPreviewTarget.name, EditorStyles.toolbarButton);
                lockSecondPreview = GUILayout.Toggle(lockSecondPreview, GetLockIcon(lockSecondPreview), EditorStyles.toolbarButton, buttonLayout);
            }

            compareEnabled = GUILayout.Toggle(compareEnabled, MixtureEditorUtils.compareIcon, EditorStyles.toolbarButton, buttonLayout);

            GUILayout.Space(2);

            if (GUILayout.Button(MixtureEditorUtils.settingsIcon, EditorStyles.toolbarButton, buttonLayout))
            {
                comparisonWindow = new NodeInspectorSettingsPopupWindow(this);
                UnityEditor.PopupWindow.Show(new Rect(EditorGUIUtility.currentViewWidth - NodeInspectorSettingsPopupWindow.width, -NodeInspectorSettingsPopupWindow.height, 0, 0), comparisonWindow);
            }
        }
Beispiel #25
0
 public static string GetCompareLabel(this FileProperty property, CompareMode mode)
 {
     if (property.IsComperable())
     {
         return(mode.GetLabel());
     }
     else
     {
         return(property.GetEqualityLabel(!mode.ContainsEqual()));
     }
 }
Beispiel #26
0
        public bool Contains(Vector2 Point, CompareMode CompareMode)
        {
            switch (CompareMode)
            {
            case CompareMode.Exclusive:
                return(ContainsExclusive(Point));

            case CompareMode.Inclusive:
            default:
                return(Contains(Point));
            }
        }
Beispiel #27
0
        public bool IntersectsWith(Rectangle other, CompareMode CompareMode)
        {
            switch (CompareMode)
            {
            case CompareMode.Exclusive:
                return(IntersectsWithExclusive(other));

            case CompareMode.Inclusive:
            default:
                return(IntersectsWith(other));
            }
        }
Beispiel #28
0
        public bool Contains(Rectangle Other, CompareMode CompareMode)
        {
            switch (CompareMode)
            {
            case CompareMode.Exclusive:
                return(ContainsExclusive(Other));

            case CompareMode.Inclusive:
            default:
                return(Contains(Other));
            }
        }
Beispiel #29
0
        /// <summary>
        /// Whether operator contains equality(=)
        /// </summary>
        /// <param name="mode"></param>
        /// <returns></returns>
        public static bool ContainsEqual(this CompareMode mode)
        {
            switch (mode)
            {
            case CompareMode.LessEqual:
            case CompareMode.Equal:
            case CompareMode.GreatEqual:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #30
0
        public static TextureCompareMode Convert(this CompareMode mode)
        {
            switch (mode)
            {
            case CompareMode.None:
                return(TextureCompareMode.None);

            case CompareMode.CompareRToTexture:
                return(TextureCompareMode.CompareRToTexture);
            }

            Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(CompareMode)} enum value: {mode}.");

            return(TextureCompareMode.None);
        }
Beispiel #31
0
        /// <summary>
        /// Creates a new instance of the cached sampler.
        /// </summary>
        /// <param name="context">The GPU context the sampler belongs to</param>
        /// <param name="descriptor">The Maxwell sampler descriptor</param>
        public Sampler(GpuContext context, SamplerDescriptor descriptor)
        {
            MinFilter minFilter = descriptor.UnpackMinFilter();
            MagFilter magFilter = descriptor.UnpackMagFilter();

            bool seamlessCubemap = descriptor.UnpackSeamlessCubemap();

            AddressMode addressU = descriptor.UnpackAddressU();
            AddressMode addressV = descriptor.UnpackAddressV();
            AddressMode addressP = descriptor.UnpackAddressP();

            CompareMode compareMode = descriptor.UnpackCompareMode();
            CompareOp   compareOp   = descriptor.UnpackCompareOp();

            ColorF color = new ColorF(
                descriptor.BorderColorR,
                descriptor.BorderColorG,
                descriptor.BorderColorB,
                descriptor.BorderColorA);

            float minLod     = descriptor.UnpackMinLod();
            float maxLod     = descriptor.UnpackMaxLod();
            float mipLodBias = descriptor.UnpackMipLodBias();

            float maxRequestedAnisotropy = GraphicsConfig.MaxAnisotropy >= 0 && GraphicsConfig.MaxAnisotropy <= 16 ? GraphicsConfig.MaxAnisotropy : descriptor.UnpackMaxAnisotropy();
            float maxSupportedAnisotropy = context.Capabilities.MaximumSupportedAnisotropy;

            if (maxRequestedAnisotropy > maxSupportedAnisotropy)
            {
                maxRequestedAnisotropy = maxSupportedAnisotropy;
            }

            HostSampler = context.Renderer.CreateSampler(new SamplerCreateInfo(
                                                             minFilter,
                                                             magFilter,
                                                             seamlessCubemap,
                                                             addressU,
                                                             addressV,
                                                             addressP,
                                                             compareMode,
                                                             compareOp,
                                                             color,
                                                             minLod,
                                                             maxLod,
                                                             mipLodBias,
                                                             maxRequestedAnisotropy));
        }
Beispiel #32
0
        public override bool Compare(Object file1, Object file2, CompareMode compareMode)
        {
            if (file1 != null && file2 != null)
            {
                if (File.Exists((String)file1) && File.Exists((String)file2))
                {
                    switch (compareMode)
                    {
                        case CompareMode.Binary:
                            return compareBin((String)file1,(String)file2);
                        case CompareMode.Text:
                            return compareTxt((String)file1, (String)file2);
                    }
                }
            }

            return false;
        }
        private bool RunCodeMetrics(string output)
        {
            string metricsExePath = Path.Combine(ProgramFilesX86(), @"Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\FxCop\metrics.exe");
            if (!File.Exists(metricsExePath))
            {
                this.LogBuildError("Could not locate " + metricsExePath + ". Please download Visual Studio Code Metrics PowerTool 11.0 at http://www.microsoft.com/en-gb/download/details.aspx?id=38196");
                return false;
            }

            string metricsExeArguments = this.GetFilesToProcess().Aggregate(string.Empty, (current, file) => current + string.Format(" /f:\"{0}\"", file));
            metricsExeArguments += string.Format(" /out:\"{0}\"", output);
            if (this.SearchGac.Get(this.ActivityContext))
            {
                metricsExeArguments += string.Format(" /searchgac");
            }

            if (this.IgnoreGeneratedCode.Get(this.ActivityContext))
            {
                metricsExeArguments += " /ignoregeneratedcode";
            }

            if (!string.IsNullOrEmpty(this.AssemblyCompareMode.Get(this.ActivityContext)))
            {
                this.assemblyCompareMode = (CompareMode)Enum.Parse(typeof(CompareMode), this.AssemblyCompareMode.Get(this.ActivityContext));

                if (this.assemblyCompareMode != CodeQuality.CodeMetrics.CompareMode.StrongName)
                {
                    metricsExeArguments += " /assemblyCompareMode:" + this.assemblyCompareMode.ToString();
                }
            }
            
            ProcessStartInfo psi = new ProcessStartInfo { FileName = metricsExePath, UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = metricsExeArguments, WorkingDirectory = this.BinariesDirectory.Get(this.ActivityContext) };
            this.LogBuildMessage("Running " + psi.FileName + " " + psi.Arguments);

            using (Process process = Process.Start(psi))
            {
                using (ManualResetEvent mreOut = new ManualResetEvent(false), mreErr = new ManualResetEvent(false))
                {
                    process.OutputDataReceived += (o, e) =>
                                                      {
                                                          if (e.Data == null)
                                                          {
                                                              mreOut.Set();
                                                          }
                                                          else
                                                          {
                                                              this.LogBuildMessage(e.Data);
                                                          }
                                                      };
                    process.BeginOutputReadLine();
                    process.ErrorDataReceived += (o, e) =>
                                                     {
                                                         if (e.Data == null)
                                                         {
                                                             mreErr.Set();
                                                         }
                                                         else
                                                         {
                                                             this.LogBuildMessage(e.Data);
                                                         }
                                                     };
                    process.BeginErrorReadLine();
                    process.StandardInput.Close();
                    process.WaitForExit();

                    mreOut.WaitOne();
                    mreErr.WaitOne();

                    if (process.ExitCode != 0)
                    {
                        this.LogBuildError(process.ExitCode.ToString(CultureInfo.CurrentCulture));
                        return false;
                    }

                    if (!File.Exists(output))
                    {
                        this.LogBuildError("Could not locate file " + output);
                        return false;
                    }
                }
            }

            return true;
        }
Beispiel #34
0
 public abstract bool Compare(Object obj1, Object obj2, CompareMode compareMode);
Beispiel #35
0
 public override bool Compare(object obj1, object obj2, CompareMode compareMode)
 {
     throw new Exception("The method or operation is not implemented.");
 }
        /// <summary>
        /// Handler for recognized speech events.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        public void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            // Ignore speech if the coach is talking
            // (Does not work perfectly, confidence threshold set higher for this reason)
            if (coach.isSpeaking)
            {
                return;
            }

            // Speech utterance confidence below which we treat speech as if it hadn't been heard
            const double ConfidenceThreshold = 0.7;

            if (e.Result.Confidence >= ConfidenceThreshold)
            {
                if (!listening)
                {
                    switch (e.Result.Semantics["type"].Value.ToString())
                    {
                        case "startlisten":
                            coach.Speak("Ready");
                            signal.Text = "Ready";
                            ClearAll();
                            listening = true;
                            break;
                    }
                }
                else
                {
                    switch (e.Result.Semantics["type"].Value.ToString())
                    {
                        case "stoplisten":
                            coach.Speak("Understood.  Bye, for now.");
                            ClearAll();
                            signal.Text = "Deactivated";
                            listening = false;
                            break;
                        case "simple":
                            switch (e.Result.Semantics["command"].Value.ToString())
                            {
                                case "recording":
                                    StartRecordingSkeleton("recording");
                                    break;
                                case "stoprecording":
                                    StopRecordingSkeleton();
                                    break;
                                case "show":
                                    if (currentPose != null)
                                    {
                                        dm = DemoMode.POSE;
                                    }
                                    else if (currentAction != null)
                                    {
                                        dm = DemoMode.ACTION;
                                    }
                                    break;
                                case "hide":
                                    dm = DemoMode.NONE;
                                    break;
                                case "incorrect":
                                    if (cpm == CompareMode.POSE)
                                    {
                                        critiquePose = true;
                                    }
                                    else if (cpm == CompareMode.ACTION || cpm == CompareMode.SIMUL_ACTION)
                                    {
                                        EvaluateAction();
                                    }
                                    break;
                                case "again":
                                    if (previousSpeech != null)
                                    {
                                        SpeechRecognized(null, previousSpeech);
                                    }
                                    break;
                                case "exit":
                                    this.Close();
                                    break;
                                case "clear":
                                    ClearAll();
                                    break;
                                case "calibrate":
                                    cpm = CompareMode.CALIBRATE;
                                    break;
                                case "showdemoaction":
                                    actionFrameCount = 0;
                                    cpm = cpm == CompareMode.ACTION ? CompareMode.SIMUL_ACTION : cpm;
                                    break;
                                case "hidedemoaction":
                                    actionFrameCount = 0;
                                    cpm = cpm == CompareMode.SIMUL_ACTION ? CompareMode.ACTION : cpm;
                                    break;
                            }
                            break;
                        case "pose":
                            CheckPose(e.Result.Semantics["pose"].Value.ToString());
                            previousSpeech = e;
                            break;
                        case "action":
                            WatchAction(e.Result.Semantics["action"].Value.ToString());
                            previousSpeech = e;
                            break;
                    }
                }
            }
        }
Beispiel #37
0
 public override bool Compare(object obj1, object obj2,CompareMode compareMode)
 {
     if (obj1 == null || obj2 == null)
     {
         return false;
     }
     else
     {
         switch (compareMode)
         {
             case CompareMode.HtmlVSFile:
                 return HtmlCompareFile(obj1.ToString(), obj2.ToString());
             case CompareMode.HtmlVSImg:
                 return HtmlImgCompare(obj1.ToString(), obj2.ToString());
             default:
                 return false;
         }
     }
 }
        private void ClearAll()
        {
            signal.Text = "Ready";
            currentPose = null;
            currentAction = null;

            dm = DemoMode.NONE;
            cpm = CompareMode.NONE;

            watchingAction = false;
            actionStarted = false;
            actionFrames = new List<Skeleton>();
            actionFrameCount = 0;

            StopRecordingSkeleton();
        }
 private void CheckPose(string pose)
 {
     coach.Speak("Enter " + pose + " position");
     signal.Text = "Checking " + pose;
     currentPose = new Pose(pose);
     currentPose.ApplyTransform(rotTransform);
     cpm = CompareMode.POSE;
     correctBonePen = new Pen(Brushes.Green, 6);
 }
        /// <summary>
        /// Event handler for Kinect sensor's SkeletonFrameReady event
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            Skeleton[] skeletons = new Skeleton[0];

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    skeletonFrame.CopySkeletonDataTo(skeletons);
                }
            }

            using (DrawingContext dc = this.drawingGroup.Open())
            {
                // Draw a transparent background to set the render size
                dc.DrawRectangle(Brushes.LightBlue, null, new Rect(0.0, 0.0, RenderWidth, RenderHeight));

                Pen oldPen = trackedBonePen;
                switch (dm)
                {
                    case DemoMode.POSE:
                        trackedBonePen = new Pen(Brushes.DarkGreen, 6);
                        this.DrawBonesAndJoints(currentPose.frame, dc);
                        break;
                    case DemoMode.ACTION:
                        if (actionFrameCount == currentAction.bestFrames.Count)
                        {
                            actionFrameCount = 0;
                        }
                        trackedBonePen = new Pen(Brushes.DarkGreen, 6);
                        this.DrawBonesAndJoints(currentAction.bestFrames.ElementAt(actionFrameCount), dc);
                        actionFrameCount++;
                        break;
                }
                trackedBonePen = oldPen;

                switch (cpm)
                {
                    case CompareMode.POSE:
                        foreach (Skeleton skel in skeletons)
                        {
                            if (skel.TrackingState == SkeletonTrackingState.Tracked)
                            {
                                this.DrawBonesAndJointsWithComparison(skel, currentPose, dc);
                                if (currentPose.MatchesSkeleton(skel, 1))
                                {
                                    critiquePose = false;
                                    coach.SayCorrect();
                                    ClearAll();
                                }

                                if (critiquePose)
                                {
                                    coach.SayPoseErrors(currentPose.GetSignificantErrors(skel, frontTransform));
                                    critiquePose = false;
                                }
                            }
                        }
                        break;
                    case CompareMode.CALIBRATE:
                        foreach (Skeleton skel in skeletons)
                        {
                            if (skel.TrackingState == SkeletonTrackingState.Tracked)
                            {
                                currentPose = new Pose("ready");
                                rotTransform = KinectFrameUtils.GetRotationMatrix(skel, currentPose.frame);
                                currentPose = new Pose("frontready");
                                frontTransform = KinectFrameUtils.GetRotationMatrix(skel, currentPose.frame);
                                currentPose = null;
                                coach.Speak("Rotational differences recorded");
                                cpm = CompareMode.NONE;
                            }
                        }
                        break;
                    case CompareMode.ACTION:
                        if (actionFrameCount >= currentAction.bestFrames.Count)
                        {
                            actionFrameCount = 0;
                        }
                        this.DrawBonesAndJointsWithComparison(actionFrames.ElementAt(actionFrameCount), currentAction.GetPoseOfFrame(actionFrameCount), dc);
                        actionFrameCount++;
                        break;
                    case CompareMode.SIMUL_ACTION:
                        if (actionFrameCount >= currentAction.bestFrames.Count)
                        {
                            actionFrameCount = 0;
                        }
                        trackedBonePen = new Pen(Brushes.DarkGreen, 6);
                        this.DrawBonesAndJoints(currentAction.bestFrames.ElementAt(actionFrameCount), dc);
                        trackedBonePen = new Pen(Brushes.DarkBlue, 6);
                        this.DrawBonesAndJointsWithComparison(actionFrames.ElementAt(actionFrameCount), currentAction.GetPoseOfFrame(actionFrameCount), dc);
                        actionFrameCount++;
                        break;
                    case CompareMode.NONE:
                        foreach (Skeleton skel in skeletons)
                        {
                            if (skel.TrackingState == SkeletonTrackingState.Tracked)
                            {

                                if (watchingAction)
                                {
                                    if (!actionStarted)
                                    {
                                        CheckActionStart(skel);
                                        this.DrawBonesAndJointsWithComparison(skel, currentAction.startPose, dc);
                                    }
                                    else
                                    {
                                        this.DrawBonesAndJoints(skel, dc);
                                        actionFrames.Add(skel);
                                        CheckActionEnd(skel);
                                    }
                                }
                                else
                                {
                                    RenderClippedEdges(skel, dc);
                                    this.DrawBonesAndJoints(skel, dc);
                                }
                            }
                        }
                        break;
                }
                this.drawingGroup.ClipGeometry = new RectangleGeometry(new Rect(0.0, 0.0, RenderWidth, RenderHeight));
            }
        }
 private void ProcessAction()
 {
     currentAction.DetermineBestFrames(actionFrames);
     actionFrames = KinectFrameUtils.GetStartCorrectedFrames(actionFrames, currentAction.bestFrames);
     currentAction.ShiftBestFrames(actionFrames.ElementAt(0).Joints[JointType.HipCenter].Position);
     cpm = CompareMode.SIMUL_ACTION;
     dm = DemoMode.NONE;
     correctBonePen = new Pen(Brushes.Blue, 6);
 }
Beispiel #42
0
 private void currentPositionToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     CompareMode = CompareMode.CurrentPosition;
 }
Beispiel #43
0
        /// <summary>
        /// Executes the logic for this workflow activity
        /// </summary>
        protected override void InternalExecute()
        {
            string fxcopIntPath;

            if (string.IsNullOrEmpty(this.FxCopPath.Get(this.ActivityContext)))
            {
                string programFilePath = Environment.GetEnvironmentVariable("ProgramFiles");
                if (string.IsNullOrEmpty(programFilePath))
                {
                    this.LogBuildError("Failed to read a value from the ProgramFiles Environment Variable");
                    return;
                }

                if (System.IO.File.Exists(programFilePath + @"\Microsoft FxCop 1.36\FxCopCmd.exe"))
                {
                    fxcopIntPath = programFilePath + @"\Microsoft FxCop 1.36\FxCopCmd.exe";
                }
                else if (System.IO.File.Exists(programFilePath + @"\Microsoft FxCop 10.0\FxCopCmd.exe"))
                {
                    fxcopIntPath = programFilePath + @"\Microsoft FxCop 10.0\FxCopCmd.exe";
                }
                else
                {
                    this.LogBuildError(string.Format(CultureInfo.CurrentCulture, "FxCopCmd.exe was not found in the default location. Use FxCopPath to specify it. Searched at: {0}", programFilePath + @"\Microsoft FxCop 1.36 and \Microsoft FxCop 10.0"));
                    return;
                }
            }
            else
            {
                fxcopIntPath = this.FxCopPath.Get(this.ActivityContext);
            }

            string arguments = string.Empty;

            if (!string.IsNullOrEmpty(this.ReportXsl.Get(this.ActivityContext)))
            {
                arguments += "/applyoutXsl /outXsl:\"" + this.ReportXsl.Get(this.ActivityContext) + "\"";
            }

            if (this.LogToConsole.Get(this.ActivityContext))
            {
                arguments += " /console";

                if (!string.IsNullOrEmpty(this.ConsoleXsl.Get(this.ActivityContext)))
                {
                    arguments += " /consoleXsl:\"" + this.ConsoleXsl.Get(this.ActivityContext) + "\"";
                }
            }

            if (!string.IsNullOrEmpty(this.Ruleset.Get(this.ActivityContext)))
            {
                arguments += " /ruleset:\"" + this.Ruleset.Get(this.ActivityContext) + "\"";
            }

            if (!string.IsNullOrEmpty(this.RulesetDirectory.Get(this.ActivityContext)))
            {
                arguments += " /rulesetdirectory:\"" + this.RulesetDirectory.Get(this.ActivityContext) + "\"";
            }

            if (this.UpdateProject.Get(this.ActivityContext))
            {
                arguments += " /update";
            }

            if (this.SearchGac.Get(this.ActivityContext))
            {
                arguments += " /gac";
            }

            if (this.SuccessFile.Get(this.ActivityContext))
            {
                arguments += " /successfile";
            }

            if (this.FailOnMissingRules.Get(this.ActivityContext))
            {
                arguments += " /failonmissingrules";
            }

            if (this.IgnoreGeneratedCode.Get(this.ActivityContext))
            {
                arguments += " /ignoregeneratedcode";
            }

            if (this.OverrideRuleVisibilities.Get(this.ActivityContext))
            {
                arguments += " /overriderulevisibilities";
            }

            if (this.AspNetOnly.Get(this.ActivityContext))
            {
                arguments += " /aspnet";
            }

            if (this.IgnoreInvalidTargets.Get(this.ActivityContext))
            {
                arguments += " /ignoreinvalidtargets";
            }

            if (this.Timeout.Get(this.ActivityContext) > 0)
            {
                arguments += " /timeout:" + this.Timeout.Get(this.ActivityContext);
            }

            if (this.Quiet.Get(this.ActivityContext))
            {
                arguments += " /quiet";
            }

            if (this.ForceOutput.Get(this.ActivityContext))
            {
                arguments += " /forceoutput";
            }

            if (!string.IsNullOrEmpty(this.Dictionary.Get(this.ActivityContext)))
            {
                arguments += " /dictionary:\"" + this.Dictionary.Get(this.ActivityContext) + "\"";
            }

            if (this.ShowSummary.Get(this.ActivityContext))
            {
                arguments += " /summary";
            }

            if (this.Verbose.Get(this.ActivityContext))
            {
                arguments += " /verbose";
            }

            if (!string.IsNullOrEmpty(this.AssemblyCompareMode.Get(this.ActivityContext)))
            {
                this.assemblyCompareMode = (CompareMode)Enum.Parse(typeof(CompareMode), this.AssemblyCompareMode.Get(this.ActivityContext));

                if (this.assemblyCompareMode != CodeQuality.FxCop.CompareMode.StrongName)
                {
                    arguments += " /assemblyCompareMode:" + this.assemblyCompareMode.ToString();
                }
            }

            if (!string.IsNullOrEmpty(this.Types.Get(this.ActivityContext)))
            {
                arguments += " /types:\"" + this.Types.Get(this.ActivityContext) + "\"";
            }

            if (this.DependencyDirectories.Get(this.ActivityContext) != null)
            {
                foreach (var i in this.DependencyDirectories.Get(this.ActivityContext))
                {
                    string path = i;
                    if (path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase) || path.EndsWith("/", StringComparison.OrdinalIgnoreCase))
                    {
                        path = path.Substring(0, path.Length - 1);
                    }

                    arguments += " /directory:\"" + path + "\"";
                }
            }

            if (this.Imports.Get(this.ActivityContext) != null)
            {
                arguments = this.Imports.Get(this.ActivityContext).Aggregate(arguments, (current, import) => current + (" /import:\"" + import + "\""));
            }

            if (this.Rules.Get(this.ActivityContext) != null)
            {
                arguments = this.Rules.Get(this.ActivityContext).Aggregate(arguments, (current, rule) => current + (" /rule:\"" + rule + "\""));
            }

            if (string.IsNullOrEmpty(this.Project.Get(this.ActivityContext)) && this.Files.Get(this.ActivityContext) == null)
            {
                this.LogBuildError("A Project and / or Files collection must be passed.");
                return;
            }

            if (!string.IsNullOrEmpty(this.Project.Get(this.ActivityContext)))
            {
                arguments += " /project:\"" + this.Project.Get(this.ActivityContext) + "\"";
            }

            if (this.Files.Get(this.ActivityContext) != null)
            {
                arguments = this.Files.Get(this.ActivityContext).Aggregate(arguments, (current, file) => current + (" /file:\"" + file + "\""));
            }

            if (this.References.Get(this.ActivityContext) != null)
            {
                arguments = this.References.Get(this.ActivityContext).Aggregate(arguments, (current, reference) => current + (" /reference:\"" + reference + "\""));
            }

            arguments += " /out:\"" + this.OutputFile.Get(this.ActivityContext) + "\"";

            // if the output file exists, delete it.
            if (System.IO.File.Exists(this.OutputFile.Get(this.ActivityContext)))
            {
                System.IO.File.Delete(this.OutputFile.Get(this.ActivityContext));
            }

            using (Process proc = new Process())
            {
                proc.StartInfo.FileName = fxcopIntPath;
                proc.StartInfo.UseShellExecute = false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError = true;
                proc.StartInfo.Arguments = arguments;
                proc.StartInfo.CreateNoWindow = true;
                this.LogBuildMessage("Running " + proc.StartInfo.FileName + " " + proc.StartInfo.Arguments);
                proc.Start();

                string outputStream = proc.StandardOutput.ReadToEnd();
                if (outputStream.Length > 0)
                {
                    this.LogBuildMessage(outputStream);
                    this.OutputText.Set(this.ActivityContext, outputStream);
                }

                string errorStream = proc.StandardError.ReadToEnd();
                if (errorStream.Length > 0)
                {
                    this.LogBuildError(errorStream);
                }

                proc.WaitForExit();
                if (proc.ExitCode != 0)
                {
                    this.ExitCode.Set(this.ActivityContext, proc.ExitCode);
                    this.LogBuildError(proc.ExitCode.ToString(CultureInfo.CurrentCulture));
                    this.AnalysisFailed.Set(this.ActivityContext, true);
                    return;
                }

                string outputPath = this.OutputFile.Get(this.ActivityContext);
                bool resultsFileExists = System.IO.File.Exists(outputPath);

                this.AnalysisFailed.Set(this.ActivityContext, resultsFileExists);

                if (resultsFileExists && this.LogResultsToBuildLog.Get(this.ActivityContext))
                {
                    this.LogResults(outputPath, this.TreatWarningsAsErrors.Get(this.ActivityContext));
                }
            }
        }
Beispiel #44
0
 private void skipBackToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     CompareMode = CompareMode.SkipBack;
 }
Beispiel #45
0
 private void restartToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     CompareMode = CompareMode.Restart;
 }
Beispiel #46
0
 private void LoadComparison(string fileName)
 {
     XmlDocument document = new XmlDocument();
     document.Load(fileName);
     XmlNode compareModeNode = document.SelectSingleNode("MixDiff/Settings/@CompareMode");
     CompareMode = (CompareMode)Enum.Parse(typeof(CompareMode), compareModeNode.Value);
     XmlNodeList mixes = document.SelectNodes("MixDiff/Mix");
     int buttonIndex = 0;
     foreach(XmlNode mixNode in mixes)
     {
         Button button = fileButtons[buttonIndex++];
         MixdownInfo info = new MixdownInfo(mixNode.SelectSingleNode("@FileName").Value);
         info.DelayMilliseconds = Int32.Parse(mixNode.SelectSingleNode("@DelayMilliseconds").Value);
         info.OffsetMilliseconds = Int32.Parse(mixNode.SelectSingleNode("@OffsetMilliseconds").Value);
         info.VolumeDecibels = Int32.Parse(mixNode.SelectSingleNode("@VolumeDecibels").Value);
         info.Letter = button.Name.Substring(button.Name.Length - 1);
         info.Stream.Mute = true;
         SetButtonInfo(button,info);                
     }
     SelectButton(fileButtons[0]);
 }