private void drawMultipleEntriesState(Rectangle bounds, SpriteBatch sb)
        {
            var num1 = 22f;
            var num2 = 2f;
            var pos  = new Vector2(bounds.X + 20f, bounds.Y + 10f);
            var num3 =
                (int)
                Math.Min(searchResultsNames.Count,
                         (float)((bounds.Height - 40.0 - 40.0 - 80.0) / (num1 + (double)num2)));

            TextItem.doFontLabel(pos, "Multiple Matches", GuiData.font, new Color?(), float.MaxValue, float.MaxValue);
            pos.Y += 30f;
            if (num3 > searchResultsNames.Count)
            {
                TextItem.doFontLabel(new Vector2(pos.X, pos.Y - 18f), "Some Results Omitted", GuiData.tinyfont,
                                     new Color?(), float.MaxValue, float.MaxValue);
            }
            sb.Draw(Utils.white, new Rectangle((int)pos.X, (int)pos.Y, (int)(bounds.Width - (double)pos.X - 5.0), 2),
                    Color.White);
            pos.Y += 12f;
            for (var index = 0; index < num3; ++index)
            {
                if (Button.doButton(1237000 + index, (int)pos.X, (int)pos.Y, (int)(bounds.Width * 0.666), (int)num1,
                                    searchResultsNames[index], darkThemeColor))
                {
                    searchedName    = searchResultsNames[index];
                    state           = ADDState.MultiMatchSearch;
                    searchStartTime = os.timer;
                }
                pos.Y += num1 + num2;
            }
            pos.Y += 5f;
            sb.Draw(Utils.white, new Rectangle((int)pos.X, (int)pos.Y, (int)(bounds.Width - (double)pos.X - 5.0), 2),
                    Color.White);
            pos.Y += 10f;
            if (Button.doButton(12346080, (int)pos.X, (int)pos.Y, 160, 25, "Refine Search", themeColor))
            {
                state = ADDState.Seach;
                os.execute("getString Name");
            }
            if (!Button.doButton(12346085, (int)pos.X + 170, (int)pos.Y, 160, 25, "Go Back", darkThemeColor))
            {
                return;
            }
            state = ADDState.Welcome;
        }
        private void doPreEntryViewSearch()
        {
            var fileForName = findFileForName(searchedName);

            if (fileForName != null)
            {
                setDegreesFromFileEntryData(fileForName.data);
            }
            else if (searchResultsNames.Count > 1)
            {
                state = ADDState.MultipleEntriesFound;
            }
            else
            {
                state = ADDState.EntryNotFound;
            }
        }
 public override void navigatedTo()
 {
     state = ADDState.Welcome;
 }
 private void drawEditDegreeState(Rectangle bounds, SpriteBatch sb)
 {
     if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
         state = ADDState.Entry;
     var pos = new Vector2(bounds.X + 10f, bounds.Y + 60f);
     var flag = editedField == ADDEditField.None;
     TextItem.doSmallLabel(pos, "University:", new Color?());
     pos.X += 110f;
     TextItem.doSmallLabel(pos, searchedDegrees[editedIndex].uni,
         editedField == ADDEditField.Uni ? themeColor : Color.White);
     pos.X -= 110f;
     pos.Y += 20f;
     if (flag && Button.doButton(46700, (int) pos.X, (int) pos.Y, 80, 20, "Edit", darkThemeColor))
     {
         editedField = ADDEditField.Uni;
         os.execute("getString University");
     }
     pos.Y += 30f;
     TextItem.doSmallLabel(pos, "Degree:", new Color?());
     pos.X += 110f;
     TextItem.doSmallLabel(pos, searchedDegrees[editedIndex].name,
         editedField == ADDEditField.Degree ? themeColor : Color.White);
     pos.X -= 110f;
     pos.Y += 20f;
     if (flag && Button.doButton(46705, (int) pos.X, (int) pos.Y, 80, 20, "Edit", darkThemeColor))
     {
         editedField = ADDEditField.Degree;
         os.execute("getString Degree");
     }
     pos.Y += 30f;
     TextItem.doSmallLabel(pos, "GPA:", new Color?());
     pos.X += 110f;
     TextItem.doSmallLabel(pos, string.Concat(searchedDegrees[editedIndex].GPA),
         editedField == ADDEditField.GPA ? themeColor : Color.White);
     pos.X -= 110f;
     pos.Y += 20f;
     if (flag && Button.doButton(46710, (int) pos.X, (int) pos.Y, 80, 20, "Edit", darkThemeColor))
     {
         editedField = ADDEditField.GPA;
         os.execute("getString GPA");
     }
     pos.Y += 30f;
     if (editedField != ADDEditField.None)
     {
         if (!doEditField())
             return;
         editedField = ADDEditField.None;
         os.getStringCache = "";
         saveChangesToEntry();
     }
     else
     {
         if (
             !Button.doButton(486012, bounds.X + 2, bounds.Y + bounds.Height - 40, 180, 30, "Save And Return",
                 backThemeColor))
             return;
         state = ADDState.Entry;
         comp.log(string.Concat("ACADEMIC_DATABASE::RecordEdit_:_#", editedIndex, "_: ",
             searchedName.Replace(" ", "_")));
     }
 }
 private void drawEntryState(Rectangle bounds, SpriteBatch sb)
 {
     if (state == ADDState.Entry && os.hasConnectionPermission(true))
         state = ADDState.EditPerson;
     if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
         state = ADDState.Welcome;
     var x = bounds.X + 20f;
     var y1 = bounds.Y + 50f;
     TextItem.doFontLabel(new Vector2(x, y1), searchedName, GuiData.font, new Color?(),
         bounds.Width - (x - bounds.X), 60f);
     var y2 = y1 + 30f;
     if (searchedDegrees.Count == 0)
         TextItem.doFontLabel(new Vector2(x, y2), " -No Degrees Found", GuiData.smallfont, new Color?(),
             float.MaxValue, float.MaxValue);
     for (var index = 0; index < searchedDegrees.Count; ++index)
     {
         var text = "Degree :" + searchedDegrees[index].name + "\nUni      :" + searchedDegrees[index].uni +
                    "\nGPA      :" + searchedDegrees[index].GPA;
         TextItem.doFontLabel(new Vector2(x, y2), text, GuiData.smallfont, new Color?(),
             bounds.Width - (bounds.X - x), 50f);
         y2 += 60f;
         if (state == ADDState.EditPerson)
         {
             var num = y2 - 10f;
             if (Button.doButton(457900 + index, (int) x, (int) num, 100, 20, "Edit", new Color?()))
             {
                 state = ADDState.EditEntry;
                 editedField = ADDEditField.None;
                 editedIndex = index;
             }
             if (Button.doButton(456900 + index, (int) x + 105, (int) num, 100, 20,
                 needsDeletionConfirmation ? "Delete" : "Confirm?",
                 needsDeletionConfirmation ? Color.Gray : Color.Red))
             {
                 if (needsDeletionConfirmation)
                 {
                     needsDeletionConfirmation = false;
                 }
                 else
                 {
                     comp.log(string.Concat("ACADEMIC_DATABASE::RecordDeletion_:_#", index, "_: ",
                         searchedName.Replace(" ", "_")));
                     searchedDegrees.RemoveAt(index);
                     saveChangesToEntry();
                     --index;
                     needsDeletionConfirmation = true;
                 }
             }
             y2 = num + 35f;
         }
     }
     var num1 = y2 + 10f;
     if (state != ADDState.EditPerson ||
         !Button.doButton(458009, (int) x, (int) num1, 170, 30, "Add Degree", themeColor))
         return;
     var degree = new Degree("UNKNOWN", "UNKNOWN", 0.0f);
     searchedDegrees.Add(degree);
     editedIndex = searchedDegrees.IndexOf(degree);
     state = ADDState.EditEntry;
     comp.log(string.Concat("ACADEMIC_DATABASE::RecordAdd_:_#", editedIndex, "_: ",
         searchedName.Replace(" ", "_")));
 }
 private void drawMultipleEntriesState(Rectangle bounds, SpriteBatch sb)
 {
     var num1 = 22f;
     var num2 = 2f;
     var pos = new Vector2(bounds.X + 20f, bounds.Y + 10f);
     var num3 =
         (int)
             Math.Min(searchResultsNames.Count,
                 (float) ((bounds.Height - 40.0 - 40.0 - 80.0)/(num1 + (double) num2)));
     TextItem.doFontLabel(pos, "Multiple Matches", GuiData.font, new Color?(), float.MaxValue, float.MaxValue);
     pos.Y += 30f;
     if (num3 > searchResultsNames.Count)
         TextItem.doFontLabel(new Vector2(pos.X, pos.Y - 18f), "Some Results Omitted", GuiData.tinyfont,
             new Color?(), float.MaxValue, float.MaxValue);
     sb.Draw(Utils.white, new Rectangle((int) pos.X, (int) pos.Y, (int) (bounds.Width - (double) pos.X - 5.0), 2),
         Color.White);
     pos.Y += 12f;
     for (var index = 0; index < num3; ++index)
     {
         if (Button.doButton(1237000 + index, (int) pos.X, (int) pos.Y, (int) (bounds.Width*0.666), (int) num1,
             searchResultsNames[index], darkThemeColor))
         {
             searchedName = searchResultsNames[index];
             state = ADDState.MultiMatchSearch;
             searchStartTime = os.timer;
         }
         pos.Y += num1 + num2;
     }
     pos.Y += 5f;
     sb.Draw(Utils.white, new Rectangle((int) pos.X, (int) pos.Y, (int) (bounds.Width - (double) pos.X - 5.0), 2),
         Color.White);
     pos.Y += 10f;
     if (Button.doButton(12346080, (int) pos.X, (int) pos.Y, 160, 25, "Refine Search", themeColor))
     {
         state = ADDState.Seach;
         os.execute("getString Name");
     }
     if (!Button.doButton(12346085, (int) pos.X + 170, (int) pos.Y, 160, 25, "Go Back", darkThemeColor))
         return;
     state = ADDState.Welcome;
 }
 private void drawSearchState(Rectangle bounds, SpriteBatch sb)
 {
     if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
         state = ADDState.Welcome;
     var str = "";
     var x = bounds.X + 6;
     var num1 = bounds.Y + 100;
     var vector2_1 = TextItem.doMeasuredSmallLabel(new Vector2(x, num1),
         "Please enter the name you with to search for:", new Color?());
     var y1 = num1 + ((int) vector2_1.Y + 10);
     var strArray = os.getStringCache.Split(new string[1]
     {
         "#$#$#$$#$&$#$#$#$#"
     }, StringSplitOptions.None);
     if (strArray.Length > 1)
     {
         str = strArray[1];
         if (str.Equals(""))
             str = os.terminal.currentLine;
     }
     var destinationRectangle = new Rectangle(x, y1, bounds.Width - 12, 80);
     sb.Draw(Utils.white, destinationRectangle, os.darkBackgroundColor);
     var num2 = y1 + 28;
     var vector2_2 = TextItem.doMeasuredSmallLabel(new Vector2(x, num2), "Name: " + str, new Color?());
     destinationRectangle.X = x + (int) vector2_2.X + 2;
     destinationRectangle.Y = num2;
     destinationRectangle.Width = 7;
     destinationRectangle.Height = 20;
     if (os.timer%1.0 < 0.300000011920929)
         sb.Draw(Utils.white, destinationRectangle, os.outlineColor);
     var y2 = num2 + 122;
     if (strArray.Length <= 2 && !Button.doButton(30, x, y2, 300, 22, "Search", os.highlightColor))
         return;
     if (strArray.Length <= 2)
         os.terminal.executeLine();
     if (str.Length > 0)
     {
         state = ADDState.PendingResult;
         searchedName = str;
         searchStartTime = os.timer;
         comp.log("ACADEMIC_DATABASE::RecordSearch_:_" + str);
     }
     else
         state = ADDState.EntryNotFound;
 }
 public override void draw(Rectangle bounds, SpriteBatch sb)
 {
     drawSideBar(bounds, sb);
     var num1 = (int) (bounds.Width/5.0);
     bounds.Width -= num1;
     bounds.X += num1;
     drawTitle(bounds, sb);
     bounds.Y += 30;
     bounds.Height -= 30;
     switch (state)
     {
         case ADDState.Welcome:
             var flag = comp.adminIP == os.thisComputer.ip;
             var destinationRectangle = bounds;
             destinationRectangle.Y = bounds.Y + 60 - 20;
             destinationRectangle.Height = 22;
             sb.Draw(Utils.white, destinationRectangle, flag ? themeColor : darkThemeColor);
             var text1 = "Valid Administrator Account Detected";
             if (!flag)
                 text1 = "Non-Admin Account Active";
             var vector2 = GuiData.smallfont.MeasureString(text1);
             var position1 = new Vector2(destinationRectangle.X + destinationRectangle.Width/2 - vector2.X/2f,
                 destinationRectangle.Y);
             sb.DrawString(GuiData.smallfont, text1, position1, Color.Black);
             if (Button.doButton(456011, bounds.X + 30, bounds.Y + bounds.Height/2 - 15, bounds.Width/2, 40,
                 "About This Server", themeColor))
                 state = ADDState.InfoPanel;
             if (Button.doButton(456001, bounds.X + 30, bounds.Y + bounds.Height/2 - 15 + 50, bounds.Width/2, 40,
                 "Search Entries", themeColor))
             {
                 state = ADDState.Seach;
                 os.execute("getString Name");
             }
             if (
                 !Button.doButton(456005, bounds.X + 30, bounds.Y + bounds.Height/2 - 15 + 100, bounds.Width/2,
                     40, "Exit", themeColor))
                 break;
             os.display.command = "connect";
             break;
         case ADDState.Seach:
             drawSearchState(bounds, sb);
             break;
         case ADDState.MultiMatchSearch:
         case ADDState.PendingResult:
             if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
                 state = ADDState.Welcome;
             var position2 = new Vector2(bounds.X + bounds.Width/2, bounds.Y = bounds.Height/2);
             var origin = new Vector2(loadingCircle.Width/2, loadingCircle.Height/2);
             sb.Draw(loadingCircle, position2, new Rectangle?(), Color.White, (float) (os.timer%Math.PI*3.0),
                 origin, Vector2.One, SpriteEffects.None, 0.5f);
             var num2 = os.timer - searchStartTime;
             if ((state != ADDState.PendingResult || num2 <= 3.59999990463257) &&
                 (state != ADDState.MultiMatchSearch || num2 <= 0.699999988079071))
                 break;
             state = ADDState.Entry;
             needsDeletionConfirmation = true;
             doPreEntryViewSearch();
             break;
         case ADDState.Entry:
         case ADDState.EditPerson:
             drawEntryState(bounds, sb);
             break;
         case ADDState.EntryNotFound:
             if (Button.doButton(456010, bounds.X + 2, bounds.Y + 20, 160, 30, "Back", darkThemeColor))
                 state = ADDState.Welcome;
             if (Button.doButton(456015, bounds.X + 2, bounds.Y + 55, 160, 30, "Search Again", darkThemeColor))
             {
                 state = ADDState.Seach;
                 os.execute("getString Name");
             }
             TextItem.doFontLabel(new Vector2(bounds.X + 2, bounds.Y + 90), "No Entries Found", GuiData.font,
                 new Color?(), float.MaxValue, float.MaxValue);
             break;
         case ADDState.MultipleEntriesFound:
             drawMultipleEntriesState(bounds, sb);
             break;
         case ADDState.InfoPanel:
             if (Button.doButton(456010, bounds.X + 2, bounds.Y + 30, 160, 30, "Back", darkThemeColor))
                 state = ADDState.Welcome;
             var pos = new Vector2(bounds.X + 20, bounds.Y + 70);
             TextItem.doFontLabel(pos, "Information", GuiData.font, new Color?(), float.MaxValue, float.MaxValue);
             pos.Y += 40f;
             var fileEntry = root.searchForFile("info.txt");
             var text2 = "ERROR: Unhandled System.IO.FileNotFoundException\nFile \"info.txt\" was not found";
             if (fileEntry != null)
                 text2 = DisplayModule.cleanSplitForWidth(fileEntry.data, bounds.Width - 80);
             TextItem.DrawShadow = false;
             TextItem.doFontLabel(pos, text2, GuiData.smallfont, new Color?(), bounds.Width - 40, float.MaxValue);
             break;
         case ADDState.EditEntry:
             drawEditDegreeState(bounds, sb);
             break;
     }
 }
 private void doPreEntryViewSearch()
 {
     var fileForName = findFileForName(searchedName);
     if (fileForName != null)
         setDegreesFromFileEntryData(fileForName.data);
     else if (searchResultsNames.Count > 1)
         state = ADDState.MultipleEntriesFound;
     else
         state = ADDState.EntryNotFound;
 }
