Jump to content

ملف XML


Recommended Posts

الاكس ام ل , انا اشوف انه ماهو بذيك الصعوبه

لاكن بعض الناس يحط بعقله ذا الشي , لاكن مهي مشكله

راح اعطيك مثال صغير عن حفظ الكلام في ايديت او جلبه

edit = guiCreateEdit (....) 
save = guiCreateButton (....) 
  
addEventHandler ("onClientResourceStart", resourceRoot, function () -- اول ما يشتغل 
    local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
    if not xml then return end -- اذا ما كان موجود يوقف الوظيفه 
    local child = xmlFindChild (xml, "TheText", 0 ) -- نجيب مكان الكتابه 
    if (child) then -- اذا مكان الكتابه موجود 
    local text = xmlNodeGetValue (child) -- نجيب الكلام 
    guiSetText (edit, text) -- نكتبه 
    end 
end 
) 
  
addEventHandler ("onClientGUIClick", resourceRoot, function () 
    if (source == save) then -- اذا كان الزر زر الحفظ 
        local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
        local child = xmlFindChild (xml, "TheText", 0 ) or xmlCreateChild (xml, "TheText") -- نجيب مكان الكتابه 
        xmlNodeSetValue (child, guiGetText (edit))  -- نكتب الكلام في مكان الكتابه 
        xmlSaveFile (xml) -- نحفظ الملف 
        xmlUnloadFile (xml) -- نقفل الملف 
    end 
end 
)  
Link to comment
الاكس ام ل , انا اشوف انه ماهو بذيك الصعوبه

لاكن بعض الناس يحط بعقله ذا الشي , لاكن مهي مشكله

راح اعطيك مثال صغير عن حفظ الكلام في ايديت او جلبه

edit = guiCreateEdit (....) 
save = guiCreateButton (....) 
  
addEventHandler ("onClientResourceStart", resourceRoot, function () -- اول ما يشتغل 
    local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
    if not xml then return end -- اذا ما كان موجود يوقف الوظيفه 
    local child = xmlFindChild (xml, "TheText", 0 ) -- نجيب مكان الكتابه 
    if (child) then -- اذا مكان الكتابه موجود 
    local text = xmlNodeGetValue (child) -- نجيب الكلام 
    guiSetText (edit, text) -- نكتبه 
    end 
end 
) 
  
addEventHandler ("onClientGUIClick", resourceRoot, function () 
    if (source == save) then -- اذا كان الزر زر الحفظ 
        local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
        local child = xmlFindChild (xml, "TheText", 0 ) or xmlCreateChild (xml, "TheText") -- نجيب مكان الكتابه 
        xmlNodeSetValue (child, guiGetText (edit))  -- نكتب الكلام في مكان الكتابه 
        xmlSaveFile (xml) -- نحفظ الملف 
        xmlUnloadFile (xml) -- نقفل الملف 
    end 
end 
)  

ممكن توضح اكثر لو سمحت

ايش Text و TheText

ومشكور

Link to comment
الاكس ام ل , انا اشوف انه ماهو بذيك الصعوبه

لاكن بعض الناس يحط بعقله ذا الشي , لاكن مهي مشكله

راح اعطيك مثال صغير عن حفظ الكلام في ايديت او جلبه

edit = guiCreateEdit (....) 
save = guiCreateButton (....) 
  
addEventHandler ("onClientResourceStart", resourceRoot, function () -- اول ما يشتغل 
    local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
    if not xml then return end -- اذا ما كان موجود يوقف الوظيفه 
    local child = xmlFindChild (xml, "TheText", 0 ) -- نجيب مكان الكتابه 
    if (child) then -- اذا مكان الكتابه موجود 
    local text = xmlNodeGetValue (child) -- نجيب الكلام 
    guiSetText (edit, text) -- نكتبه 
    end 
end 
) 
  
addEventHandler ("onClientGUIClick", resourceRoot, function () 
    if (source == save) then -- اذا كان الزر زر الحفظ 
        local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
        local child = xmlFindChild (xml, "TheText", 0 ) or xmlCreateChild (xml, "TheText") -- نجيب مكان الكتابه 
        xmlNodeSetValue (child, guiGetText (edit))  -- نكتب الكلام في مكان الكتابه 
        xmlSaveFile (xml) -- نحفظ الملف 
        xmlUnloadFile (xml) -- نقفل الملف 
    end 
end 
)  

وضح اكتر لاهنت

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...