示例#1
0
        static void GenSeason(int year)
        {
            //try{
            //Console.Error.WriteLine("Year = {0}",year);
            Season s = new Season(year);
            string str = s.GenerateSeason();

            if( System.IO.Path.DirectorySeparatorChar == '\\' )
            {
                str = str.Replace("\r\n","\n");
                str = str.Replace("\n", "\r\n");
            }
            Console.WriteLine(str);
            //}
            /*catch(Exception e)
            {
                Console.Error.WriteLine(e.StackTrace+"\n"+e.Message);
            }*/
        }
示例#2
0
        private void GenerateBasedOnYear()
        {
            int fa_startingIndex= 30;
            string fa_str = System.Configuration.ConfigurationSettings.AppSettings["FreeAgentStartingIndex"];
            if( fa_str != null )
            {
                try
                {
                    fa_startingIndex = Int32.Parse(fa_str);
                }
                catch{}
            }

            int year = 0;
            string s_year = mYearTextBox.Text;
            string test = MainClass.LeagueFolder+Path.DirectorySeparatorChar+ s_year;
            if( Directory.Exists(test) )
            {
                year = Int32.Parse( s_year);
                Season s = new Season(year);

                string season = s.GenerateSeason();
                string fileName = "tmpSeasonGen.csv";
                if( MainClass.GenerateFreeAgents )
                {
                    test = MainClass.LeagueFolder+Path.DirectorySeparatorChar+ (year-1);
                    if( Directory.Exists(test) )
                    {
                        string nextSeason = "";
                        if( Directory.Exists( MainClass.LeagueFolder+Path.DirectorySeparatorChar+ (year+1)))
                        {
                            Season ns = new Season(year+1);
                            nextSeason = ns.GenerateSeason();
                        }
                        Season previousSeason = new Season(year -1);
                        previousSeason.PlayerIndexToStartAt = fa_startingIndex;
                        string previousPlayers = previousSeason.GenerateSeason();
                        string freeAgents = FreeAgentHelper.GetFreeAgents(season, previousPlayers, nextSeason);
                        season += freeAgents;
                    }
                    else
                    {
                        season += "\r\n# Free Agents not available for this year";
                    }
                }
                if (mGenerateDepthChartCheckBox.Checked)
                {
                    string depthChart = s.GetDepthChart();
                    string depthChartFile = "tmpDepthChart.csv";
                    ShowResults(depthChart, depthChartFile); // show Depth Chart
                }
                ShowResults(season,fileName);
            }
            else
            {
                MessageBox.Show(string.Format("Invalid year {0}",s_year));
                mYearTextBox.Focus();
                mYearTextBox.SelectAll();
            }
        }
示例#3
0
        static void GenSeason(string configFile)
        {
            //try{
            Season s = new Season(configFile);
            string str = s.GenerateSeason();

            if( System.IO.Path.DirectorySeparatorChar == '\\' )
            {
                str = str.Replace("\r\n","\n");
                str = str.Replace("\n", "\r\n");
            }
            Console.WriteLine(str);
            //}catch(Exception e){
            //	MainClass.AddError(e.StackTrace+"\n"+e.Message);
            //}
        }