Пример #10
0
 public override void navigatedTo()
 {
     state = ADDState.Welcome;
 }
Пример #11
0
        private void drawEditDegreeState(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
            {
                state = ADDState.Entry;
            }
            var pos  = new Vector2(bounds.X + 10f, bounds.Y + 60f);
            var flag = editedField == ADDEditField.None;

            TextItem.doSmallLabel(pos, "University:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, searchedDegrees[editedIndex].uni,
                                  editedField == ADDEditField.Uni ? themeColor : Color.White);
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46700, (int)pos.X, (int)pos.Y, 80, 20, "Edit", darkThemeColor))
            {
                editedField = ADDEditField.Uni;
                os.execute("getString University");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, "Degree:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, searchedDegrees[editedIndex].name,
                                  editedField == ADDEditField.Degree ? themeColor : Color.White);
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46705, (int)pos.X, (int)pos.Y, 80, 20, "Edit", darkThemeColor))
            {
                editedField = ADDEditField.Degree;
                os.execute("getString Degree");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, "GPA:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, string.Concat(searchedDegrees[editedIndex].GPA),
                                  editedField == ADDEditField.GPA ? themeColor : Color.White);
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46710, (int)pos.X, (int)pos.Y, 80, 20, "Edit", darkThemeColor))
            {
                editedField = ADDEditField.GPA;
                os.execute("getString GPA");
            }
            pos.Y += 30f;
            if (editedField != ADDEditField.None)
            {
                if (!doEditField())
                {
                    return;
                }
                editedField       = ADDEditField.None;
                os.getStringCache = "";
                saveChangesToEntry();
            }
            else
            {
                if (
                    !Button.doButton(486012, bounds.X + 2, bounds.Y + bounds.Height - 40, 180, 30, "Save And Return",
                                     backThemeColor))
                {
                    return;
                }
                state = ADDState.Entry;
                comp.log(string.Concat("ACADEMIC_DATABASE::RecordEdit_:_#", editedIndex, "_: ",
                                       searchedName.Replace(" ", "_")));
            }
        }
