mono

黑科技抢先尝(续)

那年仲夏 提交于 2021-02-12 06:59:30
[TOC] 之前,本人写了一篇文章 黑科技抢先尝 - Windows全新终端初体验(附无需编译就能安装的Preview版本及代码Build全过程 ,介绍了玩转Windows terminal的两种方式。 今天这篇文章,主要介绍如何美化 Windows terminal 中 WSL 的 Linux 终端,依然是以本人最熟悉的 Ubuntu 为例,其他版本的 Linux 请参考本文的流程换用对应的命令。假定你已按我的上一篇文章已安装好 Windows terminal预编译版本,同时安装好了 Ubuntu,并设置好了 WSL 的权限,然后就可以按本文继续操作了。 修改默认源,为apt-get安装提速 由于 Ubuntu 官方的源实在是太慢了,建议大家缓存阿里云镜像的 Ubuntu 源,其具体操作步骤如下: 首先将原配置文件备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.20190516 然后 vim 打开 sources.list , sudo vim /etc/apt/sources.list i (插入)模式下,在末尾输入依次输入每一行进行替换: :%s/security.ubuntu/mirrors.aliyun/g :%s/archive.ubuntu/mirrors.aliyun/g 每输入一行,回车一次

Windows kernel32 functions in Mono on Linux

丶灬走出姿态 提交于 2021-02-09 09:02:31
问题 I got this awesomely simple ini class that I downloaded from somewhere a while ago, but now that I'm using mono I'm running into the issue that it's importing stuff from kernel32 [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); Which on mono (in

.NET之全平台一体化的体验

妖精的绣舞 提交于 2021-02-08 14:58:57
一、前言 近来利用空闲时间研究了一下Xamarin的技术,想想既然提供了如此好的支持,就该尝试一切可能,来一个”大小通吃“。 何为全平台:APP包括Android、IOS、WP,WEB可在Window和Linux部署运行 (进可攻,退可守) 二、简单实现 先来看张图吧 这个是本人实现项目的截图,比较简单。 app那块的话,目前仅实现了Android,IOS的话,没有机器,不想在虚拟机装(已经装了3个Linux了,再装估计要卡爆了) UWP也是机子问题(还未升级到win 10 10568,界面不能实时看到调起来很蛋疼,所以暂时现放着,过段时间补上) 对于我这种情况来说,标题说成是全平台是夸大了一点,但是却是完全可行!!不是弄虚作假的。 下面来说说“进可攻,退可守” 这个问题主要是针对web端的。 先来说说“进可攻”,可以在linux下部署我们的后台网站和数据服务,主要的话还是 Jexus(免安装mono版)和TinyFox 不是我不用ASP.NET Core,而是用的我好揪心所以就没用了。 "退可守",我们还有win server 的IIS 看,我真的没有装mono喔!!! 然后简单说说一些细节上的东西 目前有14个子项目分在5个项目文件夹里面(包含几个测试项目) 01-APP 是app相关的 02-Website 是后台管理的网站,基于NancyFx,身份验证用了自带的Forms

How to lock/unlock a file across process?

烈酒焚心 提交于 2021-02-08 14:22:59
问题 Using C# running on mono on Linux, notice that below code works well on windows can lock a file across process but not on linux via mono (ubuntu 14.04) new FileStream("myfile.lock",FileMode.OpenOrCreate,FileAccess.ReadWrite,FileShare.None); research from internet, i should be able to do it with advisory lock FileStream.Lock however, it doesn`t work. tested with two processes on ubuntu 14.04, both of them can execute "FileStream.Lock(0, int.MaxValue)". i would expect the later one will fail

How to lock/unlock a file across process?

耗尽温柔 提交于 2021-02-08 14:22:24
问题 Using C# running on mono on Linux, notice that below code works well on windows can lock a file across process but not on linux via mono (ubuntu 14.04) new FileStream("myfile.lock",FileMode.OpenOrCreate,FileAccess.ReadWrite,FileShare.None); research from internet, i should be able to do it with advisory lock FileStream.Lock however, it doesn`t work. tested with two processes on ubuntu 14.04, both of them can execute "FileStream.Lock(0, int.MaxValue)". i would expect the later one will fail

add Mono internal call where a string is passed by reference

守給你的承諾、 提交于 2021-02-08 09:38:13
问题 I'm trying to create a method using mono where a string is passed by reference, here is the test code I have: C++: static bool p_TestMethod(int num, MonoString ** response) { auto b = mono_string_new(mono_domain_get(), "Test repsonse"); response = &b; return true; } //... mono_add_internal_call("SharpCode.TestClass::Testmethod", p_TestMethod); C#: [MethodImpl(MethodImplOptions.InternalCall)] public static extern bool Testmethod(int num, out string response); public bool RunTheTest() { string

Does Xamarin.mac Support GTK# User Interface

谁说我不能喝 提交于 2021-02-08 07:22:06
问题 I have an application coded with Mono.Mac using GTK# for the UI.I now have access to Xamarin.mac.Im trying to migrate the mono.mac solution to xamarin.mac. I'm trying copy-paste the code from mono.mac to a new xamarin.mac project,but there is no GUI builder in the Xamarin.mac project.So does Xamarin.mac support GTK#? Is there a better way i can migrate? EDIT: My goal is to bundle the mono runtime with the app package so that the user need not install it manually. 回答1: MonoMac .csproj

Does Xamarin.mac Support GTK# User Interface

回眸只為那壹抹淺笑 提交于 2021-02-08 07:20:43
问题 I have an application coded with Mono.Mac using GTK# for the UI.I now have access to Xamarin.mac.Im trying to migrate the mono.mac solution to xamarin.mac. I'm trying copy-paste the code from mono.mac to a new xamarin.mac project,but there is no GUI builder in the Xamarin.mac project.So does Xamarin.mac support GTK#? Is there a better way i can migrate? EDIT: My goal is to bundle the mono runtime with the app package so that the user need not install it manually. 回答1: MonoMac .csproj

Mono gtk.RadioButton Clicked event firing twice

落爺英雄遲暮 提交于 2021-02-08 04:51:31
问题 I have a problem with the Gtk.RadioButton widget's Clicked event. Here is the example code: using System; using Gtk; public partial class MainWindow: Gtk.Window { public MainWindow (): base (Gtk.WindowType.Toplevel) { Build (); RadioButton rbt1 = new RadioButton (null, "rbt1"); RadioButton rbt2 = new RadioButton (rbt1, "rbt2"); RadioButton rbt3 = new RadioButton (rbt1, "rbt3"); VBox vbx1 = new VBox (); vbx1.PackStart (rbt1, false, false, 0); vbx1.PackStart (rbt2, false, false, 0); vbx1

How to run a Windows.Forms C# program from Terminal in OSX?

与世无争的帅哥 提交于 2021-02-08 04:00:43
问题 I have to use System.Windows.Forms for my C# course in school but I own a Macbook and Visual Studio says that it doesn't exist. I read that I could use WinForms if I installed Mono and then compile and run it from terminal using mcs hello.cs -pkg:dotnet . "hello.cs" is just a Hello World program using System.Windows.Forms... it compiles but when I do mono hello.exe it says: WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at