コード例 #1
0
        public async Task PostAsync([FromBody] TheObject theObject)
        {
            IFileCompleter completer = new FileCompleter();

            //Use a discard variable to prevent warnings from not using an await
            _ = Task.Run(() => completer.ObjectCompleter(theObject));
        }
コード例 #2
0
 /// <summary>
 /// Disposes the InstantiatedObject and calls the stored object's Dispose
 /// method if the object implements IDisposable.
 /// </summary>
 public void Dispose()
 {
     if (TheObject is IDisposable)
     {
         TheObject.Dispose();
     }
 }
コード例 #3
0
ファイル: ListOfObjects.cs プロジェクト: kilfour/QuickAcid
 public void Remove(TheObject obj)
 {
     var ix = List.IndexOf(obj);
     if (ix == 0)
         return;
     List.Remove(obj);
 }
コード例 #4
0
        public async Task ObjectCompleter(TheObject theObject)
        {
            theObject.Identifier    = Guid.NewGuid().ToString();
            theObject.DateCompleted = DateTime.Now.ToString();
            System.Threading.Thread.Sleep(40000);
            Console.WriteLine("DateCompleted = " + theObject.DateCompleted);

            //call Notify service
        }
コード例 #5
0
            public void Remove(TheObject obj)
            {
                var ix = List.IndexOf(obj);

                if (ix == 0)
                {
                    return;
                }
                List.Remove(obj);
            }
コード例 #6
0
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is AtomicNativeObjectInfo))
            {
                return(false);
            }

            var noi = (AtomicNativeObjectInfo)obj;

            return(TheObject == noi.GetObject() || TheObject.Equals(noi.GetObject()));
        }
コード例 #7
0
    public void createAsteroid(Transform asteroids, float x, int numberIndex, int symbolIndex, bool rightAnswear)
    {
        GameObject ast = Instantiate(asteroid, asteroids.transform);

        ast.transform.position = new Vector3(x, asteroids.position.y, asteroids.position.z);

        TheObject astObjectComponent = ast.GetComponent <TheObject>();

        ast.GetComponent <Asteroid>().rightAnswear = rightAnswear;

        astObjectComponent.SetNumber(numberIndex);
        // astObjectComponent.SetSymbol(symbolIndex);
    }
コード例 #8
0
        public void Add_IndexZeroWithObjects_ReturnReference()
        {
            //Arrange
            TheObject object1 = new TheObject();
            CustomList <TheObject> theList = new CustomList <TheObject>();
            TheObject expected             = object1;
            TheObject actual = theList[0];

            //Act
            theList.Add(expected);

            //Assert
            Assert.AreEqual(expected, theList[0]);
        }
コード例 #9
0
        public void Remove_IndexZeroWithObjects_ReturnObject() //5
        {
            //Arrange
            TheObject theObject            = new TheObject();
            TheObject theObject2           = new TheObject();
            CustomList <TheObject> theList = new CustomList <TheObject>();
            TheObject expected             = theObject;

            //Act
            theList.Add(theObject);
            theList.Add(theObject2);
            theList.Remove(theObject2);

            //Assert
            Assert.AreEqual(expected, theList[0]);
        }
