public FILE_INFO FileUpload2(HttpPostedFileBase file, string folderName = "")
        {
            FILE_INFO rtnFile = new FILE_INFO();

            try
            {
                rtnFile.FILE_EXT  = System.IO.Path.GetExtension(file.FileName);
                rtnFile.FILE_NAME = System.IO.Path.GetFileName(file.FileName);
                string fileDate     = DateTime.Now.ToString("yyyyMMddHHmmss");
                string UploadUrl    = System.Configuration.ConfigurationManager.AppSettings["UploadUrl"].ToString() + (string.IsNullOrEmpty(folderName) ? DateTime.Now.ToString("yyyyMM") + "/" : folderName + "/");
                string oriUploadUrl = UploadUrl;
                UploadUrl = HttpContext.Current.Server.MapPath(UploadUrl);
                Global.FileInformation.MakeFolder(UploadUrl);
                string fileLocation = UploadUrl + fileDate + rtnFile.FILE_EXT; //  fileName;

                file.SaveAs(fileLocation);
                rtnFile.URL      = oriUploadUrl + fileDate + rtnFile.FILE_EXT;
                rtnFile.FULL_URL = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority + rtnFile.URL;
                rtnFile.FULL_URL = rtnFile.FULL_URL.ConvertHttpsUrl();
            }
            catch (Exception ex)
            {
                rtnFile.return_msg = ex.Message;
            }
            return(rtnFile);
        }
        public JsonResult FileUpload(FILE_COND Cond)
        {
            string msg        = string.Empty;
            string folderName = Request["FolderName"] == null?DateTime.Now.ToString("yyyyMM") : Request["FolderName"];

            try
            {
                HttpPostedFileBase file = Request.Files[0];
                #region >> 글로벌 함수로 빼서 검증할 경우 file.contentlength 가 0 이 되는 현상이 있음
                int bLocalBoxImage = Convert.ToInt32(Request["bLocalBoxImage"] == null ? "0" : Request["bLocalBoxImage"]);
                if (bLocalBoxImage == 1)
                {
                    Size   size  = System.Drawing.Image.FromStream(file.InputStream).Size;
                    double dSize = Convert.ToDouble(size.Width) / Convert.ToDouble(size.Height);

                    if (!(dSize > 1.6 && dSize < 1.8))
                    {
                        throw new Exception("로컬박스 이미지는 1920(가로) * 1080(세로) 이미지를 등록하셔야 합니다. ");
                    }
                }
                #endregion
                FILE_INFO rtn = GlobalMvc.FileInfo.FileUpload2(file, folderName);
                return(new JsonResult {
                    Data = rtn
                });
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(new JsonResult {
                    Data = new { FULL_URL = "", URL = "", FILE_NAME = "", FILE_EXT = "", return_msg = msg }
                });
            }
        }
Example #3
0
        public override void LogosSplusInitialize()
        {
            _SplusNVRAM   = new SplusNVRAM(this);
            SBUF          = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 2000, this);
            FILE_CONTENTS = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 2000, this);
            FILE_LINE     = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 50, this);
            STR           = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 50, this);
            NFILEINFO     = new FILE_INFO();
            NFILEINFO.PopulateDefaults();

            PRESET_INIT = new Crestron.Logos.SplusObjects.DigitalInput(PRESET_INIT__DigitalInput__, this);
            m_DigitalInputList.Add(PRESET_INIT__DigitalInput__, PRESET_INIT);

            PRESET_SAVE = new Crestron.Logos.SplusObjects.DigitalInput(PRESET_SAVE__DigitalInput__, this);
            m_DigitalInputList.Add(PRESET_SAVE__DigitalInput__, PRESET_SAVE);

            PRESET_SAVED_FB = new Crestron.Logos.SplusObjects.DigitalOutput(PRESET_SAVED_FB__DigitalOutput__, this);
            m_DigitalOutputList.Add(PRESET_SAVED_FB__DigitalOutput__, PRESET_SAVED_FB);

            LEVEL_IN = new InOutArray <AnalogInput>(32, this);
            for (uint i = 0; i < 32; i++)
            {
                LEVEL_IN[i + 1] = new Crestron.Logos.SplusObjects.AnalogInput(LEVEL_IN__AnalogSerialInput__ + i, LEVEL_IN__AnalogSerialInput__, this);
                m_AnalogInputList.Add(LEVEL_IN__AnalogSerialInput__ + i, LEVEL_IN[i + 1]);
            }

            LEVEL_OUT = new InOutArray <AnalogOutput>(32, this);
            for (uint i = 0; i < 32; i++)
            {
                LEVEL_OUT[i + 1] = new Crestron.Logos.SplusObjects.AnalogOutput(LEVEL_OUT__AnalogSerialOutput__ + i, this);
                m_AnalogOutputList.Add(LEVEL_OUT__AnalogSerialOutput__ + i, LEVEL_OUT[i + 1]);
            }

            DEFAULT_LEVEL = new UShortParameter(DEFAULT_LEVEL__Parameter__, this);
            m_ParameterList.Add(DEFAULT_LEVEL__Parameter__, DEFAULT_LEVEL);

            ROOMID = new StringParameter(ROOMID__Parameter__, this);
            m_ParameterList.Add(ROOMID__Parameter__, ROOMID);

            FILE_PATH = new StringParameter(FILE_PATH__Parameter__, this);
            m_ParameterList.Add(FILE_PATH__Parameter__, FILE_PATH);

            PRESET_NAME = new StringParameter(PRESET_NAME__Parameter__, this);
            m_ParameterList.Add(PRESET_NAME__Parameter__, PRESET_NAME);


            PRESET_SAVE.OnDigitalPush.Add(new InputChangeHandlerWrapper(PRESET_SAVE_OnPush_0, false));
            PRESET_INIT.OnDigitalPush.Add(new InputChangeHandlerWrapper(PRESET_INIT_OnPush_1, false));

            _SplusNVRAM.PopulateCustomAttributeList(true);

            NVRAM = _SplusNVRAM;
        }
        object DO_SEARCH_OnPush_0(Object __EventInfo__)

        {
            Crestron.Logos.SplusObjects.SignalEventArgs __SignalEventArg__ = (Crestron.Logos.SplusObjects.SignalEventArgs)__EventInfo__;
            try
            {
                SplusExecutionContext __context__ = SplusThreadStartCode(__SignalEventArg__);
                short IRESULT     = 0;
                short IFINDRESULT = 0;

                FILE_INFO FI;
                FI = new FILE_INFO();
                FI.PopulateDefaults();

                ushort IFILECOUNT = 0;


                __context__.SourceCodeLine = 33;
                StartFileOperations( );
                __context__.SourceCodeLine = 35;
                IRESULT = (short)(SetCurrentDirectory(SEARCH_PATH__DOLLAR__));
                __context__.SourceCodeLine = 37;
                if (Functions.TestForTrue((Functions.BoolToInt(IRESULT < 0))))
                {
                    __context__.SourceCodeLine = 39;
                    SETFILECOUNT(__context__, (ushort)(0));
                    __context__.SourceCodeLine = 40;
                    Functions.TerminateEvent();
                }

                __context__.SourceCodeLine = 43;
                IFILECOUNT = (ushort)(0);
                __context__.SourceCodeLine = 45;
                IFINDRESULT = (short)(FindFirst(FILENAME_SPEC__DOLLAR__, ref FI));
                __context__.SourceCodeLine = 47;
                while (Functions.TestForTrue((Functions.BoolToInt(IFINDRESULT == 0))))
                {
                    __context__.SourceCodeLine = 49;
                    IFILECOUNT = (ushort)((IFILECOUNT + 1));
                    __context__.SourceCodeLine = 50;
                    IFINDRESULT = (short)(FindNext(ref FI));
                    __context__.SourceCodeLine = 47;
                }

                __context__.SourceCodeLine = 53;
                SETFILECOUNT(__context__, (ushort)(IFILECOUNT));
                __context__.SourceCodeLine = 55;
                EndFileOperations( );
            }
            catch (Exception e) { ObjectCatchHandler(e); }
            finally { ObjectFinallyHandler(__SignalEventArg__); }
            return(this);
        }
        private void WRITESETPOINTS(SplusExecutionContext __context__)
        {
            short FILEHANDLE = 0;

            FILE_INFO FILEINFO;

            FILEINFO = new FILE_INFO();
            FILEINFO.PopulateDefaults();


            __context__.SourceCodeLine = 92;
            StartFileOperations( );
            __context__.SourceCodeLine = 94;
            FILEHANDLE = (short)(FileOpen(FILENAME, (ushort)(((1 | 256) | 512) | 32768)));
            __context__.SourceCodeLine = 96;
            if (Functions.TestForTrue((Functions.BoolToInt(FILEHANDLE >= 0))))
            {
                __context__.SourceCodeLine = 99;
                WriteInteger((short)(FILEHANDLE), (ushort)(HEAT));
                __context__.SourceCodeLine = 100;
                WriteInteger((short)(FILEHANDLE), (ushort)(COOL));
                __context__.SourceCodeLine = 101;
                WriteInteger((short)(FILEHANDLE), (ushort)(AUTO1PT));
                __context__.SourceCodeLine = 102;
                WriteInteger((short)(FILEHANDLE), (ushort)(SETBKENABLED));
                __context__.SourceCodeLine = 104;
            }

            else
            {
                __context__.SourceCodeLine = 110;
            }

            __context__.SourceCodeLine = 114;
            FileClose((short)(FILEHANDLE));
            __context__.SourceCodeLine = 116;
            EndFileOperations( );
        }
