private void ToggleCommand(object param)
        {
            BoolObject tempbool = (BoolObject)param;

            tempbool.Bool = !tempbool.Bool;
            ResetLight();
        }
Esempio n. 2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool)
            {
                switch ((bool)value)
                {
                case true:
                    return(Visibility.Collapsed);

                case false:
                    return(Visibility.Visible);
                }
            }
            else
            {
                BoolObject boolObject = (BoolObject)value;
                switch (boolObject.Bool)
                {
                case true:
                    return(Visibility.Collapsed);

                case false:
                    return(Visibility.Visible);
                }
            }
        }
        /// <summary>
        /// Initializes music player, music loader thread, the GUI, and the artist/album scroller thread
        /// If the iTunes playlists haven't been imported, it calls the appropriate methods to do so
        /// </summary>
        public MainWindow()
        {
            MainWindow.khandler.setWindow(this);

            //import the iTunes playlists if they don't already exist
            if (!System.IO.Directory.Exists(outputDir) || System.IO.Directory.GetFiles(outputDir).Length == 0)
            {
                getLibLocation();
                //getiTunesSongs();
                parseiTunesSongs(outputDir);
            }

            //init the player and music loader thread
            player = new MusicPlayer_Bass(this);
            loader = new CustomMusicLoader(outputDir);

            //create hole in admin priveleges for messages to the taskbar
            //params: handle, WM_COMMAND, allow, null
            ChangeWindowMessageFilterEx(this.Handle, 0x0111, 1, IntPtr.Zero);

            //init the GUI
            InitializeComponent();
            InitPlaylistBox();

            currentSong = null;
            Control.CheckForIllegalCrossThreadCalls = false;

            //init the artist/album scroller thread and its related objects
            labelHasChanged        = new BoolObject(true);
            scrollThreadShouldExit = new BoolObject(false);
            scrollThread           = new Thread(new ThreadStart(ScrollText));
            scrollThread.Start();
        }
