コード例 #1
0
        /// <summary>
        /// コートの配置などの設定情報を読み込む.
        /// 設定情報が見つからなかったらデフォルトの設定となる.
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        /// <exception cref="FileFormatException">設定ファイルの形式がおかしい.</exception>
        /// <exception cref="IOException">ファイルを開くときにエラー発生. なんかよく分からない.</exception>
        /// <exception cref="System.Security.SecurityException">プログラムにファイルアクセス許可がない.</exception>
        /// <exception cref="UnauthorizedAccessException">ファイルが読み込み専用やったり, ディレクトリやったり, いろいろ.</exception>
        public LayoutInformation Import(string filePath)
        {
            Dictionary<string, string> setting_str = ReadAsDictionary(filePath);

            LayoutInformation layout_info = new LayoutInformation();
            layout_info.Row = setting_str.ContainsKey("Row") ? int.Parse(setting_str["Row"]) : 1;
            layout_info.Column = setting_str.ContainsKey("Column") ? int.Parse(setting_str["Column"]) : 3;
            layout_info.CourtCount = setting_str.ContainsKey("CourtCount") ? int.Parse(setting_str["CourtCount"]) : 3;

            return layout_info;
        }
コード例 #2
0
        public LayoutWindow(List<MatchInformation> matches, LayoutInformation layout)
        {
            InitializeComponent();

            if (matches.Count > layout.CourtCount)
            {
                throw new ArgumentOutOfRangeException("matches", "コート数より試合数のほうが多いです.");
            }

            Matches = matches;
            Layout = layout;
            ViewBoxes = new List<Viewbox>();
            for (int i = 0; i < Layout.Row * Layout.Column; i++)
            {
                ViewBoxes.Add(new Viewbox());
            }
        }
コード例 #3
0
        /// <summary>
        /// コートの配置などの設定情報を読み込む.
        /// 設定ファイルが既にあったら上書き.
        /// </summary>
        /// <param name="filePath">ファイルパス</param>
        /// <param name="layout_info">保存するコート配置設定</param>
        /// <exception cref="ArgumentNullException">引数<see cref="filePath"/>または<see cref="layout_info"/>がnull</exception>
        /// <exception cref="ArgumentException"><see cref="filePath"/>が空文字やったり, 無効な文字が含まれている.</exception>
        /// <exception cref="DirectoryNotFoundException"><see cref="filePath"/>が有効でないパス.例えばマップされていないドライブにあるなど.</exception>
        /// <exception cref="PathTooLongException">パス長すぎ.</exception>
        /// <exception cref="NotSupportedException"><see cref="filePath"/>の形式が無効. どういうのが無効なのかはよく分からん.</exception>
        /// <exception cref="System.Security.SecurityException">プログラムにファイルアクセス許可がない.</exception>
        /// <exception cref="UnauthorizedAccessException">ファイルが読み込み専用やったり, ディレクトリやったり, いろいろ.</exception>
        /// <exception cref="IOException">ファイルを開くときにエラー発生. なんかよく分からない.</exception>
        public void Export(string filePath, LayoutInformation layout_info)
        {
            #region 引数チェック
            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }
            if (layout_info == null)
            {
                throw new ArgumentNullException(nameof(layout_info));
            }
            #endregion

            Dictionary<string, string> setting_str = new Dictionary<string, string>();

            setting_str["Row"] = layout_info.Row.ToString();
            setting_str["Column"] = layout_info.Column.ToString();
            setting_str["CourtCount"] = layout_info.CourtCount.ToString();

            File.WriteAllLines(filePath, setting_str.Select(pair => pair.Key + ":" + pair.Value));
        }
コード例 #4
0
        public LayoutConfigureWindow(LayoutInformation courtLayout)
        {
            InitializeComponent();

            CourtLayout = courtLayout;
        }
コード例 #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SettingImporter setting_importer = new SettingImporter();
            CourtLayout = setting_importer.Import("Setting.ini");

            InitializeMemberData();
            InitializeEntrantData();
        }