Example #6
0
        private CrestronString FNFINDMOBILEPROJECT(SplusExecutionContext __context__)
        {
            FILE_INFO FIFILEINFO;

            FIFILEINFO = new FILE_INFO();
            FIFILEINFO.PopulateDefaults();

            ushort NALTLOCATIONFOUND = 0;
            ushort NPOSITION         = 0;

            short SNMANIFESTFILEFOUND = 0;
            short SNSTARTFILEIOERROR  = 0;
            short SNENDFILEIOERROR    = 0;

            CrestronString SMANIFESTFILENAME__DOLLAR__;
            CrestronString SMANIFESTSEARCHPATH__DOLLAR__;
            CrestronString SMANIFESTSEARCHPATHALT__DOLLAR__;

            SMANIFESTFILENAME__DOLLAR__      = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 200, this);
            SMANIFESTSEARCHPATH__DOLLAR__    = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 250, this);
            SMANIFESTSEARCHPATHALT__DOLLAR__ = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 250, this);


            __context__.SourceCodeLine = 291;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 291;
                Trace("***** Start fnFindMobileProject *****\r\n");
            }

            __context__.SourceCodeLine = 293;
            NALTLOCATIONFOUND          = (ushort)(0);
            __context__.SourceCodeLine = 295;
            FNGETSEARCHLOCATION(__context__);
            __context__.SourceCodeLine = 297;
            if (Functions.TestForTrue((Functions.BoolToInt(Functions.Length(G_SMATCHSEGMENT__DOLLAR__) > 1))))
            {
                __context__.SourceCodeLine = 299;
                MakeString(SMANIFESTSEARCHPATH__DOLLAR__, "{0}*{1}{2}", G_SSEARCHLOCATION__DOLLAR__, G_SMATCHSEGMENT__DOLLAR__, "*_Manifest.xml");
            }

            else
            {
                __context__.SourceCodeLine = 303;
                MakeString(SMANIFESTSEARCHPATH__DOLLAR__, "{0}{1}", G_SSEARCHLOCATION__DOLLAR__, "*_Manifest.xml");
            }

            __context__.SourceCodeLine = 305;
            if (Functions.TestForTrue((Functions.BoolToInt(Functions.Length(SMANIFESTSEARCHPATHALT__DOLLAR__) > 1))))
            {
                __context__.SourceCodeLine = 307;
                if (Functions.TestForTrue((Functions.BoolToInt(Functions.Length(G_SMATCHSEGMENT__DOLLAR__) > 1))))
                {
                    __context__.SourceCodeLine = 309;
                    MakeString(SMANIFESTSEARCHPATHALT__DOLLAR__, "{0}*{1}{2}", G_SSEARCHLOCATIONALT__DOLLAR__, G_SMATCHSEGMENT__DOLLAR__, "*_Manifest.xml");
                }

                else
                {
                    __context__.SourceCodeLine = 313;
                    MakeString(SMANIFESTSEARCHPATHALT__DOLLAR__, "{0}{1}", G_SSEARCHLOCATIONALT__DOLLAR__, "*_Manifest.xml");
                }

                __context__.SourceCodeLine = 315;
                NALTLOCATIONFOUND          = (ushort)(1);
            }

            else
            {
                __context__.SourceCodeLine = 319;
                Functions.ClearBuffer(SMANIFESTSEARCHPATHALT__DOLLAR__);
                __context__.SourceCodeLine = 320;
                NALTLOCATIONFOUND          = (ushort)(0);
            }

            __context__.SourceCodeLine = 323;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 323;
                Trace("sManifestSearchPath$ = {0}\r\n", SMANIFESTSEARCHPATH__DOLLAR__);
            }

            __context__.SourceCodeLine = 324;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 324;
                Trace("sManifestSearchPathAlt$ = {0}\r\n", SMANIFESTSEARCHPATHALT__DOLLAR__);
            }

            __context__.SourceCodeLine = 326;
            MakeString(SMANIFESTSEARCHPATH__DOLLAR__, "{0}", FNADDSPECIALCHARACTERS(__context__, SMANIFESTSEARCHPATH__DOLLAR__));
            __context__.SourceCodeLine = 327;
            MakeString(SMANIFESTSEARCHPATHALT__DOLLAR__, "{0}", FNADDSPECIALCHARACTERS(__context__, SMANIFESTSEARCHPATHALT__DOLLAR__));
            __context__.SourceCodeLine = 329;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 329;
                Trace("sManifestSearchPath$ = {0}\r\n", SMANIFESTSEARCHPATH__DOLLAR__);
            }

            __context__.SourceCodeLine = 330;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 330;
                Trace("sManifestSearchPathAlt$ = {0}\r\n", SMANIFESTSEARCHPATHALT__DOLLAR__);
            }

            __context__.SourceCodeLine = 332;
            SNSTARTFILEIOERROR         = (short)(StartFileOperations());
            __context__.SourceCodeLine = 333;
            while (Functions.TestForTrue((Functions.BoolToInt(SNSTARTFILEIOERROR != 0))))
            {
                __context__.SourceCodeLine = 335;
                if (Functions.TestForTrue((G_NDEBUG)))
                {
                    __context__.SourceCodeLine = 335;
                    Trace("Start File Operations Error Retrying\r\n");
                }

                __context__.SourceCodeLine = 336;
                Functions.Delay((int)(100));
                __context__.SourceCodeLine = 337;
                SNSTARTFILEIOERROR         = (short)(StartFileOperations());
                __context__.SourceCodeLine = 333;
            }

            __context__.SourceCodeLine = 340;

            {
                int __SPLS_TMPVAR__SWTCH_2__ = ((int)Functions.GetSeries());

                {
                    if (Functions.TestForTrue((__SPLS_TMPVAR__SWTCH_2__ == (2))))
                    {
                        __context__.SourceCodeLine = 344;
                        SNMANIFESTFILEFOUND        = (short)(FindFirst(SMANIFESTSEARCHPATH__DOLLAR__, ref FIFILEINFO));
                        __context__.SourceCodeLine = 345;
                        FindClose( );
                    }

                    else if (Functions.TestForTrue((__SPLS_TMPVAR__SWTCH_2__ == (3))))
                    {
                        __context__.SourceCodeLine = 349;
                        SNMANIFESTFILEFOUND        = (short)(FindFirstShared(SMANIFESTSEARCHPATH__DOLLAR__, ref FIFILEINFO));
                        __context__.SourceCodeLine = 350;
                        FindClose( );
                    }
                }
            }


            __context__.SourceCodeLine = 354;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 354;
                Trace("snManifestFileFound = {0:d}\r\n", (short)SNMANIFESTFILEFOUND);
            }

            __context__.SourceCodeLine = 356;
            if (Functions.TestForTrue((Functions.BoolToInt(SNMANIFESTFILEFOUND == 0))))
            {
                __context__.SourceCodeLine = 358;
                MakeString(SMANIFESTFILENAME__DOLLAR__, "{0}", FIFILEINFO.Name);
            }

            else
            {
                __context__.SourceCodeLine = 360;
                if (Functions.TestForTrue((NALTLOCATIONFOUND)))
                {
                    __context__.SourceCodeLine = 362;

                    {
                        int __SPLS_TMPVAR__SWTCH_3__ = ((int)Functions.GetSeries());

                        {
                            if (Functions.TestForTrue((__SPLS_TMPVAR__SWTCH_3__ == (2))))
                            {
                                __context__.SourceCodeLine = 366;
                                SNMANIFESTFILEFOUND        = (short)(FindFirst(SMANIFESTSEARCHPATHALT__DOLLAR__, ref FIFILEINFO));
                                __context__.SourceCodeLine = 367;
                                FindClose( );
                            }

                            else if (Functions.TestForTrue((__SPLS_TMPVAR__SWTCH_3__ == (3))))
                            {
                                __context__.SourceCodeLine = 371;
                                SNMANIFESTFILEFOUND        = (short)(FindFirstShared(SMANIFESTSEARCHPATHALT__DOLLAR__, ref FIFILEINFO));
                                __context__.SourceCodeLine = 372;
                                FindClose( );
                            }
                        }
                    }


                    __context__.SourceCodeLine = 376;
                    if (Functions.TestForTrue((Functions.BoolToInt(SNMANIFESTFILEFOUND == 0))))
                    {
                        __context__.SourceCodeLine = 378;
                        MakeString(SMANIFESTFILENAME__DOLLAR__, "{0}", FIFILEINFO.Name);
                    }

                    else
                    {
                        __context__.SourceCodeLine = 382;
                        MakeString(SMANIFESTFILENAME__DOLLAR__, "{0}", "Error Finding Project");
                    }
                }

                else
                {
                    __context__.SourceCodeLine = 387;
                    MakeString(SMANIFESTFILENAME__DOLLAR__, "{0}", "Error Finding Project");
                }
            }

            __context__.SourceCodeLine = 389;
            SNENDFILEIOERROR           = (short)(EndFileOperations());
            __context__.SourceCodeLine = 390;
            while (Functions.TestForTrue((Functions.BoolToInt(SNENDFILEIOERROR != 0))))
            {
                __context__.SourceCodeLine = 392;
                if (Functions.TestForTrue((G_NDEBUG)))
                {
                    __context__.SourceCodeLine = 392;
                    Trace("End File Operations Error Retrying\r\n");
                }

                __context__.SourceCodeLine = 393;
                Functions.Delay((int)(100));
                __context__.SourceCodeLine = 394;
                SNENDFILEIOERROR           = (short)(EndFileOperations());
                __context__.SourceCodeLine = 390;
            }

            __context__.SourceCodeLine = 397;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 397;
                Trace("sManifestFileName$ = {0}\r\n", SMANIFESTFILENAME__DOLLAR__);
            }

            __context__.SourceCodeLine = 399;
            if (Functions.TestForTrue((Functions.BoolToInt(SMANIFESTFILENAME__DOLLAR__ != "Error Finding Project"))))
            {
                __context__.SourceCodeLine = 401;
                MakeString(SMANIFESTFILENAME__DOLLAR__, "{0}", FNREMOVESPECIALCHARACTERS(__context__, SMANIFESTFILENAME__DOLLAR__));
                __context__.SourceCodeLine = 402;
                NPOSITION = (ushort)(Functions.Find("_Manifest.xml", SMANIFESTFILENAME__DOLLAR__));
                __context__.SourceCodeLine = 403;
                if (Functions.TestForTrue((G_NDEBUG)))
                {
                    __context__.SourceCodeLine = 403;
                    Trace("sManifestFileName$ = {0}\r\n", SMANIFESTFILENAME__DOLLAR__);
                }

                __context__.SourceCodeLine = 404;
                if (Functions.TestForTrue((G_NDEBUG)))
                {
                    __context__.SourceCodeLine = 404;
                    Trace("nPosition = {0:d}\r\n", (short)NPOSITION);
                }

                __context__.SourceCodeLine = 406;
                if (Functions.TestForTrue((NPOSITION)))
                {
                    __context__.SourceCodeLine = 408;
                    MakeString(SMANIFESTFILENAME__DOLLAR__, "{0}", Functions.Left(SMANIFESTFILENAME__DOLLAR__, (int)((NPOSITION - 1))));
                }
            }

            __context__.SourceCodeLine = 412;
            return(SMANIFESTFILENAME__DOLLAR__);

            __context__.SourceCodeLine = 414;
            if (Functions.TestForTrue((G_NDEBUG)))
            {
                __context__.SourceCodeLine = 414;
                Trace("***** End fnFindMobileProject *****\r\n");
            }
        }
