Exemple #1
0
 /// <summary>
 /// Default use here method with one argument
 /// Return false in case of exception, otherwise true
 /// In console app is needed put in into try-catch error due to there is no globally handler of errors
 /// </summary>
 /// <param name="type"></param>
 /// <param name="methodName"></param>
 /// <param name="exception"></param>
 public static bool ThrowIsNotNull(string stacktrace, object type, string methodName, string exception)
 {
     if (exception != null)
     {
         ThrowExceptions.Custom(Exc.GetStackTrace(), type, Exc.CallingMethod(), exception);
         return(false);
     }
     return(true);
 }
Exemple #2
0
        public static string i18n(string k)
        {
            switch (k)
            {
            case "isNotInWindowsPathFormat":
                return("is not in Windows Path format");

            default:
                ThrowExceptions.NotImplementedCase(Exc.GetStackTrace(), type, Exc.CallingMethod(), k);
                break;
            }

            return(null);
        }
Exemple #3
0
        /// <summary>
        /// Create all upfolders of A1 with, if they dont exist
        /// </summary>
        /// <param name="nad"></param>
        public static void CreateFoldersPsysicallyUnlessThere(string nad)
        {
            ThrowExceptions.IsNullOrEmpty(Exc.GetStackTrace(), type, "CreateFoldersPsysicallyUnlessThere", "nad", nad);
            ThrowExceptions.IsNotWindowsPathFormat(Exc.GetStackTrace(), type, Exc.CallingMethod(), "nad", nad);

            FS.MakeUncLongPath(ref nad);
            if (FS.ExistsDirectory(nad))
            {
                return;
            }
            else
            {
                List <string> slozkyKVytvoreni = new List <string>();
                slozkyKVytvoreni.Add(nad);

                while (true)
                {
                    nad = FS.GetDirectoryName(nad);

                    // TODO: Tady to nefunguje pro UWP/UAP apps protoze nemaji pristup k celemu disku. Zjistit co to je UWP/UAP/... a jak v nem ziskat/overit jakoukoliv slozku na disku
                    if (FS.ExistsDirectory(nad))
                    {
                        break;
                    }

                    string kopia = nad;
                    slozkyKVytvoreni.Add(kopia);
                }

                slozkyKVytvoreni.Reverse();
                foreach (string item in slozkyKVytvoreni)
                {
                    string folder = FS.MakeUncLongPath(item);
                    if (!FS.ExistsDirectory(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }
                }
            }
        }