Пример #12
0
        private void drawEntryState(Rectangle bounds, SpriteBatch sb)
        {
            if (state == ADDState.Entry && os.hasConnectionPermission(true))
            {
                state = ADDState.EditPerson;
            }
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
            {
                state = ADDState.Welcome;
            }
            var x  = bounds.X + 20f;
            var y1 = bounds.Y + 50f;

            TextItem.doFontLabel(new Vector2(x, y1), searchedName, GuiData.font, new Color?(),
                                 bounds.Width - (x - bounds.X), 60f);
            var y2 = y1 + 30f;

            if (searchedDegrees.Count == 0)
            {
                TextItem.doFontLabel(new Vector2(x, y2), " -No Degrees Found", GuiData.smallfont, new Color?(),
                                     float.MaxValue, float.MaxValue);
            }
            for (var index = 0; index < searchedDegrees.Count; ++index)
            {
                var text = "Degree :" + searchedDegrees[index].name + "\nUni      :" + searchedDegrees[index].uni +
                           "\nGPA      :" + searchedDegrees[index].GPA;
                TextItem.doFontLabel(new Vector2(x, y2), text, GuiData.smallfont, new Color?(),
                                     bounds.Width - (bounds.X - x), 50f);
                y2 += 60f;
                if (state == ADDState.EditPerson)
                {
                    var num = y2 - 10f;
                    if (Button.doButton(457900 + index, (int)x, (int)num, 100, 20, "Edit", new Color?()))
                    {
                        state       = ADDState.EditEntry;
                        editedField = ADDEditField.None;
                        editedIndex = index;
                    }
                    if (Button.doButton(456900 + index, (int)x + 105, (int)num, 100, 20,
                                        needsDeletionConfirmation ? "Delete" : "Confirm?",
                                        needsDeletionConfirmation ? Color.Gray : Color.Red))
                    {
                        if (needsDeletionConfirmation)
                        {
                            needsDeletionConfirmation = false;
                        }
                        else
                        {
                            comp.log(string.Concat("ACADEMIC_DATABASE::RecordDeletion_:_#", index, "_: ",
                                                   searchedName.Replace(" ", "_")));
                            searchedDegrees.RemoveAt(index);
                            saveChangesToEntry();
                            --index;
                            needsDeletionConfirmation = true;
                        }
                    }
                    y2 = num + 35f;
                }
            }
            var num1 = y2 + 10f;

            if (state != ADDState.EditPerson ||
                !Button.doButton(458009, (int)x, (int)num1, 170, 30, "Add Degree", themeColor))
            {
                return;
            }
            var degree = new Degree("UNKNOWN", "UNKNOWN", 0.0f);

            searchedDegrees.Add(degree);
            editedIndex = searchedDegrees.IndexOf(degree);
            state       = ADDState.EditEntry;
            comp.log(string.Concat("ACADEMIC_DATABASE::RecordAdd_:_#", editedIndex, "_: ",
                                   searchedName.Replace(" ", "_")));
        }
