Version: 3.4.2 (using KDE 3.4.2, Debian Package 4:3.4.2-4 (testing/unstable)) Compiler: Target: i486-linux-gnu OS: Linux (i686) release 2.6.12-1-k7 I have some C# source files, and konqueror incorrectly reads them as Java, Objective C or C++ sources. Included are 3 files which get detected as Java, C and C++ respectively. --- Begin Objective C mismatch --- using System.Reflection; using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- End Objective C mismatch --- --- Begin C++ Mismatch --- using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; namespace Tarea3 { /// <summary> /// Summary description for Mesa. /// </summary> public class Mesa { private Stack[] mazos; private Stack robo; #region Constantes private const int XTorre = 75; private const int YTorre = 300; private const int AnchoCarta = 75; //dejamos un espacio private const int AltoCarta = 96; #endregion public Mesa() { // Solo 4 al mismo tiempo mazos = new Stack[4]; for(int i=0; i<4; i++) { mazos[i] = new Stack(); } Carta[] temp = CreaMazo(); temp = Baraja(temp); robo = new Stack( temp ); } public void AgregaCarta(Carta carta, int torre) { // No aceptamos movimientos inválidos, el jugador se preocupa de eso Debug.Assert( EsPosiblePoner( carta,torre ) ); Stack mazo = mazos[torre]; carta.X = XTorre + AnchoCarta*torre; carta.Y = YTorre; mazo.Push(carta); // Ahora chequeamos si el mazo se llenó if( mazo.Count == 12 ) { foreach(Carta nuevaCarta in mazo) { robo.Push(nuevaCarta); } mazo.Clear(); Carta[] nuevas = new Carta[robo.Count]; for(int i = 0; i < nuevas.Length; i++) { nuevas[i] = (Carta)robo.Pop(); } nuevas = Baraja( nuevas ); robo = new Stack(nuevas); } } public int QueTorre(Stack torre) { int i; for(i = 0; i<4 && mazos[i] != torre; i++) ; Debug.Assert( i < 4 ); return i; } public bool EsPosiblePoner(Carta carta, int torre) { Debug.Assert( torre < 4 && torre >= 0 ); if( carta == null ) return false; if( mazos[torre].Count == 0 ) { if( carta.ElNumero == numero.As ) return true; else return false; } Carta ultima = (Carta)mazos[torre].Peek(); if( ultima.ElNumero+1 == carta.ElNumero) return true; else return false; } private Carta[] CreaMazo() { Carta[] mazo = new Carta[108]; // Todas las cartas menos los jokers y los reyes (para simplificar el juego) for(int i = 0, j = -1; i < 96; i++) { if( (i%12)==0 ) j++; mazo[i] = new Carta((pinta)(j%4),(numero)(i%12)); } return mazo; } private Carta[] Baraja(Carta[] mazo) { Carta[] mazoBarajado= new Carta[mazo.Length]; bool[] usado = new bool[mazo.Length]; for( int i = 0; i < mazo.Length; i++ ) { usado[i] = false; } Random rnd = new Random(); int cuenta = 0; int indice; while( cuenta < mazo.Length ) { indice = rnd.Next( 0, mazo.Length ); if( usado[indice] == false ) { mazoBarajado[cuenta] = mazo[indice]; usado[indice] = true; cuenta++; } } return mazoBarajado; } public void Dibuja(System.Windows.Forms.Form control) { foreach( Stack mazo in mazos ) { if( mazo.Count > 0 ) ((Carta)mazo.Peek()).dibujar(control); } } public Stack[] TorresCentrales { get { return mazos; } } public Stack Robo { get { return robo; } } public void Clona(Mesa m) { mazos = m.mazos; robo = m.robo; } public void Serializa(Stream str) { StreamWriter output = new StreamWriter(str); string msg = null; // Notese que los \n son necesarios output.Write("Todo:\n"); // Ahora enviamos todas las cartas foreach(Stack pila in mazos) { output.Write("Torre:\n"); foreach(Carta carta in pila) { msg = string.Format("{0},{1}\n", (int)carta.ElNumero, (int)carta.LaPinta); output.Write(msg); } output.Write("FinTorre\n"); } output.Write("Robo:\n"); foreach(Carta carta in robo) { if( carta == null ) continue; msg = string.Format("{0},{1}\n", (int)carta.ElNumero, (int)carta.LaPinta); output.Write(msg); } output.Write("FinRobo\n"); // Terminamos de enviar output.Write("FinTodo\n"); // Forzamos la escritura output.Flush(); } public void DeSerializa(Stream str) { StreamReader input = new StreamReader(str); string msg = null; const string regex = @"^[1]?\d,[0-3]$"; int torre = 0; Stack pila; try { msg = input.ReadLine(); } catch( System.Net.Sockets.SocketException ) { // Así el jugador remoto puede recuperar del error throw new Exception("Socket"); } if( msg != "Todo:" ) { throw new Exception("Inicio malo:"+msg); } while( ( msg = input.ReadLine() )!= "FinTodo" ) { switch(msg) { case "Torre:": pila = new Stack(); mazos[torre].Clear(); while( ( msg = input.ReadLine() )!= "FinTorre" ) { if( !Regex.IsMatch(msg, regex) ) { throw new Exception("Mensaje malo: "+msg); } string[] splt = msg.Split(','); int numero = Int32.Parse(splt[0]); int pinta = Int32.Parse(splt[1]); Carta temp = new Carta((ProyectoIIC.pinta)pinta,(ProyectoIIC.numero)numero); pila.Push(temp); } // Tenemos que invertir el orden de las cartas while(pila.Count > 0) { AgregaCarta( (Carta)pila.Pop(),torre); //mazos[torre].Push(pila.Pop()); } torre++; pila = null; break; case "Robo:": pila = new Stack(); robo.Clear(); while( ( msg = input.ReadLine() )!= "FinRobo" ) { if( !Regex.IsMatch(msg, regex) ) { throw new Exception("Mensaje malo: "+msg); } string[] splt = msg.Split(','); int numero = Int32.Parse(splt[0]); int pinta = Int32.Parse(splt[1]); Carta temp = new Carta((ProyectoIIC.pinta)pinta,(ProyectoIIC.numero)numero); pila.Push(temp); } // Tenemos que invertir el orden de las cartas while(pila.Count>0) { Robo.Push(pila.Pop()); } pila = null; break; default: throw new Exception("Mensaje malo: "+msg); } } } } } --- End C++ Mismatch --- --- Begin Java Mismatch --- using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; namespace Tarea3 { /// <summary> /// Summary description for Mesa. /// </summary> public class Mesa { private Stack[] mazos; private Stack robo; #region Constantes private const int XTorre = 75; private const int YTorre = 300; private const int AnchoCarta = 75; //dejamos un espacio private const int AltoCarta = 96; #endregion public Mesa() { // Solo 4 al mismo tiempo mazos = new Stack[4]; for(int i=0; i<4; i++) { mazos[i] = new Stack(); } Carta[] temp = CreaMazo(); temp = Baraja(temp); robo = new Stack( temp ); } public void AgregaCarta(Carta carta, int torre) { // No aceptamos movimientos inválidos, el jugador se preocupa de eso Debug.Assert( EsPosiblePoner( carta,torre ) ); Stack mazo = mazos[torre]; carta.X = XTorre + AnchoCarta*torre; carta.Y = YTorre; mazo.Push(carta); // Ahora chequeamos si el mazo se llenó if( mazo.Count == 12 ) { foreach(Carta nuevaCarta in mazo) { robo.Push(nuevaCarta); } mazo.Clear(); Carta[] nuevas = new Carta[robo.Count]; for(int i = 0; i < nuevas.Length; i++) { nuevas[i] = (Carta)robo.Pop(); } nuevas = Baraja( nuevas ); robo = new Stack(nuevas); } } public int QueTorre(Stack torre) { int i; for(i = 0; i<4 && mazos[i] != torre; i++) ; Debug.Assert( i < 4 ); return i; } public bool EsPosiblePoner(Carta carta, int torre) { Debug.Assert( torre < 4 && torre >= 0 ); if( carta == null ) return false; if( mazos[torre].Count == 0 ) { if( carta.ElNumero == numero.As ) return true; else return false; } Carta ultima = (Carta)mazos[torre].Peek(); if( ultima.ElNumero+1 == carta.ElNumero) return true; else return false; } private Carta[] CreaMazo() { Carta[] mazo = new Carta[108]; // Todas las cartas menos los jokers y los reyes (para simplificar el juego) for(int i = 0, j = -1; i < 96; i++) { if( (i%12)==0 ) j++; mazo[i] = new Carta((pinta)(j%4),(numero)(i%12)); } return mazo; } private Carta[] Baraja(Carta[] mazo) { Carta[] mazoBarajado= new Carta[mazo.Length]; bool[] usado = new bool[mazo.Length]; for( int i = 0; i < mazo.Length; i++ ) { usado[i] = false; } Random rnd = new Random(); int cuenta = 0; int indice; while( cuenta < mazo.Length ) { indice = rnd.Next( 0, mazo.Length ); if( usado[indice] == false ) { mazoBarajado[cuenta] = mazo[indice]; usado[indice] = true; cuenta++; } } return mazoBarajado; } public void Dibuja(System.Windows.Forms.Form control) { foreach( Stack mazo in mazos ) { if( mazo.Count > 0 ) ((Carta)mazo.Peek()).dibujar(control); } } public Stack[] TorresCentrales { get { return mazos; } } public Stack Robo { get { return robo; } } public void Clona(Mesa m) { mazos = m.mazos; robo = m.robo; } public void Serializa(Stream str) { StreamWriter output = new StreamWriter(str); string msg = null; // Notese que los \n son necesarios output.Write("Todo:\n"); // Ahora enviamos todas las cartas foreach(Stack pila in mazos) { output.Write("Torre:\n"); foreach(Carta carta in pila) { msg = string.Format("{0},{1}\n", (int)carta.ElNumero, (int)carta.LaPinta); output.Write(msg); } output.Write("FinTorre\n"); } output.Write("Robo:\n"); foreach(Carta carta in robo) { if( carta == null ) continue; msg = string.Format("{0},{1}\n", (int)carta.ElNumero, (int)carta.LaPinta); output.Write(msg); } output.Write("FinRobo\n"); // Terminamos de enviar output.Write("FinTodo\n"); // Forzamos la escritura output.Flush(); } public void DeSerializa(Stream str) { StreamReader input = new StreamReader(str); string msg = null; const string regex = @"^[1]?\d,[0-3]$"; int torre = 0; Stack pila; try { msg = input.ReadLine(); } catch( System.Net.Sockets.SocketException ) { // Así el jugador remoto puede recuperar del error throw new Exception("Socket"); } if( msg != "Todo:" ) { throw new Exception("Inicio malo:"+msg); } while( ( msg = input.ReadLine() )!= "FinTodo" ) { switch(msg) { case "Torre:": pila = new Stack(); mazos[torre].Clear(); while( ( msg = input.ReadLine() )!= "FinTorre" ) { if( !Regex.IsMatch(msg, regex) ) { throw new Exception("Mensaje malo: "+msg); } string[] splt = msg.Split(','); int numero = Int32.Parse(splt[0]); int pinta = Int32.Parse(splt[1]); Carta temp = new Carta((ProyectoIIC.pinta)pinta,(ProyectoIIC.numero)numero); pila.Push(temp); } // Tenemos que invertir el orden de las cartas while(pila.Count > 0) { AgregaCarta( (Carta)pila.Pop(),torre); //mazos[torre].Push(pila.Pop()); } torre++; pila = null; break; case "Robo:": pila = new Stack(); robo.Clear(); while( ( msg = input.ReadLine() )!= "FinRobo" ) { if( !Regex.IsMatch(msg, regex) ) { throw new Exception("Mensaje malo: "+msg); } string[] splt = msg.Split(','); int numero = Int32.Parse(splt[0]); int pinta = Int32.Parse(splt[1]); Carta temp = new Carta((ProyectoIIC.pinta)pinta,(ProyectoIIC.numero)numero); pila.Push(temp); } // Tenemos que invertir el orden de las cartas while(pila.Count>0) { Robo.Push(pila.Pop()); } pila = null; break; default: throw new Exception("Mensaje malo: "+msg); } } } } } --- End Java Mismatch ---
Read from where? Local file system? Web? You're talking about an editor kpart?
On Wednesday 23 November 2005 06:17, Stephan Binner wrote: > Read from where? Local file system? Web? You're talking about an editor > kpart? Read from local file system, and in file manager mode, ie: I go to the directory where my c# sources are, and they show with different icons (Java, C++).
Just found out I didn't have a mimetype for C# files. Added it and now everything is fine.
KDE doesn't provide a MIME type for C# source files (*.cs, I think). Should we add one?
I think it should. After all, C# is supposed to gain popularity in the future.
Please look at freedesktop.org and check the mime database to see if there is a mimetype for C# there. (KDE4 is planned to switch to that mime database.) Have a nice day!
We can't add a new MIME type for KDE 3.5 now (message freeze & all). And since KDE 4 will feature the XDG MIME database, this is now out of our hands. Please make sure XDG has the proper MIME type.
SVN commit 566697 by jpetso: Add C# mimetype for KDE 4. (This is a temporary solution until fd.o's XDG MIME-type database is supported.) The "x-csharp" MIME-type is what XDG also uses (see https://bugs.freedesktop.org/show_bug.cgi?id=231) and does not yet have a corresponding icon in the Crystal or Oxygen iconsets. There won't be a C# mimetype for KDE 3.x anymore. BUG: 116889 A x-csharp.desktop