HelpFour small errors

Posts 17 of 7 · Page 1 of 1
Four small errors
Hey.
I have downloaded one good program and I have decompiled it. I want to change some adresses and then to build it, but in Visual Studio I have 4 errors found... One is "Duplicate System Runtime Versioning Target Framework attribute", other about names which do not exist. You can see it in the screenshots. I am totally beginner, so although I have found some information about it, I cannot repair the source code.
I hope skilled programmer will have it done in 4 minutes...

Could anybody help me? I really need it!

Thanks a lot.



Second one.



Uploaded with ImageShack.us

Uploaded with ImageShack.us

Code:
// Assembly Hack-Dayz, Version 1.0.0.0

[assembly: System.Reflection.AssemblyCompany("")]
[assembly: System.Reflection.AssemblyProduct("Hack-Dayz")]
[assembly: System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: System.Reflection.AssemblyTitle("Hack-Dayz")]
[assembly: System.Reflection.AssemblyDescription("")]
[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | System.Diagnostics.DebuggableAttribute.DebuggingModes.Default)]
[assembly: System.Runtime.CompilerServices.CompilationRelaxations(8)]
[assembly: System.Runtime.InteropServices.Guid("5862f95c-7600-42ad-85a2-a5334007131d")]
[assembly: System.Reflection.AssemblyCopyright("Copyright \x00a9  2012")]
[assembly: System.Reflection.AssemblyFileVersion("1.0.0.0")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.0,Profile=Client", FrameworkDisplayName=".NET Framework 4 Client Profile")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.Reflection.AssemblyTrademark("")]

----

namespace WindowsApplication1.My
{
    using Microsoft.VisualBasic.ApplicationServices;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.Configuration;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;

    [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0"), CompilerGenerated, EditorBrowsable(EditorBrowsableState.Advanced)]
    internal sealed class MySettings : ApplicationSettingsBase
    {
        private static bool addedHandler;
        private static object addedHandlerLockObject = RuntimeHelpers.GetObjectValue(new object());
        private static MySettings defaultInstance = ((MySettings) SettingsBase.Synchronized(new MySettings()));

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Advanced)]
        private static void AutoSaveSettings(object sender, EventArgs e)
        {
            if (MyProject.Application.SaveMySettingsOnExit)
            {
                MySettingsProperty.Settings.Save();
            }
        }

        public static MySettings Default
        {
            get
            {
                if (!addedHandler)
                {
                    object addedHandlerLockObject = MySettings.addedHandlerLockObject;
                    ObjectFlowControl.CheckForSyncLockOnValueType(addedHandlerLockObject);
                    lock (addedHandlerLockObject)
                    {
                        if (!addedHandler)
                        {
                            MyProject.Application.Shutdown += new ShutdownEventHandler(MySettings.AutoSaveSettings);
                            addedHandler = true;
                        }
                    }
                }
                return defaultInstance;
            }
        }
    }
}
Might be a silly question, but the part about ..
Code:
[assembly: System.Reflection.AssemblyCompany("")]
[assembly: System.Reflection.AssemblyProduct("Hack-Dayz")]
[assembly: System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)]
[assembly: System.Reflection.AssemblyTitle("Hack-Dayz")]
[assembly: System.Reflection.AssemblyDescription("")]
[assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | System.Diagnostics.DebuggableAttribute.DebuggingModes.Default)]
[assembly: System.Runtime.CompilerServices.CompilationRelaxations(8)]
[assembly: System.Runtime.InteropServices.Guid("5862f95c-7600-42ad-85a2-a5334007131d")]
[assembly: System.Reflection.AssemblyCopyright("Copyright \x00a9  2012")]
[assembly: System.Reflection.AssemblyFileVersion("1.0.0.0")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.0,Profile=Client", FrameworkDisplayName=".NET Framework 4 Client Profile")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.Reflection.AssemblyTrademark("")]
(error 1: Duplicate System Runtime Versioning Target Framework attribute)
did you type all that manually into your new project? When you create a new project in msvs, it should automatically add all those properties for you (when you tell it the project name / target framework etc). ??
(aka. how did it get in there twice? A bug in msvs, or you typed it in?)

--not sure about the legality of 'copying'/'modifying' someone's program like that. (?)

Do you know about Classes, variable scope, functions etc? Or is this your first time programming? Just new to C#?
I am totally beginner. I just need to optimalize the program. So I do not know anything.
Copying - I think it will not be problem because the program will be only for me.
MyProject.Application.SaveMySettingsOnExit should be Properties.Settings.Default.SaveMySettingsOnExit ? but..

"SaveMySettingsOnExit" isn't declared.

Code:
internal sealed class MySettings : ApplicationSettingsBase
    {
        private static bool addedHandler;
        private static object addedHandlerLockObject = RuntimeHelpers.GetObjectValue(new object());
        private static MySettings defaultInstance = ((MySettings) SettingsBase.Synchronized(new MySettings()));

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Advanced)]
        private static void AutoSaveSettings(object sender, EventArgs e)
        {
            if (MyProject.Application.SaveMySettingsOnExit)
            {
                MySettingsProperty.Settings.Save();
            }
        }

        public static MySettings Default
        {
            get
            {
                if (!addedHandler)
                {
                    object addedHandlerLockObject = MySettings.addedHandlerLockObject;
                    ObjectFlowControl.CheckForSyncLockOnValueType(addedHandlerLockObject);
                    lock (addedHandlerLockObject)
                    {
                        if (!addedHandler)
                        {
                            MyProject.Application.Shutdown += new ShutdownEventHandler(MySettings.AutoSaveSettings);
                            addedHandler = true;
                        }
                    }
                }
                return defaultInstance;
            }
        }
    }
