Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

cyn8

@cyn8
About
Posts
129
Topics
67
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem getting shared folder that created by code using Win32_LogicalShareSecuritySetting [modified]
    C cyn8

    Hi, How to get a list of all the shared folder and get the share permission for each one? I tried to use ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_LogicalShareSecuritySetting"); But the line of code above does not return shared folder created by code. If i manually create the folder and set it as Shared folder through windows, the shared folder can be obtain from Win32_LogicalShareSecuritySetting. Just for information, the share and security setting for both folder created through code and manually created is the same. But if the shared folder created using code, it fails to return using Win32_LogicalShareSecuritySetting. If i use Win32_Share, i'm able to get all the share folders but the problem is i cannot use the method ("GetSecurityDescriptor") below to obtain the AccessMask or the share permission information. It will throw exception because GetSecurityDescriptor is not a method under Win32_Share: ManagementBaseObject outParamsMthd = m.InvokeMethod("GetSecurityDescriptor", null, options); Below is the code snippet to obtain shared folder permission information for user name "Everyone"

    ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_LogicalShareSecuritySetting");
    ManagementObjectSearcher searcher = new
    ManagementObjectSearcher(scope, query);

                    ManagementObjectCollection queryCollection = searcher.Get();
                    foreach (ManagementObject m in queryCollection)
                    {
                        string shareName = m\["Name"\].ToString();
                        string shareLocalPath = ShareManager.GetShareLocalPath(shareName);
                        Console.WriteLine(shareLocalPath);
                        if (folderPath == shareLocalPath)
                        {
                            InvokeMethodOptions options = new InvokeMethodOptions();
    
                            ManagementBaseObject outParamsMthd =
                            m.InvokeMethod("GetSecurityDescriptor", null, options);//GetSecurityDescriptor
                            ManagementBaseObject descriptor =
                            outParamsMthd\["Descriptor"\] as ManagementBaseObject;
    
                            ManagementBaseObject\[\] dacl = descriptor\["DACL"\] as
                            ManagementBaseObject\[\];
    
                            foreach (ManagementBaseObject ace in dacl)
                            {
                                Manag
    
    C# database security help tutorial question

  • How to get shared folder sharing permission for certain user name or group?
    C cyn8

    Hi everyone, Does anyone knows how to get shared folder sharing permission for certain user name or group? For example, for username "Everyone", how do get the info whether the sharing permission is Full Control, Change or Read? Thanks in advance

    C# tutorial question

  • what is the value if u add a value more than the maximum value for the data type
    C cyn8

    it is not my homework, just something that i encounter while programming...i want to know how the adding and minus works....how can it be negative number when the delta is 1 and it is added to the max value?

    C# question

  • what is the value if u add a value more than the maximum value for the data type
    C cyn8

    hi, may i know what suppose to be the answer for the below code and its reason for it? Int16 minValue=-32768; Int16 maxValue=32767; Int16 delta=2; Int16 Value = (Int16)(minValue - delta) Int16 Value = (Int16)(maxValue + delta) Thanks in advance.

    C# question

  • get the float value with 5 decimal place [modified]
    C cyn8

    hi, how do i set the decimal place of a float? i have, double Value = 3.40292e+038; then i want to get the float value with 5 decimal place. First i need to cast double into float, float x=(float)Value; what code should i use to be able to get x==3.40282e+038?

    modified on Thursday, December 13, 2007 12:12:20 AM

    C# question

  • write a function to check if the value is in float format?
    C cyn8

    hi, how can i write a function to check if the value is in float format? it should return true is the value is in float format. thanks

    C# question

  • safely bind data using xml file
    C cyn8

    hi, in the first application, i have a textbox which it's content is bind to a xml file. if there is 2 application running at the same time, when the second app changes the data in the xml file, how can i safely update the textbox which was binded to the xml file in the first app? Thanks in advance

    C# question xml announcement

  • how does wrapper class works?
    C cyn8

    Hi, can anyone explain with example(if can) what is a wrapper class? From my basic understanding, u can use it in order to enable reusability and also if in case in the future, there is a better class, u can just replace it with the new one. However, i'm not quite sure how it works. Thanks for any reply.

    C# question tutorial

  • socket programming
    C cyn8

    hi, i was wondering....how do you determine when to use sockets in networking. What conditions or requirement that needs sockets. the socket is from "using system.net.socket" Thanks in advance

    C# csharp

  • converting decimal into hexadecimal
    C cyn8

    hi, is there any simple way or code that i can use to convert a decimal into a hexadecimal? Thanks in advance:)

    C# question

  • data binding for listbox to display table
    C cyn8

    hi, i need your suggestion on how to do data binding to display a table consisting of data that is obtained from xml file. The table is created using listbox and should have the structure as shown below: _____________________________ |aaaaaaaaaaa|_________1______| |___________|_________2______| |bbbbbbbbbbb|________3_______| |___________|_________4______| May i know how should i write my xaml codes? Thanks.

    C# wpf wcf xml tutorial question

  • How to do effective multithreading
    C cyn8

    hi, i'm new to multithreading and i found it abit hard to understand. For example, i i were to have 3 thread which each prints the letter 'A','B' and 'C' respectively for 3 times(meaning, in total there should be 3 As,3 Bs and 3 Cs) and it is suppose to output as such ABCAABBCC. But how can i do it? I thought of using Join method to ensure that the thread which writes A will execute the final 2 As and the same for Bs and Cs.....However, it does not seem to work... what should i take note of to ensure that it works accordingly? Below are the codes that i've written wrongly i suppose. using System; using System.Threading; namespace MultiThreading2 { /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Thread t1=new Thread(new ThreadStart(WriteA)); Thread t2=new Thread(new ThreadStart(WriteB)); Thread t3=new Thread(new ThreadStart(WriteC)); t1.Start(); t2.Start(); t3.Start(); t1.Join(); t2.Join(); t3.Join(); Console.ReadLine(); } static void WriteA() { for(int i=0;i<3;i++) {Console.WriteLine("A"); Thread.Sleep(2000); } } static void WriteB() {for(int j=0;j<3;j++) { Console.WriteLine("B"); Thread.Sleep(2000); } } static void WriteC() {for(int k=0;k<3;k++) { Console.WriteLine("C"); Thread.Sleep(2000); } } } } Thanks for any replies:)

    C# tutorial question

  • declaring xmlserializer where typeof is a class derived from arraylist
    C cyn8

    Hi, Thanks...Your solution is just what i need to do! Now it seems that all is working properly:) Thanks and best regards:rose: Have a nice day:-D

    C# question xml help

  • declaring xmlserializer where typeof is a class derived from arraylist
    C cyn8

    THANK YOU!!! You are a LIFE SAVER!!! Man, it is the people like you that makes this world a better place to live in:P Your codes works like a charm. However, there is a small problem, there seem to extra shape(exactly same shape) that is overlap on each shape. When i drag and drop on of the shape, the extra shape is temporary will be display at the original coordinate. But later if i want to drag the extra shape, it cannot be dragged and sometimes after i dragged a shape, all the extra shapes that is position on the saved shape original position will disappear. What you think that it is caused by? Below are the codes in the Load function located in the form( ShapeTypeList,CoordList,SizeList are arraylist that contains the data for the shapes to be drawn on the form): OpenFileDialog openFileDialog = new OpenFileDialog(); ArrayList arr =new ArrayList(); ArrayList ColorArr =new ArrayList(); if (openFileDialog.ShowDialog() == DialogResult.OK) { filename = openFileDialog.FileName; ClearArrayList(); MyData deserializeData =MyData.Load(filename); ShapeTypeList=deserializeData.ShapeTypeList; CoordList=deserializeData.CoordList; ColorArr=deserializeData.ColorList; SizeList=deserializeData.SizeList; arr=deserializeData.GraphicsPathData; for(int j=0;j What should i do to solve this problem? Thanks a million:) -- modified at 6:53 Thursday 23rd August, 2007

    C# question xml help

  • declaring xmlserializer where typeof is a class derived from arraylist
    C cyn8

    Sorry, the links does not seem to work. Can you please send it again? Thanks:)

    C# question xml help

  • needs advice in xmlserialize arraylist. [modified]
    C cyn8

    hi, imagine that i have five arraylists(ShapeTypeList,ColorList,CoordList,SizeList,PathList). All contains different types such as enum,Color,Point[] and etc. This arraylist is used in the form to store information on the Shapes to be drawn onto the form. Then, there is a Save function which is used to store all the informations in the arraylist using xml. I've create a AllData class inorder to serialize the class to an xml file. Can anybody give me some guides or tips on how to use xmlserializer to save the arraylist into xml file? the format i'm looking for is as below: .... .... .... ....... ........ ........ However other format also acceptable as long as i can deserialize it later. Thanks in advance. -- modified at 3:59 Wednesday 22nd August, 2007

    C# xml tutorial question

  • declaring xmlserializer where typeof is a class derived from arraylist
    C cyn8

    hi, i'm sorry to say that i'm still stuck. The XML file can be generated but it is the same as shown before where there is no root and all the element is "ArrayOfAnyType" [XmlRoot("MyData")] public class MyData { ArrayList shapeTypeList; ArrayList colorList; ArrayList coordList; ArrayList sizeList; ArrayList arrS; [XmlArray("ShapeData")] [XmlArrayItem("Shape",typeof(ShapeL))] public ArrayList ShapeTypeList { get { return this.shapeTypeList; } set{this.shapeTypeList=value;} } public class ShapeL { public ShapeL(){} public TypeOfShape c { get{return c;} set{c=value;} } } [XmlArray("ColorData")] [XmlArrayItem("Color",typeof(ColorL))] public ArrayList ColorList { get { return this.colorList; } set{this.colorList=value;} } public class ColorL { public ColorL(){} [XmlElement("color")] public Color c { get{return c;} set{c=value;} } } [XmlArray("CoordinateData")] [XmlArrayItem("Coordinate",typeof(Coordinate))] public ArrayList CoordList { get { return this.coordList; } set{this.coordList=value;} } public class Coordinate { public Coordinate(){} public Point[] point { get{return point;} set{point=value;} } } [XmlArray("SizeData")] [XmlArrayItem("Size",typeof(SizeL))] public ArrayList SizeList { get { return this.sizeList; } set{this.sizeList=value;} } public class SizeL { public SizeL(){} public Size c { get{return c;} set{c=value;} } } [XmlArray("GPDData")] [XmlArrayItem("GPD",typeof(ArrSave))] public ArrayList ArrS { get { return this.arrS; } set{ this.arrS=value;} } public class ArrSave { public ArrSave(){} public MemoryStream c { get{return c;} set{c=value;} } } public MyData() { } public MyData(ArrayList shape, ArrayList color, ArrayList coord, ArrayList size, ArrayList gpd) { this.ShapeTypeList = shape; this.ColorList = color; this.CoordList = coord; this.SizeList = size; this.ArrS = gpd; } public enum TypeOfShape { Square, Rect, Parallelogram, Trapezoid, Diamond, Triangle, RightAngleTriangle,Circle,Oval,Hexagon,Pentagon,None } // XmlSerializer serializ() // { // XmlSerializer s = new XmlSerializer( typeof(ArrayList),new Type[] {typeof(Coordinate),typeof(ColorL),typeof(SizeL), type

    C# question xml help

  • declaring xmlserializer where typeof is a class derived from arraylist
    C cyn8

    hi, if i have a class like below: [XmlRoot("MyData")] public class MyData:ArrayList { public MyData() { } public MyData(ArrayList shape, ArrayList color, ArrayList coord, ArrayList size, ArrayList gpd) { this.ShapeTypeList = shape; this.ColorList = color; this.CoordList = coord; this.SizeList = size; this.ArrS = gpd; }....... In the Form: MyData data=new MyData(); XmlSerializer s=new XmlSerializer(typeof(MyData)); generates the error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error reflecting type 'DrawShape.MyData'. How can i declare XmlSerializer for a Class MyData which inherits ArrayList class? Thanks in advance

    C# question xml help

  • problem in xmlserialization for arraylist
    C cyn8

    hi, now i've tried to create the MyData class. However, i'm stuck on how to change the codes in the form to do the serialization. below is some of the codes: MyData Class: [XmlRoot("MyData")] public class MyData { public MyData() { } public MyData(ArrayList shape, ArrayList color, ArrayList coord, ArrayList size, ArrayList gpd) { this.ShapeTypeList = shape; this.ColorList = color; this.CoordList = coord; this.SizeList = size; this.arrS = gpd; } public enum TypeOfShape { Square, Rect, Parallelogram, Trapezoid, Diamond, Triangle, RightAngleTriangle,Circle,Oval,Hexagon,Pentagon,None } // XmlSerializer serializ() // { // XmlSerializer s = new XmlSerializer( typeof(ArrayList),new Type[] {typeof(Coordinate),typeof(ColorL),typeof(SizeL), typeof(ArrSave)} ); // return s; // } XmlSerializer s = new XmlSerializer( typeof(ArrayList),new Type[] {typeof(Coordinate),typeof(ColorL),typeof(SizeL), typeof(ArrSave)} ); ArrayList ShapeTypeList=new ArrayList (); ArrayList ColorList=new ArrayList (); ArrayList CoordList=new ArrayList(); ArrayList SizeList = new ArrayList(); ArrayList arrS = new ArrayList(); ArrayList PathList =new ArrayList(); //[XmlArray("CoordinateData")] [XmlElement("Coordinate",typeof(Coordinate))] public ArrayList coordList { get{return CoordList;} set{CoordList=value;} } public class Coordinate { public Coordinate(){} public Point[] point { get{return point;} set{point=value;} } }..................... MovePosition Function in Form: private void MovePosition(int position,int BshapeNo,int sztotal,int szOrd) { if((TypeOfShape)ShapeTypeList[shapeNo]!=TypeOfShape.Circle&&(TypeOfShape)ShapeTypeList[shapeNo]!=TypeOfShape.Oval) { alDrawingObjects.Insert(position, new Polygon((Color)ColorList[shapeNo], (Point[])CoordList[shapeNo], 5,(GraphicsPath)PathList[shapeNo] )); } else if ((TypeOfShape)ShapeTypeList[shapeNo]==TypeOfShape.Circle||(TypeOfShape)ShapeTypeList[shapeNo]==TypeOfShape.Oval) { alDrawingObjects.Insert(position, new Ellipse((Color)ColorList[shapeNo],(Point[]) CoordList[shapeNo], (Size)SizeList[sizeOrder], 5) ); SizeList.Insert(sztotal,(Size)SizeList[sizeOrder]); SizeList.RemoveAt(szOrd); } CoordList.Insert(position, (Point[])CoordList[shapeNo]); ColorList.Insert(position,(Color)ColorList[shapeNo]); ShapeTypeList.Insert(position,(TypeOf

    C# question help xml

  • problem in xmlserialization for arraylist
    C cyn8

    Hi, below is how i declare my XmlRoot. However the error is still the same as before. Should i create another class such as MyData class as you shown before? [XmlRoot("Form")] public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Panel panel1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; ColorDialog clg = new ColorDialog(); XmlSerializer s = new XmlSerializer( typeof(ArrayList),new Type[] {typeof(Coordinate),typeof(ColorL),typeof(SizeL), typeof(ArrSave)} ); ArrayList ShapeTypeList=new ArrayList (); ArrayList ColorList=new ArrayList (); private ArrayList alDrawingObjects = new ArrayList(); ArrayList CoordList=new ArrayList(); //[XmlArray("CoordinateData")] [XmlElement("Coordinate",typeof(Coordinate))] public ArrayList coordList { get{return CoordList;} set{CoordList=value;} } public class Coordinate { public Coordinate(){} public Point[] point { get{return point;} set{point=value;} } }............ Thanks for the reply:)

    C# question help xml
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups