예제 #1
0
 public static void Save(string fieldName, Type type)
 {
     if (fieldName == null || type == null)
     {
         return;
     }
     if (IsValid(type, out string name))
     {
         DO_Helper.Save(Path.Combine(Path.GetDirectoryName(type.Assembly.Location), name), fieldName, type);
     }
 }
예제 #2
0
        // public static void Save(int[] indexes, Type type)
        // {
        //     if (indexes == null || type == null)
        //         return;
        //     if (IsValid(type, out string name))
        //         DO_Helper.Save(Path.Combine(Path.GetDirectoryName(type.Assembly.Location), name), indexes, type);
        // }

        // public static void Save(int[] indexes, Type type, string rootdir)
        // {
        //     if (indexes == null || type == null || string.IsNullOrWhiteSpace(rootdir))
        //         return;
        //     if (IsValid(type, out string name))
        //         DO_Helper.Save(Path.Combine(rootdir, name), indexes, type);
        // }
        #endregion

        #region private
        private static void OnRefresh(string root_dir, Type t)
        {
            if (IsValid(t, out string name))
            {
                string path = Path.Combine(root_dir, name);
                if (File.Exists(path))
                {
                    DO_Helper.Parse(path, t);
                }
            }
        }
예제 #3
0
 public static void Save(Type type, string rootdir)
 {
     if (type == null || string.IsNullOrWhiteSpace(rootdir))
     {
         return;
     }
     if (IsValid(type, out string name))
     {
         DO_Helper.SaveAll(Path.Combine(rootdir, name), type);
     }
 }
예제 #4
0
        public static void Debug(Type type, string option_text, bool forcedSetMode)
        {
            System.Diagnostics.Debug.Assert(type != null);
            System.Diagnostics.Debug.Assert(string.IsNullOrWhiteSpace(option_text) == false);

            if (forcedSetMode == false || IsValid(type, out string name))
            {
                System.Diagnostics.Debug.WriteLine($"SCL::DataObject, ok -> {nameof(ConfigMgr)}");
                DO_Helper.Debug(type, option_text);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine($"SCL::DataObject, warn -> {nameof(forcedSetMode)} is FALSE");
                System.Diagnostics.Debug.WriteLine($"SCL::DataObject, warn -> {nameof(type)} is INVALID.");
                System.Diagnostics.Debug.Fail($"SCL::DataObject, fail -> {nameof(ConfigMgr)}");
            }
        }