标签: mono

iPhone 5分辨率和MonoDevelop

今天,我收到了Apple Developer Support的这封电子邮件:

如果要更新iPhone 5和iPod touch(第5代)的应用程序,则必须提供其他屏幕截图以支持App Store的新屏幕尺寸.新截图尺寸为:

  • 640 x 1136(肖像)
  • 640 x 1096(肖像)
  • 1136 x 640(风景)
  • 1136 x 600(风景)

但是没有支持此分辨率(在iPhone应用程序选项中)的MonoDevelop版本(没有alpha或beta版本).在这种情况下,我可以做什么来提交符合图标的应用程序?

mono monodevelop xamarin.ios iphone-5

0
推荐指数
1
解决办法
241
查看次数

使用Mono处理iOS6中的方向

我在XCode上发现了同样的问题

无法在iOS 6中处理方向?

我还没有找到Mono映射方法

this.windows.setRootViewController(viewControllerObj);
Run Code Online (Sandbox Code Playgroud)

Mono如何修复它?

mono monodevelop xamarin.ios ios6

0
推荐指数
1
解决办法
197
查看次数

我无法部署我的单声道应用程序,因为o DllNotFoundException

当我尝试使用以下命令运行我的单声道应用程序时:

mono SimpleBrowser.exe
Run Code Online (Sandbox Code Playgroud)

我的Mac上出现以下错误:

Unhandled Exception: System.TypeInitializationException: An exception  was thrown by the type initializer for Gtk.Application ---> System.DllNotFoundException: glibsharpglue-2
  at (wrapper managed-to-native) GLib.Thread:glibsharp_g_thread_supported ()
  at GLib.Thread.get_Supported () [0x00000] in <filename unknown>:0
  at Gtk.Application..cctor () [0x00000] in <filename unknown>:0    
  --- End of inner exception stack trace ---
  at SimpleBrowser.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0  [ERROR]
  FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Application ---> System.DllNotFoundException: glibsharpglue-2
  at (wrapper managed-to-native) GLib.Thread:glibsharp_g_thread_supported ()
  at GLib.Thread.get_Supported …
Run Code Online (Sandbox Code Playgroud)

c# mono

0
推荐指数
1
解决办法
4100
查看次数

Linux/Mono抛出ArgumentOutOfRangeException,而Windows则没有

尝试将数据从TcpClient缓冲区读取到字节数组中:

