Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
548770c1
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
548770c1
编写于
9月 04, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pipe through ChecksumAlgorithm from serialization
上级
490dff63
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
8 addition
and
21 deletion
+8
-21
src/EditorFeatures/Core/Implementation/Workspaces/EditorTextFactoryService.cs
...ore/Implementation/Workspaces/EditorTextFactoryService.cs
+0
-6
src/Workspaces/Core/Portable/Serialization/SerializerService_Asset.cs
...es/Core/Portable/Serialization/SerializerService_Asset.cs
+2
-3
src/Workspaces/Core/Portable/TemporaryStorage/TemporaryStorageServiceFactory.cs
...rtable/TemporaryStorage/TemporaryStorageServiceFactory.cs
+4
-4
src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageService2.cs
...kspace/Host/TemporaryStorage/ITemporaryStorageService2.cs
+2
-1
src/Workspaces/Core/Portable/Workspace/Host/TextFactory/ITextFactoryService.cs
...ortable/Workspace/Host/TextFactory/ITextFactoryService.cs
+0
-2
src/Workspaces/Core/Portable/Workspace/Host/TextFactory/TextFactoryService.cs
...Portable/Workspace/Host/TextFactory/TextFactoryService.cs
+0
-5
未找到文件。
src/EditorFeatures/Core/Implementation/Workspaces/EditorTextFactoryService.cs
浏览文件 @
548770c1
...
...
@@ -5,7 +5,6 @@
#
nullable
enable
using
System.Composition
;
using
System.Diagnostics
;
using
System.Diagnostics.CodeAnalysis
;
using
System.IO
;
using
System.Text
;
...
...
@@ -40,11 +39,6 @@ internal class EditorTextFactoryService : ITextFactoryService
private
static
readonly
Encoding
s_throwingUtf8Encoding
=
new
UTF8Encoding
(
encoderShouldEmitUTF8Identifier
:
false
,
throwOnInvalidBytes
:
true
);
/// <summary>
/// The default algorithm used by <see cref="SourceText"/> is <see cref="SourceHashAlgorithm.Sha1"/>.
/// </summary>
public
SourceHashAlgorithm
ChecksumAlgorithm
=>
SourceHashAlgorithm
.
Sha1
;
public
SourceText
CreateText
(
Stream
stream
,
Encoding
?
defaultEncoding
,
CancellationToken
cancellationToken
=
default
)
{
// this API is for a case where user wants us to figure out encoding from the given stream.
...
...
src/Workspaces/Core/Portable/Serialization/SerializerService_Asset.cs
浏览文件 @
548770c1
...
...
@@ -49,8 +49,7 @@ private SerializableSourceText DeserializeSerializableSourceText(ObjectReader re
{
cancellationToken
.
ThrowIfCancellationRequested
();
// REVIEW: why IDE services doesnt care about checksumAlgorithm?
_
=
(
SourceHashAlgorithm
)
reader
.
ReadInt32
();
var
checksumAlgorithm
=
(
SourceHashAlgorithm
)
reader
.
ReadInt32
();
var
encoding
=
(
Encoding
)
reader
.
ReadValue
();
var
kind
=
(
SerializationKinds
)
reader
.
ReadInt32
();
...
...
@@ -62,7 +61,7 @@ private SerializableSourceText DeserializeSerializableSourceText(ObjectReader re
var
offset
=
reader
.
ReadInt64
();
var
size
=
reader
.
ReadInt64
();
var
storage
=
storage2
.
AttachTemporaryTextStorage
(
name
,
offset
,
size
,
encoding
,
cancellationToken
);
var
storage
=
storage2
.
AttachTemporaryTextStorage
(
name
,
offset
,
size
,
checksumAlgorithm
,
encoding
,
cancellationToken
);
if
(
storage
is
ITemporaryTextStorageWithName
storageWithName
)
{
return
new
SerializableSourceText
(
storageWithName
);
...
...
src/Workspaces/Core/Portable/TemporaryStorage/TemporaryStorageServiceFactory.cs
浏览文件 @
548770c1
...
...
@@ -120,8 +120,8 @@ public TemporaryStorageService(ITextFactoryService textFactory)
public
ITemporaryTextStorage
CreateTemporaryTextStorage
(
CancellationToken
cancellationToken
)
=>
new
TemporaryTextStorage
(
this
);
public
ITemporaryTextStorage
AttachTemporaryTextStorage
(
string
storageName
,
long
offset
,
long
size
,
Encoding
?
encoding
,
CancellationToken
cancellationToken
)
=>
new
TemporaryTextStorage
(
this
,
storageName
,
offset
,
size
,
encoding
);
public
ITemporaryTextStorage
AttachTemporaryTextStorage
(
string
storageName
,
long
offset
,
long
size
,
SourceHashAlgorithm
checksumAlgorithm
,
Encoding
?
encoding
,
CancellationToken
cancellationToken
)
=>
new
TemporaryTextStorage
(
this
,
storageName
,
offset
,
size
,
checksumAlgorithm
,
encoding
);
public
ITemporaryStreamStorage
CreateTemporaryStreamStorage
(
CancellationToken
cancellationToken
)
=>
new
TemporaryStreamStorage
(
this
);
...
...
@@ -190,10 +190,10 @@ private sealed class TemporaryTextStorage : ITemporaryTextStorage, ITemporaryTex
public
TemporaryTextStorage
(
TemporaryStorageService
service
)
=>
_service
=
service
;
public
TemporaryTextStorage
(
TemporaryStorageService
service
,
string
storageName
,
long
offset
,
long
size
,
Encoding
?
encoding
)
public
TemporaryTextStorage
(
TemporaryStorageService
service
,
string
storageName
,
long
offset
,
long
size
,
SourceHashAlgorithm
checksumAlgorithm
,
Encoding
?
encoding
)
{
_service
=
service
;
_checksumAlgorithm
=
service
.
_textFactory
.
C
hecksumAlgorithm
;
_checksumAlgorithm
=
c
hecksumAlgorithm
;
_encoding
=
encoding
;
_memoryMappedInfo
=
new
MemoryMappedInfo
(
storageName
,
offset
,
size
);
}
...
...
src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageService2.cs
浏览文件 @
548770c1
...
...
@@ -6,6 +6,7 @@
using
System.Text
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.Text
;
namespace
Microsoft.CodeAnalysis.Host
{
...
...
@@ -22,6 +23,6 @@ internal interface ITemporaryStorageService2 : ITemporaryStorageService
/// <summary>
/// Attach to existing <see cref="ITemporaryTextStorage"/> with given name.
/// </summary>
ITemporaryTextStorage
AttachTemporaryTextStorage
(
string
storageName
,
long
offset
,
long
size
,
Encoding
?
encoding
,
CancellationToken
cancellationToken
=
default
);
ITemporaryTextStorage
AttachTemporaryTextStorage
(
string
storageName
,
long
offset
,
long
size
,
SourceHashAlgorithm
checksumAlgorithm
,
Encoding
?
encoding
,
CancellationToken
cancellationToken
=
default
);
}
}
src/Workspaces/Core/Portable/Workspace/Host/TextFactory/ITextFactoryService.cs
浏览文件 @
548770c1
...
...
@@ -16,8 +16,6 @@ namespace Microsoft.CodeAnalysis.Host
/// </summary>
internal
interface
ITextFactoryService
:
IWorkspaceService
{
SourceHashAlgorithm
ChecksumAlgorithm
{
get
;
}
/// <summary>
/// Creates <see cref="SourceText"/> from a stream.
/// </summary>
...
...
src/Workspaces/Core/Portable/Workspace/Host/TextFactory/TextFactoryService.cs
浏览文件 @
548770c1
...
...
@@ -24,11 +24,6 @@ public TextFactoryService()
{
}
/// <summary>
/// The default algorithm used by <see cref="SourceText"/> is <see cref="SourceHashAlgorithm.Sha1"/>.
/// </summary>
public
SourceHashAlgorithm
ChecksumAlgorithm
=>
SourceHashAlgorithm
.
Sha1
;
public
SourceText
CreateText
(
Stream
stream
,
Encoding
?
defaultEncoding
,
CancellationToken
cancellationToken
=
default
)
{
cancellationToken
.
ThrowIfCancellationRequested
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录