Esempio n. 4
0
        /// <summary>
        ///  Read a number from the input stream.
        /// </summary>
        /// <remarks>
        ///  TODO: Check and support overflow (both INT_MAX and INT_MIN).
        ///  TODO: Suport floating point values.
        /// </remarks>
        /// <returns>Number that was read.</returns>
        private SObject ReadBool()
        {
            char       c      = GetNextCharacter();
            BoolObject result = null;

            switch (c)
            {
            case 'T':
            case 't':
                result = mContext.True;
                break;

            case 'F':
            case 'f':
                result = mContext.False;
                break;

            default:
                throw new ReaderInvalidBoolTokenException(GetCurrentLine());
            }

            if (!PeekIsNextCharacterDelimiter())
            {
                throw new ReaderInvalidBoolTokenException(GetCurrentLine());
            }

            return(result);
        }
        public bool CheckInFiles(string strLocalPath, string strRemotePath, string Comment)
        {
            List <string> listFilesFullNameToCheckIn = new List <string>();
            bool          bKeepCheckout    = false;
            bool          bRemoveLocalCopy = true;
            string        strComment       = Comment;
            List <long>   listIssueID      = new List <long>();
            bool          bUseReadOnly     = false;
            int           iEnumCheckInUnChangedFileHandling     = EnumCheckinUnchangedFileHandling.enumUndoCheckinUnchangedFile;
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            BoolObject   bConflictExists = new BoolObject();
            StringObject strobjError     = new StringObject();

            strRemotePath = SAWCommon.ConvertPath(strRemotePath);
            listFilesFullNameToCheckIn.Add(strRemotePath);
            if (0 != sdkObject.CheckInFiles(strRepositoryName, listFilesFullNameToCheckIn, bKeepCheckout, bRemoveLocalCopy, strComment, listIssueID, bUseReadOnly, iEnumCheckInUnChangedFileHandling, ref listItemOperateResults, bConflictExists, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Esempio n. 6
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool)
            {
                if (value == null)
                {
                    return(null);
                }
                bool temp = (bool)value;

                if (temp)
                {
                    return(TextDecorations.Strikethrough);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                BoolObject boolObject = (BoolObject)value;
                switch (boolObject.Bool)
                {
                case true:
                    return(TextDecorations.Strikethrough);

                case false:
                    return(null);
                }
            }
        }
        public bool CheckInProject(string strLocalPath, string strRemotePath, string Comment)   //no use
        {
            List <SDKItemOperatorResult> results = new List <SDKItemOperatorResult>();
            BoolObject   bConflict = new BoolObject();
            StringObject error     = new StringObject();

            return(0 == sdkObject.CheckInFolder("", strRemotePath, true, Comment, null, false, 2, ref results, bConflict, error));
        }
 public AnimusObject(AnimusObject animusObject)
 {
     completed      = new BoolObject();
     this.Name      = animusObject.Name;
     this.Completed = animusObject.Completed;
     this.PointF    = animusObject.PointF;
     this.Map       = animusObject.Map;
     this.Person    = animusObject.Person;
     this.Type      = animusObject.Type;
 }
Esempio n. 9
0
        public void TestBoolObjectSerialization()
        {
            PrimitiveTestPatternBuffer patternBuffer = new PrimitiveTestPatternBuffer();
            BoolObject b = new BoolObject(false);

            byte[] bytes = patternBuffer.Energize(b);
            Assert.AreEqual(2, bytes.Length);
            object o = patternBuffer.Energize(bytes);

            Assert.IsTrue(o is BoolObject);
            Assert.AreEqual(b.BoolValue, ((BoolObject)o).BoolValue);
            Assert.IsFalse(b == o);
        }
Esempio n. 10
0
        public void Bools()
        {
            var parser =
                FSBuilder
                .Take <BoolObject>(",", "A")
                .Take(",", "B")
                .TakeRest("C")
                .Seal();

            var obj = new BoolObject();

            parser("True,1,false", obj);
            Assert.IsTrue(obj.A);
            Assert.IsTrue(obj.B);
            Assert.IsFalse(obj.C.Value);
        }
Esempio n. 11
0
        public void NullableSkip()
        {
            var parser =
                FSBuilder
                .Take <BoolObject>(",", "A")
                .Take(",", "C")
                .TakeRest("B")
                .Seal();

            var obj = new BoolObject();

            parser("True,,false", obj);

            Assert.IsTrue(obj.A);
            Assert.IsFalse(obj.B);
            Assert.IsNull(obj.C);
        }
Esempio n. 12
0
        public ZetaModel()
        {
            ZetaActivity = "No Sense";
            CurrentLight = 0;

            ramVisibility          = new BoolObject();
            bullVisibility         = new BoolObject();
            twinsVisibility        = new BoolObject();
            crabVisibility         = new BoolObject();
            lionVisibility         = new BoolObject();
            maidenVisibility       = new BoolObject();
            scalesVisibility       = new BoolObject();
            scorpionVisibility     = new BoolObject();
            archerVisibility       = new BoolObject();
            goatVisibility         = new BoolObject();
            water_bearerVisibility = new BoolObject();
            fishVisibility         = new BoolObject();
        }
Esempio n. 13
0
        private static int getNumber(int nBits, sbyte[] buf, int bufPtr, int inc, BoolObject flag, IntObject mask, IntObject buffer, sbyte[] @in, IntObject nextIn)
        {
            // Extract and return a number (consisting of n_bits bits) from in stream
            IntObject number = new IntObject(1);

            if (nBits >= 3)
            {
                nextBit(buf, bufPtr + 3 * inc, number, mask, mask, buffer, @in, nextIn);
                if (nBits >= 4)
                {
                    nextBit(buf, bufPtr + 3 * inc, number, mask, mask, buffer, @in, nextIn);
                    if (nBits >= 5)
                    {
                        fillBuffer(mask, mask, buffer, @in, nextIn);
                        for (; nBits >= 5; nBits--)
                        {
                            number.Value = number.Value << 1;
                            mask.Value   = (int)((uint)mask.Value >> 1);
                            if (u32(buffer.Value) < u32(mask.Value))
                            {
                                number.incr();
                            }
                            else
                            {
                                buffer.sub(mask.Value);
                            }
                        }
                    }
                }
            }
            flag.Value = nextBit(buf, bufPtr, number, mask, mask, buffer, @in, nextIn);
            if (nBits >= 1)
            {
                nextBit(buf, bufPtr + inc, number, mask, mask, buffer, @in, nextIn);
                if (nBits >= 2)
                {
                    nextBit(buf, bufPtr + 2 * inc, number, mask, mask, buffer, @in, nextIn);
                }
            }

            return(number.Value);
        }
        public bool Login(string strName, string Password, string rep)
        {
            this.strUserName       = strName;
            this.strPassword       = Password;
            this.strRepositoryName = rep;
            BoolObject   bTrial        = new BoolObject();
            IntObject    nTrial        = new IntObject();
            IntObject    nPasswordLeft = new IntObject();
            StringObject error         = new StringObject();

            if (0 != sdkObject.ConnectToServer(strServerIP, nServerPort, false, strName, Password, 0, "", 0, "", "", bTrial, nTrial, nPasswordLeft, error))
            {
                this.bLogin = false;
                return(false);
            }
            else
            {
                this.bLogin = true;
                return(true);
            }
        }
    void DrawBoolExit()
    {
        GUILayout.BeginVertical("Box");
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Bool Exit");
                GUI.color = Color.green;
                if (GUILayout.Button("Add", GUILayout.Width(100)))
                {
                    BoolObject boolObj = new BoolObject();
                    ambBase.boolObjectsExit.Add(boolObj);
                }
                GUI.color = Color.white;
            }
            GUILayout.EndHorizontal();

            for (int i = 0; i < ambBase.boolObjectsExit.Count; i++)
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Name:");
                    ambBase.boolObjectsExit[i].boolName = GUILayout.TextField(ambBase.boolObjectsExit[i].boolName, 25);
                    ambBase.boolObjectsExit[i].value    = GUILayout.Toggle(ambBase.boolObjectsExit[i].value, "");
                    GUI.color = Color.cyan;
                    if (GUILayout.Button("Delete", GUILayout.Width(50)))
                    {
                        ambBase.boolObjectsExit.RemoveAt(i);
                    }
                    GUI.color = Color.white;
                }
                GUILayout.EndHorizontal();
            }
        }
        GUILayout.EndVertical();
    }
 public AnimusObject(bool boolean)
 {
     completed           = new BoolObject();
     this.Completed.Bool = boolean;
 }
 public AnimusObject()
 {
     completed = new BoolObject();
 }
