ToString() public method

public ToString ( ) : string
return string
Example #1
0
 public override string ToString()
 {
     return(base.ToString() + ": " +
            "DegreeCreditID = " + DegreeCreditID +
            "DegreeID = " + DegreeID +
            ", Credit = {" + Credit.ToString() +
            "}");
 }
Example #2
0
    public string HistoryDatabseString()
    {
        StringBuilder hdbstring = new StringBuilder(Coursename);

        hdbstring.Insert(12, Term);
        hdbstring.Insert(17, Credit.ToString());
        hdbstring.Insert(23, Grade);

        return(hdbstring.ToString());
    }
Example #3
0
 //取得查詢資料
 public void GetSearchList()
 {
     using (ClassWeb.Repository.Entity.SchoolEntities DBEntity = new Repository.Entity.SchoolEntities())
     {
         classList = DBEntity.Class.Where(o => !string.IsNullOrEmpty(No) ? o.Class_No == No : true &&
                                          !string.IsNullOrEmpty(Name) ? o.Class_Name.Contains(Name) : true &&
                                          !string.IsNullOrEmpty(Credit.ToString()) && Credit != 0 ? o.Class_Credit == Credit : true &&
                                          !string.IsNullOrEmpty(Place) ? o.Class_Place.Contains(Place) : true &&
                                          !string.IsNullOrEmpty(Teacher)? o.Class_Teacher.Contains(Teacher) : true).ToList();
     }
 }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Account type: ");
            sb.Append(AccountType);
            sb.Append(" | Name: ");
            sb.Append(Name);
            sb.Append(" | Balance: $");
            sb.Append(Balance.ToString("F2"));
            sb.Append(" | Credit: $");
            sb.Append(Credit.ToString("F2"));
            return(sb.ToString());
        }
Example #5
0
    public string CourseDatabaseString()
    {
        StringBuilder cdbstring = new StringBuilder(Term);

        cdbstring.Insert(5, Coursename);
        cdbstring.Insert(17, Coursetitle);
        cdbstring.Insert(34, Instructor);
        cdbstring.Insert(46, Credit.ToString());
        cdbstring.Insert(52, Seats.ToString());
        cdbstring.Insert(57, Times.Count);
        foreach (coursetime time in Times)
        {
            cdbstring.Append(time.ToString() + "  ");
        }

        return(cdbstring.ToString());
    }
Example #6
0
 public override string ToString()
 {
     return($"{Semester} \t{Code} \t{Name} \t{Credit.ToString()} \t{Grade}");
 }
Example #7
0
        /// <summary>
        /// 充值信用,超过100就算100
        /// </summary>
        /// <param name="money">充值量</param>
        /// <returns>返回最终信用</returns>
        internal int Charge(int money)
        {
            if (money < 0)
            {
                return(Credit);
            }
            if (Credit + money > 100)
            {
                Credit = 100;
            }
            else
            {
                Credit += money;
            }

            RefreshCreditFile("用户于" + ClassTime.SystemTimeEng + "充值信用" + money + ",当前信用" + Credit.ToString() + "。");

            UpdateCurrentMaxBorrowableAmount();

            return(Credit);
        }
Example #8
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteElementString("Name", Name);
     writer.WriteElementString("Credit", Credit.ToString());
 }