Пример #13
0
        private void drawSearchState(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
            {
                state = ADDState.Welcome;
            }
            var str       = "";
            var x         = bounds.X + 6;
            var num1      = bounds.Y + 100;
            var vector2_1 = TextItem.doMeasuredSmallLabel(new Vector2(x, num1),
                                                          "Please enter the name you with to search for:", new Color?());
            var y1       = num1 + ((int)vector2_1.Y + 10);
            var strArray = os.getStringCache.Split(new string[1]
            {
                "#$#$#$$#$&$#$#$#$#"
            }, StringSplitOptions.None);

            if (strArray.Length > 1)
            {
                str = strArray[1];
                if (str.Equals(""))
                {
                    str = os.terminal.currentLine;
                }
            }
            var destinationRectangle = new Rectangle(x, y1, bounds.Width - 12, 80);

            sb.Draw(Utils.white, destinationRectangle, os.darkBackgroundColor);
            var num2      = y1 + 28;
            var vector2_2 = TextItem.doMeasuredSmallLabel(new Vector2(x, num2), "Name: " + str, new Color?());

            destinationRectangle.X      = x + (int)vector2_2.X + 2;
            destinationRectangle.Y      = num2;
            destinationRectangle.Width  = 7;
            destinationRectangle.Height = 20;
            if (os.timer % 1.0 < 0.300000011920929)
            {
                sb.Draw(Utils.white, destinationRectangle, os.outlineColor);
            }
            var y2 = num2 + 122;

            if (strArray.Length <= 2 && !Button.doButton(30, x, y2, 300, 22, "Search", os.highlightColor))
            {
                return;
            }
            if (strArray.Length <= 2)
            {
                os.terminal.executeLine();
            }
            if (str.Length > 0)
            {
                state           = ADDState.PendingResult;
                searchedName    = str;
                searchStartTime = os.timer;
                comp.log("ACADEMIC_DATABASE::RecordSearch_:_" + str);
            }
            else
            {
                state = ADDState.EntryNotFound;
            }
        }