コード例 #10
0
ファイル: ContainsEvaluation.cs プロジェクト: Myvar/Eclang
        private bool CheckIfCollectionContainsNativeValue(IEnumerable collection, Type typeDefinition)
        {
            if (typeDefinition == typeof(AbstractObjectInfo))
            {
                foreach (AbstractObjectInfo abstractObjectInfo in collection)
                {
                    if (abstractObjectInfo == null && TheObject == null)
                    {
                        return(true);
                    }

                    if (abstractObjectInfo != null && TheObject == null)
                    {
                        return(false);
                    }

                    if (abstractObjectInfo != null && TheObject.Equals(abstractObjectInfo.GetObject()))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                foreach (var item in collection)
                {
                    if (item == null && TheObject == null)
                    {
                        return(true);
                    }

                    if (item != null && TheObject == null)
                    {
                        return(false);
                    }

                    if (TheObject.Equals(item))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
    void FixedUpdate()                                                                                                                                //this is called at set intevals, and the update is calling the statemachine after the fixedupdate have updated the colliders
    {
        MyPos [0, 0] = ((transform.position.x - _NewMapCenter) / _NodeDimentions) - (((transform.position.x - _NewMapCenter) / _NodeDimentions) % 1); //Calculating Object World Position In The Node Map
        MyPos [0, 1] = ((transform.position.y - _NewMapCenter) / _NodeDimentions) - (((transform.position.y - _NewMapCenter) / _NodeDimentions) % 1); //Calculating Object World Position In The Node Map

        if (TheObject.FreezeCharacter == true)
        {
            if (TheObject.MyRididBody.velocity.magnitude < 0.01f)
            {
                TheObject.GotPushed       = true;
                TheObject.FreezeCharacter = false;
            }
        }
        else
        {
            TheObject.BehaviourUpdate();
        }
    }
コード例 #12
0
        public void Zip_IndexOneObjectVersion_ReturnList()
        {
            //Arrange
            TheObject object1              = new TheObject();
            TheObject object2              = new TheObject();
            TheObject expected             = object2;
            CustomList <TheObject> theList = new CustomList <TheObject>()
            {
                object1
            };
            CustomList <TheObject> theList2 = new CustomList <TheObject>()
            {
                object2
            };

            //Act
            CustomList <TheObject> ZipTwoLists = theList.Zip(theList2);

            //Assert
            Assert.AreEqual(expected, ZipTwoLists[1]);
        }
コード例 #13
0
ファイル: ObjectViewModel.cs プロジェクト: ygoe/CecilExplorer
        protected override void LoadChildren()
        {
            bool            referenceLoop = false;
            ObjectViewModel parent        = ParentObject;

            while (parent != null)
            {
                if (parent.TheObject == TheObject)
                {
                    referenceLoop = true;
                    break;
                }
                parent = parent.ParentObject;
            }

            if (TheObject != null && referenceLoop)
            {
                var child = new InfoNode("Reference loop", Brushes.Gray, loopIcon);
                Children.Add(child);
            }
            else if (TheObject != null && canLoadChildren)
            {
                if (TheObject.GetType().IsArray)
                {
                    Array a = (Array)TheObject;
                    for (int i = 0; i < a.Length; i++)
                    {
                        object value = a.GetValue(i);
                        Children.Add(new ObjectViewModel($"[{i}]", value, TheObject.GetType().GetElementType(), fieldIcon, null, elementLevel));
                    }
                }
                else if (IsEnumerable(TheObject))
                {
                    int i = 0;
                    foreach (var value in TheObject as IEnumerable)
                    {
                        Children.Add(new ObjectViewModel($"[{i}]", value, value.GetType(), fieldIcon, null, elementLevel));
                        i++;
                    }
                }
                else
                {
                    foreach (var propInfo in TheObject.GetType()
                             .GetProperties(BindingFlags.Instance | BindingFlags.Public)
                             .Where(p => p.GetMethod != null)
                             .OrderBy(p => p.Name))
                    {
                        object value      = null;
                        Brush  valueColor = null;
                        try
                        {
                            value = propInfo.GetValue(TheObject);
                        }
                        catch (Exception ex)
                        {
                            value      = "[" + ex.Message + "]";
                            valueColor = Brushes.OrangeRed;
                        }
                        var child = new ObjectViewModel(propInfo.Name, value, propInfo.PropertyType, propertyIcon, valueColor, elementLevel);
                        Children.Add(child);
                        SetFontWeight(propInfo, child);
                        //if (TheObject.GetType() == typeof(Mono.Cecil.Cil.MethodBody) && propInfo.Name == "Instructions")
                        //{
                        //	child.IsExpanded = true;
                        //}
                    }

                    foreach (var fieldInfo in TheObject.GetType()
                             .GetFields(BindingFlags.Instance | BindingFlags.Public)
                             .OrderBy(f => f.Name))
                    {
                        object value      = null;
                        Brush  valueColor = null;
                        try
                        {
                            value = fieldInfo.GetValue(TheObject);
                        }
                        catch (Exception ex)
                        {
                            value      = "[" + ex.Message + "]";
                            valueColor = Brushes.OrangeRed;
                        }
                        Children.Add(new ObjectViewModel(fieldInfo.Name, value, fieldInfo.FieldType, fieldIcon, valueColor, elementLevel));
                    }

                    foreach (var methodInfo in TheObject.GetType()
                             .GetMethods(BindingFlags.Instance | BindingFlags.Public)
                             .Where(m => m.Name != "Clone")
                             .Where(m => m.Name != "GetHashCode")
                             .Where(m => m.Name != "GetType")
                             .Where(m => m.Name != "ToString")
                             .Where(m => !m.Name.StartsWith("get_"))
                             .Where(m => m.ReturnType != typeof(void))
                             .Where(m => m.GetParameters().Length == 0)
                             .OrderBy(m => m.Name))
                    {
                        object value      = null;
                        Brush  valueColor = null;
                        try
                        {
                            value = methodInfo.Invoke(TheObject, new object[0]);
                        }
                        catch (Exception ex)
                        {
                            value      = ex;
                            valueColor = Brushes.OrangeRed;
                        }
                        Children.Add(new ObjectViewModel(methodInfo.Name + "()", value, methodInfo.ReturnType, methodIcon, valueColor, elementLevel));
                    }
                }
            }
            IsChildrenLoaded = true;
            ForNode(this, o => o.HighlightObject());
        }
コード例 #14
0
 public override string ToString()
 {
     return(TheObject != null
                ? TheObject.ToString()
                : "null");
 }
コード例 #15
0
 void Start()
 {
     TheObject.BehaviourStart();
     TheObject._PersonalNodeMap.CreateNodeMap();
     TheObject._PersonalNodeMap.SetTargetPos(TheObject._TheTarget.MyPos);
 }
コード例 #16
0
 public static UserMethod(TheObject theObject);
コード例 #17
0
 public void Notify(TheObject theObject)
 {
     //Send json post request to the cient application
 }
コード例 #18
0
ファイル: ListOfObjects.cs プロジェクト: kilfour/QuickAcid
 public void Add(TheObject obj)
 {
     List.Add(obj);
 }
コード例 #19
0
 public void Add(TheObject obj)
 {
     List.Add(obj);
 }
コード例 #20
0
 public TheObserver(TheObject o)
 {
     o.StateChanged += Object_StateChanged;
 }
コード例 #21
0
 void Start()
 {
     TheObject.BehaviourStart();
 }
コード例 #22
0
ファイル: ObjectViewModel.cs プロジェクト: ygoe/CecilExplorer
 private void SetValue()
 {
     if (TheObject == null)
     {
         Value           = "null";
         ValueColor      = Brushes.Gray;
         canLoadChildren = false;
     }
     else if (TheObject is bool)
     {
         Value = ((bool)TheObject).ToString(CultureInfo.InvariantCulture).ToLowerInvariant();
     }
     else if (TheObject is byte)
     {
         Value = (byte)TheObject + " (0x" + GroupDigits(((byte)TheObject).ToString("x2")) + ")";
     }
     else if (TheObject is sbyte)
     {
         Value = (sbyte)TheObject + " (0x" + GroupDigits(((sbyte)TheObject).ToString("x2")) + ")";
     }
     else if (TheObject is ushort)
     {
         Value = (ushort)TheObject + " (0x" + GroupDigits(((ushort)TheObject).ToString("x4")) + ")";
     }
     else if (TheObject is short)
     {
         Value = (short)TheObject + " (0x" + GroupDigits(((short)TheObject).ToString("x4")) + ")";
     }
     else if (TheObject is uint)
     {
         Value = (uint)TheObject + " (0x" + GroupDigits(((uint)TheObject).ToString("x8")) + ")";
     }
     else if (TheObject is int)
     {
         Value = (int)TheObject + " (0x" + GroupDigits(((int)TheObject).ToString("x8")) + ")";
     }
     else if (TheObject is ulong)
     {
         Value = (ulong)TheObject + " (0x" + GroupDigits(((ulong)TheObject).ToString("x16")) + ")";
     }
     else if (TheObject is long)
     {
         Value = (long)TheObject + " (0x" + GroupDigits(((long)TheObject).ToString("x16")) + ")";
     }
     else if (TheObject is Exception)
     {
         Value           = ((Exception)TheObject).Message;
         canLoadChildren = true;
     }
     else if (canLoadChildren && IsEnumerable(TheObject))
     {
         int count = ((IEnumerable)TheObject).OfType <object>().Count();
         if (count == 0)
         {
             Value = "(empty)";
         }
         else if (count == 1)
         {
             Value = "(1 item)";
         }
         else
         {
             Value = "(" + count + " items)";
         }
         ValueColor = Brushes.Gray;
         if (count == 0)
         {
             canLoadChildren = false;
         }
     }
     else
     {
         Value = Convert.ToString(TheObject, CultureInfo.InvariantCulture);
         if (Value == TheObject.GetType().FullName)
         {
             if (TheObject.GetType() == typeof(Mono.Cecil.CustomAttribute))
             {
                 Value      = (TheObject.GetType().GetProperty("AttributeType")?.GetValue(TheObject) as Mono.Cecil.TypeReference).Name;
                 ValueColor = Brushes.MediumBlue;
             }
             else if (TheObject.GetType() == typeof(Mono.Cecil.CustomAttributeArgument))
             {
                 Value = "(" + (TheObject.GetType().GetProperty("Type")?.GetValue(TheObject) as Mono.Cecil.TypeReference).Name + ") " +
                         Convert.ToString(TheObject.GetType().GetProperty("Value")?.GetValue(TheObject), CultureInfo.InvariantCulture);
                 ValueColor = Brushes.MediumBlue;
             }
         }
     }
 }
コード例 #23
0
        private bool CheckIfStringEndsWithValue(string candidateAsString)
        {
            var theObjectAsString = TheObject as string;

            if (theObjectAsString != null)
            {
                return(candidateAsString.EndsWith(theObjectAsString,
                                                  _isCaseSensitive
                                                      ? StringComparison.Ordinal
                                                      : StringComparison.OrdinalIgnoreCase));
            }

            throw new OdbRuntimeException(
                      NDatabaseError.QueryEndsWithConstraintTypeNotSupported.AddParameter(TheObject.GetType().FullName));
        }
コード例 #24
0
 public override int GetHashCode()
 {
     return(TheObject != null
                 ? TheObject.GetHashCode()
                 : 0);
 }
コード例 #25
0
ファイル: ObjectViewModel.cs プロジェクト: ygoe/CecilExplorer
 private void SetFontWeight(PropertyInfo propInfo, ObjectViewModel item)
 {
     if (TheObject.GetType() == typeof(Mono.Cecil.AssemblyDefinition))
     {
         if (propInfo.Name == "EntryPoint" ||
             propInfo.Name == "MainModule")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.CustomAttribute))
     {
         if (propInfo.Name == "AttributeType" ||
             propInfo.Name == "ConstructorArguments")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.FieldDefinition))
     {
         if (propInfo.Name == "Constant" ||
             propInfo.Name == "CustomAttributes" ||
             propInfo.Name == "FieldType")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.GenericInstanceMethod))
     {
         if (propInfo.Name == "DeclaringType" ||
             propInfo.Name == "GenericArguments" ||
             propInfo.Name == "Parameters" ||
             propInfo.Name == "ReturnType")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.GenericInstanceType))
     {
         if (propInfo.Name == "GenericArguments")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.GenericParameter))
     {
         if (propInfo.Name == "Constraints")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.Cil.Instruction))
     {
         if (propInfo.Name == "OpCode" ||
             propInfo.Name == "Operand")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.Cil.MethodBody))
     {
         if (propInfo.Name == "Instructions" ||
             propInfo.Name == "Variables")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.MethodDefinition))
     {
         if (propInfo.Name == "Body" ||
             propInfo.Name == "CustomAttributes" ||
             propInfo.Name == "GenericParameters" ||
             propInfo.Name == "Parameters" ||
             propInfo.Name == "ReturnType")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.MethodReference))
     {
         if (propInfo.Name == "DeclaringType" ||
             propInfo.Name == "Parameters" ||
             propInfo.Name == "ReturnType")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.ModuleDefinition))
     {
         if (propInfo.Name == "Types")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.ParameterDefinition))
     {
         if (propInfo.Name == "ParameterType")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.PropertyDefinition))
     {
         if (propInfo.Name == "CustomAttributes" ||
             propInfo.Name == "GetMethod" ||
             propInfo.Name == "PropertyType" ||
             propInfo.Name == "SetMethod")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
     if (TheObject.GetType() == typeof(Mono.Cecil.TypeDefinition))
     {
         if (propInfo.Name == "BaseType" ||
             propInfo.Name == "CustomAttributes" ||
             propInfo.Name == "Events" ||
             propInfo.Name == "Fields" ||
             propInfo.Name == "Interfaces" ||
             propInfo.Name == "Methods" ||
             propInfo.Name == "NestedTypes" ||
             propInfo.Name == "Properties")
         {
             ((TextBlock)item.Text).FontWeight = FontWeights.Bold;
         }
     }
 }