Example #7
0
        public override void LogosSplusInitialize()
        {
            _SplusNVRAM            = new SplusNVRAM(this);
            G_LOADS_FILE__DOLLAR__ = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 96, this);
            G_LOADNAME             = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 50, this);
            G_LASTSAVEDTIME        = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 8, this);
            G_LASTSAVEDDATE        = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 10, this);
            STOREDCOMMANDSTRING    = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 256, this);
            G_FILEINFO             = new FILE_INFO();
            G_FILEINFO.PopulateDefaults();

            LOAD_LEVEL_INCREASING = new Crestron.Logos.SplusObjects.DigitalInput(LOAD_LEVEL_INCREASING__DigitalInput__, this);
            m_DigitalInputList.Add(LOAD_LEVEL_INCREASING__DigitalInput__, LOAD_LEVEL_INCREASING);

            LOAD_LEVEL_DECREASING = new Crestron.Logos.SplusObjects.DigitalInput(LOAD_LEVEL_DECREASING__DigitalInput__, this);
            m_DigitalInputList.Add(LOAD_LEVEL_DECREASING__DigitalInput__, LOAD_LEVEL_DECREASING);

            LOAD_LEVEL_RAMPING = new Crestron.Logos.SplusObjects.DigitalInput(LOAD_LEVEL_RAMPING__DigitalInput__, this);
            m_DigitalInputList.Add(LOAD_LEVEL_RAMPING__DigitalInput__, LOAD_LEVEL_RAMPING);

            SUBSCRIPTIONEXPIRED = new Crestron.Logos.SplusObjects.DigitalInput(SUBSCRIPTIONEXPIRED__DigitalInput__, this);
            m_DigitalInputList.Add(SUBSCRIPTIONEXPIRED__DigitalInput__, SUBSCRIPTIONEXPIRED);

            RAISELEVEL = new Crestron.Logos.SplusObjects.DigitalOutput(RAISELEVEL__DigitalOutput__, this);
            m_DigitalOutputList.Add(RAISELEVEL__DigitalOutput__, RAISELEVEL);

            LOWERLEVEL = new Crestron.Logos.SplusObjects.DigitalOutput(LOWERLEVEL__DigitalOutput__, this);
            m_DigitalOutputList.Add(LOWERLEVEL__DigitalOutput__, LOWERLEVEL);

            LOADSUBSCRIBED = new Crestron.Logos.SplusObjects.DigitalOutput(LOADSUBSCRIBED__DigitalOutput__, this);
            m_DigitalOutputList.Add(LOADSUBSCRIBED__DigitalOutput__, LOADSUBSCRIBED);

            LOADNOTSUBSCRIBED = new Crestron.Logos.SplusObjects.DigitalOutput(LOADNOTSUBSCRIBED__DigitalOutput__, this);
            m_DigitalOutputList.Add(LOADNOTSUBSCRIBED__DigitalOutput__, LOADNOTSUBSCRIBED);

            SETLEVEL = new Crestron.Logos.SplusObjects.AnalogOutput(SETLEVEL__AnalogSerialOutput__, this);
            m_AnalogOutputList.Add(SETLEVEL__AnalogSerialOutput__, SETLEVEL);

            RESPONSEID = new Crestron.Logos.SplusObjects.AnalogOutput(RESPONSEID__AnalogSerialOutput__, this);
            m_AnalogOutputList.Add(RESPONSEID__AnalogSerialOutput__, RESPONSEID);

            PATH__DOLLAR__ = new Crestron.Logos.SplusObjects.StringInput(PATH__DOLLAR____AnalogSerialInput__, 64, this);
            m_StringInputList.Add(PATH__DOLLAR____AnalogSerialInput__, PATH__DOLLAR__);

            RESPONSE__DOLLAR__ = new Crestron.Logos.SplusObjects.StringOutput(RESPONSE__DOLLAR____AnalogSerialOutput__, this);
            m_StringOutputList.Add(RESPONSE__DOLLAR____AnalogSerialOutput__, RESPONSE__DOLLAR__);

            LOAD_CMD__DOLLAR__ = new Crestron.Logos.SplusObjects.BufferInput(LOAD_CMD__DOLLAR____AnalogSerialInput__, 512, this);
            m_StringInputList.Add(LOAD_CMD__DOLLAR____AnalogSerialInput__, LOAD_CMD__DOLLAR__);

            LOAD_NUMBER = new UShortParameter(LOAD_NUMBER__Parameter__, this);
            m_ParameterList.Add(LOAD_NUMBER__Parameter__, LOAD_NUMBER);


            LOAD_CMD__DOLLAR__.OnSerialChange.Add(new InputChangeHandlerWrapper(LOAD_CMD__DOLLAR___OnChange_0, false));
            SUBSCRIPTIONEXPIRED.OnDigitalPush.Add(new InputChangeHandlerWrapper(SUBSCRIPTIONEXPIRED_OnPush_1, false));
            LOAD_LEVEL_INCREASING.OnDigitalPush.Add(new InputChangeHandlerWrapper(LOAD_LEVEL_INCREASING_OnPush_2, false));
            LOAD_LEVEL_DECREASING.OnDigitalPush.Add(new InputChangeHandlerWrapper(LOAD_LEVEL_DECREASING_OnPush_3, false));
            LOAD_LEVEL_RAMPING.OnDigitalRelease.Add(new InputChangeHandlerWrapper(LOAD_LEVEL_RAMPING_OnRelease_4, false));
            PATH__DOLLAR__.OnSerialChange.Add(new InputChangeHandlerWrapper(PATH__DOLLAR___OnChange_5, false));

            _SplusNVRAM.PopulateCustomAttributeList(true);

            NVRAM = _SplusNVRAM;
        }
        object CONCAT_OnPush_0(Object __EventInfo__)

        {
            Crestron.Logos.SplusObjects.SignalEventArgs __SignalEventArg__ = (Crestron.Logos.SplusObjects.SignalEventArgs)__EventInfo__;
            try
            {
                SplusExecutionContext __context__ = SplusThreadStartCode(__SignalEventArg__);
                short IRESULT          = 0;
                short IFINDRESULT      = 0;
                short IFILEHANDLEWRITE = 0;
                short IFILEHANDLEREAD  = 0;

                ushort I = 0;

                CrestronString SREADDATA;
                SREADDATA = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 300, this);

                CrestronString SREADFILENAME;
                SREADFILENAME = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 100, this);

                FILE_INFO FI;
                FI = new FILE_INFO();
                FI.PopulateDefaults();

                ushort IFILECOUNT = 0;


                __context__.SourceCodeLine = 23;
                StartFileOperations( );
                __context__.SourceCodeLine = 25;
                FileDelete(WRITE_FILENAME__DOLLAR__);
                __context__.SourceCodeLine = 27;
                IFILEHANDLEWRITE           = (short)(FileOpen(WRITE_FILENAME__DOLLAR__, (ushort)((256 | 1) | 16384)));
                __context__.SourceCodeLine = 29;
                if (Functions.TestForTrue((Functions.BoolToInt(IFILEHANDLEWRITE >= 0))))
                {
                    __context__.SourceCodeLine = 31;
                    IRESULT = (short)(SetCurrentDirectory(READ_PATH__DOLLAR__));
                    __context__.SourceCodeLine = 33;
                    if (Functions.TestForTrue((Functions.BoolToInt(IRESULT < 0))))
                    {
                        __context__.SourceCodeLine = 35;
                        RESPONSE_MSG__DOLLAR__.UpdateValue("ERROR\r\n>");
                        __context__.SourceCodeLine = 36;
                        Functions.TerminateEvent();
                    }

                    __context__.SourceCodeLine = 39;
                    IFILECOUNT = (ushort)(0);
                    __context__.SourceCodeLine = 41;
                    IFINDRESULT = (short)(FindFirst(READ_WILDCARD__DOLLAR__, ref FI));
                    __context__.SourceCodeLine = 43;
                    while (Functions.TestForTrue((Functions.Not(IFINDRESULT))))
                    {
                        __context__.SourceCodeLine = 45;
                        SREADFILENAME.UpdateValue(FI.Name);
                        __context__.SourceCodeLine = 46;
                        IFILEHANDLEREAD            = (short)(FileOpen(SREADFILENAME, (ushort)(0 | 32768)));
                        __context__.SourceCodeLine = 48;
                        if (Functions.TestForTrue((Functions.BoolToInt(IFILEHANDLEREAD >= 0))))
                        {
                            __context__.SourceCodeLine = 51;
                            IFILECOUNT = (ushort)((IFILECOUNT + 1));
                            __context__.SourceCodeLine = 53;
                            SREADDATA.UpdateValue("[" + FI.Name + "]");
                            __context__.SourceCodeLine = 54;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 55;
                            FileWrite((short)(IFILEHANDLEWRITE), "\u000D\u000A", (ushort)(2));
                            __context__.SourceCodeLine = 57;
                            I = (ushort)(1);
                            __context__.SourceCodeLine = 59;
                            while (Functions.TestForTrue((Functions.Not(FileEOF((short)(IFILEHANDLEREAD))))))
                            {
                                __context__.SourceCodeLine = 61;
                                IRESULT = (short)(FileRead((short)(IFILEHANDLEREAD), SREADDATA, (ushort)(256)));
                                __context__.SourceCodeLine = 63;
                                if (Functions.TestForTrue((Functions.BoolToInt(IRESULT > 0))))
                                {
                                    __context__.SourceCodeLine = 66;
                                    FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                                }

                                else
                                {
                                    __context__.SourceCodeLine = 70;
                                    break;
                                }

                                __context__.SourceCodeLine = 59;
                            }

                            __context__.SourceCodeLine = 74;
                            FileWrite((short)(IFILEHANDLEWRITE), "\u000D\u000A", (ushort)(2));
                            __context__.SourceCodeLine = 75;
                            IRESULT = (short)(FileClose((short)(IFILEHANDLEREAD)));
                        }

                        __context__.SourceCodeLine = 78;
                        IFINDRESULT = (short)(FindNext(ref FI));
                        __context__.SourceCodeLine = 43;
                    }

                    __context__.SourceCodeLine = 82;
                    IRESULT = (short)(FileClose((short)(IFILEHANDLEWRITE)));
                    __context__.SourceCodeLine = 84;
                    RESPONSE_MSG__DOLLAR__.UpdateValue("OK " + Functions.ItoA((int)(IFILECOUNT)) + "\r\n>");
                }

                else
                {
                    __context__.SourceCodeLine = 88;
                    RESPONSE_MSG__DOLLAR__.UpdateValue("ERROR\r\n>");
                }

                __context__.SourceCodeLine = 90;
                EndFileOperations( );
            }
            catch (Exception e) { ObjectCatchHandler(e); }
            finally { ObjectFinallyHandler(__SignalEventArg__); }
            return(this);
        }