Пример #14
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            drawSideBar(bounds, sb);
            var num1 = (int)(bounds.Width / 5.0);

            bounds.Width -= num1;
            bounds.X     += num1;
            drawTitle(bounds, sb);
            bounds.Y      += 30;
            bounds.Height -= 30;
            switch (state)
            {
            case ADDState.Welcome:
                var flag = comp.adminIP == os.thisComputer.ip;
                var destinationRectangle = bounds;
                destinationRectangle.Y      = bounds.Y + 60 - 20;
                destinationRectangle.Height = 22;
                sb.Draw(Utils.white, destinationRectangle, flag ? themeColor : darkThemeColor);
                var text1 = "Valid Administrator Account Detected";
                if (!flag)
                {
                    text1 = "Non-Admin Account Active";
                }
                var vector2   = GuiData.smallfont.MeasureString(text1);
                var position1 = new Vector2(destinationRectangle.X + destinationRectangle.Width / 2 - vector2.X / 2f,
                                            destinationRectangle.Y);
                sb.DrawString(GuiData.smallfont, text1, position1, Color.Black);
                if (Button.doButton(456011, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15, bounds.Width / 2, 40,
                                    "About This Server", themeColor))
                {
                    state = ADDState.InfoPanel;
                }
                if (Button.doButton(456001, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 50, bounds.Width / 2, 40,
                                    "Search Entries", themeColor))
                {
                    state = ADDState.Seach;
                    os.execute("getString Name");
                }
                if (
                    !Button.doButton(456005, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 100, bounds.Width / 2,
                                     40, "Exit", themeColor))
                {
                    break;
                }
                os.display.command = "connect";
                break;

            case ADDState.Seach:
                drawSearchState(bounds, sb);
                break;

            case ADDState.MultiMatchSearch:
            case ADDState.PendingResult:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
                {
                    state = ADDState.Welcome;
                }
                var position2 = new Vector2(bounds.X + bounds.Width / 2, bounds.Y = bounds.Height / 2);
                var origin    = new Vector2(loadingCircle.Width / 2, loadingCircle.Height / 2);
                sb.Draw(loadingCircle, position2, new Rectangle?(), Color.White, (float)(os.timer % Math.PI * 3.0),
                        origin, Vector2.One, SpriteEffects.None, 0.5f);
                var num2 = os.timer - searchStartTime;
                if ((state != ADDState.PendingResult || num2 <= 3.59999990463257) &&
                    (state != ADDState.MultiMatchSearch || num2 <= 0.699999988079071))
                {
                    break;
                }
                state = ADDState.Entry;
                needsDeletionConfirmation = true;
                doPreEntryViewSearch();
                break;

            case ADDState.Entry:
            case ADDState.EditPerson:
                drawEntryState(bounds, sb);
                break;

            case ADDState.EntryNotFound:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 20, 160, 30, "Back", darkThemeColor))
                {
                    state = ADDState.Welcome;
                }
                if (Button.doButton(456015, bounds.X + 2, bounds.Y + 55, 160, 30, "Search Again", darkThemeColor))
                {
                    state = ADDState.Seach;
                    os.execute("getString Name");
                }
                TextItem.doFontLabel(new Vector2(bounds.X + 2, bounds.Y + 90), "No Entries Found", GuiData.font,
                                     new Color?(), float.MaxValue, float.MaxValue);
                break;

            case ADDState.MultipleEntriesFound:
                drawMultipleEntriesState(bounds, sb);
                break;

            case ADDState.InfoPanel:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 30, 160, 30, "Back", darkThemeColor))
                {
                    state = ADDState.Welcome;
                }
                var pos = new Vector2(bounds.X + 20, bounds.Y + 70);
                TextItem.doFontLabel(pos, "Information", GuiData.font, new Color?(), float.MaxValue, float.MaxValue);
                pos.Y += 40f;
                var fileEntry = root.searchForFile("info.txt");
                var text2     = "ERROR: Unhandled System.IO.FileNotFoundException\nFile \"info.txt\" was not found";
                if (fileEntry != null)
                {
                    text2 = DisplayModule.cleanSplitForWidth(fileEntry.data, bounds.Width - 80);
                }
                TextItem.DrawShadow = false;
                TextItem.doFontLabel(pos, text2, GuiData.smallfont, new Color?(), bounds.Width - 40, float.MaxValue);
                break;

            case ADDState.EditEntry:
                drawEditDegreeState(bounds, sb);
                break;
            }
        }