コード例 #1
0
        private void CreateChangeItem(ChangeSet cs, string changeItem)
        {
            var ci = new ChangeItem();

            // Example
            // M Visualization.Controls/Strings.resx
            // A Visualization.Controls/Tools/IHighlighting.cs
            // R083 Visualization.Controls/Filter/FilterView.xaml   Visualization.Controls/Tools/ToolView.xaml

            var parts      = changeItem.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
            var changeKind = ToKindOfChange(parts[0]);

            ci.Kind = changeKind;

            if (changeKind == KindOfChange.Rename || changeKind == KindOfChange.Copy)
            {
                Debug.Assert(parts.Length == 3);
                var oldName = parts[1];
                var newName = parts[2];
                ci.ServerPath     = Decoder.DecodeEscapedBytes(newName);
                ci.FromServerPath = Decoder.DecodeEscapedBytes(oldName);
                cs.Items.Add(ci);
            }
            else
            {
                Debug.Assert(parts.Length == 2 || parts.Length == 3);
                ci.ServerPath = Decoder.DecodeEscapedBytes(parts[1]);
                cs.Items.Add(ci);
            }

            ci.LocalPath = _mapper.MapToLocalFile(ci.ServerPath);
        }
コード例 #2
0
ファイル: DecoderTests.cs プロジェクト: tlaufkoetter/Insight
        public void DecodeEscapedPaths()
        {
            const string escaped  = @"file_with_umlauts_\303\244\303\266\303\274.txt";
            const string expected = "file_with_umlauts_äöü.txt";

            var decoded = Decoder.DecodeEscapedBytes(escaped);

            Assert.AreEqual(expected, decoded);
        }
コード例 #3
0
ファイル: PathMapper.cs プロジェクト: tlaufkoetter/Insight
        public string MapToLocalFile(string serverPath)
        {
            var decoded = Decoder.DecodeEscapedBytes(serverPath);

            // In git we have the restriction
            // that we cannot choose any sub directory.
            // (Current knowledge). Select the one with .git for the moment.

            // Example
            // _startDirectory = d:\\....\Insight
            // serverPath = Insight/Board.txt
            // localPath = d:\\....\Insight\Insight/Board.txt
            var serverNormalized = decoded.Replace("/", "\\");
            var localPath        = Path.Combine(_startDirectory, serverNormalized);

            return(localPath);
        }