本文整理汇总了C#中ConnectionResult类的典型用法代码示例。如果您正苦于以下问题:C# ConnectionResult类的具体用法?C# ConnectionResult怎么用?C# ConnectionResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionResult类属于命名空间,在下文中一共展示了ConnectionResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UploadVideoHash
public static bool UploadVideoHash(IMLItem Item, string location, string imdbid, ConnectionResult connectionresult, bool FileServerIsOnline, bool IsUNC)
{
if (String.IsNullOrEmpty(imdbid))
{
Debugger.LogMessageToFile("[OSdb movie hash uploader] This video's IMDb ID is not available. Uploading of it's file hash cannot be performed.");
return false;
}
if (!FileServerIsOnline && IsUNC)
{
Debugger.LogMessageToFile("[OSdb movie hash uploader] Your file server is offline. ");
return false;
}
if (!File.Exists(location))
return false;
string moviehash = Helpers.GetTagValueFromItem(Item, "VideoHash");
if (String.IsNullOrEmpty(moviehash))
return false;
#region get file info
Debugger.LogMessageToFile("[OSdb movie hash uploader] Extracting file information for movie hash uploading...");
FileInfo file = new FileInfo(location);
long filesize = file.Length;
string imdbidNumOnly = imdbid.Remove(0, 2);
#endregion
return PerformUploading(Item, moviehash, connectionresult, filesize, imdbidNumOnly);
}
示例2: PerformUploading
private static bool PerformUploading(IMLItem Item, string moviehash, ConnectionResult connectionresult, long filesize, string imdbidNumOnly)
{
try
{
MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Updating video definitions database...");
InsertVideoHash(Item, connectionresult.OsDbLoginResult.token, moviehash, filesize,
imdbidNumOnly);
return true;
}
catch
{
MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress,
"Osdb database did not respond. Retrying...");
Thread.Sleep(3000);
try
{
InsertVideoHash(Item, connectionresult.OsDbLoginResult.token, moviehash, filesize,
imdbidNumOnly);
return true;
}
catch
{
Debugger.LogMessageToFile("Unable to communicate with OSdb. Video hash was not uploaded.");
MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress,
"Unable to communicate with OSdb. Video hash was not uploaded.");
return false;
}
}
}//endof method
示例3: OSoperations
internal static ConnectionResult ConnectToOsDb
(ConnectionResult connectionResult)
{
if (!connectionResult.InternetConnectionAvailable
&&
Settings.ConnectionDiagnosticsEnabled)
{
connectionResult.OSDbIsOnline = false;
return connectionResult;
}
if (!Settings.EnableVideoHasher &&
!Settings.EnableSubtitleDownloader &&
!Settings.WantOSdbDetails)
{
connectionResult.OSDbIsOnline = false;
return connectionResult;
}
OSoperations osDbOperations = new OSoperations();
connectionResult =
TryConnection(osDbOperations, connectionResult);
return connectionResult;
}
示例4: OsDbConnectionRetry
internal static ConnectionResult OsDbConnectionRetry(OSoperations osDbOperations,
ConnectionResult connectionResult)
{
MainImportingEngine.ThisProgress.Progress
(MainImportingEngine.CurrentProgress,
"OSdb did not respond. Retrying... ");
Thread.Sleep(2000);
try
{
connectionResult.OsDbLoginResult =
osDbOperations.SiteLogin();
MainImportingEngine.ThisProgress.Progress
(MainImportingEngine.CurrentProgress,
"login status: " +
connectionResult.OsDbLoginResult.Status);
Thread.Sleep(3000);
connectionResult.OsDbIsOnline = true;
}
catch (Exception)
{
connectionResult =
DisableOsDbConnection(connectionResult);
}
return connectionResult;
}
示例5: OnConnectionFailed
public void OnConnectionFailed (ConnectionResult result)
{
Log.Debug (TAG, "onConnectionFailed:" + result);
if (!mIsResolving && mShouldResolve)
{
if (result.HasResolution)
{
try
{
result.StartResolutionForResult (Activity, RC_SIGN_IN);
mIsResolving = true;
}
catch (IntentSender.SendIntentException e)
{
Log.Error (TAG, "Could not resolve ConnectionResult.", e);
mIsResolving = false;
mGoogleApiClient.Connect ();
}
}
else {
ShowErrorDialog (result);
}
}
else {
UpdateUI (false);
}
}
示例6: IdentifyMovieByVideoFingerprint
internal static string IdentifyMovieByVideoFingerprint(IMLItem item, ConnectionResult connectionresult, bool FileServerIsOnline, bool IsUNC, string location, string parent )
{
#region function variables
string moviehash = Helpers.GetTagValueFromItem(item,"VideoHash");
string imdbid = Helpers.GetTagValueFromItem(item,"ImdbID");
#endregion
if (!String.IsNullOrEmpty(imdbid))
return imdbid;
#region Compute Hash
if (String.IsNullOrEmpty(moviehash))
{
//if ( Importer.EnableHashing)
//{
if (!IsUNC || FileServerIsOnline)
{
if (File.Exists(location))
{
Debugger.LogMessageToFile("Computing video fingerprint for " + item.Name + "...");
MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Computing video fingerprint for " + item.Name + "...");
Thread.Sleep(200);
moviehash = Hasher.ComputeHash(location, item);
item.Tags["VideoHash"] = moviehash;
item.SaveTags();
}
else
{
MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "The video file in location field was not found. MediaFairy cannot identify this film.");
Thread.Sleep(Settings.SleepValue);
}
}
//}
}
else moviehash = Helpers.GetTagValueFromItem(item,"VideoHash");
item.SaveTags();
#endregion
MovieDescriptorReader.ReadMovieDescriptor(item, moviehash, parent, item.Name );
if (Settings.PrimaryVideoFingerprintMatchingSource == "OSDb")
{
OSDbVideoFingeprintIdentifier.IdentifyMovieByHashOSDb(item, connectionresult);
imdbid = TMDbVideoFingerprintIdentifier.IdentifyMovieByHashTMDb(item, connectionresult);
}
else
{
TMDbVideoFingerprintIdentifier.IdentifyMovieByHashTMDb(item, connectionresult);
imdbid = OSDbVideoFingeprintIdentifier.IdentifyMovieByHashOSDb(item, connectionresult);
}
return imdbid;
}
示例7: ResolveConnectionFailed
public static void ResolveConnectionFailed(ConnectionResult connectionResult)
{
if (connectionResult.HasResolution) {
} else {
}
}
示例8: OnConnectionFailed
public void OnConnectionFailed(ConnectionResult result)
{
if (progressDialog.IsShowing) {
ResolveLogin (result);
}
connectionResult = result;
Toast.MakeText (this, "Connection Failed!", ToastLength.Long).Show ();
}
示例9: DisconnectMessage
public void DisconnectMessage(ConnectionResult result, string customReason)
{
var msg = new DisconnectMessage();
msg.Reason = ConnectionResult.Success;
msg.CustomReason = null;
var mresult = msg.AssertLengthMatches();
Assert.AreEqual (msg.Reason, mresult.Reason);
Assert.AreEqual (msg.CustomReason, mresult.CustomReason);
}
示例10:
public static string IdentifyFilmByFilmTitleMatchingEngines
(IMLItem item, string imdbid, IMDbOperations imdbOp,
string year, ConnectionResult connectionresult)
{
#region Return Cases
if (!Settings.FilmTitleMatchingEnginesAreEnabled)
{
Debugger.LogMessageToFile("[IMDb Film Title Matcher] IMDb Title matching is disabled. Returning...");
return imdbid;
}
if (!String.IsNullOrEmpty(imdbid))
{
Debugger.LogMessageToFile("[IMDb Film Title Matcher] This item is already identified. Returning...");
return imdbid;
}
#endregion
if (Settings.PrimaryFilmTitleMatchingEngine == "TMDb")
{
imdbid = Code.Media_Identifiers.
Film_Identifiers.Title_Matching_Engines
.TMDb.TMDbTitleMatchingEngine.
IdentifyFilmByTMDbFilmTitleMatchingEngine(item);
imdbid = IdentifyFilmByIMDbFilmTitleMatchingEngines
(item, imdbid, imdbOp, connectionresult);
}
else
{
imdbid = IdentifyFilmByIMDbFilmTitleMatchingEngines
(item, imdbid, imdbOp, connectionresult);
imdbid = Code.Media_Identifiers.
Film_Identifiers.Title_Matching_Engines
.TMDb.TMDbTitleMatchingEngine.
IdentifyFilmByTMDbFilmTitleMatchingEngine(item);
}
return imdbid;
}
示例11: InternetConnectionTestWasSuccessful
private static ConnectionResult InternetConnectionTestWasSuccessful()
{
ConnectionResult connectionresult = new ConnectionResult();
Helpers.UpdateProgress("Performing Diagnostic Operations...",
"Internet connection test was successful.", null);
Thread.Sleep(3000);
connectionresult.InternetConnectionAvailable = true;
return connectionresult;
}
示例12: IdentifyEpisode
public static string IdentifyEpisode(IMLItem item, ConnectionResult connectionresult,
bool fileServerIsOnline, bool isUNC, string location, string parent)
{
CalculateVideoHash(item, fileServerIsOnline, isUNC, location);
//Helpers.ReadXmlForEpisode(Item, moviehash, parent );
string videoHash = Helpers.GetTagValueFromItem(item, "Hash");
string imdbID = Helpers.GetTagValueFromItem(item, "ImdbID");
//imdbID = GetIMDbIdByVideoHash(item, connectionresult, imdbID, videoHash);
return imdbID;
}
示例13: ConnectToOsDb
internal static ConnectionResult ConnectToOsDb(ConnectionResult connectionResult)
{
if (!connectionResult.InternetConnectionAvailable
&&
Settings.ConnectionDiagnosticsEnabled)
{
connectionResult.OsDbIsOnline = false;
return connectionResult;
}
OSoperations osDbOperations = new OSoperations();
connectionResult =
TryConnection(osDbOperations, connectionResult);
return connectionResult;
}
示例14: OsDbConnectionFirstTry
internal static ConnectionResult OsDbConnectionFirstTry(OSoperations osDbOperations,
ConnectionResult connectionResult)
{
connectionResult.OsDbLoginResult =
osDbOperations.SiteLogin();
MainImportingEngine.ThisProgress.Progress
(MainImportingEngine.CurrentProgress,
"login status: " +
connectionResult.OsDbLoginResult.Status);
Thread.Sleep(3000);
connectionResult.OsDbIsOnline = true;
return connectionResult;
}
示例15: CalculateMusicDnsIdentificationTime
internal static int CalculateMusicDnsIdentificationTime(ConnectionResult connectionresult,
out int tracksToIdentify, ref int totalTracksToIdentifyCount)
{
int remainingTime = 0;
tracksToIdentify = 0;
if (!Settings.EnableMusicDnsAudioTrackIdentification)
return remainingTime;
if (
!Settings.EstimateAudioIdentification ||
(
!connectionresult.InternetConnectionAvailable &&
Settings.ConnectionDiagnosticsEnabled
)
)
return remainingTime;
Debugger.LogMessageToFile("Calculating audio identification time...");
MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress,
"Calculating audio identification time...");
Thread.Sleep(500);
CountItemsWhichNeedMusicDnsIdentification
(ref totalTracksToIdentifyCount);
remainingTime = totalTracksToIdentifyCount*10;
tracksToIdentify = totalTracksToIdentifyCount;
if (totalTracksToIdentifyCount > 12)
{
StatusForm.statusForm.TrayIcon.ShowBalloonTip(5000,
"Music Track Identification has started.",
"This operation will need approximately " +
remainingTime/60 + " minutes to complete. ",
ToolTipIcon.Info);
}
return remainingTime;
}