Esempio n. 18
0
        public static int decompress(sbyte[] @out, int outCapacity, sbyte[] @in)
        {
            int       type   = @in[0];
            IntObject buffer = new IntObject((u8(@in[1]) << 24) | (u8(@in[2]) << 16) | (u8(@in[3]) << 8) | u8(@in[4]));

            IntObject nextIn  = new IntObject(5);
            int       nextOut = 0;
            int       outEnd  = outCapacity;

            if (type < 0)
            {
                // copy from stream without decompression
                int seqEnd = nextOut + buffer.Value;
                if (seqEnd > outEnd)
                {
                    return(-1);
                }
                while (nextOut < seqEnd)
                {
                    @out[nextOut++] = @in[nextIn.incr()];
                }
                return(nextOut);
            }

            // Create and inti buffer
            sbyte[] buf = new sbyte[2800];
            Arrays.Fill(buf, unchecked ((sbyte)0x80));
            int bufOff = 0;

            IntObject mask     = new IntObject(unchecked ((int)0xFFFFFFFF));
            IntObject testMask = new IntObject(0);
            int       lastChar = 0;

            while (true)
            {
                int bufPtr1 = bufOff + 2488;
                if (!nextBit(buf, bufPtr1, IntObject.Null, mask, mask, buffer, @in, nextIn))
                {
                    // Single new char
                    if (bufOff > 0)
                    {
                        bufOff--;
                    }
                    if (nextOut == outEnd)
                    {
                        return(-1);
                    }
                    bufPtr1 = (((((nextOut & 0x07) << 8) + lastChar) >> type) & 0x07) * 0xFF - 0x01;
                    IntObject j = new IntObject(1);
                    while (j.Value <= 0xFF)
                    {
                        nextBit(buf, bufPtr1 + j.Value, j, mask, mask, buffer, @in, nextIn);
                    }
                    @out[nextOut++] = (sbyte)j.Value;
                }
                else
                {
                    // Sequence of chars that exists in out stream

                    // Find number of bits of sequence Length
                    testMask.Value = mask.Value;
                    int        nBits = -1;
                    BoolObject flag  = new BoolObject();
                    do
                    {
                        bufPtr1   += 8;
                        flag.Value = nextBit(buf, bufPtr1, IntObject.Null, testMask, mask, buffer, @in, nextIn);
                        if (flag.Value)
                        {
                            nBits++;
                        }
                    } while (flag.Value && nBits < 6);

                    // Find sequence Length
                    int bufPtr2 = nBits + 2033;
                    int j       = 64;
                    int seqLen;
                    if (flag.Value || nBits >= 0)
                    {
                        bufPtr1 = (nBits << 5) + (((nextOut << nBits) & 0x03) << 3) + bufOff + 2552;
                        seqLen  = getNumber(nBits, buf, bufPtr1, 8, flag, mask, buffer, @in, nextIn);
                        if (seqLen == 0xFF)
                        {
                            return(nextOut);                            // End of data stream
                        }
                        if (flag.Value || nBits > 0)
                        {
                            bufPtr2 += 56;
                            j        = 352;
                        }
                    }
                    else
                    {
                        seqLen = 1;
                    }

                    // Find number of bits of sequence offset
                    IntObject i = new IntObject(1);
                    do
                    {
                        nBits      = (i.Value << 4) - j;
                        flag.Value = nextBit(buf, bufPtr2 + (i.Value << 3), i, mask, mask, buffer, @in, nextIn);
                    } while (nBits < 0);

                    // Find sequence offset
                    int seqOff;
                    if (flag.Value || nBits > 0)
                    {
                        if (!flag.Value)
                        {
                            nBits -= 8;
                        }
                        seqOff = getNumber(nBits / 8, buf, nBits + 2344, 1, flag, mask, buffer, @in, nextIn);
                    }
                    else
                    {
                        seqOff = 1;
                    }

                    // Copy sequence
                    int nextSeq = nextOut - seqOff;
                    if (nextSeq < 0)
                    {
                        return(-1);
                    }
                    int seqEnd = nextOut + seqLen + 1;
                    if (seqEnd > outEnd)
                    {
                        return(-1);
                    }
                    bufOff = ((seqEnd + 1) & 0x01) + 0x06;
                    do
                    {
                        @out[nextOut++] = @out[nextSeq++];
                    } while (nextOut < seqEnd);
                }
                lastChar = u8(@out[nextOut - 1]);
            }
        }