Quantcast
Channel: SharpDevelop Community
Viewing all 1764 articles
Browse latest View live

Set a internal file name of gzip file.

$
0
0

Hi, I need set a file name internal of gzip.

I re-compiler ICSharpCode.SharpZipLib.csproj 

I modifided a class GZipOutputStream

Create a new method 

private string _fname = "";

/// <summary>

/// Sets the name of internal file of gzip

/// Create by Afonso Dutra

/// </summary>

/// <param name="name">name of internal file in de gzip</param>

public void SetFileName(string name)

{

_fname = name;

}

And I modifided a exist method WriteHeader()

                         //AFONSO 

byte[ fname = { 0 };

if (!string.IsNullOrEmpty(_fname))

{

fname = Encoding.GetEncoding("ISO-8859-1").GetBytes(_fname);

Array.Resize<byte>(ref fname, fname.Length + 1);

fname[fname.Length - 1] = 0;

}

//END AFONSO

And modifided de byte of Header

 

byte[ gzipHeader = {

// The two magic bytes

(byte) (GZipConstants.GZIP_MAGIC >> 8),

(byte) (GZipConstants.GZIP_MAGIC & 0xff),

// The compression type

(byte) Deflater.DEFLATED,

// The flags (not set)

(byte) (!string.IsNullOrEmpty(_fname) ?  GZipConstants.FNAME : 0), 

// The modification time

(byte) mod_time,

(byte) (mod_time >> 8),

(byte) (mod_time >> 16),

(byte) (mod_time >> 24),

// The extra flags

0,

// 255 The OS type (unknown)

// 0 FAT filesystem (MS-DOS, OS/2, NT/Win32)

(byte) 0 //255

};

 

For incluide a real file name in gzip, include is function after "baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length);"

                            //AFONSO

if (!string.IsNullOrEmpty(_fname))

baseOutputStream_.Write(fname, 0, fname.Length);

//END AFONSO

 

It´s possible incluide this code for future release?

 

Thanks.

 


about Mid() to substring

$
0
0

// VB.NET code 

  Public ReadOnly Property DB_Provider() As String

    Get

      Try

        dbProvider = Mid(ConfigurationManager.AppSettings("DB_Provider").ToString, 1, 1)

      Catch error_occure As Exception

        dbProvider = "S"   ' MS SQL

      End Try

      Return dbProvider

    End Get

  End Property

// C# from conversion
public string DB_Provider 
{
get 
{
try 
{
dbProvider = Strings.Mid(ConfigurationManager.AppSettings("DB_Provider").ToString, 1, 1);
catch (Exception error_occure) 
{
dbProvider = "S";   // MS SQL
}
return dbProvider;
}
}
// Please be informed about Mid() to substring
dbProvider = ConfigurationManager.AppSettings["DB_Provider"].Substring(0, 1);
Thank you for your support
Kittisak

inform about AppSettings() from VB.NET

$
0
0

// VB.NET

        Try

          connectUser = ConfigurationManager.AppSettings("DB_User_ID").ToString

        Catch error_occure As Exception

          connectUser = ""

        End Try

// c# from conversion
try {
connectUser = ConfigurationManager.AppSettings("DB_User_ID").ToString;
} catch (Exception error_occure) {
connectUser = "";
}
// inform about AppSettings[" "] and no ToString
                connectUser = ConfigurationManager.AppSettings["DB_User_ID"];
Thank you

AvalonEditor and handle input binding for MouseWheel up/down + Ctrl key

$
0
0

Application has main window which contains toolbar, preview control and AvalonEdit control.

Would like to handle MouseWhell up/down + Ctrl key when mouse is above AvalonEdit control. Then I would execute commands to zoom in and zoom out of text editor text (I do "zoom" in and out by changing fontsize of editor control in my MVVM).

I have following input bindings on main window:

<MouseBinding Gesture="{inputmouse:MouseWheel Direction=Up, Keys=Control}" Command="{Binding MouseWhellUpCommand}" />
<MouseBinding Gesture="{inputmouse:MouseWheel Direction=Down, Keys=Control}" Command="{Binding MouseWhellDownCommand}" />

Following input bindings are handled and commands are executed everywhere in main window - except above AvalonEdit text control.

By looking at UISnoop and WPF Inspector I can see that events are already handled by AvalonEdit so they do not bubble up to my handlers on window.

Have even tried to move mouse bindings to AvalonEdit control itself but events still do not reach command handlers.

Should I maybe use PreviewMouseWheel or should I sub class AvalonEdit control (then what should I override?) ...

Right now - I'm little bit out of ideas how to solve this issue and I would need help.

 

 

Il tipo 'System.Data.Common.DbConnection' è definito in un assembly di cui manca il riferimento.

$
0
0

I would like tostart usingSharpDevelop

Butin my testproject Iaddedthe reference System.Data.SqlServerCe

Thisis my project

/*
 * Creato da SharpDevelop.
 * Utente: Marco
 * Data: 27/03/2017
 * Ora: 9.59
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
 
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Data.SqlServerCe;

namespace prova
{

    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public partial class MainForm : Form
    {
        public static void Main(string[ args)
        {
            Application.Run(new MainForm());
        }
       
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();


 

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
       
        void Button1Click(object sender, EventArgs e)
        {
           
                        SqlCeConnection conn = null;
            try
                {
                conn = new SqlCeConnection("Data Source=Server2008; Integrated Security=SSPI; Initial Catalog=cmfspa;User Id=sa;Password=martina02");
                con.Open();
                SqlCeCommand cmd = con.CreateCommand();
                cmd.CommandText="SELECT ar_descr, ar_desint, ar_codart, ar_ubicaz FROM artico WHERE ar_codart = '" + Codice_articolo.ToUpper().Trim() + "' , con";
                cmd.ExecuteNonQuery();
               
            }
            finally
                {
                con.Close();
                    }
        }
    }
}

Ierror in

SqlCeConnection conn = null;

and

SqlCeCommand cmd = con.CreateCommand();

the error for SqlCeConnection and SqlCeCommand is

The'System.Data.Common.DbConnection'type isdefined in an assemblyof which thereferenceis missing.Addan assembly reference'System.Data,Version =2.0.0.0,Culture = neutral,PublicKeyToken=b77a5c561934e089'.(CS0012)

Missing reference dll on target machine

$
0
0

Hi all, i'm developing a little windows forms project and referencing system.data.sqlite (ver 1.0.92.0 assembly installed on dev machine)

In reference poperties "specific version" is set to false

Debug and Release are working fine on dev machine (obviously!) but not on target machine, the error says that the reference to system.data.sqlite ver 1.0.92.0 is missing; after installing on target machine the same version (from sqlite) the error persist.

Dev machine: windows 10 pro 32 bit

Target machine: windows 10 pro 32 bit, windows 10 pro 64bit

Thanks in advance

 

Edit:

Just missed to say: it's a single .exe application, no install.

SharpDevelop Version : 5.1.0.5216-0e58df71

.NET Version         : 4.6.01586

target .net: 4.5.1

Is anyone monitoring this site

$
0
0

Or has it gone stale.

I reported an error, see post 59007. ILSpy just doesnt work with dlls produced by VS2017.

I would have thought it a major problem.

Can SharpDevelop do C++?

$
0
0

The reason I ask is because I love the language and I saw a folder called C++ in the new project box. But I can't try it out cuz I'm getting that business about the Windows SDK not being installed. And it is.


SharpZipLib unzip with url

$
0
0

We are unzipping a .zip file using Server.MapFile(SomeZipFile), pulling out a .pdf and displying it in the webpage on our main website. 

byte [ pdfBytes;
if (r[1].ToString() != "")
{
  ZipFile f = new ZipFile(Server.MapPath("/PDMA/somezipdile.zip");
  ZipEntry ze = f.GetEntry(somepdf.pdf);
  BinaryReader br = new BinaryReader(f.GetInputStream(ze));
  pdfBytes = br.ReadBytes(256000);
  br.Close();
  f.Close();
}

The above code works on our webserver...

Now,  I'm creating a second wesite and I have to grab a .zip file from our sebsite and do the same thing, HOWEVER, i have to use http://www.ourwebsite.com/folder/PDMA/somezipdile.zip

open that file, find the PDF and open it.  This second website will be on a different server... Any help would be fantactic.

Thanks in advance,

Customize the appearance of TextEditor

$
0
0

Good day!

In my program I use your TextEditor. I configure several schemes of highlight for it, but I can not figure out how to customize the appearance of the element itself.

I would very much like to set up a dark theme for the design.

Tell me please, is it possible, and if possible, then how?

AvalonEdit: BackgroundGeometryBuilder.GetRectsFromVisualSegment fails when ShowTabs is true

$
0
0

Hi, I have a pretty simple use case that works fine as long as I don't set ShowTabs to true in AvalonEdit. I have a IBackgroundRenderer where I want to highlight som characters by drawing a rectangle around them with this simple code:

private static void highlightCharacters(TextView textView, DrawingContext drawingContext, VisualLine visualLine, int startIndex, int length)
{
    var rects = BackgroundGeometryBuilder.GetRectsFromVisualSegment(textView, visualLine, startIndex, startIndex + length);
    foreach (Rect r in rects)
    {
        Rect drawRect = new Rect(r.X, r.Y, r.Width, r.Height);

        drawingContext.DrawRectangle(s_brush, null, drawRect);
    }
}

The problem with a line with tabs and ShowTabs (textView.Options.ShowTabs == true) is that the indexes seems to be all offset with the amount of tabs on that line. E.g. if I ask for startIndex 0 and length 1 and the first char on that line is a tab then a rect with Width 0 is returned instead of 32.

Bug? Am I doing anything wrong? Workaround?

Thanks!

Passing data between MainForm and Form1 in Python Windows Application

$
0
0

Hi,

I want to pass values between two Forms (Python Windows Application). How can I do it?

I have two forms: MainForm and Form1.

MainForm  contains one button and a Label. When I click on that button, Form1 should open and MainForm should be in inactive mode (i.e not selectable).

Form1 contains one submit button. When I click the submit button in Form1, the Form1 should close and change the text label in MainForm.

How can I do it? Can somebody help me to do this?

Bilder Auswahl

$
0
0

Hallo Community,

ich arbeite erst kürzlich mit SharpDevelop (SharpDevelop Version: 4.3.1.9430-406354be Build: 9430) und habe daher noch wenig Erfahrung. Ich möchte eine Windows Application schreiben, wo ich ein Bild (.png) pro Kategorie auswählen kann und mir das ausgewählte Bild dann, an eine von mir fest definierte Position angezeigt wird.

(Siehe Screenshot) In der Kategorie ''Hut'' wird also gefragt, welchen ich tragen möchte. In der ComboBox möchte ich dann bspw. zwischen drei Hüten auswählen können (Blauer Hut, Roter Hut, Schwarzer Hut) und je nachdem welchen Hut ich auswähle, so soll bspw. der Rote Hut dann, in der rechten PictureBox, an einer festen Stelle das Bild des Roten Hutes geladen/angezeigt werden.

- Zwischenfrage: Wie kann ich in der ComboBox einstellen, dass die Schriftfarbe des Blauen Hutes blau, des Roten rot und des Schwarzen schwarz ist?

- Zwischenfrage: Wie kann ich definieren, dass wenn ich bspw. den Roten Hut (der Hut kostet 2€) und eine Gelbe Hose (die Hose kostet 3€) auswähle, mir der Gesamtpreis (also 5€) unten Rechts, Rechts im leeren, weißen Feld neber dem ''Cost''-Feld, berechnet/angezeigt wird? Das kleine, leere, weiße Feld ist noch eine TextBox falls das hilft.

Das gleiche soll bei den drei anderen Kategorien passieren (Jacke, Hose, Schuhwerk). Die CheckBox ''Set'' könnt ihr getrost ignorieren (eine Spielerei).

 

Ich hoffe Ihr/Du könnt/kannst mir bei meinem Vorhaben helfen und mir ggf. Tipps geben welche Boxen oder sogar Programmiersprachen besser für sowas geeignet wären.

 


LG tr4mp

Getting started with a simple CS file

$
0
0

Hi all, Newby to this -- Installed OK, CS files​ associated with it OK, CS file loads OK, Same CS file compiles with dot net's CSC.exe fine (Net 4). SharpDevelop doesn't want to know. Almost all Build / Debug greyed out. After much consulting the oracle Google, not a sausage. Debug / "Attach to process" seemed a good place to start.  Nope, that just made mscorsvw.exe vanish from list. Came back after about 3 restarts. Finally, I find a feature that is not greyed out - an icon called "Builds all projects in the current solution"-- and that finally says "Compiling single files is not supported. Please create a project". So I go to File / New and Project is GREYED OUT. I can create a new CS file, which does NOTHING. So I choose New Solution. Then I get folders, I get files, I get lost, I give up.

Anyone telling me I should know how to use C#  before I come here is missding the point. I was fine with C# and Notepad++ and I wanted something a tiny bit better, buit I do not want to download MS.Net (I downloaded there Community edition, and on a 64 bit PC, it took 3 hours, then updated itself for anotgher 3 hours, then .. well, let's just remind ourselves I came here for something simpler and lighter, but something more t6han a text editor. 

So basically may I ask could we simplify this for newbies? Could you please help with a simple simple simple getting started guide? Please see tags for simplified questions. I hope this query helps others. 
Ps: Tried to sign in with a *.eu email address, email came 30 mins later. Tried googlemail.com, it took about 15 mins. Ended up ignoring first. That's not good is it. :-) .. Idea: Tell folks to expect to wait 30 mins?

Integrate NLP+AI into sharpdevelop IDE

$
0
0

I am not sure this idea is already in place or not, or it is possible or not. But I am thinking to place this idea to a right forum. Can it be possible integrate NLP + AI with Sharp Develop IDE? 


Now what is that and moreover why we need to do that? This feature is not for normal developer but who is not able to write code (Like, in accident may be they lost hand or something like that and for this they are losing their job!) but love to code and know how to write code. This feature will bring them another hope to write code and do job at some company. 
My idea will give them option to do all the stuffs using voice i.e. writing code + operating menus everything, whatever possible manually in IDE. 
But yes it is very difficult to integrate NLP+AI concept in Sharp develop to achieve this kind of activities but not impossible, I believe.

What you guys says about this?


printing in AvalonEdit- any way to do that?

$
0
0

Hi,

a newbie question- how do i print the text that an AvalonEdit control hold (including the text that has coloring applied)

 

Thanks in advanced,

Din

C# 6.0?

$
0
0

Is there any way to enable C# 6.0 in the editor, or even just in the compiler?

If not, is there a roadmap for this feature?

Exception while trying to decompile

$
0
0

Hello

I'm getting exception while decompilng any of the win form

p.s. "use variable names from debug symbols, if available" is unchecked

 

 ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Windows.Forms.Label Emanet.Acma_Onay_Barkod_Form::get_DolapNoLbl()
 ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__33_0(MethodDefinition method, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Mono.Cecil.MethodDefinition.get_Body()
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters)
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDefinition methodDef, DecompilerContext context, IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDefinition methodDef, DecompilerContext context, IEnumerable`1 parameters)
   at ICSharpCode.Decompiler.Ast.AstBuilder.CreateProperty(PropertyDefinition propDef)
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddTypeMembers(TypeDeclaration astType, TypeDefinition typeDef)
   at ICSharpCode.Decompiler.Ast.AstBuilder.CreateType(TypeDefinition typeDef)
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddType(TypeDefinition typeDef)
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileType(TypeDefinition type, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass31_0.<DecompileAsync>b__0()

 

 

Hi i need help for my school homework(Timer/Delay problem)

$
0
0

Hello im having a problem whit this code i dont now how to use the Timer

 

The idea is when you click the main boton the background change in colors (Blue-red) 50 times

i do this code but i dont now how to add a timer

/*
 * Created by SharpDevelop.
 * User: Ain
 * Date: 20/04/2017
 * Time: 19:49
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace nuevo
{

    publicpartialclassMainForm : Form
    {
        publicMainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
        voidButton1Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 50; i++) {
                BackColor = Color.Red;
                // i think i need to put the timer here
                BackColor = Color.Red;
                
            }
        }
        
    }

 

 

i try to go to desing/tools/Windows Form < and the end of the list there is a "Timer" but i dont have idea how to use it, i try to search documentation but all i found is sharpdevelop 1.0 :(

my question again! please help! in need a migrate

$
0
0

i have my cuestion here:

http://stackoverflow.com/questions/43552759/import-project-from-sharpdevelop-4-4-to-visual-studio-2010

and here http://community.sharpdevelop.net/forums/t/25202.aspx

Please help!! i need a solution please! thanks!!

Viewing all 1764 articles
Browse latest View live