本文整理汇总了C#中ISession.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.ToString方法的具体用法?C# ISession.ToString怎么用?C# ISession.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
/**
* Connect to the CMIS repository.
*/
public void Connect()
{
do
{
try
{
// Create session factory.
SessionFactory factory = SessionFactory.NewInstance();
session = factory.CreateSession(cmisParameters);
// Detect whether the repository has the ChangeLog capability.
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
SparkleLogger.LogInfo("Sync", "Created CMIS session: " + session.ToString());
}
catch (CmisRuntimeException e)
{
SparkleLogger.LogInfo("Sync", "Exception: " + e.Message + ", error content: " + e.ErrorContent);
}
if (session == null)
{
SparkleLogger.LogInfo("Sync", "Connection failed, waiting for 10 seconds...");
System.Threading.Thread.Sleep(10 * 1000);
}
}
while (session == null);
}
示例2: Execute
public int Execute(ISession session, Sinan.Collections.BytesSegment data)
{
List<Tuple<int, List<object>>> results = new List<Tuple<int, List<object>>>();
int offset = data.Offset;
int maxIndex = offset + data.Count;
byte[] buffer = data.Array;
while (maxIndex >= offset + 2)
{
// 取包长,前两字节表示
int packetLen = buffer[offset] + (buffer[offset + 1] << 8);
if (packetLen < m_capacity)
{
if (maxIndex < offset + packetLen)
{
break;
}
try
{
if (!session.Decode(buffer, offset, packetLen))
{
session.Close();
return -1;
}
// 取命令,第3/4字节
int command = buffer[offset + 2] + (buffer[offset + 3] << 8);
var param = AmfCodec.Decode(buffer, offset, packetLen);
results.Add(new Tuple<int, List<object>>(command, param));
#if FlowLog
// 写流量接收记录
FlowLog.AddIn(command, packetLen);
#endif
}
catch (AmfException ex)
{
LogWrapper.Warn(session.ToString(), ex);
session.Close();
return -1;
}
}
foreach (var v in results)
{
if (!this.Execute(session, v))
{
break;
}
}
offset += packetLen;
}
return maxIndex - offset;
}
示例3: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
// Create session.
session = Auth.Auth.GetCmisSession(repoinfo.Address.ToString(), repoinfo.User, repoinfo.Password.ToString(), repoinfo.RepoID);
Logger.Debug("Created CMIS session: " + session.ToString());
// Detect repository capabilities.
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
IsGetDescendantsSupported = session.RepositoryInfo.Capabilities.IsGetDescendantsSupported == true;
IsGetFolderTreeSupported = session.RepositoryInfo.Capabilities.IsGetFolderTreeSupported == true;
Config.SyncConfig.Folder folder = ConfigManager.CurrentConfig.GetFolder(this.repoinfo.Name);
if (folder != null)
{
Config.Feature features = folder.SupportedFeatures;
if (features != null)
{
if (IsGetDescendantsSupported && features.GetDescendantsSupport == false)
IsGetDescendantsSupported = false;
if (IsGetFolderTreeSupported && features.GetFolderTreeSupport == false)
IsGetFolderTreeSupported = false;
if (ChangeLogCapability && features.GetContentChangesSupport == false)
ChangeLogCapability = false;
if (ChangeLogCapability && session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.Properties)
IsPropertyChangesSupported = true;
}
}
Logger.Debug("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Debug("Get folder tree support: " + IsGetFolderTreeSupported.ToString());
Logger.Debug("Get descendants support: " + IsGetDescendantsSupported.ToString());
if (repoinfo.ChunkSize > 0)
{
Logger.Debug("Chunked Up/Download enabled: chunk size = " + repoinfo.ChunkSize.ToString() + " byte");
}
else
{
Logger.Debug("Chunked Up/Download disabled");
}
HashSet<string> filters = new HashSet<string>();
filters.Add("cmis:objectId");
filters.Add("cmis:name");
filters.Add("cmis:contentStreamFileName");
filters.Add("cmis:contentStreamLength");
filters.Add("cmis:lastModificationDate");
filters.Add("cmis:lastModifiedBy");
filters.Add("cmis:path");
filters.Add("cmis:changeToken"); // Needed to send update commands, see https://github.com/aegif/CmisSync/issues/516
session.DefaultContext = session.CreateOperationContext(filters, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
}
示例4: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
// Create session factory.
SessionFactory factory = SessionFactory.NewInstance();
session = factory.CreateSession(cmisParameters);
// Detect whether the repository has the ChangeLog capability.
Logger.Debug("Created CMIS session: " + session.ToString());
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
IsGetDescendantsSupported = session.RepositoryInfo.Capabilities.IsGetDescendantsSupported == true;
IsGetFolderTreeSupported = session.RepositoryInfo.Capabilities.IsGetFolderTreeSupported == true;
Config.SyncConfig.Folder folder = ConfigManager.CurrentConfig.getFolder(this.repoinfo.Name);
if (folder != null)
{
Config.Feature features = folder.SupportedFeatures;
if (features != null)
{
if (IsGetDescendantsSupported && features.GetDescendantsSupport == false)
IsGetDescendantsSupported = false;
if (IsGetFolderTreeSupported && features.GetFolderTreeSupport == false)
IsGetFolderTreeSupported = false;
if (ChangeLogCapability && features.GetContentChangesSupport == false)
ChangeLogCapability = false;
if(ChangeLogCapability && session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.Properties)
IsPropertyChangesSupported = true;
}
}
Logger.Debug("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Debug("Get folder tree support: " + IsGetFolderTreeSupported.ToString());
Logger.Debug("Get descendants support: " + IsGetDescendantsSupported.ToString());
if(repoinfo.ChunkSize>0) {
Logger.Debug("Chunked Up/Download enabled: chunk size = "+ repoinfo.ChunkSize.ToString() + " byte");
}else {
Logger.Debug("Chunked Up/Download disabled");
}
HashSet<string> filters = new HashSet<string>();
filters.Add("cmis:objectId");
filters.Add("cmis:name");
filters.Add("cmis:contentStreamFileName");
filters.Add("cmis:contentStreamLength");
filters.Add("cmis:lastModificationDate");
filters.Add("cmis:lastModifiedBy");
filters.Add("cmis:path");
session.DefaultContext = session.CreateOperationContext(filters, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
}
示例5: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
// Create session factory.
SessionFactory factory = SessionFactory.NewInstance();
session = factory.CreateSession(cmisParameters);
// Detect whether the repository has the ChangeLog capability.
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
Logger.Info("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Info("Created CMIS session: " + session.ToString());
}
示例6: Connect
public void Connect()
{
// Create session factory.
SessionFactory factory = SessionFactory.NewInstance();
try
{
// Get the list of repositories. There should be only one, because we specified RepositoryId.
IList<IRepository> repositories = factory.GetRepositories(cmisParameters);
if (repositories.Count != 1)
SparkleLogger.LogInfo("Sync", "Unexpected number of matching repositories: " + repositories.Count);
// Get the repository.
IRepository repository = factory.GetRepositories(cmisParameters)[0];
// Detect whether the repository has the ChangeLog capability.
ChangeLogCapability = repository.Capabilities.ChangesCapability == CapabilityChanges.All
|| repository.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
session = repository.CreateSession();
SparkleLogger.LogInfo("Sync", "Created CMIS session: " + session.ToString());
}
catch (CmisRuntimeException e)
{
SparkleLogger.LogInfo("Sync", "Exception: " + e.Message + ", error content: " + e.ErrorContent);
}
}
示例7: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
if (_session == null)
{
// Create session.
_session = Auth.Auth.GetCmisSession(SyncFolderInfo.Account.RemoteUrl, SyncFolderInfo.Account.Credentials, SyncFolderInfo.RepositoryId);
Logger.Debug("Created CMIS session: " + _session.ToString());
// Detect repository capabilities.
ChangeLogCapability = _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
IsGetDescendantsSupported = _session.RepositoryInfo.Capabilities.IsGetDescendantsSupported == true;
IsGetFolderTreeSupported = _session.RepositoryInfo.Capabilities.IsGetFolderTreeSupported == true;
Config.Feature features = SyncFolderInfo.SupportedFeatures;
if (features != null)
{
if (IsGetDescendantsSupported && features.GetDescendantsSupport == false)
IsGetDescendantsSupported = false;
if (IsGetFolderTreeSupported && features.GetFolderTreeSupport == false)
IsGetFolderTreeSupported = false;
if (ChangeLogCapability && features.GetContentChangesSupport == false)
ChangeLogCapability = false;
if (ChangeLogCapability && _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| _session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.Properties)
IsPropertyChangesSupported = true;
}
Logger.Debug("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Debug("Get folder tree support: " + IsGetFolderTreeSupported.ToString());
Logger.Debug("Get descendants support: " + IsGetDescendantsSupported.ToString());
if (SyncFolderInfo.ChunkSize > 0)
{
Logger.Debug("Chunked Up/Download enabled: chunk size = " + SyncFolderInfo.ChunkSize.ToString() + " byte");
}
else
{
Logger.Debug("Chunked Up/Download disabled");
}
HashSet<string> filters = new HashSet<string>();
filters.Add("cmis:objectId");
filters.Add("cmis:name");
filters.Add("cmis:contentStreamFileName");
filters.Add("cmis:contentStreamLength");
filters.Add("cmis:lastModificationDate");
filters.Add("cmis:lastModifiedBy");
filters.Add("cmis:path");
filters.Add("cmis:changeToken"); // Needed to send update commands, see https://github.com/aegif/CmisSync/issues/516
_session.DefaultContext = _session.CreateOperationContext(filters, false, true, false, IncludeRelationshipsFlag.None, null, true, null, true, 100);
}
else
{
Logger.Warn("Connect() called, but the session is yet present");
}
}
示例8: Connect
/// <summary>
/// Connect to the CMIS repository.
/// </summary>
public void Connect()
{
try
{
// Create session factory.
SessionFactory factory = SessionFactory.NewInstance();
session = factory.CreateSession(cmisParameters);
// Detect whether the repository has the ChangeLog capability.
ChangeLogCapability = session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.All
|| session.RepositoryInfo.Capabilities.ChangesCapability == CapabilityChanges.ObjectIdsOnly;
Logger.Info("ChangeLog capability: " + ChangeLogCapability.ToString());
Logger.Info("Created CMIS session: " + session.ToString());
}
//TODO Implement error handling -> informing user about connection problems by showing status
catch (CmisRuntimeException e)
{
Logger.Error("Connection to repository failed: ", e);
}
catch (CmisObjectNotFoundException e)
{
Logger.Error("Failed to find cmis object: ", e);
}
catch (CmisBaseException e)
{
Logger.Error("Failed to create session to remote " + this.repoinfo.Address.ToString() + ": ", e);
}
}