当前位置: 首页>>代码示例>>C#>>正文


C# Utils.ToString方法代码示例

本文整理汇总了C#中Utils.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Utils.ToString方法的具体用法?C# Utils.ToString怎么用?C# Utils.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils的用法示例。


在下文中一共展示了Utils.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CoverartArchiveGetTumbnails

    // End: Extract CoverArtArchive Front Thumb  URL

    // Begin: CoverArtArchive Get Tumbnails for Artist/Album
    public int CoverartArchiveGetTumbnails(Utils.Category category, string artist, string album, string mbid, bool externalAccess)
    {
      if (!Utils.UseCoverArtArchive)
        return 0 ;

      var Method = (string) null;
      var URL = (string) null;

      URL = "http://coverartarchive.org/release-group/{0}/";

      // CoverArtArchive.org get Artist/Album Tumbnails
      if (category == Utils.Category.MusicAlbumThumbScraped) 
      {
        if (string.IsNullOrEmpty(artist) && string.IsNullOrEmpty(album) && string.IsNullOrEmpty(mbid)) {
          logger.Debug("CoverArtArchive: GetTumbnails - Artist/Album/MBID - Empty.");
          return 0 ;
        }
        Method = "Artist/Album: "+artist+" - "+album+" - "+mbid ;
      // Last.FM wrong Category ...
      } else {
        logger.Warn("CoverArtArchive: GetTumbnails - wrong category - " + category.ToString() + ".");
        return 0 ;
      }

      try
      {
        var num = 0;
        var html = (string) null;
        var path = (string) null;
        var filename = (string) null;
        var sourceFilename = (string) null;
        var flag = false;
        logger.Debug("CoverArtArchive: Trying to find thumbnail for "+Method+".");
        GetHtml(String.Format(URL,mbid.Trim()), out html) ;
        try
        {
          if (html != null) {
            if (html.Length > 0) {
              sourceFilename = GetCoverArtFrontThumbURL(html) ;
              flag = !string.IsNullOrEmpty(sourceFilename);
            }
          }
        }
        catch (Exception ex)
        {
          logger.Error(ex.ToString());
        }

        if (flag) 
        {
          var dbartist = Utils.GetArtist(artist, Utils.Category.MusicFanartScraped);
          var dbalbum  = (category == Utils.Category.MusicAlbumThumbScraped) ? Utils.GetAlbum(album, Utils.Category.MusicFanartScraped) : null;

          if (DownloadImage(ref artist, (category == Utils.Category.MusicAlbumThumbScraped) ? album : null, ref sourceFilename, ref path, ref filename, category, null)) 
          {
            checked { ++num; }
            Utils.GetDbm().LoadFanart(dbartist, filename.Replace("_tmp.jpg", "L.jpg"), sourceFilename, category, dbalbum, Utils.Provider.CoverArtArchive, null, mbid);
            ExternalAccess.InvokeScraperCompleted(category.ToString(), dbartist);
          }
        }
        return num;
      }
      catch (Exception ex) {
        logger.Error("CoverArtArchive: GetTumbnails: " + Method + " - " + ex);
      }
      finally
      {
      }
      return 9999;
    }
开发者ID:hkjensen,项目名称:mediaportal-fanart-handler,代码行数:73,代码来源:Scraper.cs

