public void LoadAsset()
    {
        try
        {
            StreamReader reader = new StreamReader(filePath, Encoding.Default);
            using (reader)
            {
                string tag;
                //Debug.Log("LoadAsset read from " + filePath);
                ccUtils.PositionAfter(reader, "Asset");
                string value = null;
                do
                {
                    value = ccUtils.SDTNext(reader, out tag);
                    if (value == null)
                    {
                        continue;
                    }
                    //Debug.Log("LoadAsset got " + value + " for tag " + tag);
                    switch (tag)
                    {
                    case "Name":
                        this.asset_name = value;
                        //Debug.Log("LoadAsset adding to dict: " + this.asset_name);
                        asset_dict.Add(this.asset_name, this);
                        break;

                    case "ActualAccessList":
                        //Debug.Log("AssetBehavior, LoadAsset ActualAccessList is " + value);
                        this.dac_access = new DACAccess(value, this);
                        //Debug.Log("dac string is "+GetDACString());
                        break;
                    }
                }while (value != null);
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message + "\n");
        }
    }
예제 #2
0
    public void SetDAC(DACAccess dac)
    {
        /* associate a DACAccess with this gui panel */
        this.current_dac = dac;
        user_group_dropdown.ClearOptions();
        List <Dropdown.OptionData> ddo = new List <Dropdown.OptionData>();

        foreach (KeyValuePair <string, DACAccess.DACEntry> entry in dac.dac_dict)
        {
            Dropdown.OptionData new_data = new Dropdown.OptionData(entry.Key);
            ddo.Add(new_data);
        }
        user_group_dropdown.AddOptions(ddo);
        string user_group_name = user_group_dropdown.captionText.text;

        DACAccess.DACEntry dac_entry = dac.dac_dict[user_group_name];
        ModeOptions(read_dropdown, dac_entry.read);
        ModeOptions(write_dropdown, dac_entry.write);
        ModeOptions(control_dropdown, dac_entry.control);
        ModeOptions(execute_dropdown, dac_entry.execute);
    }