public static GetAvatar ( string email, int size, string target_path ) : string | ||
string | ||
size | int | |
target_path | string | |
리턴 | string |
public NoteController() { SparkleShare.Controller.ShowNoteWindowEvent += OnNoteWindowEvent; if (SparkleShare.Controller.AvatarsEnabled && !SparkleShare.Controller.FirstRun) { AvatarFilePath = Avatars.GetAvatar(SparkleShare.Controller.CurrentUser.Email, 48, SparkleShare.Controller.Config.DirectoryPath, SparkleShare.Controller.AvatarsProvider); } }
private string GetAvatarFilePath(User user) { if (!SparkleShare.Controller.AvatarsEnabled) { return("<!-- $pixmaps-path -->/user-icon-default.png"); } string fetched_avatar = Avatars.GetAvatar(user.Email, 48, SparkleShare.Controller.Config.DirectoryPath); if (!string.IsNullOrEmpty(fetched_avatar)) { return("file://" + fetched_avatar.Replace("\\", "/")); } else { return("<!-- $pixmaps-path -->/user-icon-default.png"); } }
void AddRepository(string folder_path) { BaseRepository repo = null; string folder_name = Path.GetFileName(folder_path); string backend = Config.BackendByName(folder_name); try { repo = (BaseRepository)Activator.CreateInstance( Type.GetType("Sparkles." + backend + "." + backend + "Repository, Sparkles." + backend), new object [] { folder_path, Config, SSHAuthenticationInfo.DefaultAuthenticationInfo }); } catch (Exception e) { Logger.LogInfo("Controller", "Failed to load backend '" + backend + "' for '" + folder_name + "': ", e); return; } repo.ChangesDetected += delegate { UpdateState(); }; repo.SyncStatusChanged += delegate(SyncStatus status) { if (status == SyncStatus.Idle) { ProgressPercentage = 0.0; ProgressSpeedUp = 0.0; ProgressSpeedDown = 0.0; ProgressInformation = ""; } UpdateState(); }; repo.ProgressChanged += delegate { ProgressPercentage = 0.0; ProgressSpeedUp = 0.0; ProgressSpeedDown = 0.0; ProgressInformation = ""; double percentage = 0.0; int repo_count = 0; foreach (BaseRepository rep in Repositories) { if (rep.ProgressPercentage > 0) { percentage += rep.ProgressPercentage; repo_count++; } if (rep.Status == SyncStatus.SyncUp) { ProgressSpeedUp += rep.ProgressSpeed; } if (rep.Status == SyncStatus.SyncDown) { ProgressSpeedDown += rep.ProgressSpeed; } } if (repo_count == 1) { ProgressInformation = repo.ProgressInformation; } if (repo_count > 0) { ProgressPercentage = percentage / repo_count; } UpdateState(); }; repo.NewChangeSet += delegate(ChangeSet change_set) { if (AvatarsEnabled) { string provider = "gravatar"; if (AvatarsProvider == "libravatar") { provider = AvatarsProvider; } change_set.User.AvatarFilePath = Avatars.GetAvatar(change_set.User.Email, 48, Config.DirectoryPath, provider); } NotificationRaised(change_set); }; repo.ConflictResolved += delegate { AlertNotificationRaised("Resolved a file collision", "Local and server versions were kept."); }; AddRepository(repo); repo.Initialize(); }