reduce debug logs
This commit is contained in:
parent
7e01c0bbda
commit
21c93310ea
@ -26,7 +26,9 @@ namespace Pixiview.iOS
|
||||
|
||||
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"url: {url}.");
|
||||
#endif
|
||||
return App.OpenUrl(url);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,9 @@ namespace Pixiview
|
||||
if (!string.IsNullOrEmpty(host) && port > 0)
|
||||
{
|
||||
Configs.Proxy = new System.Net.WebProxy(host, port);
|
||||
#if DEBUG
|
||||
DebugPrint($"load proxy: {host}:{port}");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -74,7 +76,9 @@ namespace Pixiview
|
||||
{
|
||||
return;
|
||||
}
|
||||
#if DEBUG
|
||||
DebugPrint($"application theme: {theme}");
|
||||
#endif
|
||||
ThemeBase themeInstance;
|
||||
if (theme == AppTheme.Dark)
|
||||
{
|
||||
|
@ -57,7 +57,10 @@ namespace Pixiview
|
||||
BindingContext = this;
|
||||
InitializeComponent();
|
||||
|
||||
#if DEBUG
|
||||
App.DebugPrint($"folder: {Stores.PersonalFolder}");
|
||||
App.DebugPrint($"cache: {Stores.CacheFolder}");
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void OnNavigated(ShellNavigatedEventArgs args)
|
||||
|
@ -280,14 +280,18 @@ namespace Pixiview.Illust
|
||||
if (bookmarkId != null)
|
||||
{
|
||||
// not exists in remote any more
|
||||
#if DEBUG
|
||||
App.DebugPrint($"remove bookmark ({bookmarkId}) - {b.Id}: {b.Title}");
|
||||
#endif
|
||||
nows.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
else if (bookmarkId != bookmark.BookmarkId)
|
||||
{
|
||||
// update bookmark id
|
||||
#if DEBUG
|
||||
App.DebugPrint($"change bookmark ({bookmarkId}) to ({bookmark.BookmarkId}) - {b.Id}: {b.Title}");
|
||||
#endif
|
||||
b.BookmarkId = bookmark.BookmarkId;
|
||||
}
|
||||
}
|
||||
@ -299,7 +303,9 @@ namespace Pixiview.Illust
|
||||
for (var i = 0; i < list.Length; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
#if DEBUG
|
||||
App.DebugPrint($"add bookmark ({item.BookmarkId}) - {item.Id}: {item.Title}");
|
||||
#endif
|
||||
item.Image = StyleDefinition.DownloadBackground;
|
||||
}
|
||||
nows.InsertRange(0, list);
|
||||
|
@ -166,7 +166,9 @@ namespace Pixiview.Illust
|
||||
if (Columns != columns)
|
||||
{
|
||||
Columns = columns;
|
||||
#if DEBUG
|
||||
App.DebugPrint($"change columns to {columns}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +523,9 @@ namespace Pixiview.Illust
|
||||
|
||||
protected void DoLoadIllusts(bool force = false, bool bottom = false)
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"start loading data, force: {force}");
|
||||
#endif
|
||||
illustData = DoLoadIllustData(force);
|
||||
if (illustData == null)
|
||||
{
|
||||
@ -702,7 +706,9 @@ namespace Pixiview.Illust
|
||||
if (CheckRefresh())
|
||||
{
|
||||
lastRefreshY = y;
|
||||
#if DEBUG
|
||||
App.DebugPrint("start to load next page");
|
||||
#endif
|
||||
StartLoad(true, true);
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +320,9 @@ namespace Pixiview.Illust
|
||||
if (nextPage == currentPage + 1)
|
||||
{
|
||||
currentPage = nextPage;
|
||||
#if DEBUG
|
||||
App.DebugPrint($"loading page {nextPage}");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -353,7 +355,9 @@ namespace Pixiview.Illust
|
||||
{
|
||||
// query changed.
|
||||
lastQueryKey = query;
|
||||
#if DEBUG
|
||||
App.DebugPrint($"query changed: {query}");
|
||||
#endif
|
||||
PrepareLoad();
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,9 @@ namespace Pixiview.Illust
|
||||
if (UserColumns != columns)
|
||||
{
|
||||
UserColumns = columns;
|
||||
#if DEBUG
|
||||
App.DebugPrint($"change user columns to {columns}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,9 @@ namespace Pixiview.Illust
|
||||
if (ids.Length == 0 || nextIndex >= illustIds.Length)
|
||||
{
|
||||
// done
|
||||
#if DEBUG
|
||||
App.DebugPrint($"download completed: {startIndex}");
|
||||
#endif
|
||||
startIndex = nextIndex;
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,9 @@ namespace Pixiview.Illust
|
||||
return null;
|
||||
}
|
||||
illustIds = init.body.illusts.Keys.OrderByDescending(i => int.TryParse(i, out int id) ? id : -1).ToArray();
|
||||
#if DEBUG
|
||||
App.DebugPrint($"user has ({illustIds.Length}) illusts.");
|
||||
#endif
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
@ -75,7 +77,9 @@ namespace Pixiview.Illust
|
||||
if (ids.Length == 0 || nextIndex >= illustIds.Length)
|
||||
{
|
||||
// done
|
||||
#if DEBUG
|
||||
App.DebugPrint($"download completed: {startIndex}");
|
||||
#endif
|
||||
startIndex = nextIndex;
|
||||
}
|
||||
return data;
|
||||
|
@ -353,7 +353,9 @@ namespace Pixiview.Illust
|
||||
var reload = false;
|
||||
if (pages.body.Length > items.Length)
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"local page count ({items.Length}) is not equals the remote one ({pages.body.Length})");
|
||||
#endif
|
||||
var tmp = new IllustDetailItem[pages.body.Length];
|
||||
items.CopyTo(items, 0);
|
||||
#if __IOS__
|
||||
@ -430,7 +432,9 @@ namespace Pixiview.Illust
|
||||
{
|
||||
if (item.Loading || item.Image != null)
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"skipped, loading or already loaded, index: {index}, loading: {item.Loading}");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -102,14 +102,18 @@ namespace Pixiview
|
||||
{
|
||||
Preferences.Set(Configs.IsOnR18Key, r18);
|
||||
Configs.IsOnR18 = r18;
|
||||
#if DEBUG
|
||||
App.DebugPrint($"r-18 filter: {r18}");
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((int)Configs.SyncFavType != syncType)
|
||||
{
|
||||
Preferences.Set(Configs.SyncFavTypeKey, syncType);
|
||||
Configs.SyncFavType = (SyncType)syncType;
|
||||
#if DEBUG
|
||||
App.DebugPrint($"favorite sync type changed to {Configs.SyncFavType}");
|
||||
#endif
|
||||
}
|
||||
|
||||
var proxy = Configs.Proxy;
|
||||
@ -130,7 +134,9 @@ namespace Pixiview
|
||||
if (!string.IsNullOrEmpty(h) && pt > 0)
|
||||
{
|
||||
Configs.Proxy = new System.Net.WebProxy(h, pt);
|
||||
#if DEBUG
|
||||
App.DebugPrint($"set proxy to: {h}:{pt}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,7 +151,9 @@ namespace Pixiview
|
||||
if (proxy != null)
|
||||
{
|
||||
Configs.Proxy = null;
|
||||
#if DEBUG
|
||||
App.DebugPrint("clear proxy");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,8 +170,9 @@ namespace Pixiview
|
||||
{
|
||||
session = session.Substring(0, index);
|
||||
Configs.SetUserId(session, true);
|
||||
|
||||
#if DEBUG
|
||||
App.DebugPrint($"cookie changed, user id: {session}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,9 @@ namespace Pixiview.UI
|
||||
{
|
||||
if (Tap.IsBusy)
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint("gesture recognizer is now busy...");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
using (Tap.Start())
|
||||
|
@ -109,8 +109,9 @@ namespace Pixiview.Utils
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = ci;
|
||||
Thread.CurrentThread.CurrentUICulture = ci;
|
||||
|
||||
#if DEBUG
|
||||
App.DebugPrint($"CurrentCulture set: {ci.Name}");
|
||||
#endif
|
||||
}
|
||||
|
||||
public static CultureInfo GetCurrentCultureInfo()
|
||||
@ -179,7 +180,9 @@ namespace Pixiview.Utils
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
App.DebugPrint($"iOS Language: {iOSLanguage}, .NET Language/Locale: {netLanguage}");
|
||||
#endif
|
||||
return netLanguage;
|
||||
}
|
||||
#elif __ANDROID__
|
||||
@ -207,7 +210,9 @@ namespace Pixiview.Utils
|
||||
netLanguage = androidLanguage;
|
||||
break;
|
||||
}
|
||||
#if DEBUG
|
||||
App.DebugPrint($"Android Language: {androidLanguage}, .NET Language/Locale: {netLanguage}");
|
||||
#endif
|
||||
return netLanguage;
|
||||
}
|
||||
#endif
|
||||
@ -232,7 +237,9 @@ namespace Pixiview.Utils
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
App.DebugPrint($".NET Fallback Language/Locale: {platCulture.LanguageCode} to {netLanguage} (application-specific)");
|
||||
#endif
|
||||
return netLanguage;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,9 @@ namespace Pixiview.Utils
|
||||
}
|
||||
if (disposed)
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"parallel task determinate, disposed");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
@ -183,7 +185,9 @@ namespace Pixiview.Utils
|
||||
}
|
||||
});
|
||||
}
|
||||
#if DEBUG
|
||||
App.DebugPrint($"parallel task done");
|
||||
#endif
|
||||
complete?.Invoke();
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,7 @@ namespace Pixiview.Utils
|
||||
public static class Stores
|
||||
{
|
||||
public static readonly string PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
||||
#if __IOS__
|
||||
public static readonly string CacheFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
|
||||
#else
|
||||
public static readonly string CacheFolder = FileSystem.CacheDirectory;
|
||||
#endif
|
||||
|
||||
private const string favoriteFile = "favorites.json";
|
||||
private const string globalFile = "global.json";
|
||||
@ -98,14 +94,7 @@ namespace Pixiview.Utils
|
||||
var file = Path.Combine(PersonalFolder, ugoiraFolder, zip, frame);
|
||||
if (File.Exists(file))
|
||||
{
|
||||
//try
|
||||
//{
|
||||
return file;
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// App.DebugError("load.ugoira", $"failed to load ugoira frame: {zip}/{frame}, error: {ex.Message}");
|
||||
//}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -314,7 +303,9 @@ namespace Pixiview.Utils
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"current csrf token: {result.token}");
|
||||
#endif
|
||||
Configs.CsrfToken = result.token;
|
||||
}
|
||||
return result;
|
||||
@ -347,7 +338,9 @@ namespace Pixiview.Utils
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
App.DebugPrint($"successs, bookmark id: {result.body.last_bookmark_id}, status: {result.body.stacc_status_id}");
|
||||
#endif
|
||||
return result.body.last_bookmark_id;
|
||||
}
|
||||
return null;
|
||||
@ -381,7 +374,9 @@ namespace Pixiview.Utils
|
||||
App.DebugPrint("failed to delete bookmark, result is null");
|
||||
return false;
|
||||
}
|
||||
#if DEBUG
|
||||
App.DebugPrint($"successs, delete bookmark");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,9 @@ namespace Pixiview.Utils
|
||||
var url = ugoira.originalSrc;
|
||||
var id = detailItem.Id;
|
||||
var (size, lastModified, client) = HttpUtility.GetUgoiraHeader(url, id);
|
||||
#if DEBUG
|
||||
App.DebugPrint($"starting download ugoira: {size} bytes, last modified: {lastModified}");
|
||||
#endif
|
||||
|
||||
var data = new byte[size];
|
||||
|
||||
@ -284,7 +286,9 @@ namespace Pixiview.Utils
|
||||
ParallelTask.Start(0, inSegs.Count, 2, i =>
|
||||
{
|
||||
var seg = inSegs[i];
|
||||
#if DEBUG
|
||||
App.DebugPrint($"start to download segment #{seg.Index}, from {seg.From} to {seg.To} / {size}");
|
||||
#endif
|
||||
using (var ms = new MemoryStream(data, (int)seg.From, seg.Count))
|
||||
{
|
||||
HttpUtility.DownloadUgoiraImage(client, url, id, lastModified, seg.From, seg.To, ms);
|
||||
@ -321,7 +325,9 @@ namespace Pixiview.Utils
|
||||
}
|
||||
}
|
||||
}
|
||||
#if DEBUG
|
||||
App.DebugPrint("download over");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user