Example #9
0
 public static extern int TAT_Get_File_Index_Info(int handle, byte mode, string fname, ref FILE_INFO f_info);
Example #10
0
        unsafe public void vDownLoadFile(string sFileName, string ftime)
        {
            string temp_name   = "";
            string fname_front = "";
            string fname_rear  = "";

            if (!sFileName.Equals(""))
            {
                managedTAT.TATWrap[] obj = new managedTAT.TATWrap[3];
                for (int i = 0; i < 3; i++)
                {
                    obj[i] = new managedTAT.TATWrap();
                }
                FILE_INFO f_info = new FILE_INFO();
                f_info.audio        = 0;
                f_info.audio_bit    = 0;
                f_info.audio_ch     = 0;
                f_info.audio_sample = 0;

                char[] VSet   = new char[5];
                char[] t_name = new char[100];
                byte[] f_name = new byte[100];
                byte[] t_data = new byte[1024 * 1024];
                //      char ii, V2Ch, mode;
                byte test = 0;
                uint rtn, size = 0, timestamp = 0, pb_pos;
                //        int gps_tt = 0, frame_index = 0;
                byte   ch = 0, f_type = 0, p_type = 0;
                char[] a           = sFileName.ToCharArray();
                char[] temp        = new char[40];
                char[] nam         = sFileName.ToCharArray();
                char * charPointer = stackalloc char[100];

                for (int i = 0; i < a.Length; i++)
                {
                    f_name[i] = (byte)a[i];
                }

                if (f_name[16] == 'E')
                {
                    mode = '0';
                    test = 0;
                }
                else if (f_name[16] == 'I')
                {
                    mode = '1';
                    test = 1;
                }
                else if (f_name[16] == 'P')
                {
                    mode = '2';
                    test = 2;
                }
                else if (f_name[16] == 'J')
                {
                    mode = '3';
                    test = 3;
                }
                else if (f_name[16] == 'C')
                {
                    mode = '4';
                    test = 4;
                }
                else
                {
                    return;
                }

                for (int i = 0; i < 100; i++)
                {
                    charPointer[i] = (char)f_name[i];
                }
                int ttemp = 255;
                ttemp = TAT_Get_File_Index_Info(handle, test, sFileName, ref f_info);
                TAT_PB_Init(handle);
                pb_pos = TAT_Get_PB_Pos(handle, test, sFileName);//제조사확인 에러 뜨는곳
                TAT_PB_Start(handle, test, 0, pb_pos);
                name[0] = Video_Path + t_name.ToString();
                name[1] = Video_Path + t_name.ToString();
                name[2] = Video_Path + t_name.ToString();

                for (int i = 0; i < 3; i++)
                {
                    VSet[i] = '0';
                }

                int index = 1;
                while (true)
                {
                    rtn = TAT_Read_Frame(handle, ref ch, ref f_type, ref p_type, ref size, t_data, ref timestamp);
                    if ((rtn == 1) || (rtn == 2) || (rtn == 3))
                    {
                        break;
                    }

                    if (VSet[ch].Equals('0') && (ch < 3))
                    {
                        if ((t_data[0] == 0) && (t_data[1] == 0) && (t_data[2] == 0) && (t_data[3] == 1) && (p_type == 1) && (f_type == 2))
                        {
                            VSet[ch] = '1';
                            obj[ch].SetDim(0, f_info.width[ch], f_info.height[ch]);
                            obj[ch].SetAudioSampleRate(8000);
                            obj[ch].SetFPS(0, f_info.fps[ch]);
                            obj[ch].UseVideo2(false);

                            if (ch.ToString() == "0") //전방
                            {
                                fname_front = Video_Path + ch.ToString() + sFileName;
                                temp_name   = fname_front;
                            }

                            else //후방
                            {
                                fname_rear = Video_Path + ch.ToString() + sFileName;
                                temp_name  = fname_rear;
                            }

                            byte[] bytes = Encoding.ASCII.GetBytes(temp_name);

                            unsafe
                            {
                                fixed(byte *p = bytes)
                                {
                                    sbyte *sp = (sbyte *)p;

                                    obj[ch].Create(sp);
                                }
                            }
                        }
                    }

                    if (!(VSet[ch].Equals('0')) || (ch == '3') || (ch == '2'))
                    {
                        switch (f_type)
                        {
                        case 2:
                        {
                            if (!VSet[ch].Equals('0'))
                            {
                                if (ch == 0)
                                {
                                    unsafe
                                    {
                                        fixed(byte *pp = t_data)
                                        {
                                            sbyte *spp = (sbyte *)pp;

                                            obj[ch].AddData(spp, (int)size, 0);
                                        }
                                    }
                                }
                                else if (ch == 1)
                                {
                                    unsafe
                                    {
                                        fixed(byte *pp = t_data)
                                        {
                                            sbyte *spp = (sbyte *)pp;

                                            obj[ch].AddData(spp, (int)size, 0);
                                        }
                                    }
                                }
                                else if (ch == 2)
                                {
                                    unsafe
                                    {
                                        fixed(byte *pp = t_data)
                                        {
                                            sbyte *spp = (sbyte *)pp;

                                            obj[ch].AddData(spp, (int)size, 0);
                                        }
                                    }
                                }
                            }
                        }
                        break;

                        case 1:
                        {
                            if (VSet[0].Equals('1'))
                            {
                                unsafe
                                {
                                    fixed(byte *pp = t_data)
                                    {
                                        sbyte *spp = (sbyte *)pp;

                                        obj[0].AddData(spp, (int)size, 2);
                                    }
                                }
                            }
                            if (VSet[1].Equals('1'))
                            {
                                unsafe
                                {
                                    fixed(byte *pp = t_data)
                                    {
                                        sbyte *spp = (sbyte *)pp;

                                        obj[1].AddData(spp, (int)size, 2);
                                    }
                                }
                            }
                            if (VSet[2].Equals('1'))
                            {
                                unsafe
                                {
                                    fixed(byte *pp = t_data)
                                    {
                                        sbyte *spp = (sbyte *)pp;

                                        obj[2].AddData(spp, (int)size, 2);
                                    }
                                }
                            }
                        }
                        break;

                        case 3:    //GSENSOR
                        {
                            float[] floats = new float[3];
                            for (int i = 0; i < floats.Length; i++)
                            {
                                floats[i] = BitConverter.ToSingle(t_data, i * 4);
                            }

                            //데이터 포인트 저장
                            GsensorVal[0].Add((double)index);
                            GsensorVal[1].Add(Convert.ToDouble(floats[0]));
                            GsensorVal[2].Add(Convert.ToDouble(floats[1]));
                            GsensorVal[3].Add(Convert.ToDouble(floats[2]));

                            index++;

                            /*
                             * Console.Write("X = ");
                             * Console.Write(floats[0].ToString("N3"));
                             * Console.Write("Y = ");
                             * Console.Write(floats[1].ToString("N3"));
                             * Console.Write("Z = ");
                             * Console.Write(floats[2].ToString("N3"));
                             * Console.WriteLine();
                             */
                        }
                        break;

                        case 4:                                      //GPS
                        {
                            Console.WriteLine(t_data[0].ToString()); //
                        }
                        break;
                        }
                    }
                }
                if (!VSet[0].Equals('0'))
                {
                    obj[0].Close(null, 0);
                }
                if (!VSet[1].Equals('0'))
                {
                    obj[1].Close(null, 0);
                }
                if (!VSet[2].Equals('0'))
                {
                    obj[2].Close(null, 0);
                }
            }

            //데이터바인딩
            chart_Gsensor.Series[0].Points.DataBindY(GsensorVal[1], "x값");
            chart_Gsensor.Series[1].Points.DataBindY(GsensorVal[2], "y값");
            chart_Gsensor.Series[2].Points.DataBindY(GsensorVal[3], "Z값");
            chart_Gsensor.ChartAreas[0].AxisX.Maximum = GsensorVal[0].Count;
            timer1.Interval = 1000 * Convert.ToInt32(ftime.Remove(ftime.Length - 1, 1)) / GsensorVal[0].Count;

            //버튼 표시
            button_play.Visible = false;
            button_play.Enabled = false;
            button_stop.Visible = true;
            button_stop.Enabled = true;

            //재생
            VideoPlay(fname_front, fname_rear);
        }
        private void WRITEEVENTSTOFILE(SplusExecutionContext __context__)
        {
            ushort I = 0;

            short IFILEHANDLE = 0;
            short IARCHHANDLE = 0;

            CrestronString WRITESTR;
            CrestronString MSG;

            WRITESTR = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 100, this);
            MSG      = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 85, this);

            FILE_INFO FINFO;

            FINFO = new FILE_INFO();
            FINFO.PopulateDefaults();

            int SPACE = 0;


            __context__.SourceCodeLine = 172;
            StartFileOperations( );
            __context__.SourceCodeLine = 174;
            IFILEHANDLE = (short)(FileOpen(G_FILENAME, (ushort)(((256 | 8) | 2) | 16384)));
            __context__.SourceCodeLine = 176;
            SPACE = (int)(GETDISKSPACE(__context__));
            __context__.SourceCodeLine = 178;
            if (Functions.TestForTrue((Functions.BoolToInt((Functions.TestForTrue(Functions.BoolToInt(SPACE > 0)) && Functions.TestForTrue(Functions.BoolToInt(SPACE < 5000)))))))
            {
                __context__.SourceCodeLine = 180;
                MakeString(MSG, "LOGGING STOPPED AT {0} ON {1}\r\nMINIMUM REQUIRED DISK SPACE: {2:d}\r\n", Functions.Time( ), Functions.Date((int)(1)), (short)5000);
                __context__.SourceCodeLine = 181;
                Print("{0}", MSG);
                __context__.SourceCodeLine = 183;
                if (Functions.TestForTrue((Functions.BoolToInt(SPACE > 85))))
                {
                    __context__.SourceCodeLine = 184;
                    FileWrite((short)(IFILEHANDLE), MSG, (ushort)(Functions.Length(MSG)));
                }

                __context__.SourceCodeLine = 186;
                SCHEDULER_LOGSTATE.Value   = (ushort)(0);
                __context__.SourceCodeLine = 187;
                _SplusNVRAM.LOGSTATE       = (ushort)(0);
            }

            else
            {
                __context__.SourceCodeLine = 192;
                ushort __FN_FORSTART_VAL__1 = (ushort)(1);
                ushort __FN_FOREND_VAL__1   = (ushort)(G_INEXTLOGINDEX - 1);
                int    __FN_FORSTEP_VAL__1  = (int)1;
                for (I = __FN_FORSTART_VAL__1; (__FN_FORSTEP_VAL__1 > 0)  ? ((I >= __FN_FORSTART_VAL__1) && (I <= __FN_FOREND_VAL__1)) : ((I <= __FN_FORSTART_VAL__1) && (I >= __FN_FOREND_VAL__1)); I += (ushort)__FN_FORSTEP_VAL__1)
                {
                    __context__.SourceCodeLine = 194;
                    if (Functions.TestForTrue((Functions.BoolToInt(FileSeek((short)(IFILEHANDLE), (uint)(0), (ushort)(1)) > 10000))))
                    {
                        __context__.SourceCodeLine = 196;
                        FileClose((short)(IFILEHANDLE));
                        __context__.SourceCodeLine = 197;
                        IFILEHANDLE = (short)(FileOpen(G_FILENAME, (ushort)(0 | 16384)));
                        __context__.SourceCodeLine = 198;
                        IFILEHANDLE = (short)(CYCLELOG(__context__, (short)(IFILEHANDLE)));
                    }

                    __context__.SourceCodeLine = 201;
                    WRITESTR.UpdateValue(G_LOGDATA [I].DATA);
                    __context__.SourceCodeLine = 202;
                    FileWrite((short)(IFILEHANDLE), WRITESTR, (ushort)(Functions.Length(WRITESTR)));
                    __context__.SourceCodeLine = 204;
                    Functions.ProcessLogic( );
                    __context__.SourceCodeLine = 192;
                }

                __context__.SourceCodeLine = 207;
                if (Functions.TestForTrue((G_BLOGOVERFLOW)))
                {
                    __context__.SourceCodeLine = 209;
                    FileWrite((short)(IFILEHANDLE), "ERROR: LOG OVERFLOW\r\n", (ushort)(21));
                    __context__.SourceCodeLine = 210;
                    G_BLOGOVERFLOW             = (ushort)(0);
                }
            }

            __context__.SourceCodeLine = 214;
            FileClose((short)(IFILEHANDLE));
            __context__.SourceCodeLine = 216;
            EndFileOperations( );
            __context__.SourceCodeLine = 218;
            G_INEXTLOGINDEX            = (ushort)(1);
        }
        object CONCAT_OnPush_0(Object __EventInfo__)

        {
            Crestron.Logos.SplusObjects.SignalEventArgs __SignalEventArg__ = (Crestron.Logos.SplusObjects.SignalEventArgs)__EventInfo__;
            try
            {
                SplusExecutionContext __context__ = SplusThreadStartCode(__SignalEventArg__);
                short IRESULT          = 0;
                short IFINDRESULT      = 0;
                short IFILEHANDLEWRITE = 0;
                short IFILEHANDLEREAD  = 0;

                ushort I   = 0;
                ushort POS = 0;

                CrestronString SREADDATA;
                SREADDATA = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 300, this);

                CrestronString SREADFILENAME;
                CrestronString TYPE;
                SREADFILENAME = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 100, this);
                TYPE          = new CrestronString(Crestron.Logos.SplusObjects.CrestronStringEncoding.eEncodingASCII, 25, this);

                FILE_INFO FI;
                FI = new FILE_INFO();
                FI.PopulateDefaults();

                ushort IFILECOUNT = 0;

                uint TEMPFADETIME = 0;
                uint TEMPOFFTIME  = 0;

                LOAD_SETTING TEMPLOADSETTING;
                TEMPLOADSETTING = new LOAD_SETTING(this, true);
                TEMPLOADSETTING.PopulateCustomAttributeList(false);


                __context__.SourceCodeLine = 42;
                StartFileOperations( );
                __context__.SourceCodeLine = 44;
                FileDelete(WRITE_FILENAME__DOLLAR__);
                __context__.SourceCodeLine = 46;
                IFILEHANDLEWRITE           = (short)(FileOpen(WRITE_FILENAME__DOLLAR__, (ushort)((256 | 1) | 16384)));
                __context__.SourceCodeLine = 48;
                if (Functions.TestForTrue((Functions.BoolToInt(IFILEHANDLEWRITE >= 0))))
                {
                    __context__.SourceCodeLine = 50;
                    IRESULT = (short)(SetCurrentDirectory(READ_PATH__DOLLAR__));
                    __context__.SourceCodeLine = 52;
                    if (Functions.TestForTrue((Functions.BoolToInt(IRESULT < 0))))
                    {
                        __context__.SourceCodeLine = 54;
                        RESPONSE_MSG__DOLLAR__.UpdateValue("ERROR\r\n>");
                        __context__.SourceCodeLine = 55;
                        Functions.TerminateEvent();
                    }

                    __context__.SourceCodeLine = 58;
                    IFILECOUNT = (ushort)(0);
                    __context__.SourceCodeLine = 60;
                    IFINDRESULT = (short)(FindFirst("BinaryScene_*.dat", ref FI));
                    __context__.SourceCodeLine = 62;
                    while (Functions.TestForTrue((Functions.Not(IFINDRESULT))))
                    {
                        __context__.SourceCodeLine = 64;
                        SREADFILENAME.UpdateValue(FI.Name);
                        __context__.SourceCodeLine = 65;
                        IFILEHANDLEREAD            = (short)(FileOpen(SREADFILENAME, (ushort)(0 | 32768)));
                        __context__.SourceCodeLine = 66;
                        if (Functions.TestForTrue((Functions.BoolToInt(IFILEHANDLEREAD >= 0))))
                        {
                            __context__.SourceCodeLine = 69;
                            IFILECOUNT = (ushort)((IFILECOUNT + 1));
                            __context__.SourceCodeLine = 70;
                            POS = (ushort)((Functions.Find("_", FI.Name, 1) + 1));
                            __context__.SourceCodeLine = 71;
                            SREADDATA.UpdateValue(Functions.Mid(FI.Name, (int)(POS), (int)(((Functions.Length(FI.Name) - POS) - 3))));
                            __context__.SourceCodeLine = 72;
                            SREADDATA.UpdateValue("[scene_" + SREADDATA + ".dat]\u000D\u000A");
                            __context__.SourceCodeLine = 73;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 74;
                            ReadString((short)(IFILEHANDLEREAD), ref SREADDATA);
                            __context__.SourceCodeLine = 75;
                            SREADDATA.UpdateValue("File Version\t" + SREADDATA + "\u000D\u000A");
                            __context__.SourceCodeLine = 76;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 77;
                            SREADDATA.UpdateValue("Modified Date\t" + Functions.ItoA((int)(FI.iDate)) + "\u000D\u000A");
                            __context__.SourceCodeLine = 78;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 79;
                            SREADDATA.UpdateValue("Modified Time\t" + Functions.ItoA((int)(FI.iTime)) + "\u000D\u000A");
                            __context__.SourceCodeLine = 80;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 82;
                            ReadLongInteger((short)(IFILEHANDLEREAD), ref TEMPFADETIME);
                            __context__.SourceCodeLine = 83;
                            SREADDATA.UpdateValue("Scene Fade Time\t" + Functions.LtoA((int)(TEMPFADETIME)) + "\u000D\u000A");
                            __context__.SourceCodeLine = 84;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 86;
                            ReadLongInteger((short)(IFILEHANDLEREAD), ref TEMPOFFTIME);
                            __context__.SourceCodeLine = 87;
                            SREADDATA.UpdateValue("Scene Off Time\t" + Functions.LtoA((int)(TEMPOFFTIME)) + "\u000D\u000A");
                            __context__.SourceCodeLine = 88;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 89;
                            SREADDATA.UpdateValue("Load ID\tTarget Level\u000D\u000A");
                            __context__.SourceCodeLine = 90;
                            FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                            __context__.SourceCodeLine = 92;
                            while (Functions.TestForTrue((Functions.Not(FileEOF((short)(IFILEHANDLEREAD))))))
                            {
                                __context__.SourceCodeLine = 94;
                                ReadStructure((short)(IFILEHANDLEREAD), TEMPLOADSETTING);
                                __context__.SourceCodeLine = 96;
                                if (Functions.TestForTrue((Functions.BoolToInt((Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.LLEVEL >= 0)) && Functions.TestForTrue(TEMPLOADSETTING.DIMMABLE))))))
                                {
                                    __context__.SourceCodeLine = 98;
                                    if (Functions.TestForTrue((Functions.BoolToInt(TEMPLOADSETTING.LOADEXCLUDED == 0))))
                                    {
                                        __context__.SourceCodeLine = 99;
                                        MakeString(SREADDATA, "{0:d}\t{1:d}\u000D\u000A", (int)TEMPLOADSETTING.LOADID, (int)TEMPLOADSETTING.LLEVEL);
                                    }

                                    else
                                    {
                                        __context__.SourceCodeLine = 101;
                                        MakeString(SREADDATA, "{0:d}\t{1:d}\txd\u000D\u000A", (int)TEMPLOADSETTING.LOADID, (int)TEMPLOADSETTING.LLEVEL);
                                    }
                                }

                                else
                                {
                                    __context__.SourceCodeLine = 108;
                                    if (Functions.TestForTrue((Functions.BoolToInt(TEMPLOADSETTING.LOADEXCLUDED == 0))))
                                    {
                                        __context__.SourceCodeLine = 110;
                                        if (Functions.TestForTrue((Functions.BoolToInt((Functions.TestForTrue(Functions.BoolToInt((Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.LLEVEL == -3)) || Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.LLEVEL == -4))))) || Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.DIMMABLE == 0)))))))
                                        {
                                            __context__.SourceCodeLine = 112;
                                            TYPE.UpdateValue("on");
                                        }

                                        else
                                        {
                                            __context__.SourceCodeLine = 114;
                                            if (Functions.TestForTrue((Functions.BoolToInt((Functions.TestForTrue(Functions.BoolToInt((Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.LLEVEL == -3)) || Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.LLEVEL == -4))))) || Functions.TestForTrue(Functions.BoolToInt(TEMPLOADSETTING.DIMMABLE == 0)))))))
                                            {
                                                __context__.SourceCodeLine = 116;
                                                TYPE.UpdateValue("off");
                                            }
                                        }
                                    }

                                    __context__.SourceCodeLine = 120;
                                    if (Functions.TestForTrue((Functions.BoolToInt(TEMPLOADSETTING.LOADEXCLUDED == 1))))
                                    {
                                        __context__.SourceCodeLine = 121;
                                        MakeString(SREADDATA, "{0:d}\t{1}\txn\u000D\u000A", (int)TEMPLOADSETTING.LOADID, TYPE);
                                    }

                                    else
                                    {
                                        __context__.SourceCodeLine = 123;
                                        MakeString(SREADDATA, "{0:d}\t{1}\u000D\u000A", (int)TEMPLOADSETTING.LOADID, TYPE);
                                    }
                                }

                                __context__.SourceCodeLine = 125;
                                FileWrite((short)(IFILEHANDLEWRITE), SREADDATA, (ushort)(Functions.Length(SREADDATA)));
                                __context__.SourceCodeLine = 92;
                            }

                            __context__.SourceCodeLine = 127;
                            FileWrite((short)(IFILEHANDLEWRITE), "\u000D\u000A", (ushort)(Functions.Length("\u000D\u000A")));
                            __context__.SourceCodeLine = 128;
                            IRESULT = (short)(FileClose((short)(IFILEHANDLEREAD)));
                        }

                        __context__.SourceCodeLine = 131;
                        IFINDRESULT = (short)(FindNext(ref FI));
                        __context__.SourceCodeLine = 62;
                    }

                    __context__.SourceCodeLine = 135;
                    IRESULT = (short)(FileClose((short)(IFILEHANDLEWRITE)));
                    __context__.SourceCodeLine = 137;
                    RESPONSE_MSG__DOLLAR__.UpdateValue("OK " + Functions.ItoA((int)(IFILECOUNT)) + "\r\n>");
                }

                else
                {
                    __context__.SourceCodeLine = 141;
                    RESPONSE_MSG__DOLLAR__.UpdateValue("ERROR\r\n>");
                }

                __context__.SourceCodeLine = 143;
                EndFileOperations( );
            }
            catch (Exception e) { ObjectCatchHandler(e); }
            finally { ObjectFinallyHandler(__SignalEventArg__); }
            return(this);
        }