示例2: DownloadImage

    // End: GetHtml

    // Begin: Download Image
    private bool DownloadImage(ref string sArtist, string sAlbum, ref string sourceFilename, ref string path, ref string filename, Utils.Category category, string id)
    {
      // if (!MediaPortal.Util.Win32API.IsConnectedToInternet())
      //   return false ;

      var TryCount         = 0;
      var FileLength       = 0L;
      var DownloaderStatus = "Start";
      var FileNameLarge    = (string) null;
      var FileNameThumb    = (string) null;
      var requestPic       = (HttpWebRequest) null;
      var responsePic      = (WebResponse) null;
      var Text             = (string) null;

      if (category == Utils.Category.MusicArtistThumbScraped)
      {
        path = Utils.FAHMusicArtists;
        FileNameThumb = Path.Combine(path, MediaPortal.Util.Utils.MakeFileName(sArtist) + ".jpg");
        FileNameLarge = Path.Combine(path, MediaPortal.Util.Utils.MakeFileName(sArtist) + "L.jpg");
        filename = Path.Combine(path, MediaPortal.Util.Utils.MakeFileName(sArtist) + "_tmp.jpg");
        Text = sArtist ;
        logger.Info("Download: Artist tumbnail for " + Text + " (" + filename + ").");
      }
      else if (category == Utils.Category.MusicAlbumThumbScraped)
      {
        path = Utils.FAHMusicAlbums;
        FileNameThumb = MediaPortal.Util.Utils.GetAlbumThumbName(sArtist, sAlbum);
        FileNameLarge = MediaPortal.Util.Utils.ConvertToLargeCoverArt(FileNameThumb);
        filename = FileNameThumb.Substring(0, FileNameThumb.IndexOf(".jpg")) + "_tmp.jpg";
        Text = sArtist + " - " + sAlbum;
        logger.Info("Download: Album tumbnail for " + Text + " (" + filename + ").");
      }
      else if (category == Utils.Category.MusicFanartScraped)
      {
        path = Utils.FAHSMusic;
        filename = Path.Combine(path, MediaPortal.Util.Utils.MakeFileName(sArtist) + " (" + id + ").jpg");
        Text = sArtist ;
        // if (File.Exists(filename))
        //  return false;
        logger.Info("Download: Fanart for " + Text + " (" + filename + ").");
      }
      else if (category == Utils.Category.MovieScraped)
      {
        path = Utils.FAHSMovies;
        if (Utils.MoviesFanartNameAsMediaportal)
        {
          var i = Utils.GetFilesCountByMask(path, sArtist + "{*}.jpg");
          if (i <= 10)
            id = i.ToString() ;
        }
        filename = Path.Combine(path, sArtist + "{"+id+"}.jpg");
        if (File.Exists(filename))
          return false;
        Text = sArtist + " ["+id+"]";
        logger.Info("Download: Fanart for Movies " + Text + " (" + filename + ").");
      }
      else if (category == Utils.Category.FanartTVArt)
      {
        if (string.IsNullOrEmpty(path))
          return false;
        filename = Path.Combine(path, MediaPortal.Util.Utils.MakeFileName((string.IsNullOrEmpty(id) ? sArtist : id)) + ".png");
        if (File.Exists(filename))
          return false;
        Text = sArtist + (string.IsNullOrEmpty(id) ? string.Empty : " - "  + id) ;
        logger.Info("Download: Fanart.TV image for " + Text + " (" + filename + ").");
      }
      else if (category == Utils.Category.FanartTVCDArt)
      {
        if (string.IsNullOrEmpty(path))
          return false;
        filename = Path.Combine(path, string.Format(Utils.MusicMask, MediaPortal.Util.Utils.MakeFileName(sArtist).Trim(), MediaPortal.Util.Utils.MakeFileName(sAlbum).Trim()) + ".png");
        if (File.Exists(filename))
          return false;
        Text = sArtist + " - " + sAlbum;
        logger.Info("Download: Fanart.TV CD image for " + Text + " (" + filename + ").");
      }
      else
      {
        logger.Warn("Download: Wrong category [" + category.ToString() + "] for " + sArtist + " " + sAlbum + " (" + filename + ").");
        return false;
      }

      if (category == Utils.Category.MusicArtistThumbScraped || category == Utils.Category.MusicAlbumThumbScraped)
      {
        if (File.Exists(FileNameLarge) && Utils.DoNotReplaceExistingThumbs)
          DownloaderStatus = "Skip" ;
        if (File.Exists(FileNameThumb) && Utils.DoNotReplaceExistingThumbs)
          DownloaderStatus = "Skip" ;
      }

      while (!DownloaderStatus.Equals("Success", StringComparison.CurrentCulture) && 
             !DownloaderStatus.Equals("Stop", StringComparison.CurrentCulture) && 
             !DownloaderStatus.Equals("Skip", StringComparison.CurrentCulture) && 
             TryCount < 10)
      {
        var stream = (Stream) null;
        var fileStream = (FileStream) null;
//.........这里部分代码省略.........
开发者ID:hkjensen,项目名称:mediaportal-fanart-handler,代码行数:101,代码来源:Scraper.cs

示例3: LastFMGetTumbnails

    // Begin: Last.FM Get Tumbnails for Artist or Artist/Album
    public int LastFMGetTumbnails(Utils.Category category, string artist, string album, bool externalAccess)
    {
      if (!Utils.UseLastFM)
        return 0 ;

      var Method = (string) null;
      var URL = (string) null;
      var POST = (string) null;
      var validUrlLastFmString1 = (string) null;
      var validUrlLastFmString2 = (string) null;

      URL = "http://ws.audioscrobbler.com/2.0/?method=";
      POST = "&autocorrect=1&api_key="+ApiKeyLastFM;

      // Last.FM get Artist Tumbnails
      if (category == Utils.Category.MusicArtistThumbScraped) {
        if (string.IsNullOrEmpty(artist)) {
          logger.Debug("LastFM: GetTumbnails - Artist - Empty.");
          return 0 ;
        }
        Method = "Artist: "+artist ;
        validUrlLastFmString1 = getValidURLLastFMString(UndoArtistPrefix(artist));
        URL = URL + "artist.getInfo" ;
        POST = POST + "&artist=" + validUrlLastFmString1;
      // Last.FM get Artist/Album Tumbnails
      } else if (category == Utils.Category.MusicAlbumThumbScraped) {
          if (string.IsNullOrEmpty(artist) && string.IsNullOrEmpty(album)) {
            logger.Debug("LastFM: GetTumbnails - Artist/Album - Empty.");
            return 0 ;
          }
          Method = "Artist/Album: "+artist+" - "+album ;
          validUrlLastFmString1 = getValidURLLastFMString(UndoArtistPrefix(artist));
          validUrlLastFmString2 = getValidURLLastFMString(album);
          URL = URL + "album.getInfo" ;
          POST = POST + "&artist=" + validUrlLastFmString1 + "&album=" + validUrlLastFmString2;
      // Last.FM wrong Category ...
      } else {
        logger.Warn("LastFM: GetTumbnails - wrong category - " + category.ToString() + ".");
        return 0 ;
      }

      try
      {
        var num = 0;
        var html = (string) null;
        var path = (string) null;
        var filename = (string) null;
        var sourceFilename = (string) null;
        var mbid = (string) null;
        var flag = false;
        logger.Debug("Last.FM: Trying to find thumbnail for "+Method+".");
        GetHtml(URL+POST, out html) ;
        try
        {
          if (html != null) {
            if (html.Length > 0) {
              if (html.IndexOf("\">http") > 0) 
              {
                sourceFilename = html.Substring(checked (html.IndexOf("size=\"mega\">") + 12));
                sourceFilename = sourceFilename.Substring(0, sourceFilename.IndexOf("</image>"));
                logger.Debug("Last.FM: Thumb Mega for " + Method + " - " + sourceFilename);
                if (sourceFilename.ToLower().IndexOf(".jpg") > 0 || sourceFilename.ToLower().IndexOf(".png") > 0 || sourceFilename.ToLower().IndexOf(".gif") > 0)
                  flag = true ;
                else {
                  sourceFilename = html.Substring(checked (html.IndexOf("size=\"extralarge\">") + 18));
                  sourceFilename = sourceFilename.Substring(0, sourceFilename.IndexOf("</image>"));
                  logger.Debug("Last.FM: Thumb Extra for " + Method + " - " + sourceFilename);
                  if (sourceFilename.ToLower().IndexOf(".jpg") > 0 || sourceFilename.ToLower().IndexOf(".png") > 0 || sourceFilename.ToLower().IndexOf(".gif") > 0)
                    flag = true ;
                  else
                    flag = false ;
                }
              }
              if (html.IndexOf("<mbid>") > 0) 
              {
                mbid = html.Substring(checked (html.IndexOf("<mbid>") + 6));
                mbid = mbid.Substring(0, mbid.IndexOf("</mbid>"));
                logger.Debug("Last.FM: MBID for " + Method + " - " + mbid);
                if (mbid.Length == 0)
                  mbid = null;
              }
            }
          }
        }
        catch (Exception ex)
        {
          logger.Error(ex.ToString());
        }

        if (flag) {
          if (sourceFilename != null && !sourceFilename.Contains("bad_tag")) {
            var dbartist = Utils.GetArtist(artist, Utils.Category.MusicFanartScraped);
            var dbalbum  = (category == Utils.Category.MusicAlbumThumbScraped) ? Utils.GetAlbum(album, Utils.Category.MusicFanartScraped) : null;
            // logger.Debug("*** " + artist + " | " + dbartist + " | ["+ ((category == Utils.Category.MusicArtistThumbScraped) ? string.Empty : album) +"]");
            if (DownloadImage(ref artist, (category == Utils.Category.MusicAlbumThumbScraped) ? album : null, ref sourceFilename, ref path, ref filename, /*ref requestPic, ref responsePic,*/ category, null)) 
            {
              checked { ++num; }
              Utils.GetDbm().LoadFanart(dbartist, filename.Replace("_tmp.jpg", "L.jpg"), sourceFilename, category, dbalbum, Utils.Provider.LastFM, null, mbid);
              ExternalAccess.InvokeScraperCompleted(category.ToString(), dbartist);
//.........这里部分代码省略.........
开发者ID:hkjensen,项目名称:mediaportal-fanart-handler,代码行数:101,代码来源:Scraper.cs

示例4: FanartTVGetPictures

    // End: Extract Fanart.TV URL

    // Begin: Fanart.TV Get Fanart/Tumbnails for Artist or Artist/Album
    public int FanartTVGetPictures(Utils.Category category, string id, string artist, string album, int iMax, bool doTriggerRefresh, bool externalAccess, bool doScrapeFanart, string info=null, bool onlyClearArt=false)
    {
      if (!doScrapeFanart || !Utils.UseFanartTV)
        return 0 ;

      var Method = (string) null;
      var Section = (string) null;
      var URL = (string) null;
      var FanArtAdd = (string) null;
      var html = (string) null;
      var flag = false;
      // var ScraperFlag = false;
      var num = 0;
      var URLList = new List<string>() ; 

      var dbartist = Utils.GetArtist(artist, Utils.Category.MusicFanartScraped) ;
      var dbalbum  = (category == Utils.Category.MusicAlbumThumbScraped) ? Utils.GetAlbum(album, Utils.Category.MusicFanartScraped) : null ;

      URL       = "http://webservice.fanart.tv/v3/" ;
      FanArtAdd = "{0}?api_key=" ;

      // Fanart.TV get Artist Fanart
      if (category == Utils.Category.MusicFanartScraped) {
        if (string.IsNullOrEmpty(artist)) {
          logger.Debug("Fanart.TV: GetFanart - Artist - Empty.");
          return 0 ;
        }
        Method = "Artist (Fanart): "+artist+" - "+id ;
        URL = URL + "music/" + FanArtAdd + ApiKeyFanartTV ;
        Section = "artistbackground";
        if (((iMax = iMax - Utils.GetDbm().GetNumberOfFanartImages(dbartist)) <= 0) && !onlyClearArt)
          return 8888 ;
      // Fanart.TV get Artist Tumbnails
      } else if (category == Utils.Category.MusicArtistThumbScraped) {
        if (string.IsNullOrEmpty(artist)) {
          logger.Debug("Fanart.TV: GetTumbnails - Artist - Empty.");
          return 0 ;
        }
        Method = "Artist (Thumbs): "+artist+" - "+id ;
        URL = URL + "music/" + FanArtAdd + ApiKeyFanartTV ;
        Section = "artistthumb";
      // Fanart.TV get Artist/Album Tumbnails
      } else if (category == Utils.Category.MusicAlbumThumbScraped) {
        if (string.IsNullOrEmpty(artist) && string.IsNullOrEmpty(album)) {
          logger.Debug("Fanart.TV: GetTumbnails - Artist/Album - Empty.");
          return 0 ;
        }
        Method = "Artist/Album (Thumbs): "+artist+" - "+album+" - "+id ;
        URL = URL + "music/albums/" + FanArtAdd + ApiKeyFanartTV ;
        Section = "albumcover";
      } else if (category == Utils.Category.MovieScraped) {
        if (string.IsNullOrEmpty(artist) && string.IsNullOrEmpty(id)) {
          logger.Debug("Fanart.TV: GetBackgrounds - Movies ID/IMDBID - Empty.");
          return 0 ;
        }
        Method = "Movies (Fanart): "+artist+" - "+id+" - "+info ;
        URL = URL + "movies/" + FanArtAdd + ApiKeyFanartTV ;
        Section = "moviebackground";
        if (iMax < 0)
          iMax = checked(Convert.ToInt32(Utils.ScraperMaxImages,CultureInfo.CurrentCulture));
        if ((iMax = iMax - Utils.GetDbm().GetNumberOfFanartImages(artist)) <= 0)
          return 8888 ;
      // Fanart.TV wrong Category ...
      } else {
        logger.Warn("Fanart.TV: GetPictures - wrong category - " + category.ToString() + ".");
        return 0;
      }

      // Add Fanart.TV personal API Key
      if (!string.IsNullOrEmpty(Utils.FanartTVPersonalAPIKey))
      {
        URL = URL+"&client_key="+Utils.FanartTVPersonalAPIKey;
      }
      logger.Debug("Fanart.TV: Use personal API Key: "+(!string.IsNullOrEmpty(Utils.FanartTVPersonalAPIKey)).ToString());

      try
      {
        logger.Debug("Fanart.TV: Trying to find pictures for "+Method+".");
        GetHtml(String.Format(URL,id.Trim()), out html) ;
        if (!onlyClearArt)
        {
          try
          {
            if (html != null) {
              if (html.Length > 0) 
              {
                URLList = ExtractURL(Section, html);
                if (URLList != null)
                  flag = (URLList.Count > 0);
              }
            }
          }
          catch (Exception ex)
          {
            logger.Error("Fanart.TV: Get URL: "+ex.ToString());
          }
        }
//.........这里部分代码省略.........
开发者ID:hkjensen,项目名称:mediaportal-fanart-handler,代码行数:101,代码来源:Scraper.cs

示例5: setValueSession

 /// <summary>
 /// Ressume da sessão
 /// </summary>
 /// <param name="hand"></param>
 /// <param name="loss"></param>
 /// <param name="time"></param>
 public void setValueSession(String hand, String time, Double bbs, Double bbmax, Double bb100)
 {
     if (resumesession)
     {
         textBoxRsHands.Text = hand;
         if (String.IsNullOrEmpty(time))
         {
             textBoxRsTime.Text = "00:00:00";
         }
         else
         {
             textBoxRsTime.Text = time;
         }
         textBoxBbsMax.Text = bbmax.ToString();
         if (bbmax > 0)
         {
             textBoxBbsMax.ForeColor = Color.Green;
             labelBbsMax.ForeColor = Color.Green;
         }
         if (bbs < 0)
         {
             textBoxRsBbs.Text = bbs.ToString();
             textBoxRsBbs.ForeColor = Color.Red;
             labelSessionBBs.ForeColor = Color.Red;
         }
         else
         {
             textBoxRsBbs.Text = bbs.ToString();
             textBoxRsBbs.ForeColor = Color.Green;
             labelSessionBBs.ForeColor = Color.Green;
         }
         if (bb100 < 0)
         {
             textBoxbb100.Text = bb100.ToString();
             textBoxbb100.ForeColor = Color.Red;
             labelbb100.ForeColor = Color.Red;
         }
         else
         {
             textBoxbb100.Text = bb100.ToString();
             textBoxbb100.ForeColor = Color.Green;
             labelbb100.ForeColor = Color.Green;
         }
         tabControlMain.SelectedTab = tabResumeSession;
     }
     //mas faço na mesma o history
     Int32 handsession = new Utils().stringtoInt32(hand);
     Int32 timesession = new Utils().stringTimeToMinute(time);
     if (handsession > histhands)
     {
         histhands = handsession;
         textBoxHistoryHands.Text = handsession.ToString();
     }
     if (timesession > histtime)
     {
         histtime = timesession;
         textBoxHistoryTime.Text = new Utils().intToStringTimer(timesession);
     }
     if (bbs < histbbsloss)
     {
         histbbsloss = bbs;
         textBoxHistoryBbsloss.Text = bbs.ToString();
     }
     if (bbs > histbbsmax)
     {
         histbbsmax = bbs;
         textBoxHistoryBbsMax.Text = bbs.ToString();
     }
     //aqui recuperar a hora e data.
     lastsession = DateTime.Now;
     //aqui para o cooldown
     if (checkBoxCooldown.Checked)
     {
         DataTable dt = dbsqlite.GetDataTable("select * from questionwc where enabled = 1 AND type = 'cooldown'");
         if (dt.Rows.Count > 0)
         {
             FormCoolDown fc = new FormCoolDown(dbsqlite);
             fc.Show();
         }
         else
         {
             MessageBox.Show("You haven't configure cooldown");
         }
     }
     //brm management
     bbbrm += bbs;
     checkBrm();
 }
开发者ID:ricain59,项目名称:fortaff,代码行数:94,代码来源:Main.cs

示例6: InsertDummyItem

        public void InsertDummyItem(string artist, string album, string mbid, Utils.Category category)
        {
            try
            {
                var DummyFile = string.Empty;

                if (category == Utils.Category.MusicArtistThumbScraped)
                {
                  DummyFile = Path.Combine(Utils.FAHMusicArtists, MediaPortal.Util.Utils.MakeFileName(artist) + ".jpg");
                }
                else if (category == Utils.Category.MusicAlbumThumbScraped)
                {
                  DummyFile = Path.Combine(Utils.FAHMusicAlbums, MediaPortal.Util.Utils.GetAlbumThumbName(artist, album));
                  if (DummyFile.IndexOf(".jpg") < 0)
                    DummyFile = DummyFile + ".jpg" ;
                }
                else if (category == Utils.Category.MusicFanartScraped)
                {
                  DummyFile = Path.Combine(Utils.FAHSMusic, MediaPortal.Util.Utils.MakeFileName(artist) + " (" + randNumber.Next(10000, 99999) + ").jpg");
                }
                else if (category == Utils.Category.MovieScraped)
                {
                  DummyFile = Path.Combine(Utils.FAHSMovies, artist.Trim() + "{99999}.jpg");
                }
                else
                {
                  logger.Warn("InsertDummyItem: Wrong category: " + category.ToString());
                  return;
                }

                var now = DateTime.Now;
                var SQL = string.Empty;
                DeleteDummyItem(artist, album, category) ;
                SQL = "INSERT INTO Image (Id, Category, Provider, Key1, Key2, FullPath, SourcePath, AvailableRandom, Enabled, DummyItem, Time_Stamp, MBID, Last_Access, Protected) "+
                                  "VALUES('" + Utils.PatchSql(DummyFile) + "', "+
                                         "'" + ((object) category).ToString() + "', "+
                                         "'" + ((object) Utils.Provider.Dummy).ToString() + "', "+
                                         "'" + Utils.PatchSql(artist) + "',"+
                                         "'" + Utils.PatchSql(album) + "', "+
                                         "null, "+
                                         "null, "+
                                         "'False', "+
                                         "'False', "+
                                         "'True', "+
                                         "'" + now.ToString("yyyyMMdd", CultureInfo.CurrentCulture) + "', "+
                                         "'" + Utils.PatchSql(mbid)+"', "+
                                         "'" + now.ToString("yyyyMMdd", CultureInfo.CurrentCulture) + "', "+
                                         "'False');";
                lock (lockObject)
                    dbClient.Execute(SQL);
            }
            catch (Exception ex)
            {
                logger.Error("InsertDummyItem: " + ex);
            }
        }
开发者ID:BobSilent,项目名称:mediaportal-fanart-handler,代码行数:56,代码来源:DatabaseManager.cs

示例7: ContainsID

 public static bool ContainsID(Hashtable ht, Utils.Logo logoType)
 {
     try
       {
     if (iActiveWindow > (int)GUIWindow.Window.WINDOW_INVALID)
     {
       return ContainsID(ht, sActiveWindow + logoType.ToString());
     }
       }
       catch { }
       return false;
 }
开发者ID:hkjensen,项目名称:mediaportal-fanart-handler,代码行数:12,代码来源:Utils.cs

示例8: handHive

        /// <summary>
        /// ver all hands file and create new file
        /// </summary>
        /// <param name="file"></param>
        /// <param name="filename"></param>
        private void handHive(String file, String filename)
        {
            String[] splitfile = file.Split(new string[] { "Hive Poker Game #" }, StringSplitOptions.RemoveEmptyEntries);
            String filefinal = "";

            //aqui ler ao contrario assim se o numero das hands se repete tipo 3x paro :)
            //foreach (String fi in splitfile)
            int repeathand = 0;
            for(int l = (splitfile.Length -1);l > 0;l--)
            {
                //Mulla 6-max - Blinds 0.01EUR/0.02EUR - No Limit Hold'em
                String limitplayed = new Utils().getNlHive(splitfile[l]);
                //String[] splitchangenametable = splitfile[l].Split(new string[] { "Table " }, StringSplitOptions.RemoveEmptyEntries);

                //String abc = removeBetween(splitchangenametable[1].ToString(), 'a', 'a');
                //String[] splitone = splitfile[l].Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries);

                //long oldnumberhand = Convert.ToInt64(splitone[0]);
                //tendo o numero antigo vou guardar na DB e dar o novo

                //string da hand
                String hand = splitfile[l];
                //obter o numero antigo da hand
                long oldnumberhand = new Utils().getOldNumberHandsHive(hand);
                //novo numero da hand
                long newhandnumber = newHandNumber(oldnumberhand);

                if (newhandnumber > 0)
                {
                    //vou mudar o numero na hand
                    hand = hand.Replace(oldnumberhand.ToString(), newhandnumber.ToString());
                    //agora mudar o nome da mesa
                    String oldnametable = new Utils().getNameTableHive(hand);
                    //change table name
                    hand = hand.Replace(oldnametable, oldnametable + limitplayed);
                    //filefinal += "PokerStars Hand #" + newhandnumber;
                    //for (int k = 1; k < splitone.Length; k++)
                    //{
                    //    filefinal += ":" + splitone[k];
                    //}
                    filefinal += "PokerStars Hand #" + hand;
                    handconverted++;
                }
                else
                {
                    repeathand++;
                }

                if (repeathand > 4) l = 0;

                //essa linha é só para testar o hud depois retirar
                //filefinal += "PokerStars Hand #" + fi;
            }
            //aqui crio o novo ficheiro
            if (!filefinal.Equals(""))
            {
                String icon_path = new Uri(folderconvertedhive).LocalPath;
                String dede = icon_path + "\\" + filename;
                StreamWriter w = new StreamWriter(dede, true);
                w.Write(filefinal);
                w.WriteLine();
                w.Close();
            }
        }
开发者ID:ricain59,项目名称:fortaff,代码行数:69,代码来源:FormInicial.cs

示例9: changeNumberHandHive

        private void changeNumberHandHive(String file, String filename)
        {
            String[] splitfile = file.Split(new string[] { "PokerStars Hand #" }, StringSplitOptions.RemoveEmptyEntries);
            String filefinal = "";

            //aqui ler ao contrario assim se o numero das hands se repete tipo 3x paro :)
            //foreach (String fi in splitfile)
            for (int l = (splitfile.Length - 1); l > 0; l--)
            {
                String hand = splitfile[l];
                //obter o numero antigo da hand
                long oldnumberhand = new Utils().getOldNumberHandsHive(hand);
                //novo numero da hand
                long newhandnumber = newHandNumber(oldnumberhand);

                Boolean verifynewnumber = true;
                while (verifynewnumber)
                {
                    if (newhandnumberhandDB < newhandnumber && newhandnumberhandDB != newhandnumber)
                    {
                        newhandnumberhandDB = newhandnumber;
                        verifynewnumber = false;
                    }
                    else
                    {
                        newhandnumber++;
                    }
                }

                if (newhandnumber > 0)
                {
                    //vou mudar o numero na hand
                    hand = hand.Replace(oldnumberhand.ToString(), newhandnumber.ToString());
                    filefinal += "PokerStars Hand #" + hand;
                    handconverted++;
                }
            }
            //aqui crio o novo ficheiro
            if (!filefinal.Equals(""))
            {
                String icon_path = new Uri(folder + "/new").LocalPath;
                String pathfinal = icon_path + "\\" + filename;
                StreamWriter w = new StreamWriter(pathfinal, true);
                w.Write(filefinal);
                w.WriteLine();
                w.Close();
            }
        }
开发者ID:ricain59,项目名称:fortaff,代码行数:48,代码来源:FormInicial.cs

示例10: FormEvaluation

 public FormEvaluation(SQLiteDatabase db, String[] time)
 {
     InitializeComponent();
     loadconfig();
     dbsqlite = db;
     timesql = time;
     //physical
     if (time[0] != "")
     {
         String value = dbsqlite.ExecuteScalar("select CAST(questionsdone AS REAL) / questionstotal from warmup where subtype = 'physical' and datequestions = '" + time[0] + "'");
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaPhysical.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaPhysical.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaPhysical.ForeColor = Color.Orange;
             }
             else
             {
                 labelEvaPhysical.ForeColor = Color.Green;
             }
         }
     }
     else
     {
         labelEvaPhysical.Text = "--%";
     }
     //mental
     if (time[1] != "")
     {
         String value = dbsqlite.ExecuteScalar("select CAST(questionsdone AS REAL) / questionstotal from warmup where subtype = 'mental' and datequestions = '" + time[1] + "'");
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaMental.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaMental.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaMental.ForeColor = Color.Orange;
             }
             else
             {
                 labelEvaMental.ForeColor = Color.Green;
             }
         }
     }
     else
     {
         labelEvaMental.Text = "--%";
     }
     //technical
     if (time[2] != "")
     {
         String value = dbsqlite.ExecuteScalar("select CAST(questionsdone AS REAL) / questionstotal from warmup where subtype = 'technical' and datequestions = '" + time[2] + "'");
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaTechnical.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaTechnical.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaTechnical.ForeColor = Color.Orange;
             }
             else
             {
                 labelEvaTechnical.ForeColor = Color.Green;
             }
         }
     }
     else
     {
         labelEvaTechnical.Text = "--%";
     }
     //practice
     if (time[3] != "")
     {
         String value = dbsqlite.ExecuteScalar("select CAST(questionsdone AS REAL) / questionstotal from warmup where subtype = 'practice' and datequestions = '" + time[3] + "'");
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaPractive.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaPractive.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaPractive.ForeColor = Color.Orange;
             }
//.........这里部分代码省略.........
开发者ID:ricain59,项目名称:fortaff,代码行数:101,代码来源:FormEvaluation.cs

示例11: ChangeEva

 private void ChangeEva(String start, String end)
 {
     //physical
     String value = dbsqlite.ExecuteScalar("select round((CAST(sum (questionsdone) AS REAL ) / sum (questionstotal)), 2) from warmup where subtype = 'physical' and datequestions >= '" + start + "' and datequestions <= '" + end + "'");
     if (value == "")
     {
         labelEvaPhysical.Text = "--%";
     }
     else
     {
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaPhysical.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaPhysical.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaPhysical.ForeColor = Color.Orange;
             }
             else
             {
                 labelEvaPhysical.ForeColor = Color.Green;
             }
         }
     }
     //mental
     value = dbsqlite.ExecuteScalar("select round((CAST(sum (questionsdone) AS REAL ) / sum (questionstotal)), 2) from warmup where subtype = 'mental' and datequestions >= '" + start + "' and datequestions <= '" + end + "'");
     if (value == "")
     {
         labelEvaMental.Text = "--%";
     }
     else
     {
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaMental.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaMental.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaMental.ForeColor = Color.Orange;
             }
             else
             {
                 labelEvaMental.ForeColor = Color.Green;
             }
         }
     }
     //technical
     value = dbsqlite.ExecuteScalar("select round((CAST(sum (questionsdone) AS REAL ) / sum (questionstotal)), 2) from warmup where subtype = 'technical' and datequestions >= '" + start + "' and datequestions <= '" + end + "'");
     if (value == "")
     {
         labelEvaTechnical.Text = "--%";
     }
     else
     {
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaTechnical.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaTechnical.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaTechnical.ForeColor = Color.Orange;
             }
             else
             {
                 labelEvaTechnical.ForeColor = Color.Green;
             }
         }
     }
     //practice
     value = dbsqlite.ExecuteScalar("select round((CAST(sum (questionsdone) AS REAL ) / sum (questionstotal)), 2) from warmup where subtype = 'practice' and datequestions >= '" + start + "' and datequestions <= '" + end + "'");
     if (value == "")
     {
         labelEvaPractive.Text = "--%";
     }
     else
     {
         Double evaphysical = new Utils().stringtoDouble(value) * 100;
         labelEvaPractive.Text = evaphysical.ToString() + "%";
         if (evaphysical <= 50)
         {
             labelEvaPractive.ForeColor = Color.Red;
         }
         else
         {
             if (evaphysical > 50 && evaphysical < 75)
             {
                 labelEvaPractive.ForeColor = Color.Orange;
             }
//.........这里部分代码省略.........
开发者ID:ricain59,项目名称:fortaff,代码行数:101,代码来源:FormViewEvaluation.cs


注:本文中的Utils.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。