forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.cs
1275 lines (1093 loc) · 50.2 KB
/
Settings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using GitCommands.Config;
using GitCommands.Logging;
using GitCommands.Repository;
using Microsoft.Win32;
namespace GitCommands
{
public enum LocalChangesAction
{
DontChange,
Merge,
Reset,
Stash
}
public static class Settings
{
//semi-constants
public static readonly string GitExtensionsVersionString;
public static readonly int GitExtensionsVersionInt;
public static readonly char PathSeparator = '\\';
public static readonly char PathSeparatorWrong = '/';
private static readonly Dictionary<String, object> ByNameMap = new Dictionary<String, object>();
static Settings()
{
Version version = Assembly.GetCallingAssembly().GetName().Version;
GitExtensionsVersionString = version.Major.ToString() + '.' + version.Minor.ToString();
GitExtensionsVersionInt = version.Major * 100 + version.Minor;
if (version.Build > 0)
{
GitExtensionsVersionString += '.' + version.Build.ToString();
GitExtensionsVersionInt = GitExtensionsVersionInt * 100 + version.Build;
}
if (!RunningOnWindows())
{
PathSeparator = '/';
PathSeparatorWrong = '\\';
}
GitLog = new CommandLogger();
//Make applicationdatapath version dependent
ApplicationDataPath = Application.UserAppDataPath.Replace(Application.ProductVersion, string.Empty);
}
private static int? _UserMenuLocationX;
public static int UserMenuLocationX
{
get { return SafeGet("usermenulocationx", -1, ref _UserMenuLocationX); }
set { SafeSet("usermenulocationx", value, ref _UserMenuLocationX); }
}
private static int? _UserMenuLocationY;
public static int UserMenuLocationY
{
get { return SafeGet("usermenulocationy", -1, ref _UserMenuLocationY); }
set { SafeSet("usermenulocationy", value, ref _UserMenuLocationY); }
}
private static bool? _stashKeepIndex;
public static bool StashKeepIndex
{
get { return SafeGet("stashkeepindex", false, ref _stashKeepIndex); }
set { SafeSet("stashkeepindex", value, ref _stashKeepIndex); }
}
private static bool? _stashConfirmDropShow;
public static bool StashConfirmDropShow
{
get { return SafeGet("stashconfirmdropshow", true, ref _stashConfirmDropShow); }
set { SafeSet("stashconfirmdropshow", value, ref _stashConfirmDropShow); }
}
private static bool? _applyPatchIgnoreWhitespace;
public static bool ApplyPatchIgnoreWhitespace
{
get { return SafeGet("applypatchignorewhitespace", false, ref _applyPatchIgnoreWhitespace); }
set { SafeSet("applypatchignorewhitespace", value, ref _applyPatchIgnoreWhitespace); }
}
private static bool? _usePatienceDiffAlgorithm;
public static bool UsePatienceDiffAlgorithm
{
get { return SafeGet("usepatiencediffalgorithm", false, ref _usePatienceDiffAlgorithm); }
set { SafeSet("usepatiencediffalgorithm", value, ref _usePatienceDiffAlgorithm); }
}
private static bool? _showErrorsWhenStagingFiles;
public static bool ShowErrorsWhenStagingFiles
{
get { return SafeGet("showerrorswhenstagingfiles", true, ref _showErrorsWhenStagingFiles); }
set { SafeSet("showerrorswhenstagingfiles", value, ref _showErrorsWhenStagingFiles); }
}
private static string _lastCommitMessage;
public static string LastCommitMessage
{
get { return SafeGet("lastCommitMessage", "", ref _lastCommitMessage); }
set { SafeSet("lastCommitMessage", value, ref _lastCommitMessage); }
}
private static string _truncatePathMethod;
public static string TruncatePathMethod
{
get { return SafeGet("truncatepathmethod", "none", ref _truncatePathMethod); }
set { SafeSet("truncatepathmethod", value, ref _truncatePathMethod); }
}
private static bool? _showGitStatusInBrowseToolbar;
public static bool ShowGitStatusInBrowseToolbar
{
get { return SafeGet("showgitstatusinbrowsetoolbar", true, ref _showGitStatusInBrowseToolbar); }
set { SafeSet("showgitstatusinbrowsetoolbar", value, ref _showGitStatusInBrowseToolbar); }
}
public static bool CommitInfoShowContainedInBranches
{
get
{
return CommitInfoShowContainedInBranchesLocal ||
CommitInfoShowContainedInBranchesRemote ||
CommitInfoShowContainedInBranchesRemoteIfNoLocal;
}
}
private static bool? _commitInfoShowContainedInBranchesLocal;
public static bool CommitInfoShowContainedInBranchesLocal
{
get { return SafeGet("commitinfoshowcontainedinbrancheslocal", true, ref _commitInfoShowContainedInBranchesLocal); }
set { SafeSet("commitinfoshowcontainedinbrancheslocal", value, ref _commitInfoShowContainedInBranchesLocal); }
}
private static bool? _checkForUncommittedChangesInCheckoutBranch;
public static bool CheckForUncommittedChangesInCheckoutBranch
{
get { return SafeGet("checkforuncommittedchangesincheckoutbranch", false, ref _checkForUncommittedChangesInCheckoutBranch); }
set { SafeSet("checkforuncommittedchangesincheckoutbranch", value, ref _checkForUncommittedChangesInCheckoutBranch); }
}
public static bool AlwaysShowCheckoutBranchDlg
{
get { return GetBool("AlwaysShowCheckoutBranchDlg", false).Value; }
set { SetBool("AlwaysShowCheckoutBranchDlg", value); }
}
private static bool? _commitInfoShowContainedInBranchesRemote;
public static bool CommitInfoShowContainedInBranchesRemote
{
get { return SafeGet("commitinfoshowcontainedinbranchesremote", false, ref _commitInfoShowContainedInBranchesRemote); }
set { SafeSet("commitinfoshowcontainedinbranchesremote", value, ref _commitInfoShowContainedInBranchesRemote); }
}
private static bool? _commitInfoShowContainedInBranchesRemoteIfNoLocal;
public static bool CommitInfoShowContainedInBranchesRemoteIfNoLocal
{
get { return SafeGet("commitinfoshowcontainedinbranchesremoteifnolocal", false, ref _commitInfoShowContainedInBranchesRemoteIfNoLocal); }
set { SafeSet("commitinfoshowcontainedinbranchesremoteifnolocal", value, ref _commitInfoShowContainedInBranchesRemoteIfNoLocal); }
}
private static bool? _commitInfoShowContainedInTags;
public static bool CommitInfoShowContainedInTags
{
get { return SafeGet("commitinfoshowcontainedintags", true, ref _commitInfoShowContainedInTags); }
set { SafeSet("commitinfoshowcontainedintags", value, ref _commitInfoShowContainedInTags); }
}
public static string ApplicationDataPath { get; private set; }
public static string GravatarCachePath
{
get { return ApplicationDataPath + "Images\\"; }
}
private static string _translation;
public static string Translation
{
get { return SafeGet("translation", "", ref _translation); }
set { SafeSet("translation", value, ref _translation); }
}
private static string _currentTranslation;
public static string CurrentTranslation
{
get { return _currentTranslation ?? Translation; }
set { _currentTranslation = value; }
}
private static bool? _userProfileHomeDir;
public static bool UserProfileHomeDir
{
get { return SafeGet("userprofilehomedir", false, ref _userProfileHomeDir); }
set { SafeSet("userprofilehomedir", value, ref _userProfileHomeDir); }
}
private static string _customHomeDir;
public static string CustomHomeDir
{
get { return SafeGet("customhomedir", "", ref _customHomeDir); }
set { SafeSet("customhomedir", value, ref _customHomeDir); }
}
private static bool? _enableAutoScale;
public static bool EnableAutoScale
{
get { return SafeGet("enableautoscale", true, ref _enableAutoScale); }
set { SafeSet("enableautoscale", value, ref _enableAutoScale); }
}
private static string _iconColor;
public static string IconColor
{
get { return SafeGet("iconcolor", "default", ref _iconColor); }
set { SafeSet("iconcolor", value, ref _iconColor); }
}
private static string _iconStyle;
public static string IconStyle
{
get { return SafeGet("iconstyle", "default", ref _iconStyle); }
set { SafeSet("iconstyle", value, ref _iconStyle); }
}
private static int? _authorImageSize;
public static int AuthorImageSize
{
get { return SafeGet("authorimagesize", 80, ref _authorImageSize); }
set { SafeSet("authorimagesize", value, ref _authorImageSize); }
}
private static int? _authorImageCacheDays;
public static int AuthorImageCacheDays
{
get { return SafeGet("authorimagecachedays", 5, ref _authorImageCacheDays); }
set { SafeSet("authorimagecachedays", value, ref _authorImageCacheDays); }
}
private static bool? _showAuthorGravatar;
public static bool ShowAuthorGravatar
{
get { return SafeGet("showauthorgravatar", true, ref _showAuthorGravatar); }
set { SafeSet("showauthorgravatar", value, ref _showAuthorGravatar); }
}
private static bool? _closeCommitDialogAfterCommit;
public static bool CloseCommitDialogAfterCommit
{
get { return SafeGet("closecommitdialogaftercommit", true, ref _closeCommitDialogAfterCommit); }
set { SafeSet("closecommitdialogaftercommit", value, ref _closeCommitDialogAfterCommit); }
}
private static bool? _closeCommitDialogAfterLastCommit;
public static bool CloseCommitDialogAfterLastCommit
{
get { return SafeGet("closecommitdialogafterlastcommit", true, ref _closeCommitDialogAfterLastCommit); }
set { SafeSet("closecommitdialogafterlastcommit", value, ref _closeCommitDialogAfterLastCommit); }
}
private static bool? _refreshCommitDialogOnFormFocus;
public static bool RefreshCommitDialogOnFormFocus
{
get { return SafeGet("refreshcommitdialogonformfocus", false, ref _refreshCommitDialogOnFormFocus); }
set { SafeSet("refreshcommitdialogonformfocus", value, ref _refreshCommitDialogOnFormFocus); }
}
private static bool? _stageInSuperprojectAfterCommit;
public static bool StageInSuperprojectAfterCommit
{
get { return SafeGet("stageinsuperprojectaftercommit", true, ref _stageInSuperprojectAfterCommit); }
set { SafeSet("stageinsuperprojectaftercommit", value, ref _stageInSuperprojectAfterCommit); }
}
private static bool? _PlaySpecialStartupSound;
public static bool PlaySpecialStartupSound
{
get { return SafeGet("PlaySpecialStartupSound", false, ref _PlaySpecialStartupSound); }
set { SafeSet("PlaySpecialStartupSound", value, ref _PlaySpecialStartupSound); }
}
private static bool? _followRenamesInFileHistory;
public static bool FollowRenamesInFileHistory
{
get { return SafeGet("followrenamesinfilehistory", true, ref _followRenamesInFileHistory); }
set { SafeSet("followrenamesinfilehistory", value, ref _followRenamesInFileHistory); }
}
private static bool? _fullHistoryInFileHistory;
public static bool FullHistoryInFileHistory
{
get { return SafeGet("fullhistoryinfilehistory", false, ref _fullHistoryInFileHistory); }
set { SafeSet("fullhistoryinfilehistory", value, ref _fullHistoryInFileHistory); }
}
public static bool LoadFileHistoryOnShow
{
get { return GetBool("LoadFileHistoryOnShow", true).Value; }
set { SetBool("LoadFileHistoryOnShow", value); }
}
public static bool LoadBlameOnShow
{
get { return GetBool("LoadBlameOnShow", true).Value; }
set { SetBool("LoadBlameOnShow", value); }
}
private static bool? _revisionGraphShowWorkingDirChanges;
public static bool RevisionGraphShowWorkingDirChanges
{
get { return SafeGet("revisiongraphshowworkingdirchanges", false, ref _revisionGraphShowWorkingDirChanges); }
set { SafeSet("revisiongraphshowworkingdirchanges", value, ref _revisionGraphShowWorkingDirChanges); }
}
private static bool? _revisionGraphDrawNonRelativesGray;
public static bool RevisionGraphDrawNonRelativesGray
{
get { return SafeGet("revisiongraphdrawnonrelativesgray", true, ref _revisionGraphDrawNonRelativesGray); }
set { SafeSet("revisiongraphdrawnonrelativesgray", value, ref _revisionGraphDrawNonRelativesGray); }
}
private static bool? _revisionGraphDrawNonRelativesTextGray;
public static bool RevisionGraphDrawNonRelativesTextGray
{
get { return SafeGet("revisiongraphdrawnonrelativestextgray", false, ref _revisionGraphDrawNonRelativesTextGray); }
set { SafeSet("revisiongraphdrawnonrelativestextgray", value, ref _revisionGraphDrawNonRelativesTextGray); }
}
public static readonly Dictionary<string, Encoding> AvailableEncodings = new Dictionary<string, Encoding>();
private static readonly Dictionary<string, Encoding> EncodingSettings = new Dictionary<string, Encoding>();
internal static bool GetEncoding(string settingName, out Encoding encoding)
{
lock (EncodingSettings)
{
return EncodingSettings.TryGetValue(settingName, out encoding);
}
}
internal static void SetEncoding(string settingName, Encoding encoding)
{
lock (EncodingSettings)
{
var items = EncodingSettings.Keys.Where(item => item.StartsWith(settingName)).ToList();
foreach (var item in items)
EncodingSettings.Remove(item);
EncodingSettings[settingName] = encoding;
}
}
public enum PullAction
{
None,
Merge,
Rebase,
Fetch,
FetchAll
}
public static PullAction PullMerge
{
get { return GetEnum<PullAction>("pullmerge", PullAction.Merge); }
set { SetEnum<PullAction>("pullmerge", value); }
}
public static bool DonSetAsLastPullAction
{
get { return GetBool("DonSetAsLastPullAction", true).Value; }
set { SetBool("DonSetAsLastPullAction", value); }
}
private static string _smtp;
public static string Smtp
{
get { return SafeGet("smtp", "", ref _smtp); }
set { SafeSet("smtp", value, ref _smtp); }
}
private static bool? _autoStash;
public static bool AutoStash
{
get { return SafeGet("autostash", false, ref _autoStash); }
set { SafeSet("autostash", value, ref _autoStash); }
}
public static LocalChangesAction CheckoutBranchAction
{
get { return GetEnum("checkoutbranchaction", LocalChangesAction.DontChange); }
set { SetEnum("checkoutbranchaction", value); }
}
public static bool UseDefaultCheckoutBranchAction
{
get { return GetBool("UseDefaultCheckoutBranchAction", false).Value; }
set { SetBool("UseDefaultCheckoutBranchAction", value); }
}
public static bool DontShowHelpImages
{
get { return GetBool("DontShowHelpImages", false).Value; }
set { SetBool("DontShowHelpImages", value); }
}
public static bool DontConfirmAmend
{
get { return GetBool("DontConfirmAmend", false).Value; }
set { SetBool("DontConfirmAmend", value); }
}
public static bool? AutoPopStashAfterPull
{
get { return GetBool("AutoPopStashAfterPull", null); }
set { SetBool("AutoPopStashAfterPull", value); }
}
public static bool? AutoPopStashAfterCheckoutBranch
{
get { return GetBool("AutoPopStashAfterCheckoutBranch", null); }
set { SetBool("AutoPopStashAfterCheckoutBranch", value); }
}
public static bool DontConfirmPushNewBranch
{
get { return GetBool("DontConfirmPushNewBranch", false).Value; }
set { SetBool("DontConfirmPushNewBranch", value); }
}
public static bool DontConfirmAddTrackingRef
{
get { return GetBool("DontConfirmAddTrackingRef", false).Value; }
set { SetBool("DontConfirmAddTrackingRef", value); }
}
private static bool? _includeUntrackedFilesInAutoStash;
public static bool IncludeUntrackedFilesInAutoStash
{
get { return SafeGet("includeUntrackedFilesInAutoStash", true, ref _includeUntrackedFilesInAutoStash); }
set { SafeSet("includeUntrackedFilesInAutoStash", value, ref _includeUntrackedFilesInAutoStash); }
}
private static bool? _includeUntrackedFilesInManualStash;
public static bool IncludeUntrackedFilesInManualStash
{
get { return SafeGet("includeUntrackedFilesInManualStash", true, ref _includeUntrackedFilesInManualStash); }
set { SafeSet("includeUntrackedFilesInManualStash", value, ref _includeUntrackedFilesInManualStash); }
}
private static bool? _orderRevisionByDate;
public static bool OrderRevisionByDate
{
get { return SafeGet("orderrevisionbydate", true, ref _orderRevisionByDate); }
set { SafeSet("orderrevisionbydate", value, ref _orderRevisionByDate); }
}
private static string _dictionary;
public static string Dictionary
{
get { return SafeGet("dictionary", "en-US", ref _dictionary); }
set { SafeSet("dictionary", value, ref _dictionary); }
}
private static bool? _showGitCommandLine;
public static bool ShowGitCommandLine
{
get { return SafeGet("showgitcommandline", false, ref _showGitCommandLine); }
set { SafeSet("showgitcommandline", value, ref _showGitCommandLine); }
}
private static bool? _showStashCount;
public static bool ShowStashCount
{
get { return SafeGet("showstashcount", false, ref _showStashCount); }
set { SafeSet("showstashcount", value, ref _showStashCount); }
}
private static bool? _relativeDate;
public static bool RelativeDate
{
get { return SafeGet("relativedate", true, ref _relativeDate); }
set { SafeSet("relativedate", value, ref _relativeDate); }
}
private static bool? _useFastChecks;
public static bool UseFastChecks
{
get { return SafeGet("usefastchecks", false, ref _useFastChecks); }
set { SafeSet("usefastchecks", value, ref _useFastChecks); }
}
private static bool? _showGitNotes;
public static bool ShowGitNotes
{
get { return SafeGet("showgitnotes", false, ref _showGitNotes); }
set { SafeSet("showgitnotes", value, ref _showGitNotes); }
}
private static int? _revisionGraphLayout;
public static int RevisionGraphLayout
{
get { return SafeGet("revisiongraphlayout", 2, ref _revisionGraphLayout); }
set { SafeSet("revisiongraphlayout", value, ref _revisionGraphLayout); }
}
private static bool? _showAuthorDate;
public static bool ShowAuthorDate
{
get { return SafeGet("showauthordate", true, ref _showAuthorDate); }
set { SafeSet("showauthordate", value, ref _showAuthorDate); }
}
private static bool? _closeProcessDialog;
public static bool CloseProcessDialog
{
get { return SafeGet("closeprocessdialog", false, ref _closeProcessDialog); }
set { SafeSet("closeprocessdialog", value, ref _closeProcessDialog); }
}
private static bool? _showCurrentBranchOnly;
public static bool ShowCurrentBranchOnly
{
get { return SafeGet("showcurrentbranchonly", false, ref _showCurrentBranchOnly); }
set { SafeSet("showcurrentbranchonly", value, ref _showCurrentBranchOnly); }
}
private static bool? _branchFilterEnabled;
public static bool BranchFilterEnabled
{
get { return SafeGet("branchfilterenabled", false, ref _branchFilterEnabled); }
set { SafeSet("branchfilterenabled", value, ref _branchFilterEnabled); }
}
private static int? _commitDialogSplitter;
public static int CommitDialogSplitter
{
get { return SafeGet("commitdialogsplitter", -1, ref _commitDialogSplitter); }
set { SafeSet("commitdialogsplitter", value, ref _commitDialogSplitter); }
}
private static int? _commitDialogRightSplitter;
public static int CommitDialogRightSplitter
{
get { return SafeGet("commitdialogrightsplitter", -1, ref _commitDialogRightSplitter); }
set { SafeSet("commitdialogrightsplitter", value, ref _commitDialogRightSplitter); }
}
private static int? _revisionGridQuickSearchTimeout;
public static int RevisionGridQuickSearchTimeout
{
get { return SafeGet("revisiongridquicksearchtimeout", 750, ref _revisionGridQuickSearchTimeout); }
set { SafeSet("revisiongridquicksearchtimeout", value, ref _revisionGridQuickSearchTimeout); }
}
private static string _gravatarFallbackService;
public static string GravatarFallbackService
{
get { return SafeGet("gravatarfallbackservice", "Identicon", ref _gravatarFallbackService); }
set { SafeSet("gravatarfallbackservice", value, ref _gravatarFallbackService); }
}
private static string _gitCommand;
public static string GitCommand
{
get { return SafeGet("gitcommand", "git", ref _gitCommand); }
set { SafeSet("gitcommand", value, ref _gitCommand); }
}
private static string _gitBinDir;
public static string GitBinDir
{
get { return SafeGet("gitbindir", "", ref _gitBinDir); }
set
{
var temp = value;
if (temp.Length > 0 && temp[temp.Length - 1] != PathSeparator)
temp += PathSeparator;
SafeSet("gitbindir", temp, ref _gitBinDir);
//if (string.IsNullOrEmpty(_gitBinDir))
// return;
//var path =
// Environment.GetEnvironmentVariable("path", EnvironmentVariableTarget.Process) + ";" +
// _gitBinDir;
//Environment.SetEnvironmentVariable("path", path, EnvironmentVariableTarget.Process);
}
}
private static int? _maxRevisionGraphCommits;
public static int MaxRevisionGraphCommits
{
get { return SafeGet("maxrevisiongraphcommits", 100000, ref _maxRevisionGraphCommits); }
set { SafeSet("maxrevisiongraphcommits", value, ref _maxRevisionGraphCommits); }
}
public static string RecentWorkingDir
{
get { return GetString("RecentWorkingDir", null); }
set { SetString("RecentWorkingDir", value); }
}
public static bool StartWithRecentWorkingDir
{
get { return GetBool("StartWithRecentWorkingDir", false).Value; }
set { SetBool("StartWithRecentWorkingDir", value); }
}
public static CommandLogger GitLog { get; private set; }
private static string _plink;
public static string Plink
{
get { return SafeGet("plink", "", ref _plink); }
set { SafeSet("plink", value, ref _plink); }
}
private static string _puttygen;
public static string Puttygen
{
get { return SafeGet("puttygen", "", ref _puttygen); }
set { SafeSet("puttygen", value, ref _puttygen); }
}
private static string _pageant;
public static string Pageant
{
get { return SafeGet("pageant", "", ref _pageant); }
set { SafeSet("pageant", value, ref _pageant); }
}
private static bool? _autoStartPageant;
public static bool AutoStartPageant
{
get { return SafeGet("autostartpageant", true, ref _autoStartPageant); }
set { SafeSet("autostartpageant", value, ref _autoStartPageant); }
}
private static bool? _markIllFormedLinesInCommitMsg;
public static bool MarkIllFormedLinesInCommitMsg
{
get { return SafeGet("markillformedlinesincommitmsg", false, ref _markIllFormedLinesInCommitMsg); }
set { SafeSet("markillformedlinesincommitmsg", value, ref _markIllFormedLinesInCommitMsg); }
}
#region Colors
private static Color? _otherTagColor;
public static Color OtherTagColor
{
get { return SafeGet("othertagcolor", Color.Gray, ref _otherTagColor); }
set { SafeSet("othertagcolor", value, ref _otherTagColor); }
}
private static Color? _tagColor;
public static Color TagColor
{
get { return SafeGet("tagcolor", Color.DarkBlue, ref _tagColor); }
set { SafeSet("tagcolor", value, ref _tagColor); }
}
private static Color? _graphColor;
public static Color GraphColor
{
get { return SafeGet("graphcolor", Color.DarkRed, ref _graphColor); }
set { SafeSet("graphcolor", value, ref _graphColor); }
}
private static Color? _branchColor;
public static Color BranchColor
{
get { return SafeGet("branchcolor", Color.DarkRed, ref _branchColor); }
set { SafeSet("branchcolor", value, ref _branchColor); }
}
private static Color? _remoteBranchColor;
public static Color RemoteBranchColor
{
get { return SafeGet("remotebranchcolor", Color.Green, ref _remoteBranchColor); }
set { SafeSet("remotebranchcolor", value, ref _remoteBranchColor); }
}
private static Color? _diffSectionColor;
public static Color DiffSectionColor
{
get { return SafeGet("diffsectioncolor", Color.FromArgb(230, 230, 230), ref _diffSectionColor); }
set { SafeSet("diffsectioncolor", value, ref _diffSectionColor); }
}
private static Color? _diffRemovedColor;
public static Color DiffRemovedColor
{
get { return SafeGet("diffremovedcolor", Color.FromArgb(255, 200, 200), ref _diffRemovedColor); }
set { SafeSet("diffremovedcolor", value, ref _diffRemovedColor); }
}
private static Color? _diffRemovedExtraColor;
public static Color DiffRemovedExtraColor
{
get { return SafeGet("diffremovedextracolor", Color.FromArgb(255, 150, 150), ref _diffRemovedExtraColor); }
set { SafeSet("diffremovedextracolor", value, ref _diffRemovedExtraColor); }
}
private static Color? _diffAddedColor;
public static Color DiffAddedColor
{
get { return SafeGet("diffaddedcolor", Color.FromArgb(200, 255, 200), ref _diffAddedColor); }
set { SafeSet("diffaddedcolor", value, ref _diffAddedColor); }
}
private static Color? _diffAddedExtraColor;
public static Color DiffAddedExtraColor
{
get { return SafeGet("diffaddedextracolor", Color.FromArgb(135, 255, 135), ref _diffAddedExtraColor); }
set { SafeSet("diffaddedextracolor", value, ref _diffAddedExtraColor); }
}
private static Font _diffFont;
public static Font DiffFont
{
get { return SafeGet("difffont", new Font("Courier New", 10), ref _diffFont); }
set { SafeSet("difffont", value, ref _diffFont); }
}
private static Font _commitFont;
public static Font CommitFont
{
get { return SafeGet("commitfont", new Font(SystemFonts.MessageBoxFont.Name, SystemFonts.MessageBoxFont.Size), ref _commitFont); }
set { SafeSet("commitfont", value, ref _commitFont); }
}
private static Font _font;
public static Font Font
{
get { return SafeGet("font", new Font(SystemFonts.MessageBoxFont.Name, SystemFonts.MessageBoxFont.Size), ref _font); }
set { SafeSet("font", value, ref _font); }
}
#endregion
private static bool? _multicolorBranches;
public static bool MulticolorBranches
{
get { return SafeGet("multicolorbranches", true, ref _multicolorBranches); }
set { SafeSet("multicolorbranches", value, ref _multicolorBranches); }
}
private static bool? _stripedBranchChange;
public static bool StripedBranchChange
{
get { return SafeGet("stripedbranchchange", true, ref _stripedBranchChange); }
set { SafeSet("stripedbranchchange", value, ref _stripedBranchChange); }
}
private static bool? _branchBorders;
public static bool BranchBorders
{
get { return SafeGet("branchborders", true, ref _branchBorders); }
set { SafeSet("branchborders", value, ref _branchBorders); }
}
private static bool? _showCurrentBranchInVisualStudio;
public static bool ShowCurrentBranchInVisualStudio
{
//This setting MUST be set to false by default, otherwise it will not work in Visual Studio without
//other changes in the Visual Studio plugin itself.
get { return SafeGet("showcurrentbranchinvisualstudio", true, ref _showCurrentBranchInVisualStudio); }
set { SafeSet("showcurrentbranchinvisualstudio", value, ref _showCurrentBranchInVisualStudio); }
}
private static string _lastFormatPatchDir;
public static string LastFormatPatchDir
{
get { return SafeGet("lastformatpatchdir", "", ref _lastFormatPatchDir); }
set { SafeSet("lastformatpatchdir", value, ref _lastFormatPatchDir); }
}
public static string GetDictionaryDir()
{
return GetInstallDir() + "\\Dictionaries\\";
}
public static string GetInstallDir()
{
return GetValue("InstallDir", "");
}
public static void SetInstallDir(string dir)
{
if (VersionIndependentRegKey != null)
SetValue("InstallDir", dir);
}
public static bool RunningOnWindows()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
case PlatformID.WinCE:
return true;
default:
return false;
}
}
public static bool RunningOnUnix()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Unix:
return true;
default:
return false;
}
}
public static bool RunningOnMacOSX()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.MacOSX:
return true;
default:
return false;
}
}
public static void SaveSettings()
{
try
{
SetValue("gitssh", GitCommandHelpers.GetSsh());
Repositories.SaveSettings();
}
catch
{ }
}
public static void LoadSettings()
{
Action<Encoding> addEncoding = delegate(Encoding e) { AvailableEncodings[e.HeaderName] = e; };
addEncoding(Encoding.Default);
addEncoding(new ASCIIEncoding());
addEncoding(new UnicodeEncoding());
addEncoding(new UTF7Encoding());
addEncoding(new UTF8Encoding());
try
{
TransferVerDependentReg();
}
catch
{ }
try
{
GitCommandHelpers.SetSsh(GetValue<string>("gitssh", null));
}
catch
{ }
}
private static bool? _dashboardShowCurrentBranch;
public static bool DashboardShowCurrentBranch
{
get { return SafeGet("dashboardshowcurrentbranch", true, ref _dashboardShowCurrentBranch); }
set { SafeSet("dashboardshowcurrentbranch", value, ref _dashboardShowCurrentBranch); }
}
private static string _ownScripts;
public static string ownScripts
{
get { return SafeGet("ownScripts", "", ref _ownScripts); }
set { SafeSet("ownScripts", value, ref _ownScripts); }
}
private static bool? _pushAllTags;
public static bool PushAllTags
{
get { return SafeGet("pushalltags", false, ref _pushAllTags); }
set { SafeSet("pushalltags", value, ref _pushAllTags); }
}
private static bool? _AutoPullOnRejected;
public static bool AutoPullOnRejected
{
get { return SafeGet("AutoPullOnRejected", false, ref _AutoPullOnRejected); }
set { SafeSet("AutoPullOnRejected", value, ref _AutoPullOnRejected); }
}
private static int? _RecursiveSubmodules;
public static int RecursiveSubmodules
{
get { return SafeGet("RecursiveSubmodules", 1, ref _RecursiveSubmodules); }
set { SafeSet("RecursiveSubmodules", value, ref _RecursiveSubmodules); }
}
private static string _ShorteningRecentRepoPathStrategy;
public static string ShorteningRecentRepoPathStrategy
{
get { return SafeGet("ShorteningRecentRepoPathStrategy", "", ref _ShorteningRecentRepoPathStrategy); }
set { SafeSet("ShorteningRecentRepoPathStrategy", value, ref _ShorteningRecentRepoPathStrategy); }
}
private static int? _MaxMostRecentRepositories;
public static int MaxMostRecentRepositories
{
get { return SafeGet("MaxMostRecentRepositories", 0, ref _MaxMostRecentRepositories); }
set { SafeSet("MaxMostRecentRepositories", value, ref _MaxMostRecentRepositories); }
}
private static int? _RecentReposComboMinWidth;
public static int RecentReposComboMinWidth
{
get { return SafeGet("RecentReposComboMinWidth", 0, ref _RecentReposComboMinWidth); }
set { SafeSet("RecentReposComboMinWidth", value, ref _RecentReposComboMinWidth); }
}
private static bool? _SortMostRecentRepos;
public static bool SortMostRecentRepos
{
get { return SafeGet("SortMostRecentRepos", false, ref _SortMostRecentRepos); }
set { SafeSet("SortMostRecentRepos", value, ref _SortMostRecentRepos); }
}
private static bool? _SortLessRecentRepos;
public static bool SortLessRecentRepos
{
get { return SafeGet("SortLessRecentRepos", false, ref _SortLessRecentRepos); }
set { SafeSet("SortLessRecentRepos", value, ref _SortLessRecentRepos); }
}
private static bool? _NoFastForwardMerge;
public static bool NoFastForwardMerge
{
get { return SafeGet("NoFastForwardMerge", false, ref _NoFastForwardMerge); }
set { SafeSet("NoFastForwardMerge", value, ref _NoFastForwardMerge); }
}
private static int? _CommitValidationMaxCntCharsFirstLine;
public static int CommitValidationMaxCntCharsFirstLine
{
get { return SafeGet("CommitValidationMaxCntCharsFirstLine", 0, ref _CommitValidationMaxCntCharsFirstLine); }
set { SafeSet("CommitValidationMaxCntCharsFirstLine", value, ref _CommitValidationMaxCntCharsFirstLine); }
}
private static int? _CommitValidationMaxCntCharsPerLine;
public static int CommitValidationMaxCntCharsPerLine
{
get { return SafeGet("CommitValidationMaxCntCharsPerLine", 0, ref _CommitValidationMaxCntCharsPerLine); }
set { SafeSet("CommitValidationMaxCntCharsPerLine", value, ref _CommitValidationMaxCntCharsPerLine); }
}
private static bool? _CommitValidationSecondLineMustBeEmpty;
public static bool CommitValidationSecondLineMustBeEmpty
{
get { return SafeGet("CommitValidationSecondLineMustBeEmpty", false, ref _CommitValidationSecondLineMustBeEmpty); }
set { SafeSet("CommitValidationSecondLineMustBeEmpty", value, ref _CommitValidationSecondLineMustBeEmpty); }
}
private static bool? _CommitValidationIndentAfterFirstLine;
public static bool CommitValidationIndentAfterFirstLine
{
get { return SafeGet("CommitValidationIndentAfterFirstLine", true, ref _CommitValidationIndentAfterFirstLine); }
set { SafeSet("CommitValidationIndentAfterFirstLine", value, ref _CommitValidationIndentAfterFirstLine); }
}
private static bool? _CommitValidationAutoWrap;
public static bool CommitValidationAutoWrap
{
get { return SafeGet("CommitValidationAutoWrap", true, ref _CommitValidationAutoWrap); }
set { SafeSet("CommitValidationAutoWrap", value, ref _CommitValidationAutoWrap); }
}
private static string _CommitValidationRegEx;
public static string CommitValidationRegEx
{
get { return SafeGet("CommitValidationRegEx", String.Empty, ref _CommitValidationRegEx); }
set { SafeSet("CommitValidationRegEx", value, ref _CommitValidationRegEx); }
}
private static string _CommitTemplates;
public static string CommitTemplates
{
get { return SafeGet("CommitTemplates", String.Empty, ref _CommitTemplates); }
set { SafeSet("CommitTemplates", value, ref _CommitTemplates); }
}
private static bool? _CreateLocalBranchForRemote;
public static bool CreateLocalBranchForRemote
{
get { return SafeGet("CreateLocalBranchForRemote", false, ref _CreateLocalBranchForRemote); }
set { SafeSet("CreateLocalBranchForRemote", value, ref _CreateLocalBranchForRemote); }
}