Esempio n. 1
0
        private static object tryGetCommonField(ref Memories MemoryHaystack, String KeyS, KeyWord KeyK, thing.Parts.Memory.MemoryComponents InPart, thing.Parts.Memory.MemoryComponents OutPart)
        {
            thing.Parts.Memory MemoryNeedle = new thing.Parts.Memory(KeyS, KeyK, String.Empty);
            foreach (thing.Parts.Memory Memory in MemoryHaystack)
            {
                switch (InPart)
                {
                case thing.Parts.Memory.MemoryComponents.KEY:
                    if (!Object.Equals(null, KeyK))
                    {
                        if (KeyK != KeyWord.NIL)
                        {
                            if (compare(Memory, MemoryNeedle, InPart))
                            {
                                return(get(Memory, OutPart));
                            }
                        }
                    }
                    if (!Object.Equals(null, KeyS))
                    {
                        if (KeyS != String.Empty)
                        {
                            if (compare(Memory, MemoryNeedle, InPart))
                            {
                                return(get(Memory, OutPart));
                            }
                        }
                    }
                    break;

                case thing.Parts.Memory.MemoryComponents.NAME:
                    if (!Object.Equals(null, KeyK))
                    {
                        if (KeyK != KeyWord.NIL)
                        {
                            if (compare(Memory, MemoryNeedle, InPart))
                            {
                                return(get(Memory, OutPart));
                            }
                        }
                    }
                    if (!Object.Equals(null, KeyS))
                    {
                        if (KeyS != String.Empty)
                        {
                            if (compare(Memory, MemoryNeedle, InPart))
                            {
                                return(get(Memory, OutPart));
                            }
                        }
                    }
                    break;
                }
            }
            return(null);
        }
Esempio n. 2
0
        private static object get(thing.Parts.Memory m, thing.Parts.Memory.MemoryComponents Part)
        {
            switch (Part)
            {
            case thing.Parts.Memory.MemoryComponents.KEY:
                return(m.Key);

            case thing.Parts.Memory.MemoryComponents.NAME:
                return(m.Name);

            case thing.Parts.Memory.MemoryComponents.VALUE:
                return(m.Value);

            default:
                return(null);
            }
        }
Esempio n. 3
0
        private static bool compare(thing.Parts.Memory a, thing.Parts.Memory b, thing.Parts.Memory.MemoryComponents Part)
        {
            switch (Part)
            {
            case thing.Parts.Memory.MemoryComponents.KEY:
                if (a.Key == b.Key)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case thing.Parts.Memory.MemoryComponents.NAME:
                if (a.Name == b.Name)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case thing.Parts.Memory.MemoryComponents.VALUE:
                if (a.Value == b.Value)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(false);
            }
        }
Esempio n. 4
0
 private static object tryGetCommonField(ref Memories MemoryHaystack, String KeyS, KeyWord KeyK, thing.Parts.Memory.MemoryComponents InPart, thing.Parts.Memory.MemoryComponents OutPart)
 {
     thing.Parts.Memory MemoryNeedle = new thing.Parts.Memory(KeyS, KeyK, String.Empty);
     foreach (thing.Parts.Memory Memory in MemoryHaystack)
     {
         switch (InPart)
         {
             case thing.Parts.Memory.MemoryComponents.KEY:
                 if (!Object.Equals(null, KeyK))
                 {
                     if (KeyK != KeyWord.NIL)
                     {
                         if (compare(Memory, MemoryNeedle, InPart))
                         {
                             return get(Memory, OutPart);
                         }
                     }
                 }
                 if (!Object.Equals(null, KeyS))
                 {
                     if (KeyS != String.Empty)
                     {
                         if (compare(Memory, MemoryNeedle, InPart))
                         {
                             return get(Memory, OutPart);
                         }
                     }
                 }
                 break;
             case thing.Parts.Memory.MemoryComponents.NAME:
                 if (!Object.Equals(null, KeyK))
                 {
                     if (KeyK != KeyWord.NIL)
                     {
                         if (compare(Memory, MemoryNeedle, InPart))
                         {
                             return get(Memory, OutPart);
                         }
                     }
                 }
                 if (!Object.Equals(null, KeyS))
                 {
                     if (KeyS != String.Empty)
                     {
                         if (compare(Memory, MemoryNeedle, InPart))
                         {
                             return get(Memory, OutPart);
                         }
                     }
                 }
                 break;
         }
     }
     return null;
 }