|
Detecting a junction should be as simple as:
private static bool IsHardLink(string filePath)
{
var attributes = File.GetAttributes(filePath);
return attributes.HasFlag(FileAttributes.ReparsePoint);
}
Retrieving the target is more complicated, but Jeff Brown has a solution:
Manipulating NTFS Junction Points in .NET[^]
private static string GetTargetName(string filePath)
{
return JunctionPoint.GetTarget(filePath);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
JunctionPoint deals with Directory.
My need is file symlink, espec HardLink, which means that the link resides on the same volume as the target but in another Directory.
|
|
|
|
|
With Windows all kinds of links are indicated by the FILE_ATTRIBUTE_REPARSE_POINT flag:
A file or directory that has an associated reparse point, or a file that is a symbolic link. To differentiate between file and directory links use the corresponding attribute flag. To check if a file is on the same drive (hard link), you have to resolve the resparse point to get the target (which you want anyway).
I have no solution for C# but the source of the article mentioned by Richard may contain useful information. A solution for C/C++ can be found at HowTo: Correctly read reparse data in Vista | Jochen Kalmbach's Blog[^].
|
|
|
|
|
For hard links, you can't do what you want. This Stack Overflow answer[^] explains why:
Quote: On NTFS all files are hard links. You can detect that a file has multiple hard links pointing to it, but there's no "real file" that it points to. You can think of hard links as just different names for the same file. So for example if you have file1.txt and you create a hard link file2.txt that points to the first file, both are hard links and the 'target' is the data on your disk.
What you can do, is detecting if a file is a symbolic link: c# - Check if a file is real or a symbolic link - Stack Overflow[^]
The quick brown ProgramFOX jumps right over the Lazy<Dog> .
|
|
|
|
|
I hope someone can help me abit. I have a customer that wants to sell his application only with a special tablet computer with windows as operating system. The application shall not be able to run on any other windows computer than the tablet that he is selling with the app. It's a very special project so please don't discuss if it is a good idea to bundle the app with the hardware.
My question is, how can I realise that? How can the app (C#, wpf) detect if it's the right computer?
For me this is a new area so I have no idea how this could work. How can I tell the application that this is the right computer? Where to store that information so that the app can compare during startup if it's still the same harware?
|
|
|
|
|
Quote: how to bind a wpf app to the hardware? You should understand the fact that a WPF application requires a .NET framework installation to work properly on the machine. Binding WPF to hardware, would require binding .NET framework to it as well.
Quote: The application shall not be able to run on any other windows computer than the tablet that he is selling with the app. You can modify the Windows Registry with some special keys, that only your publisher has access to and then check if they exist in the machine's registry. That would mean, that even a clean Windows install would remove any chances of using the application again — no keys, no usage.
Also, this is not just the hardware anymore, it is the operating system that controls the application. For hardware, you might want to consider tweaking with the BIOS — not recommended, and not necessary at all — and an even better way to do that would be to use a native application, such as a module written in C++.
You can take a look at Qt application development framework, they support embedded programming, or native programming to control and look for hardware-related stuff. Yet, providing the graphical components for your cross-platform development. This may be a better approach as compared to WPF and C#, because WPF requires .NET framework, which is only installable on Windows as .NET Core does not support WPF at the moment. Thus anything you do, first requires to pass the test of Windows operating system. Then, you can do that.
If you want to do that using WPF, please consider reading the documentation for modification of Windows Registry, How to: Create a Key In the Registry (Visual C#) | Microsoft Docs
Qt | Cross-platform software development for embedded & desktop
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Basically, you can't. Registry keys etc. are all very well, but an image backup of the tablet "hard disk" will allow it to be restored onto any compatible hardware.
All you can do is use the hardware serial numbers (such as the processor serial number: How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^] ) and use those to restrict the software to that exact tablet (but even then, you'll probably need to record that serial data at a remote site and check it in when the app starts of while it's running to avoid chating).
It's a difficult area - it's generally not worth putting a lot of effort into this as the better your protection, the more people want to crack it. And it's very, very easy to end up costing more to implement and maintain that it saves you in piracy. (Adobe spend a fortune protecting Photoshop, and the cracked version is normally still available on torrents the same day the legitimate version is released.) Add to that the fact that any failure will really piss off loyal, legitimate customers, and it gets silly to do it at all. (It's very easy to lose a good reputation, but very hard to get it back).
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 13196574 wrote: a special tablet computer How can you identify that "special tablet computer"? You have to ask your customer what he does here, and that might be a combination of things.
Then you have to find out how to read that information from the device.
If some hackers can find out how to pretend that their "standard" tablet computer is that "special" one, well, that's a problem of your customer, and you shouldn't worry about that (make sure your contract does not tell different!).
|
|
|
|
|
Almost every device I'm aware of, has a "physical" / MAC address tied to (usually) the network interface (card).
It should be globally unique, and will even identify the vendor (of the card) via the first xx-xx-xx of xx-xx-xx-xx-xx-xx (hex).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
|
hi how can i download offline Mappoint SDK API to integrate in my .net desktop software
where i can find that file
|
|
|
|
|
shaz17 wrote: download offline Mappoint SDK API to integrate in my .net desktop software That contradicts a lot, API SDKs are generated for online applications, you need to capture their REST architecture for the API and then code against it. All the applications, consuming these services require the connection to their APIs, or a test key which provides a dummy data.
You can start from here, Integrating MapPoint in your .NET applications
MapPoint
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
You have already been told the answer, why are you reposting the question? If you want to use Google maps then go to the Google developer website for information.
|
|
|
|
|
hi how can i download offline Mpoint SDK API to integrate in my .net desktop softwrea
|
|
|
|
|
What's mpoint? Is it just a mistype of MapPoint?
This space for rent
|
|
|
|
|
|
MapPoint is no longer a supported product so you're going to have problems finding a legitimate licensed version. Is there a requirement for you to use MapPoint or are you free to use alternatives (including free ones)?
This space for rent
|
|
|
|
|
we just developing a restaurant software in that system we need a feature which is we can search customer address postcode and direction and distance so that what we need for the the software if you can suggest some this that will be great full thanks
|
|
|
|
|
This is just the type of job that Bing Maps or Google Maps are designed for. These can both be used from desktop applications.
This space for rent
|
|
|
|
|
ok can you help with that plz
|
|
|
|
|
Certainly. Open up google and type in "bing maps sdk tutorial find address". If you want to use Google maps, replace bing with google in the search.
This space for rent
|
|
|
|
|
I have a USB Soundcard ("Line") which is my default recording device and has input and output:
My sound devices
Balance mixer
What I'm trying to do is adjusting the balance - set each level volume dynamically through code. I'm using the WaveLib library which allows me to identify my device and then adjust the channels. However, it tells me that my Line has 1 channel only, and any change I'm doing is done for both levels:
MixerLine line = mixers.Recording.Lines.GetMixerLineByControlId(4);
line.Channel = Channel.Left;
line.Volume = 20000;
Even when I change to:
line.Channel = Channel.Right;
line.Volume = 20000;
It wont change anything.
line properties (run time)
So I'm confused here a bit, would much appreciated help from someone who dealt with this library...
Thanks.
|
|
|
|
|
I'm using VS2005 C#. In win7 when I press the Rebuild Solution button under the error, but in winxp not error and run very well. Pay attention to win7 64 bit and 32 bit winxp.
Error 1 The "GenerateResource" task failed unexpectedly.
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(MemoryStream stream)
at System.Drawing.Image.System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at System.Resources.ResourceWriter.WriteValue(ResourceTypeCode typeCode, Object value, BinaryWriter writer, IFormatter objFormatter)
at System.Resources.ResourceWriter.Generate()
at System.Resources.ResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResourceWriter.Close()
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound) Shop
|
|
|
|
|
Member 2458467 wrote: A generic error occurred in GDI+. Well, those GDI errors generally come with useless information. The issue could be far simpler than you think: e.g. missing privileges to write the file.
Otherwise, make sure that .Net Framework version 2 is installed, and maybe you need some settings that that version is taken despite version 4 being available on the Win 7 machine.
|
|
|
|
|
I also do not know the cause of this error, all the related applications I installed on winxp how I install on win7 like that, I also installed Net 2.0 but still the error on. In win7 I do not troubleshoot (debug) This program when pressing the F11 key. Do you have any way to debug this program ?
|
|
|
|
|