private byte[] excessData;
public bool receiveMessage(ref string recvStr, string daddy = "")
{
    recvStr = "";
    CSocket_PacketProtocol packprot = new CSocket_PacketProtocol(0, this);

    WriteDebugWithTimestamp("receiveMessage obtaining client NetworkStream - daddy = " + daddy);
    NetworkStream nStream = client.GetStream();
    WriteDebugWithTimestamp("receiveMessage client NetworkStream obtained, entering receive loop");

    int bytesRead = 0;
    do
    {
        if (!packprot.done)
        {
            try
            {
                byte[] inStream = new byte[10025]; //We'll read into this stream

                int buffSize = client.ReceiveBufferSize;
                WriteDebugWithTimestamp(String.Format("Starting nStream.Read"));
                WriteDebugWithTimestamp(String.Format(String.Format("buffSize={0} -- inStream.Length={1}", buffSize, inStream.Length)));

                bytesRead = nStream.Read(inStream, 0, …
Run Code Online (Sandbox Code Playgroud)

c# mono

0
推荐指数
1
解决办法
1349
查看次数

C#服务作为debian中的守护进程,具有单一服务

我似乎无法找到一种方法让一个C#服务作为debian中的"服务"运行.我究竟做错了什么?

我跟着这个帖子从MSDN创建一个样本窗口服务:http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.80).aspx

我可以在我的Windows机器上运行该服务,启动和停止服务,并看到它写入MyNewLog.

然后我将它(.exe文件)复制到我的debian机器并尝试使用(作为root)mono-service MyNewService.exe运行它

Syslog告诉我,服务已经开始了!

我没有错误,我在系统中看不到任何新创建的日志文件.我究竟做错了什么?

如果有帮助,这里是代码:Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;

namespace MyNewService
{
static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main()
    {
        System.ServiceProcess.ServiceBase[] ServicesToRun;
        ServicesToRun = new System.ServiceProcess.ServiceBase[]
        { 
            new MyNewService() 
        };
        System.ServiceProcess.ServiceBase.Run(ServicesToRun);
    }
}
}
Run Code Online (Sandbox Code Playgroud)

Service.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;

namespace MyNewService
{
public partial class MyNewService …
Run Code Online (Sandbox Code Playgroud)

c# mono service debian daemon

0
推荐指数
1
解决办法
7519
查看次数

方法'Exists'没有重载需要'1'参数

我正在创建一个程序,它接受用户的用户名,年龄和ID,然后将它们打印到屏幕上.用户名不能包含任何符号或空格(_除外).所以,我创建了一个函数,true如果名称中包含符号,则返回该函数,false如果不符号则返回.但是我在编译期间遇到错误:No overload for method 'Exists' takes '1' arguments.完整的错误:

challenge_2.cs(23,37): error CS1501: No overload for method `Exists' takes `1' arguments
/usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
Run Code Online (Sandbox Code Playgroud)

这是代码:

using System;
using System.Collections.Generic;

public class Challenge_2
{
    static string myName;
    static string myAge;
    static string myUserID;
    public static char[] break_sentence(string str)
    {
        char[] characters = str.ToCharArray();
        return characters;
    }
    public static bool check_for_symbols(string s)
    {
        string[] _symbols_ = …
Run Code Online (Sandbox Code Playgroud)

.net c# mono

0
推荐指数
1
解决办法
2011
查看次数

从泛型方法返回某种类型

我对泛型方法有疑问.

假设我正在创建一个带有自定义UI的游戏,它有ResourceManager类.有方法从中获取对象ResourceManager并返回泛型类型,这里是类代码:

public class ResourceManager
{
        // The list that store the object
        private List<Control> _objects = new List<Control>();

        // Add object into the list
        public void Add(params Control[] objects)
        {
            _objects.AddRange(objects);
        }

        // Get the object from the list
        public T GetObject<T>(string name)
        {
            try
            {
                foreach (Control obj in _objects)
                {
                    if (obj.Name == name)
                        return (T)Convert.ChangeType(obj, typeof(T));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return default(T);
        }
}
Run Code Online (Sandbox Code Playgroud)

如你所见,Objects是Control类.在我的项目中,很少有类继承这个类,让我们说它Button …

.net c# generics mono

0
推荐指数
1
解决办法
131
查看次数

IComparer <T> child作为泛型参数不能在Sort中使用

试图List<>在C#中对我进行排序时遇到困难.

我有一个接口类型及其实现类:

public interface IRoom
{
    // ...
}

public class Room : IRoom
{
    // ...
}
Run Code Online (Sandbox Code Playgroud)

和我的比较器的基类:

public abstract class RoomComparer : IComparer<IRoom>
{
    public RoomComparer()
    {
    }

    public abstract int Compare(IRoom x, IRoom y);
}
Run Code Online (Sandbox Code Playgroud)

还有两个孩子:

public class StandardMultipliedSquareMetersComparer : RoomComparer
{
    public StandardMultipliedSquareMetersComparer()
    {
    }

    public override int Compare(IRoom a, IRoom b)
    {
        // ...
    }
}

public class SquareMetersComparer : RoomComparer
{
    public SquareMetersComparer()
    {
    }

    public override int Compare(IRoom a, IRoom b) …
Run Code Online (Sandbox Code Playgroud)

c# sorting generics mono

0
推荐指数
1
解决办法
126
查看次数

WebRequest(System.Net)是Unity中的安全选择吗?

首先,让我说明我的问题:我的游戏服务器不提供WebAPI(我们现在没有资源),而是我们的客户端像网络浏览器一样工作,我需要对会话ID的cookie支持.

搜索Google,我发现我能做的最好的事情就是手动设置请求标头并获取响应标头.我很好,因为我最初是ASP.NET MVC开发人员.

但是,我意识到它们Dictionary同时用于请求和响应.现在这就是问题所在.我们知道标题可以重复,在我的例子中是Set-Cookie.

然后我尝试了另一个,找到了UnityWebRequest仍然在UnityEngine.Experimental.Networking命名空间中的类(所以我想它还处于测试阶段?),但我还是试试运气; 只有悲伤才意识到他们也使用字典作为标题项.

所以现在我唯一的机会是vanilla .NET WebRequest(在System.Net命名空间中).但是,我没有看到Unity中.NET Framework兼容性的文档.谁能告诉我它是否在大多数平台上都受支持?我的主要目标是Windows,Android和Web.如果可能的话,即使WebClient是更好的.

这是我目前的解决方案,它在Unity编辑器中运行良好,但我还没有在其他设备上测试它们.这有什么解决方案吗?

public class CookieWebRequest
{

    private CookieContainer cookieContainer;


    public CookieWebRequest()
    {
        this.cookieContainer = new CookieContainer();
    }

    public void GetAsync(Uri uri, Action<HttpWebResponse> onFinished)
    {
        var webRequest = HttpWebRequest.Create(uri) as HttpWebRequest;
        webRequest.Method = WebRequestMethods.Http.Get;
        webRequest.CookieContainer = this.cookieContainer;

        new Thread(() =>
        {
            HttpWebResponse httpResponse;
            try
            {
                httpResponse = webRequest.GetResponse() as HttpWebResponse;
            }
            catch (WebException ex)
            {
                if (onFinished != null)
                {
                    onFinished(ex.Response as HttpWebResponse); …
Run Code Online (Sandbox Code Playgroud)

c# cookies mono network-programming unity-game-engine

0
推荐指数
1
解决办法
5577
查看次数

如何使用struct删除编译器错误:"使用未分配的局部变量"

C#编译器有点......老式......并且不会进行静态分析.所以它打破了看似正确的代码,如下所示:

MyStruct s;
bool inited = false;
foreach( Something foo in ACollection )
{
  if( foo.Test() )
    continue;
  if( inited )
    s.DoSomething();
  else
  {
    s = foo.GetMeAnS();
    inited = true;
  }
}
Run Code Online (Sandbox Code Playgroud)

注意:不寻常的问题是"s"是一个结构.如果它是一个类,我只是将它初始化为null.这个结构没有有意义的"uninited"状态,我不想支付启动我立即丢弃的东西的性能成本,只是为了满足弱编译器.

代码(应该)完全正确:在s被引入之前不可能访问s.(我从实际代码中复制/粘贴,但为了简单起见,编辑了很长的方法名称).

Mono中的C#编译器曾经允许这样做,但现在却没有.除了编译器之外什么都没有改变,编译器现在给出了未赋值变量的错误.

是否有代码方式告诉它闭嘴并介意自己的业务?:)我不想改变编译器设置(如果可能),因为代码是由其他人/组织编译的 - 我更喜欢修复问题的代码方式.

c# mono struct

0
推荐指数
1
解决办法
1390
查看次数