Example #9
0
        public static void Capture()
        {
            ConsoleKey KeyPressed;

            while (!Exit)
            {
                ShowOptions();
                KeyPressed = Console.ReadKey().Key;
                Console.Write("\n");

                switch (KeyPressed)
                {
                case ConsoleKey.F1: {                         // Credit Stats
                    PrintColor.InfoLine("===Credit Statistics===");
                    uint StartingCurrency     = Program.PopFile.Population.StartingCurrency;
                    List <List <uint> > Stats = Program.PopAnalyzer.CreditStatistics();
                    List <string>       ExplicitWaveCredits = new List <string>();

                    // Analyze
                    uint TotalDropped = 0;
                    uint TotalBonus   = 0;
                    for (int i = 0; i < Stats.Count; i++)
                    {
                        List <uint> WaveCredits = Stats[i];

                        uint   WaveMax = 0;
                        string Out     = "";
                        foreach (uint Credit in WaveCredits)
                        {
                            WaveMax += Credit;
                            Out     += " + " + Credit.ToString().PadLeft(3);
                        }
                        TotalDropped += WaveMax;

                        // Format Zero Max
                        if (Out.Length == 0)
                        {
                            ExplicitWaveCredits.Add("{f:Cyan}W" + (i + 1).ToString() + "{r}:    {f:Cyan}0{r}");
                        }
                        else
                        {
                            ExplicitWaveCredits.Add("{f:Cyan}W" + (i + 1).ToString() + "{r}: {f:Cyan}" + WaveMax.ToString().PadLeft(4) + "{r} = " + Out.Substring(3));
                            if (i != Stats.Count - 1)
                            {
                                TotalBonus += 100;                                         // Wave must drop at least 1 credit and not be last wave to receive bonus.
                            }
                        }
                    }

                    // Write
                    PrintColor.InfoLine("Starting Credits         : {f:Cyan}{$0}{r}", StartingCurrency.ToString());
                    PrintColor.InfoLine("Total Dropped Credits    : {f:Cyan}{$0}{r}", TotalDropped.ToString());
                    PrintColor.InfoLine("Total Bonus Credits      : {f:Cyan}{$0}{r}", TotalBonus.ToString());
                    PrintColor.InfoLine("Maximum Possible Credits : {f:Cyan}{$0}{r}", (StartingCurrency + TotalDropped + TotalBonus).ToString());
                    foreach (string StatLine in ExplicitWaveCredits)
                    {
                        PrintColor.InfoLine(StatLine);
                    }
                    break;
                }

                case ConsoleKey.F2: {                         // WaveSpawn Names
                    PrintColor.InfoLine("===WaveSpawn Names===");
                    List <List <string> > Roster = Program.PopAnalyzer.WaveSpawnNames();

                    for (int i = 0; i < Roster.Count; i++)
                    {
                        List <string> Names = Roster[i];
                        PrintColor.InfoLine("Wave {$0}:", (i + 1).ToString());
                        foreach (string WaveSpawnName in Names)
                        {
                            PrintColor.InfoLine("\t{$0}", WaveSpawnName);
                        }
                    }
                    break;
                }

                case ConsoleKey.F3:                         // Templates
                    PrintColor.InfoLine("===All Template Names===");
                    var           Types          = Program.PopAnalyzer.TemplateTypeNames();
                    List <string> TFBotNames     = Sort.PadSort(Types.Item1);
                    List <string> WaveSpawnNames = Sort.PadSort(Types.Item2);
                    List <string> GenericNames   = Sort.PadSort(Types.Item3);
                    PrintColor.InfoLine("TFBot Templates:");
                    foreach (string Name in TFBotNames)
                    {
                        PrintColor.InfoLine("\t" + Name);
                    }
                    PrintColor.InfoLine("WaveSpawn Templates:");
                    foreach (string Name in WaveSpawnNames)
                    {
                        PrintColor.InfoLine("\t" + Name);
                    }
                    PrintColor.InfoLine("Generic Templates:");
                    foreach (string Name in GenericNames)
                    {
                        PrintColor.InfoLine("\t" + Name);
                    }
                    break;

                case ConsoleKey.F4:                         // Custom Icons
                    PrintColor.InfoLine("===Custom Icons===");
                    List <string> Icons      = Program.PopAnalyzer.CustomIcons();
                    bool          IconExists = false;
                    foreach (string Icon in Sort.PadSort(Icons))
                    {
                        IconExists = true;
                        if (Icon == "scout_sunstick")
                        {
                            PrintColor.InfoLine("\t{$0} {f:DarkGray}(used in robot_standard.pop but has no default icon){r}", Icon);
                        }
                        else
                        {
                            PrintColor.InfoLine("\t{$0}", Icon);
                        }
                    }
                    if (!IconExists)
                    {
                        PrintColor.InfoLine("{f:DarkGray}No custom icons used.{r}");
                    }
                    break;

                case ConsoleKey.F5:                         // Reparse
                    Exit = true;
                    string Arguments = "";
                    foreach (string Key in Program.LaunchArguments.Keys)
                    {
                        if (Key.StartsWith("--"))
                        {
                            Arguments += '"' + Key + "\" ";
                        }
                        else
                        {
                            Arguments += '"' + Key + "\" \"" + Program.LaunchArguments[Key] + "\" ";
                        }
                    }
                    System.Diagnostics.Process Restart = new System.Diagnostics.Process();
                    Restart.StartInfo.FileName  = AppDomain.CurrentDomain.BaseDirectory + "P3.exe";
                    Restart.StartInfo.Arguments = Arguments;
                    Restart.Start();
                    break;

                case ConsoleKey.F6:                         // Search Items and Character Attributes
                    PrintColor.InfoLine("===Search Items & Item/Char Attributes===");
                    SearchItemCharacterAttributes();
                    break;

                case ConsoleKey.F7:                         // Unused
                    break;

                case ConsoleKey.F8:                         // Map Analyzer
                    PrintColor.InfoLine("===Analyze Map (.bsp)===");
                    MapAnalyzer();
                    break;

                case ConsoleKey.F9:                         // Unused
                    break;

                case ConsoleKey.F10:                         // Retarget items_game.txt
                    PrintColor.InfoLine("===Update Database===");
                    PrintColor.InfoLine(@"Please open your items_game.txt at");
                    PrintColor.InfoLine(@".\steamapps\Team Fortress 2\tf\scripts\items\items_game.txt");

                    // File Dialog
                    OpenFileDialog Dialog = new OpenFileDialog {
                        Filter = "|items_game.txt"
                    };
                    try {
                        Dialog.ShowDialog();
                        if (Dialog.FileName.Length == 0)
                        {
                            throw new System.IO.FileNotFoundException();
                        }
                    }
                    catch {
                        Error.WriteNoIncrement("Failed to get file by dialog.", -1, 997);
                        break;
                    }

                    // Attributes
                    using (AttributeScraper s = new AttributeScraper()) {
                        PrintColor.InfoLine("> Attributes Database");
                        PrintColor.InfoLine("Old version: {f:Yellow}{$0}{r}", s.Version);
                        s.Scrape(Dialog.FileName);
                        PrintColor.InfoLine("New version: {f:Green}{$0}{r}", s.Version);
                    }

                    // Items
                    using (ItemScraper s = new ItemScraper(Dialog.FileName)) {
                        PrintColor.InfoLine("> Items Database");
                        PrintColor.InfoLine("Old version: {f:Yellow}{$0}{r}", s.CurrentVersion);
                        s.Scrape(Dialog.FileName);
                        PrintColor.InfoLine("New version: {f:Green}{$0}{r}", s.CurrentVersion);
                    }
                    break;

                case ConsoleKey.F11:                         // Fullscreen
                    // Windows Default Key
                    // This cannot be easily changed
                    break;

                case ConsoleKey.F12:
                    PrintColor.InfoLine("Opening P3 Reference PDF");
                    System.Diagnostics.Process Process = new System.Diagnostics.Process();
                    Process.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "P3_Reference.pdf";
                    Process.Start();
                    break;

                default:
                    Exit = true;
                    break;
                }
            }
        }