/* * if (button[i].Checked == True){ * button[i] map to masking json file * display * svID.text= text; * **/ private void btnSave_Click(object sender, EventArgs e) { SSMManager aMasker = new SSMManager(); SSMPositionManager mcssmmanager = new SSMPositionManager(); // listBoxIndex.Items.Clear(); //gives index of the selected box //checkedlistbox to a string array (items which has been checked in checkedlistbox to store in a string array) ////if (acheckbox.Items.Count > 0) int[] itemArr = new int[acheckbox.CheckedItems.Count]; Int32 counter = 0; foreach (object item in this.acheckbox.CheckedItems) { int temp = Convert.ToInt32(item); itemArr[counter] = temp; counter++; aMasker.DataLength = counter; aMasker.Masking = itemArr; //indeces of selected checkboxes aMasker.Date = DateTime.Now; } aMasker.Save(); }
public void LoadMasker(string lsFilename = null) { if (lsFilename == null) { lsFilename = SSMPositionManager.MASK_FILE; } try { using (StreamReader aSReader = File.OpenText(lsFilename)) { JsonSerializer serializer = new JsonSerializer(); mcMasker = (SSMManager)serializer.Deserialize(aSReader, typeof(SSMManager)); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }