コード例 #1
0
        private static object RunTouchAndReturnExitCode(TouchOptions opts)
        {
            if (opts.Timestamp.CompareTo(new DateTime(1, 1, 1)) == 0)
            {
                // No date & time value was passed in (optional parameter)
                Console.WriteLine("using current date and time!");
                opts.Timestamp = DateTime.Now;
            }

            Console.WriteLine("SetFileDateTime(" + opts.Directory + ", " + opts.Timestamp + ", " + opts.IP + ")");

            try
            {
                bool res = USBLAN.SetFileDateTime(opts.Directory, opts.Timestamp, opts.IP);
                if (!res)
                {
                    Console.WriteLine("An error occurred.");
                    return(1);
                }
            }
            catch (Exception e)
            {
                PrintException(e);
                return(1);
            }

            Console.WriteLine("touch complete.");
            return(0);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: datalogic/USBLAN_Sample
        private static void TestSetFileDateTime()
        {
            DateTime dt = new DateTime(1995, 10, 25, 3, 57, 0, 050);

            Console.WriteLine(dt.ToFileTimeUtc());
            bool result = USBLAN.SetFileDateTime("Temp/push.txt", dt);

            Console.WriteLine("response: " + result);
        }