Jump to content
Xtreme .Net Talk

IngisKahn

Avatar/Signature
  • Posts

    436
  • Joined

  • Last visited

Everything posted by IngisKahn

  1. I'd submit that if you have to switch to c++ because of the mathematical calculations you need to do then you original language was a flaming pile. Hehe... object watch... t w a t
  2. I'd just suggest encapsulation, the "has a" relationship should be applicable. From the C# faq blog: 1. Different languages actually have different expectations for how MI works. For example, how conflicts are resolved and whether duplicate bases are merged or redundant. Before we can implement MI in the CLR, we have to do a survey of all the languages, figure out the common concepts, and decide how to express them in a language-neutral manner. We would also have to decide whether MI belongs in the CLS and what this would mean for languages that don't want this concept (presumably VB.NET, for example). Of course, that's the business we are in as a common language runtime, but we haven't got around to doing it for MI yet. 2. The number of places where MI is truly appropriate is actually quite small. In many cases, multiple interface inheritance can get the job done instead. In other cases, you may be able to use encapsulation and delegation. If we were to add a slightly different construct, like mixins, would that actually be more powerful? 3. Multiple implementation inheritance injects a lot of complexity into the implementation. This complexity impacts casting, layout, dispatch, field access, serialization, identity comparisons, verifiability, reflection, generics, and probably lots of other places.
  3. Sure, are you using C# 3.0? ;)
  4. Why not start with the DX Sample Framework's camera?
  5. Ya, increase your minimum requirements. :p
  6. Snippit? This is a fairly complicated algorithm. I've never heard of any third party software that does this (and I've worked with barcodes more than a bit), but I didn't fire up the search engine either. however, if you understand how barcode readers work, you should be able to write one.
  7. This dose of code starts a new thread, running the function Me.ShowFilesInFolder at the same time that other code is executing. <Rant Missing="Shift Space Period Dictionary" />
  8. Finally, something makes sense.
  9. Eu sou decepcionado muito! Hehe
  10. What? You mean that avatar isn't you?
  11. Hmm, it does seem that way.
  12. Right, you have 10,432 gold but no matter how much searching you do you just can't find it. Try making a simple app and use WinHack to mod a value in it. Then use the code I posted above and try to mod it. :)
  13. Marble's right, only high-end video cards support non power of 2 sized textures. However, you can just pad your jpg's to 256x256 and pass a 150x150 rectangle to the sprite's Draw function.
  14. Screen 13 heh
  15. Screw that, it's BASICA for me. It's not programming if you don't have line numbers! :p
  16. Trainers that merely track down values in memory are very easy to protect against (as seen above). The good trainers use code injection to rewrite routines. However, since .NET is JIT'ed it makes this type of exploit next to impossible to pull off. If you're writing a game in .NET you'll probably be NAMKE'ing it so it might be a good idea to ensure you do something different with your important methods.
  17. You can't. :( no fun
  18. 0 is black, 0xFFFFFF is white (ignoring alpha). :)
  19. Generally classes and boxed values go on the heap and local variables (value type or ref address) go on the stack. Here's a few simple ways you could protect a value. For the first method you'd use a ProtectedValue<int> to rebox the value on every get/set. This means it will be moving around the heap. The second method using ProtectedInt splits your value apart using a random xor'ed key and stores them in random array positions on every get/set. The third method would be to combine the two by using ProtectedValue<ProtectedInt>. struct ProtectedValue<T> where T : struct { object boxed; public T Value { get { T v = (T)boxed; boxed = v; return v; } set { boxed = value; } } public ProtectedValue(T initialValue) { boxed = initialValue; } public static implicit operator T(ProtectedValue<T> x) { return x.Value; } public static implicit operator ProtectedValue<T>(T x) { return new ProtectedValue<T>(x); } } struct ProtectedInt { static readonly System.Random random = new System.Random(); const int arraySize = 4; int keyIndex; int xorIndex; int[] key; int[] xor; public int Value { get { int v = xor[xorIndex] ^ key[keyIndex]; xor[xorIndex = random.Next(arraySize)] = v ^ (key[keyIndex = random.Next(arraySize)] = random.Next()); return v; } set { xor[xorIndex = random.Next(arraySize)] = value ^ (key[keyIndex = random.Next(arraySize)] = random.Next()); } } public ProtectedInt(int intiialValue) { keyIndex = 0; xorIndex = 0; key = new int[arraySize]; xor = new int[arraySize]; Value = intiialValue; } public static implicit operator int(ProtectedInt x) { return x.Value; } public static implicit operator ProtectedInt(int x) { return new ProtectedInt(x); } }
  20. Actually, no. If you can manage to decipher the mess of IL that is generated for anonymous methods you'd see that it creates a wrapper class for each method that contains any external values in that method as fields.
  21. An anonymous method does not need to specify delegate arguments if it does not need them (all or nothing). When you assign an anonymous method any variables defined outside that method (in this case "msg") have their values "hard coded" into that method.
  22. Then PD's example is the way to go. You can't really get a list of all the exception types, since anyone can inherit from Exception, but doing a search for Exception in Object Browser will get a list of all those that are defined.
  23. Why? http://www.microsoft.com/downloads/details.aspx?displaylang=pt-br&FamilyID=04DBAF2E-61ED-43F4-8D2A-CCB2BAB7B8EB
  24. Object Browser is your friend. There's a constructor that takes a byte[]
  25. Console only writes to the IDE window if it is set to do so in the options. Have you tried running your app outside of the IDE?
×
×
  • Create New...