Here are the examples of the csharp api System.Diagnostics.Debug.WriteLine(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
947 Examples
19
Source : BaseRequestProcessor.cs
with GNU General Public License v3.0
from CircuitLord
with GNU General Public License v3.0
from CircuitLord
protected async Task FinishDownloadAsync()
{
var download = Download;
var response = await download.Task.ConfigureAwait(false);
var eventTarget = download.Originator as EventTarget;
var eventName = EventNames.Error;
if (response != null)
{
try
{
await ProcessResponseAsync(response).ConfigureAwait(false);
eventName = EventNames.Load;
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
finally
{
response.Dispose();
}
}
eventTarget?.FireSimpleEvent(eventName);
}
19
Source : ScriptRequestProcessor.cs
with GNU General Public License v3.0
from CircuitLord
with GNU General Public License v3.0
from CircuitLord
public async Task RunAsync(CancellationToken cancel)
{
var download = Download;
if (download != null)
{
try
{
_response = await download.Task.ConfigureAwait(false);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
FireErrorEvent();
}
}
if (_response != null)
{
var cancelled = _script.FireSimpleEvent(EventNames.BeforeScriptExecute, cancelable: true);
if (!cancelled)
{
var options = CreateOptions();
var insert = _doreplacedent.Source.Index;
try
{
await _engine.EvaluateScriptAsync(_response, options, cancel).ConfigureAwait(false);
}
catch
{
/* We omit failed 3rd party services */
}
_doreplacedent.Source.Index = insert;
FireAfterScriptExecuteEvent();
_doreplacedent.QueueTask(FireLoadEvent);
_response.Dispose();
_response = null;
}
}
}
19
Source : TcpCommunicator.cs
with MIT License
from Clancey
with MIT License
from Clancey
static List<string> GetIdeIPFromResource ()
{
try {
using (Stream stream = typeof (Esp.Resources.Constants).replacedembly.GetManifestResourceStream (Constants.IDE_IP_RESOURCE_NAME))
using (StreamReader reader = new StreamReader (stream)) {
var ips = reader.ReadToEnd ().Split ('\n').ToList ();
var loopBack = IPAddress.Loopback.ToString ();
if (!ips.Contains (loopBack))
ips.Insert(0,loopBack);
return ips;
}
} catch (Exception ex) {
Debug.WriteLine (ex);
return null;
}
}
19
Source : Reload.cs
with MIT License
from Clancey
with MIT License
from Clancey
async Task HandleEvalRequest (EvalRequestMessage request)
{
Debug.WriteLine ($"Handling request");
EvalResponse evalResponse = new EvalResponse ();
EvalResult result = new EvalResult ();
try {
//var s = await eval.EvaluateCode (request, result);
//Debug.WriteLine ($"Evaluating: {s} - {result.FoundClreplacedes.Count}");
if(!request.Clreplacedes?.Any() ?? false)
{
//Nothing to load
return;
}
var replacedmebly = replacedembly.Load(request.replacedembly, request.Pdb);
var foundTypes = new List<(string, Type)>();
foreach(var c in request.Clreplacedes)
{
var fullName = $"{c.NameSpace}.{c.ClreplacedName}";
var type = replacedmebly.GetType(fullName);
foundTypes.Add((fullName, type));
}
if (!foundTypes.Any())
return;
StartingReload?.Invoke();
foreach (var f in foundTypes)
ReplaceType?.Invoke(f);
FinishedReload?.Invoke();
} catch (Exception ex) {
Debug.WriteLine (ex);
}
}
19
Source : TcpCommunicator.cs
with MIT License
from Clancey
with MIT License
from Clancey
public override async Task<bool> Send<T> (T obj)
{
if (client?.Connected ?? false) {
try {
await SendToClient (client, GetBytesForObject (obj));
return true;
} catch(Exception ex) {
Debug.WriteLine (ex);
}
}
return false;
}
19
Source : Reload.cs
with MIT License
from Clancey
with MIT License
from Clancey
string GetIdeIPFromResource ()
{
try {
using (Stream stream = GetType ().replacedembly.GetManifestResourceStream (Constants.IDE_IP_RESOURCE_NAME))
using (StreamReader reader = new StreamReader (stream)) {
return reader.ReadToEnd ().Split ('\n') [0].Trim ();
}
} catch (Exception ex) {
Debug.WriteLine (ex);
return null;
}
}
19
Source : TcpCommunicator.cs
with MIT License
from Clancey
with MIT License
from Clancey
async Task ReceiveLoop (TcpClient client, CancellationToken cancellationToken)
{
try {
byte [] bytes = new byte [1024];
int bytesRead = 0;
// Loop to receive all the data sent by the client.
bytesRead = await client.GetStream ().ReadAsync (bytes, 0, bytes.Length, cancellationToken);
Console.WriteLine ("Recieved Data");
while (bytesRead != 0) {
if (!ShouldBeConnected)
return;
// Translate data bytes to a UTF8 string.
string msg;
msg = Encoding.UTF8.GetString (bytes, 0, bytesRead);
// Process the data sent by the client.
if (pendingmsg != null) {
msg = pendingmsg + msg;
pendingmsg = null;
}
int t = msg.LastIndexOf ('\0');
if (t == -1) {
pendingmsg = msg;
msg = null;
} else if (t != msg.Length - 1) {
pendingmsg = msg.Substring (t + 1, msg.Length - t - 1);
msg = msg.Substring (0, t);
}
if (msg != null) {
var msgs = msg.Split ('\0');
foreach (var ms in msgs) {
if (!string.IsNullOrWhiteSpace (ms)) {
try {
var message = Serializer.DeserializeJson (ms);
if (message is JContainer container && ProcessMessageInternal (container)) {
//We handled this internally!
} else
DataReceived?.Invoke (Serializer.DeserializeJson (ms));
} catch (Exception ex) {
Debug.WriteLine (ex);
}
}
}
}
//Receive more bytes
bytesRead = await client.GetStream ().ReadAsync (bytes, 0, bytes.Length, cancellationToken);
}
} catch (Exception ex) {
Console.WriteLine (ex);
}
Debug.WriteLine ("Receive stopped, disconnected");
}
19
Source : Permissons.cs
with GNU Affero General Public License v3.0
from clemenskoprolin
with GNU Affero General Public License v3.0
from clemenskoprolin
public static async Task<bool> RequestMicrophonePermission()
{
try
{
MediaCapture capture = new MediaCapture();
MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.Audio;
await capture.InitializeAsync(settings);
return true;
}
catch (Exception exception)
{
Debug.WriteLine(exception);
return false;
}
}
19
Source : JavaChecker.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
private DownloadFile[] internalCheckFile(string javaVersion, MinecraftPath path,
IProgress<DownloadFileChangedEventArgs>? downloadProgress, out string binPath)
{
binPath = Path.Combine(path.Runtime, javaVersion, "bin", JavaBinaryName);
try
{
var osName = getJavaOSName(); // safe
var javaVersions = getJavaVersionsForOs(osName); // Net, JsonParse Exception
if (javaVersions != null)
{
var javaManifest = getJavaVersionManifest(javaVersions, javaVersion); // Net, JsonParse
if (javaManifest == null)
javaManifest = getJavaVersionManifest(javaVersions, "jre-legacy");
if (javaManifest == null)
return legacyJavaChecker(path, out binPath);
var files = javaManifest["files"] as JObject;
if (files == null)
return legacyJavaChecker(path, out binPath);
return toDownloadFiles(javaVersion, files, path, downloadProgress);
}
else
return legacyJavaChecker(path, out binPath);
}
catch (Exception e)
{
Debug.WriteLine(e);
if (string.IsNullOrEmpty(binPath))
return legacyJavaChecker(path, out binPath);
else
return new DownloadFile[] { };
}
}
19
Source : JavaChecker.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
private DownloadFile[] legacyJavaChecker(MinecraftPath path, out string binPath)
{
string legacyJavaPath = Path.Combine(path.Runtime, "m-legacy");
MJava mJava = new MJava(legacyJavaPath);
binPath = mJava.GetBinaryPath();
try
{
if (mJava.CheckJavaExistence())
return new DownloadFile[] {};
string javaUrl = mJava.GetJavaUrl();
string lzmaPath = Path.Combine(Path.GetTempPath(), "jre.lzma");
string zipPath = Path.Combine(Path.GetTempPath(), "jre.zip");
DownloadFile file = new DownloadFile(lzmaPath, javaUrl)
{
Name = "jre.lzma",
Type = MFile.Runtime,
AfterDownload = new Func<Task>[]
{
() => Task.Run(() =>
{
SevenZipWrapper.DecompressFileLZMA(lzmaPath, zipPath);
var z = new SharpZip(zipPath);
z.Unzip(legacyJavaPath);
tryChmod755(mJava.GetBinaryPath());
})
}
};
return new[] {file};
}
catch (Exception e)
{
Debug.WriteLine(e);
return new DownloadFile[] {};
}
}
19
Source : JavaChecker.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
private void tryChmod755(string path)
{
try
{
if (MRule.OSName != MRule.Windows)
NativeMethods.Chmod(path, NativeMethods.Chmod755);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : AssetChecker.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
private async Task replacedetCopy(string org, string des)
{
try
{
var orgFile = new FileInfo(org);
var desFile = new FileInfo(des);
if (!desFile.Exists || orgFile.Length != desFile.Length)
{
var directoryName = Path.GetDirectoryName(des);
if (!string.IsNullOrEmpty(directoryName))
Directory.CreateDirectory(directoryName);
await IOUtil.CopyFileAsync(org, des);
}
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
19
Source : IOUtil.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
public static void DeleteDirectory(string targetDir)
{
try
{
string[] files = Directory.GetFiles(targetDir);
string[] dirs = Directory.GetDirectories(targetDir);
foreach (string file in files)
{
File.Delete(file);
}
foreach (string dir in dirs)
{
DeleteDirectory(dir);
}
Directory.Delete(targetDir, true);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
19
Source : AsyncParallelDownloader.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
private async Task doDownload(DownloadFile file, int retry)
{
try
{
WebDownload downloader = new WebDownload();
downloader.FileDownloadProgressChanged += Downloader_FileDownloadProgressChanged;
await downloader.DownloadFileAsync(file).ConfigureAwait(false);
if (file.AfterDownload != null)
{
foreach (var item in file.AfterDownload)
{
await item.Invoke().ConfigureAwait(false);
}
}
Interlocked.Increment(ref progressedFiles);
pChangeFile?.Report(
new DownloadFileChangedEventArgs(file.Type, this, file.Name, totalFiles, progressedFiles));
}
catch (Exception ex)
{
if (retry <= 0)
return;
Debug.WriteLine(ex);
retry--;
await doDownload(file, retry).ConfigureAwait(false);
}
}
19
Source : MLibraryParser.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
ParseJsonObject(JObject item)
{
try
{
var list = new List<MLibrary>(2);
var name = item["name"]?.ToString();
var isRequire = true;
// check rules array
var rules = item["rules"];
if (CheckOSRules && rules != null)
isRequire = MRule.CheckOSRequire((JArray)rules);
// forge clientreq
var req = item["clientreq"]?.ToString();
if (req != null && req.ToLower() != "true")
isRequire = false;
// support TLauncher
var artifact = item["artifact"] ?? item["downloads"]?["artifact"];
var clreplacedifiers = item["clreplacedifies"] ?? item["downloads"]?["clreplacedifiers"];
var natives = item["natives"];
// NATIVE library
if (natives != null)
{
var nativeId = natives[MRule.OSName]?.ToString().Replace("${arch}", MRule.Arch);
if (clreplacedifiers != null && nativeId != null)
{
JToken? lObj = clreplacedifiers[nativeId] ?? clreplacedifiers[MRule.OSName];
if (lObj != null)
list.Add(createMLibrary(name, nativeId, isRequire, (JObject)lObj));
}
else
list.Add(createMLibrary(name, nativeId, isRequire, new JObject()));
}
// COMMON library
if (artifact != null)
{
MLibrary obj = createMLibrary(name, "", isRequire, (JObject)artifact);
list.Add(obj);
}
// library
if (artifact == null && natives == null)
{
MLibrary obj = createMLibrary(name, "", isRequire, item);
list.Add(obj);
}
return list.ToArray();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
return null;
}
}
19
Source : MainForm.cs
with MIT License
from CmlLib
with MIT License
from CmlLib
private void Launcher_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
if (Thread.CurrentThread.ManagedThreadId != uiThreadId)
{
Debug.WriteLine(e);
}
Pb_Progress.Maximum = 100;
Pb_Progress.Value = e.ProgressPercentage;
}
19
Source : TestFolder.cs
with Apache License 2.0
from cocowalla
with Apache License 2.0
from cocowalla
public void Dispose()
{
try
{
if (Directory.Exists(this.Path))
Directory.Delete(this.Path, true);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
19
Source : LetterDeliveryService.cs
with MIT License
from codemillmatt
with MIT License
from codemillmatt
public async Task<SantaResults> WriteLetterToSanta(SantaLetter letter)
{
// if we're on the Android emulator, running functions locally, need to swap out the function url
if (santaUrl.Contains("localhost") && DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DevicePlatform.Android)
{
santaUrl = "http://10.0.2.2:7071/api/WriteSanta";
}
SantaResults results = null;
try
{
var letterJson = JsonConvert.SerializeObject(letter);
var httpResponse = await httpClient.PostAsync(santaUrl, new StringContent(letterJson));
results = JsonConvert.DeserializeObject<SantaResults>(await httpResponse.Content.ReadreplacedtringAsync());
return results;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
results = new SantaResults { SentimentScore = -1 };
}
return results;
}
19
Source : FileIOService.cs
with MIT License
from colinkiama
with MIT License
from colinkiama
public async Task<bool> loadData()
{
bool dataLoaded = false;
bool ToDoTasksFilePresent = await this.checkIfToDoTasksFileIsPresent();
if (ToDoTasksFilePresent)
{
try
{
await loadFileIntoClreplaced();
dataLoaded = true;
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
else
{
Debug.WriteLine("Save File not found so saving data instead");
await saveData();
}
TileService.UpdateLiveTile(ToDoTask.listOfTasks);
return dataLoaded;
}
19
Source : ToDoTask.cs
with MIT License
from colinkiama
with MIT License
from colinkiama
public static void ReplaceOldTasksWithNewTasks(ObservableCollection<ToDoTask> listOfNewTasks)
{
Debug.WriteLine(listOfNewTasks.Count);
if (listOfNewTasks.Count > 0)
{
for (int i = 0; i < listOfNewTasks.Count; i++)
{
listOfTasks[i] = listOfNewTasks[i];
}
for (int i = 0; i < listOfTasks.Count; i++)
{
if (i > listOfNewTasks.Count - 1)
{
listOfTasks.RemoveAt(i);
}
}
}
else
{
listOfTasks.Clear();
}
}
19
Source : FileIOService.cs
with MIT License
from colinkiama
with MIT License
from colinkiama
public async Task<bool> saveData()
{
bool dataSaved = false;
var serializer = new XmlSerializer(typeof(ObservableCollection<ToDoTask>));
var ToDoTasksFile = await this.createToDoTaskFile();
try
{
using (Stream stream = await ToDoTasksFile.OpenStreamForWriteAsync())
{
serializer.Serialize(stream, ToDoTask.listOfTasks);
await stream.FlushAsync();
dataSaved = true;
}
}
catch (Exception x)
{
Debug.WriteLine("Something Was wrong with saving the file");
Debug.WriteLine(x);
Debug.Write(x.Message);
}
return dataSaved;
}
19
Source : MainWindow.xaml.cs
with Microsoft Public License
from CommunityToolkit
with Microsoft Public License
from CommunityToolkit
private async Task<Tuple<string, ILanguage>> GetCodeFileText()
{
try
{
var picker = new FileOpenPicker();
IntPtr windowHandle = (App.Current as App).WindowHandle;
IInitializeWithWindow initializeWithWindowWrapper = picker.As<IInitializeWithWindow>();
initializeWithWindowWrapper.Initialize(windowHandle);
picker.FileTypeFilter.Add("*");
var file = await picker.PickSingleFileAsync();
if (file == null) return null;
System.Diagnostics.Debugger.Launch();
string text = "";
using (var reader = new StreamReader(await file.OpenStreamForReadAsync(), true))
{
text = await reader.ReadToEndAsync();
}
ILanguage Language = Languages.FindById(file.FileType.Replace(".", "")) ?? Languages.CSharp;
return new Tuple<string, ILanguage>(text, Language);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
return new Tuple<string, ILanguage>("ERROR", Languages.CSharp);
}
}
19
Source : PipelineExtensions.cs
with Apache License 2.0
from cosmos-loops
with Apache License 2.0
from cosmos-loops
public static IEnumerable<T> AsEnumerable<T>(this IQueueSource<T> queue) {
BlockingCollection<T> bc = new BlockingCollection<T>();
Func<Task> feed = async delegate {
while (true) {
IOptional<T> item = await queue.Dequeue(CancellationToken.None);
if (item.HasValue) {
bc.Add(item.Value);
} else break;
}
bc.CompleteAdding();
};
Task _dummy = Task.Run(feed);
while (true) {
T item2 = default(T);
bool success = false;
try {
item2 = bc.Take();
success = true;
} catch (InvalidOperationException exc) {
// BlockingCollection ran out of items
System.Diagnostics.Debug.WriteLine(exc);
}
if (!success) break;
yield return item2;
}
}
19
Source : PushNotificationManager.android.cs
with MIT License
from CrossGeeks
with MIT License
from CrossGeeks
public static void Initialize(Context context, bool resetToken, bool createNotificationChannel = true, bool autoRegistration = true)
{
_context = context;
CrossPushNotification.Current.NotificationHandler = CrossPushNotification.Current.NotificationHandler ?? new DefaultPushNotificationHandler();
FirebaseMessaging.Instance.AutoInitEnabled = autoRegistration;
if (autoRegistration)
{
ThreadPool.QueueUserWorkItem(state =>
{
var packageName = Application.Context.PackageManager.GetPackageInfo(Application.Context.PackageName, PackageInfoFlags.MetaData).PackageName;
var versionCode = Application.Context.PackageManager.GetPackageInfo(Application.Context.PackageName, PackageInfoFlags.MetaData).VersionCode;
var versionName = Application.Context.PackageManager.GetPackageInfo(Application.Context.PackageName, PackageInfoFlags.MetaData).VersionName;
var prefs = Application.Context.GetSharedPreferences(KeyGroupName, FileCreationMode.Private);
try
{
var storedVersionName = prefs.GetString(AppVersionNameKey, string.Empty);
var storedVersionCode = prefs.GetString(AppVersionCodeKey, string.Empty);
var storedPackageName = prefs.GetString(AppVersionPackageNameKey, string.Empty);
if (resetToken || (!string.IsNullOrEmpty(storedPackageName) && (!storedPackageName.Equals(packageName, StringComparison.CurrentCultureIgnoreCase) || !storedVersionName.Equals(versionName, StringComparison.CurrentCultureIgnoreCase) || !storedVersionCode.Equals($"{versionCode}", StringComparison.CurrentCultureIgnoreCase))))
{
((PushNotificationManager)CrossPushNotification.Current).CleanUp();
}
}
catch (Exception ex)
{
_onNotificationError?.Invoke(CrossPushNotification.Current, new PushNotificationErrorEventArgs(PushNotificationErrorType.UnregistrationFailed, ex.ToString()));
}
finally
{
var editor = prefs.Edit();
editor.PutString(AppVersionNameKey, $"{versionName}");
editor.PutString(AppVersionCodeKey, $"{versionCode}");
editor.PutString(AppVersionPackageNameKey, $"{packageName}");
editor.Commit();
}
CrossPushNotification.Current.RegisterForPushNotifications();
});
}
if (Build.VERSION.SdkInt >= BuildVersionCodes.O && createNotificationChannel)
{
if (NotificationChannels == null || NotificationChannels.Count() == 0)
{
NotificationChannels = new List<NotificationChannelProps>()
{
new NotificationChannelProps(DefaultNotificationChannelId,
DefaultNotificationChannelName,
DefaultNotificationChannelImportance)
};
}
foreach (NotificationChannelProps channel in NotificationChannels)
{
// Create channel to show notifications.
var channelId = channel.NotificationChannelId;
var channelName = channel.NotificationChannelName;
var channelImportance = channel.NotificationChannelImportance;
var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
var notChannel = new NotificationChannel(channelId, channelName, channelImportance);
if (SoundUri != null)
{
try
{
var soundAttributes = new AudioAttributes.Builder()
.SetContentType(AudioContentType.Sonification)
.SetUsage(AudioUsageKind.Notification).Build();
notChannel.SetSound(SoundUri, soundAttributes);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
notificationManager.CreateNotificationChannel(notChannel);
}
}
System.Diagnostics.Debug.WriteLine(CrossPushNotification.Current.Token);
}
19
Source : MainActivity.cs
with MIT License
from CrossGeeks
with MIT License
from CrossGeeks
public static void PrintHashKey(Context pContext)
{
try
{
PackageInfo info = Android.App.Application.Context.PackageManager.GetPackageInfo(Android.App.Application.Context.PackageName, PackageInfoFlags.Signatures);
foreach (var signature in info.Signatures)
{
MessageDigest md = MessageDigest.GetInstance("SHA");
md.Update(signature.ToByteArray());
System.Diagnostics.Debug.WriteLine(Convert.ToBase64String(md.Digest()));
}
}
catch (NoSuchAlgorithmException e)
{
System.Diagnostics.Debug.WriteLine(e);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
19
Source : ViewTappedButtonBehavior.cs
with MIT License
from CrossGeeks
with MIT License
from CrossGeeks
void View_Tapped(object sender, EventArgs e)
{
if (_isAnimating)
return;
_isAnimating = true;
var view = (View)sender;
Device.BeginInvokeOnMainThread(async () =>
{
try
{
if(AnimationType== AnimationType.Fade)
{
await view.FadeTo(0.3, 300);
await view.FadeTo(1, 300);
}
else if (AnimationType == AnimationType.Scale)
{
await view.ScaleTo(1.2, 170, easing: Easing.Linear);
await view.ScaleTo(1, 170, easing: Easing.Linear);
}
else if (AnimationType == AnimationType.Rotate)
{
await view.RotateTo(360, 200, easing: Easing.Linear);
view.Rotation = 0;
}
else if (AnimationType == AnimationType.FlipHorizontal)
{
// Perform half of the flip
await view.RotateYTo(90, 200);
await view.RotateYTo(0, 200);
}
else if (AnimationType == AnimationType.FlipVertical)
{
// Perform half of the flip
await view.RotateXTo(90, 200);
await view.RotateXTo(0, 200);
}
else if (AnimationType == AnimationType.Shake)
{
await view.TranslateTo(-15, 0, 50);
await view.TranslateTo(15, 0, 50);
await view.TranslateTo(-10, 0, 50);
await view.TranslateTo(10, 0, 50);
await view.TranslateTo(-5, 0, 50);
await view.TranslateTo(5, 0, 50);
view.TranslationX = 0;
}
}
finally
{
if (Command != null)
{
if (Command.CanExecute(CommandParameter))
{
Command.Execute(CommandParameter);
}
}
System.Diagnostics.Debug.WriteLine(CommandParameter);
_isAnimating = false;
}
});
}
19
Source : ObsHub.cs
with MIT License
from csharpfritz
with MIT License
from csharpfritz
public async Task PostScreenshot(IAsyncEnumerable<string> stream) {
var sb = new StringBuilder();
await foreach (var item in stream)
{
sb.Append(item);
}
Debug.WriteLine(sb.Length);
var cleanString = sb.ToString().Replace("data:image/png;base64,", "");
var bytes = Convert.FromBase64String(cleanString);
ScreenshotSink.Instance.OnScreenshotReceived(bytes);
}
19
Source : DebugHelpers.cs
with GNU General Public License v3.0
from d2dyno1
with GNU General Public License v3.0
from d2dyno1
public static void PrintEnumerable(this IEnumerable enumerable)
{
#if !DEBUG
return;
#endif
foreach (var item in enumerable)
{
Debug.WriteLine(item);
}
}
19
Source : DefaultJsonSettingsDatabase.cs
with GNU General Public License v3.0
from d2dyno1
with GNU General Public License v3.0
from d2dyno1
public virtual bool ImportSettings(object import)
{
try
{
// Try convert
settingsCache = (Dictionary<string, object>)import;
// Serialize
string serialized = jsonSettingsSerializer.SerializeToJson(this.settingsCache);
// Write to file
settingsSerializer.WriteToFile(serialized);
return true;
}
catch (Exception ex)
{
Debug.WriteLine(ex);
Debugger.Break();
return false;
}
}
19
Source : DefaultJsonSettingsDatabase.cs
with GNU General Public License v3.0
from d2dyno1
with GNU General Public License v3.0
from d2dyno1
public virtual bool FlushSettings()
{
try
{
// Serialize
string serialized = jsonSettingsSerializer.SerializeToJson(this.settingsCache);
// Write to file
settingsSerializer.WriteToFile(serialized);
return true;
}
catch (Exception ex)
{
Debug.WriteLine(ex);
Debugger.Break();
return false;
}
}
19
Source : ExceptionToFileLogger.cs
with GNU General Public License v3.0
from d2dyno1
with GNU General Public License v3.0
from d2dyno1
public void LogToFile(string text)
{
try
{
string filePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, Constants.FileSystem.EXCEPTIONLOG_FILENAME);
string existing = UnsafeNativeHelpers.ReadStringFromFile(filePath);
existing += text;
UnsafeNativeHelpers.WriteStringToFile(filePath, existing);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : Options.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public async void SaveCurrent()
{
string json = JsonConvert.SerializeObject(this, Formatting.Indented);
try
{
if (!Directory.Exists(MainWindow.XDELTA3_APP_STORAGE))
{
Directory.CreateDirectory(MainWindow.XDELTA3_APP_STORAGE);
}
await File.WriteAllTextAsync(Path.Combine(MainWindow.XDELTA3_APP_STORAGE, "options.json"), json);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : PatchCreator.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public void CreatePatchingBatchFiles()
{
this.MainParent.PatchProgress = 0;
this._Progress = 0;
if (!File.Exists(Path.Combine(MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory)) && !this.MainParent.Options.CreateBatchFileOnly)
{
Directory.CreateDirectory(Path.Combine(MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory));
}
//Batch creation - Windows//
StreamWriter patchWriterWindows = new StreamWriter(Path.Combine(MainParent.Options.PatchFileDestination, "2.Apply Patch-Windows.bat"));
patchWriterWindows.WriteLine("@echo off");
patchWriterWindows.WriteLine("mkdir output");
// Batch creation - Linux //
StreamWriter patchWriterLinux = new StreamWriter(Path.Combine(MainParent.Options.PatchFileDestination, "2.Apply Patch-Linux.sh"));
patchWriterLinux.NewLine = "\n";
patchWriterLinux.WriteLine("#!/bin/sh");
patchWriterLinux.WriteLine("cd \"$(cd \"$(dirname \"$0\")\" && pwd)\"");
patchWriterLinux.WriteLine("mkdir ./output");
patchWriterLinux.WriteLine("chmod +x ./exec/" + Path.GetFileName(MainWindow.XDELTA3_BINARY_LINUX));
// Batch creation - Mac //
StreamWriter patchWriterMac = new StreamWriter(Path.Combine(MainParent.Options.PatchFileDestination, "2.Apply Patch-Mac.command"));
patchWriterMac.NewLine = "\n";
patchWriterMac.WriteLine("#!/bin/sh");
patchWriterMac.WriteLine("cd \"$(cd \"$(dirname \"$0\")\" && pwd)\"");
patchWriterMac.WriteLine("mkdir ./output");
patchWriterMac.WriteLine("chmod +x ./exec/" + Path.GetFileName(MainWindow.XDELTA3_BINARY_MACOS));
StreamWriter currentPatchScript = new StreamWriter(Path.Combine(MainParent.Options.PatchFileDestination, "doNotDelete-In-Progress.bat"));
if (!this.MainParent.Options.CreateBatchFileOnly)
{
currentPatchScript.Close();
try
{
File.Delete(Path.Combine(this.MainParent.Options.PatchFileDestination, "doNotDelete-In-Progress.bat"));
}
catch (Exception e)
{
Debug.WriteLine(e);
}
currentPatchScript = new StreamWriter(Path.Combine(MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory, "doNotDelete-In-Progress.bat"));
}
List<string> oldFileNames = new List<string>();
List<string> newFileNames = new List<string>();
this.MainParent.OldFilesList.ForEach(c => oldFileNames.Add(c.ShortName));
this.MainParent.NewFilesList.ForEach(c => newFileNames.Add(c.ShortName));
patchWriterWindows.WriteLine("echo Place the files to be patched in the \"original\" directory with the following names:");
patchWriterLinux.WriteLine("echo Place the files to be patched in the \\\"original\\\" directory with the following names:");
patchWriterMac.WriteLine("echo Place the files to be patched in the \\\"original\\\" directory with the following names:");
patchWriterWindows.WriteLine("echo --------------------");
patchWriterLinux.WriteLine("echo --------------------");
patchWriterMac.WriteLine("echo --------------------");
for (int i = 0; i < this.MainParent.OldFilesList.Count; i++)
{
patchWriterWindows.WriteLine("echo " + oldFileNames[i]);
patchWriterLinux.WriteLine("echo \"" + oldFileNames[i] + "\"");
patchWriterMac.WriteLine("echo \"" + oldFileNames[i] + "\"");
}
patchWriterWindows.WriteLine("echo --------------------");
patchWriterLinux.WriteLine("echo --------------------");
patchWriterMac.WriteLine("echo --------------------");
patchWriterWindows.WriteLine("echo Patched files will be in the \"output\" directory");
patchWriterLinux.WriteLine("echo Patched files will be in the \\\"output\\\" directory");
patchWriterMac.WriteLine("echo Patched files will be in the \\\"output\\\" directory");
patchWriterWindows.WriteLine("pause");
patchWriterLinux.WriteLine("read -p \"Press enter to continue...\" inp");
patchWriterMac.WriteLine("read -p \"Press enter to continue...\" inp");
for (int i = 0; i < this.MainParent.OldFilesList.Count; i++)
{
// Batch creation - Windows
patchWriterWindows.WriteLine("exec\\" + Path.GetFileName(MainWindow.XDELTA3_BINARY_WINDOWS) + " -v -d -s \".\\original\\{0}\" " + "\".\\" + this.MainParent.Options.PatchSubdirectory + "\\" + "{0}." + this.MainParent.Options.PatchExtention + "\" \".\\output\\{2}\"", oldFileNames[i], this.MainParent.Options.PatchSubdirectory + "\\" + (i + 1).ToString(), newFileNames[i]);
// Batch creation - Linux //
patchWriterLinux.WriteLine("./exec/" + Path.GetFileName(MainWindow.XDELTA3_BINARY_LINUX) + " -v -d -s \"./original/{0}\" " + '"' + this.MainParent.Options.PatchSubdirectory + '/' + "{0}." + this.MainParent.Options.PatchExtention + "\" \"./output/{2}\"", oldFileNames[i], this.MainParent.Options.PatchSubdirectory + (i + 1).ToString(), newFileNames[i]);
// Batch creation - Mac //
patchWriterMac.WriteLine("./exec/" + Path.GetFileName(MainWindow.XDELTA3_BINARY_MACOS) + " -v -d -s \"./original/{0}\" " + '"' + this.MainParent.Options.PatchSubdirectory + '/' + "{0}." + this.MainParent.Options.PatchExtention + "\" \"./output/{2}\"", oldFileNames[i], this.MainParent.Options.PatchSubdirectory + (i + 1).ToString(), newFileNames[i]);
// Script for patch creation
if (!this.MainParent.Options.CreateBatchFileOnly)
{
currentPatchScript.WriteLine("\"" + MainWindow.XDELTA3_PATH + "\"" + " " + this.MainParent.Options.XDeltaArguments + " " + "\"" + this.MainParent.OldFilesList[i].FullPath + "\" \"" + this.MainParent.NewFilesList[i].FullPath + "\" \"" + Path.Combine(this.MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory, oldFileNames[i]) + "." + this.MainParent.Options.PatchExtention + "\"");
}
}
patchWriterWindows.WriteLine("echo Completed!");
patchWriterWindows.WriteLine("@pause");
patchWriterWindows.Close();
patchWriterLinux.Close();
patchWriterMac.Close();
currentPatchScript.Close();
if (this.MainParent.Options.CreateBatchFileOnly)
{
try
{
File.Delete(Path.Combine(MainParent.Options.PatchFileDestination, "doNotDelete-In-Progress.bat"));
}
catch (Exception e)
{
Debug.WriteLine(e);
}
this.MainParent.PatchProgress = 0;
if (this.MainParent.Options.ZipFilesWhenDone)
{
this.ZipFiles();
}
this.MainParent.AlreadyBusy = false;
Dispatcher.UIThread.InvokeAsync(new Action(() =>
{
SuccessDialog dialog = new SuccessDialog(this.MainParent);
dialog.Show();
dialog.Topmost = true;
dialog.Topmost = false;
}));
}
else
{
CreateNewXDeltaThread().Start();
}
}
19
Source : PatchCreator.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public void CreateReadme()
{
try
{
if (!File.Exists(Path.Combine(this.MainParent.Options.PatchFileDestination, "exec")))
{
Directory.CreateDirectory(Path.Combine(this.MainParent.Options.PatchFileDestination, "exec"));
}
if (!File.Exists(Path.Combine(this.MainParent.Options.PatchFileDestination, "original")))
{
Directory.CreateDirectory(Path.Combine(this.MainParent.Options.PatchFileDestination, "original"));
}
string readmeString = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "replacedets", "doc", "1.Readme.txt"));
readmeString = String.Format(readmeString, MainWindow.VERSION);
File.WriteAllText(Path.Combine(MainParent.Options.PatchFileDestination, "1.Readme.txt"), readmeString);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : MainWindow.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
private async void CheckForUpdates()
{
try
{
HttpResponseMessage response = await new HttpClient().GetAsync(VERSION_CHECK_URL);
response.EnsureSuccessStatusCode();
string newVer = await response.Content.ReadreplacedtringAsync();
if (newVer.Trim() != VERSION.Trim())
{
UpdateDialog updateDialog = new UpdateDialog(this, newVer);
updateDialog.Show();
updateDialog.Activate();
}
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : MainWindow.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
private static string GetVersion()
{
string version = "";
try
{
version = System.Reflection.replacedembly.GetEntryreplacedembly().GetCustomAttribute<replacedemblyInformationalVersionAttribute>().InformationalVersion;
}
catch (Exception e) { Debug.WriteLine(e); }
return version;
}
19
Source : PatchCreator.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public void CopyNotice()
{
try
{
File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NOTICE.txt"), Path.Combine(MainParent.Options.PatchFileDestination, "NOTICE.txt"), true);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : PatchCreator.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
private Thread CreateNewXDeltaThread()
{
return new Thread(() =>
{
using (Process activeCMD = new Process())
{
activeCMD.OutputDataReceived += HandleCMDOutput;
activeCMD.ErrorDataReceived += HandleCMDError;
ProcessStartInfo info = new ProcessStartInfo();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
info.FileName = Path.Combine(this.MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory, "doNotDelete-In-Progress.bat");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
string args = Path.Combine(this.MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory, "doNotDelete-In-Progress.bat");
string escapedArgs = "/bin/bash " + args.Replace("\"", "\\\"").Replace(" ", "\\ ").Replace("(", "\\(").Replace(")", "\\)");
info.FileName = "/bin/bash";
info.Arguments = $"-c \"{escapedArgs}\"";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
string args = Path.Combine(this.MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory, "doNotDelete-In-Progress.bat");
string escapedArgs = "/bin/bash " + args.Replace("\"", "\\\"").Replace(" ", "\\ ").Replace("(", "\\(").Replace(")", "\\)");
info.FileName = "/bin/bash";
info.Arguments = $"-c \"{escapedArgs}\"";
}
info.WindowStyle = ProcessWindowStyle.Hidden;
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
activeCMD.StartInfo = info;
activeCMD.EnableRaisingEvents = true;
activeCMD.Start();
activeCMD.BeginOutputReadLine();
activeCMD.BeginErrorReadLine();
activeCMD.WaitForExit();
try
{
File.Delete(Path.Combine(this.MainParent.Options.PatchFileDestination, this.MainParent.Options.PatchSubdirectory, "doNotDelete-In-Progress.bat"));
}
catch (Exception e)
{
Debug.WriteLine(e);
}
if (this.MainParent.Options.ZipFilesWhenDone)
{
this.ZipFiles();
}
this.MainParent.AlreadyBusy = false;
this.MainParent.PatchProgress = 0;
Dispatcher.UIThread.InvokeAsync(new Action(() =>
{
SuccessDialog dialog = new SuccessDialog(this.MainParent);
dialog.Show();
dialog.Topmost = true;
dialog.Topmost = false;
}));
}
})
{ IsBackground = true };
}
19
Source : PatchCreator.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public void CopyExecutables()
{
if (!File.Exists(Path.Combine(this.MainParent.Options.PatchFileDestination, "exec")))
{
Directory.CreateDirectory(Path.Combine(this.MainParent.Options.PatchFileDestination, "exec"));
}
try
{
File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "replacedets", "exec", MainWindow.XDELTA3_BINARY_WINDOWS), Path.Combine(this.MainParent.Options.PatchFileDestination, "exec", MainWindow.XDELTA3_BINARY_WINDOWS), true);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
try
{
File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "replacedets", "exec", MainWindow.XDELTA3_BINARY_LINUX), Path.Combine(this.MainParent.Options.PatchFileDestination, "exec", MainWindow.XDELTA3_BINARY_LINUX), true);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
try
{
File.Copy(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "replacedets", "exec", MainWindow.XDELTA3_BINARY_MACOS), Path.Combine(this.MainParent.Options.PatchFileDestination, "exec", MainWindow.XDELTA3_BINARY_MACOS), true);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : SuccessDialog.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
private void OpenDestinationClicked(object sender, RoutedEventArgs args)
{
try
{
Process.Start(new ProcessStartInfo
{
FileName = this._Destination + Path.DirectorySeparatorChar,
UseShellExecute = true
});
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : UpdateDialog.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
private void GoToReleasesClicked(object sender, RoutedEventArgs args)
{
try
{
ProcessStartInfo url = new ProcessStartInfo
{
FileName = MainWindow.RELEASES_PAGE,
UseShellExecute = true
};
Process.Start(url);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : Console.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
protected override void OnClosing(CancelEventArgs e)
{
e.Cancel = !this.CanClose;
// Hide window instead of closing
if (!this.CanClose)
{
try
{
_Parent.ShowTerminal = false;
}
catch (Exception e1)
{
Debug.WriteLine(e1);
}
}
}
19
Source : MainWindow.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public async void AddOldFileClicked(object sender, RoutedEventArgs args)
{
try
{
string[] url = await this.OpenFileBrowser();
this.AddFiles(url, FileCategory.Old);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : MainWindow.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public async void AddNewFileClicked(object sender, RoutedEventArgs args)
{
try
{
string[] url = await this.OpenFileBrowser();
this.AddFiles(url, FileCategory.New);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : MainWindow.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
public async void BrowseOutputDirectory(object sender, RoutedEventArgs args)
{
try
{
string url = await this.OpenFolderBrowser();
if (!string.IsNullOrEmpty(url))
{
this.Options.PatchFileDestination = url;
}
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
19
Source : MainWindow.axaml.cs
with Apache License 2.0
from dan0v
with Apache License 2.0
from dan0v
private void DeleteFiles(FileCategory category)
{
List<PathFileComponent> list = this.NewFilesList;
if (category == FileCategory.New)
{
list = this.NewFilesList;
}
else if (category == FileCategory.Old)
{
list = this.OldFilesList;
}
try
{
List<PathFileComponent> deletableList = list.FindAll(c => c.IsSelected == true);
foreach (PathFileComponent component in deletableList)
{
list.Remove(component);
}
this.ReloadFiles(category, true);
}
catch (Exception e)
{
Debug.WriteLine(e);
}
this.CheckFileCounts();
if (category == FileCategory.New)
{
if (this.NewFilesListCount == 0)
{
this._AllNewFilesSelected = false;
}
}
else if (category == FileCategory.Old)
{
if (this.OldFilesListCount == 0)
{
this._AllOldFilesSelected = false;
}
}
}
19
Source : AudioService.cs
with MIT License
from DanielCKennedy
with MIT License
from DanielCKennedy
public void Start(int pos)
{
System.Diagnostics.Debug.WriteLine("Start()");
if (pos >= 0 && pos < _queue.Count && !_isPreparing)
{
_isPreparing = true;
_pos = pos;
_getQueuePos(_pos);
_player?.Reset();
try
{
_player?.SetDataSource(_queue[_pos].Uri);
_player?.PrepareAsync();
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
}
19
Source : MusicManagerIOS.cs
with MIT License
from DanielCKennedy
with MIT License
from DanielCKennedy
public async Task SetQueue(IList<Song> songs)
{
System.Diagnostics.Debug.WriteLine("SetQeueue()");
await Task.Run(() =>
{
if (songs == null)
{
songs = new ObservableCollection<Song>();
}
if (!Enumerable.SequenceEqual(_queue, songs, _comparer))
{
_queue = songs;
_getQueue?.Invoke(_queue);
}
_pos = 0;
_getQueuePos(_pos);
try
{
NSUrl url = new NSUrl(_queue[_pos].Uri);
NSMutableDictionary dict = new NSMutableDictionary();
dict.Add(new NSString("AVURLreplacedetPreferPreciseDurationAndTimingKey"), new NSNumber(true));
var playerItem = AVPlayerItem.Fromreplacedet(AVUrlreplacedet.Create(url, new AVUrlreplacedetOptions(dict)));
_player.ReplaceCurrenreplacedemWithPlayerItem(playerItem);
Pause();
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
});
}
19
Source : AudioService.cs
with MIT License
from DanielCKennedy
with MIT License
from DanielCKennedy
private void InitializeMediaSession()
{
try
{
if (_mediaSessionCompat == null)
{
Intent intent = new Intent(ApplicationContext, typeof(MainActivity));
PendingIntent pendingIntent = PendingIntent.GetActivity(ApplicationContext, 0, intent, 0);
_remoteComponentName = new ComponentName(PackageName, new AudioControlsBroadcastReceiver().ComponentName);
_mediaSessionCompat = new MediaSessionCompat(ApplicationContext, "XamMusic", _remoteComponentName, pendingIntent);
_mediaControllerCompat = new MediaControllerCompat(ApplicationContext, _mediaSessionCompat.SessionToken);
}
_mediaSessionCompat.Active = true;
_mediaSessionCompat.SetCallback(new AudioServiceCallback((AudioServiceBinder)_binder));
_mediaSessionCompat.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
19
Source : AudioService.cs
with MIT License
from DanielCKennedy
with MIT License
from DanielCKennedy
private void UpdatePlaybackState(int state)
{
if (_mediaSessionCompat != null && _player != null)
{
try
{
PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder()
.SetActions(
PlaybackStateCompat.ActionPause |
PlaybackStateCompat.ActionPlay |
PlaybackStateCompat.ActionPlayPause |
PlaybackStateCompat.ActionSkipToNext |
PlaybackStateCompat.ActionSkipToPrevious |
PlaybackStateCompat.ActionStop
)
.SetState(state, (long)_player?.CurrentPosition, 1.0f, SystemClock.ElapsedRealtime());
_mediaSessionCompat.SetPlaybackState(stateBuilder.Build());
if (state == PlaybackStateCompat.StatePlaying || state == PlaybackStateCompat.StatePaused)
{
StartNotification();
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
}
See More Examples