Ignore:
Timestamp:
Nov 10, 2004, 8:24:03 PM (20 years ago)
Author:
altba\rryu
Message:

起動時に黙って起動時のディレクトリにあるdefault.mcfaceを開くようにした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MacFaceFloat/MainForm.cs

    r8 r9  
    119119                        return SelectFaceDefine(Application.StartupPath);
    120120                }
     121
    121122                public bool SelectFaceDefine(string defaultPath)
    122123                {
    123124                        String facePath;
    124                         Hashtable property;
    125125
    126126                        // XV‚ðŽ~‚ß‚éB
     
    140140                                {
    141141                                        facePath = folderBrowser.SelectedPath;
    142                                         if (File.Exists(Path.Combine(facePath, "faceDef.plist")))
     142
     143                                        if (LoadFaceDefine(facePath))
    143144                                        {
    144                                                 break;
    145                                         }
    146                                         else
    147                                         {
    148                                                 // ƒtƒ@ƒCƒ‹‚ª‚È‚¢
    149                                                 if (MessageBox.Show(
    150                                                         String.Format("Žw’肳‚ꂽƒtƒHƒ‹ƒ_‚ÉŠçƒpƒ^[ƒ“’è‹`XMLƒtƒ@ƒCƒ‹ \"faceDef.plist\" ‚ª‘¶Ý‚µ‚Ü‚¹‚ñB\n\nƒtƒHƒ‹ƒ_:\n{0}", facePath),
    151                                                         "MacFace for Windows", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error)
    152                                                         == DialogResult.Cancel)
    153                                                 {
    154                                                         return false;
    155                                                 }
     145                                                return true;
    156146                                        }
    157147                                }
     
    162152                        }
    163153
    164                         // “ǂݍž‚Ý
     154                }
     155
     156
     157                bool LoadFaceDefine(string path)
     158                {
     159                        string plistPath = Path.Combine(path, "faceDef.plist");
     160
     161                        if (!File.Exists(plistPath))
     162                        {
     163                                System.Windows.Forms.MessageBox.Show(
     164                                        String.Format("Žw’肳‚ꂽƒtƒHƒ‹ƒ_‚ÉŠçƒpƒ^[ƒ“’è‹`XMLƒtƒ@ƒCƒ‹ \"faceDef.plist\" ‚ª‘¶Ý‚µ‚Ü‚¹‚ñB\n\nƒtƒHƒ‹ƒ_:\n{0}", path),
     165                                        "MacFace for Windows", MessageBoxButtons.OK, MessageBoxIcon.Error);
     166                                return false;
     167                        }
     168                       
     169                        Hashtable property;
    165170                        try
    166171                        {
    167                                 property = PropertyList.Load(Path.Combine(facePath, "faceDef.plist"));
     172                                property = PropertyList.Load(plistPath);
    168173                        }
    169174                        catch (System.IO.IOException ie)
     
    184189                        }
    185190
     191                        // Šçƒpƒ^[ƒ“·‚µ‘Ö‚¦’†‚͍XV‚ðŽ~‚ß‚Ä‚¨‚­
     192                        if (_updateTimer != null) _updateTimer.Stop();
     193
    186194                        _property = property;
    187                         _facePath = facePath;
     195                        _facePath = path;
    188196                        _parts = (ArrayList)_property["parts"];
    189 
    190                         // XVŠJŽn
     197                        prevUsage = -10;
     198
     199                        // XVÄŠJ
    191200                        if (_updateTimer != null) _updateTimer.Start();
    192201
    193202                        return true;
    194203                }
    195 
    196 
    197204
    198205                public void CountProcessorUsage(object sender, EventArgs e)
     
    234241                public void MainForm_Load(object sender, System.EventArgs e)
    235242                {
    236                         if (!SelectFaceDefine(Path.Combine(Application.StartupPath, "default.mcface")))
    237                         {
    238                                 Application.Exit();
    239                                 return;
    240                         }
    241 
     243                        string faceDefPath = Path.Combine(Application.StartupPath, "default.mcface");
     244                        bool result = false;
     245
     246                        if (Directory.Exists(faceDefPath))
     247                        {
     248                                result = LoadFaceDefine(faceDefPath);
     249                        }
     250
     251                        if (!result)
     252                        {
     253                                if (!SelectFaceDefine(Application.StartupPath))
     254                                {
     255                                        Application.Exit();
     256                                        return;
     257                                }
     258
     259                        }
    242260                }
    243261
Note: See TracChangeset for help on using the changeset viewer.