예제 #1
0
 //Make handlers for scheduler from profiles
 private Handler.IHandler[] MakeHandlers(JSONProfile profile)
 {
     Handler.IHandler[] handlers = new Handler.IHandler[GlobalSetting.KeyMaxNumber];
     for (int i = 0; i < handlers.Length; i++)
     {
         handlers[i] = ModeFactory.Get(profile.jSONModes[i].Name).CreateHanlder(profile.jSONModes[i].Set);
     }
     return(handlers);
 }
예제 #2
0
        public bool AddNewProfile(string name)
        {
            var profile = new JSONProfile();

            profile.Check();
            profile.Name = name;
            Array.Resize(ref cc.profileContainer.jSONProfiles, cc.profileContainer.jSONProfiles.Length + 1);
            cc.profileContainer.jSONProfiles[cc.profileContainer.jSONProfiles.Length - 1] = profile;
            if (!cc.profileContainer.Save())
            {
                Array.Resize(ref cc.profileContainer.jSONProfiles, cc.profileContainer.jSONProfiles.Length - 1);
                return(false);
            }
            return(true);
        }
예제 #3
0
        public void Check()
        {
            if (jSONProfiles.Length > GlobalSetting.ProfileMaxNumber)
            {
                Array.Resize(ref jSONProfiles, GlobalSetting.ProfileMaxNumber);
            }

            for (int i = 0; i < jSONProfiles.Length; i++)
            {
                if (jSONProfiles[i] == null)
                {
                    jSONProfiles[i] = new JSONProfile();
                }

                jSONProfiles[i].Check();
            }
        }
예제 #4
0
 public void Create()
 {
     CurrentProfileIndex = 0;
     jSONProfiles        = new JSONProfile[1];
     jSONProfiles[0]     = new JSONProfile();
 }