Exemplo n.º 1
0
 public static KeyAssignProfile FromFile(string path)
 {
     var name = Path.GetFileNameWithoutExtension(path);
     var profile = new KeyAssignProfile(name);
     using (var stream = File.OpenRead(path))
     using (var reader = new StreamReader(stream))
     {
         profile.SetAssigns(EnumerableEx.Generate(
             reader,
             r => !r.EndOfStream,
             r => r,
             r => r.ReadLine() ?? ""));
     }
     return profile;
 }
Exemplo n.º 2
0
        public static KeyAssignProfile FromFile(string path)
        {
            var name    = Path.GetFileNameWithoutExtension(path);
            var profile = new KeyAssignProfile(name);

            using (var stream = File.OpenRead(path))
                using (var reader = new StreamReader(stream))
                {
                    profile.SetAssigns(EnumerableEx.Generate(
                                           reader,
                                           r => !r.EndOfStream,
                                           r => r,
                                           r => r.ReadLine() ?? ""));
                }
            return(profile);
        }
Exemplo n.º 3
0
 public void AddNewKeyAssign()
 {
     var response = this.Messenger.GetResponse(new TransitionMessage(typeof(AddNewKeyAssignDialog),
         new AddNewKeyAssignDialogViewModel(), TransitionMode.Modal));
     var tranvm = (AddNewKeyAssignDialogViewModel)response.TransitionViewModel;
     if (tranvm.Result)
     {
         var assign = new KeyAssignProfile(tranvm.FileName);
         if (tranvm.IsCreateAsCopy)
         {
             assign.SetAssigns(
                 KeyAssignManager.CurrentProfile
                                 .ToString()
                                 .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
         }
         assign.Save(KeyAssignManager.KeyAssignsProfileDirectoryPath);
         RefreshKeyAssignCandidates();
     }
 }
 public void ClearCurrentProfile()
 {
     _profile = null;
 }