^^ie. 3 private things, and 1 public. Where is the variable for "AutoSaveOnExit"?

you have to declare a local variable in the properties class (Settings.Designer.cs) named AutoSaveOnExit..or um..SaveMySettingsOnExit.

Code:
internal sealed class MySettings : ApplicationSettingsBase
    {
        public bool SaveMySettingsOnExit = true; // or false I guess
        private static bool addedHandler;
        private static object addedHandlerLockObject = RuntimeHelpers.GetObjectValue(new object());
        private static MySettings defaultInstance = ((MySettings) SettingsBase.Synchronized(new MySettings()));

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Advanced)]
        private static void AutoSaveSettings(object sender, EventArgs e)
        {
            if (MyProject.Application.SaveMySettingsOnExit)
            {
                MySettingsProperty.Settings.Save();
            }
        }

        public static MySettings Default
        {
            get
            {
                if (!addedHandler)
                {
                    object addedHandlerLockObject = MySettings.addedHandlerLockObject;
                    ObjectFlowControl.CheckForSyncLockOnValueType(addedHandlerLockObject);
                    lock (addedHandlerLockObject)
                    {
                        if (!addedHandler)
                        {
                            MyProject.Application.Shutdown += new ShutdownEventHandler(MySettings.AutoSaveSettings);
                            addedHandler = true;
                        }
                    }
                }
                return defaultInstance;
            }
        }
    }
and also change MySettingsProperty.Settings.Save to Properties.Settings.Default.Save();


I do mostly vb.net sorry. I might be wrong.

My suggestion -- analyze what settings the program is saving. Are there a lot? Maybe forget about storing them in "Settings" and just create a global variable for each setting, since it's just for you. And erase all the code related to saving settings.

edit: you changed the namespace from "Settings" to "My" so....

MySettingsProperty.Settings.Save == Properties.My.Default.Save();

-- and also, I'm not sure how you modified the "properties" class, because when I create a new project in c# 4.0, my default looks like this (I'm not sure where you got the addHandle / addHandlerLockObject) (?)

Code:
namespace WindowsFormsApplication1.Properties
{


    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
    {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default
        {
            get
            {
                return defaultInstance;
            }
        }
        public string DoShit = "hellno"; // not default, testing namespace/visibility.

    }
}
------
Code:
if (Properties.My.Default.SaveMySettingsOnExit)
{
Properties.My.Default.Save();
}


any of the errors go away? Hopefully only 2 now?

---------- Post added at 02:17 PM ---------- Previous post was at 01:29 PM ----------

or, upload the entire project's source somewhere (remove any lines you deem sensitive of course) (w/ 2 antivirus scans, as dictated by forum rules)

and I'll modify the code and re-upload project.

---------- Post added at 03:13 PM ---------- Previous post was at 02:17 PM ----------

or, if you have TeamViewer (and understand security details involved?), I can connect to you and show you.
That would be awesome... I really need it, because it is my school project. At all, I have scanned it with Virustotal and it in one case says there is a scanner inside. Thats why I want to tell you the program is a decompiled key stealer, it means malware, which has attacked my PC in the past. And because my project is "Malware" I have chosen this one bad program, because I know how does it work and I can show its badness to other people. And example of its uploading with the source code will be nice! :-)
I need only to help with the errors, the website is already made.

For URL check your profile.
Thanks a lot.
Why does your project have 2 copies of all the files? How are you 'disassembling' the program back into source code? Just make a new project and add the important parts by hand: I'm not sure how you created that msvs project you posted to my wall, but it has more than 4 small errors. I don't think I can help, sorry.
Posts 17 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?