示例#1
0
 public ColumnsViewModel(ILogger Logger, FormatHandler FormatHandler, FilterItemSourcesViewModel FilterItemSourcesViewModel, IInlineParserFactoryModule InlineParserBuilderModule, IColorProviderModule ColorProviderModule) : base(Logger)
 {
     AssertParameterNotNull(FormatHandler, "FormatHandler", out formatHandler);
     AssertParameterNotNull(FilterItemSourcesViewModel, "FilterItemSourcesViewModel", out filterItemSourcesViewModel);
     AssertParameterNotNull(ColorProviderModule, "ColorProviderModule", out colorProviderModule);
     AssertParameterNotNull(InlineParserBuilderModule, "InlineParserBuilderModule", out inlineParserBuilderModule);
 }
示例#2
0
        private bool LoadMiscellaneousFormat(string filePath)
        {
            try
            {
                FormatHandler fHandler = FFormatManager.GetFormatHandlerFromFilePath(filePath);
                if (null == fHandler)
                {
                    return(false);
                }

                pb4ImageFiles.Visible       = true;
                pb4ImageFiles.ImageLocation = fHandler.ThumbnailFile;

                if (textBoxName.Text.Length == 0)
                {
                    textBoxName.Text = Path.GetFileNameWithoutExtension(filePath);
                }
                if (textBoxDescription.Text.Length == 0)
                {
                    textBoxDescription.Text = Path.GetFileNameWithoutExtension(filePath);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
            return(true);
        }
        private void RenderCell()
        {
            if (this.m_column != -1)
            {
                ExcelDataType excelDataType = ExcelDataType.Blank;
                RichTextInfo  richTextInfo  = null;
                if (this.m_cellValue != null)
                {
                    if (this.m_cellValueType == TypeCode.Object)
                    {
                        richTextInfo = (this.m_cellValue as RichTextInfo);
                        if (richTextInfo != null)
                        {
                            excelDataType = ExcelDataType.RichString;
                        }
                        //else if (this.m_cellValue is SqlGeometry || this.m_cellValue is SqlGeography)
                        //{
                        //    excelDataType = ExcelDataType.String;
                        //}
                    }
                    else
                    {
                        excelDataType = FormatHandler.GetDataType(this.m_cellValueType);
                    }
                }
                bool flag = false;
                switch (excelDataType)
                {
                case ExcelDataType.String:
                {
                    string text = this.m_cellValue.ToString();
                    if (text.Length > 0)
                    {
                        StringBuilder stringBuilder = new StringBuilder(text.Length);
                        ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(text, stringBuilder, this.m_checkForRotatedEastAsianChars, out flag);
                        this.m_cellValue = stringBuilder.ToString();
                    }
                    break;
                }

                case ExcelDataType.RichString:
                    flag = richTextInfo.FoundRotatedFarEastChar;
                    break;
                }
                if (flag)
                {
                    this.m_styleContainer.Orientation = Orientation.Vertical;
                }
                this.m_styleContainer.Finish();
                if (this.m_cellValue != null || this.m_styleContainer.CellIxfe != 15)
                {
                    this.m_rowHandler.Add(this.m_cellValue, richTextInfo, this.m_cellValueType, excelDataType, this.m_cellErrorCode, (short)this.m_column, (ushort)this.m_styleContainer.CellIxfe);
                }
                this.m_cellValue     = null;
                this.m_cellValueType = TypeCode.String;
                this.m_cellErrorCode = ExcelErrorCode.None;
                this.m_styleContainer.Reset();
                this.m_checkForRotatedEastAsianChars = false;
            }
        }
        private void RenderCell()
        {
            if (m_column == -1)
            {
                return;
            }
            ExcelDataType excelDataType = ExcelDataType.Blank;
            RichTextInfo  richTextInfo  = null;

            if (m_cellValue != null)
            {
                if (m_cellValueType == TypeCode.Object)
                {
                    richTextInfo = (m_cellValue as RichTextInfo);
                    if (richTextInfo != null)
                    {
                        excelDataType = ExcelDataType.RichString;
                    }
                }
                else
                {
                    excelDataType = FormatHandler.GetDataType(m_cellValueType);
                }
            }
            bool foundEastAsianChar = false;

            switch (excelDataType)
            {
            case ExcelDataType.String:
            {
                string text = m_cellValue.ToString();
                if (text.Length > 0)
                {
                    StringBuilder stringBuilder = new StringBuilder(text.Length);
                    ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(text, stringBuilder, m_checkForRotatedEastAsianChars, out foundEastAsianChar);
                    m_cellValue = stringBuilder.ToString();
                }
                break;
            }

            case ExcelDataType.RichString:
                foundEastAsianChar = richTextInfo.FoundRotatedFarEastChar;
                break;
            }
            if (foundEastAsianChar)
            {
                m_styleContainer.Orientation = Orientation.Vertical;
            }
            m_styleContainer.Finish();
            if (m_cellValue != null || m_styleContainer.CellIxfe != 15)
            {
                m_rowHandler.Add(m_cellValue, richTextInfo, m_cellValueType, excelDataType, m_cellErrorCode, (short)m_column, (ushort)m_styleContainer.CellIxfe);
            }
            m_cellValue     = null;
            m_cellValueType = TypeCode.String;
            m_cellErrorCode = ExcelErrorCode.None;
            m_styleContainer.Reset();
            m_checkForRotatedEastAsianChars = false;
        }
示例#5
0
        public void Open(string FileName)
        {
            FormatHandler schema;

            schema = FormatHandler.LoadFromFile(FileName);
            ItemsSource.Add(schema);
            SelectedItem = schema;
        }
示例#6
0
 public void CloseCurrent()
 {
     if (SelectedItem == null)
     {
         return;
     }
     ItemsSource.Remove(SelectedItem);
     SelectedItem = ItemsSource.FirstOrDefault();
 }
示例#7
0
 private void findFileOffset(object sender, EventArgs e)
 {
     Console.WriteLine("DEBUG > 03system Offset: " + FormatHandler.getHexString(Pcsx2Memory.getFileOffset(Enum.FileType.KH2_03SYSTEM), ProcessType.PCSX2));
     //Console.WriteLine("DEBUG > 00battle Offset: " + Pcsx2Memory.getFileOffset(Enum.FileType.KH2_00BATTLE));
     //Console.WriteLine("DEBUG > 00objentry Offset: " + Pcsx2Memory.getFileOffset(Enum.FileType.KH2_00OBJENTRY));
     //Console.WriteLine("DEBUG > jiminy Offset: " + Pcsx2Memory.getFileOffset(Enum.FileType.KH2_JIMINY));
     //Console.WriteLine("DEBUG > mixdata Offset: " + Pcsx2Memory.getFileOffset(Enum.FileType.KH2_MIXDATA));
     //Console.WriteLine("DEBUG > SUBBAR: " + Pcsx2Memory.getOffsetOfSubBar(0x20000000 + Pcsx2Memory.getFileOffset(Enum.FileType.KH2_03SYSTEM), "cmd\0"));
     //Console.WriteLine("DEBUG > SUBSUBBAR: " + FormatHandler.getHexString(Pcsx2Memory.getAddressOfSubSubBar(Enum.FileType.KH2_03SYSTEM, "pref", "magi"), ProcessType.PCSX2));
 }
 public static void SetupPluginVarients(out FormatHandler Formats, out SimpleToolHandler Tools)
 //public static void FormatChecker(out GenericHandler Formats)
 {
     /*fileFormats = new GenericHandler();
      * Formats = fileFormats;*/
     FileFormats = new FormatHandler();
     Formats     = FileFormats;
     SimpleTools = new SimpleToolHandler();
     Tools       = SimpleTools;
 }
示例#9
0
        public void CreateNew()
        {
            FormatHandler schema;

            schema = new FormatHandler()
            {
                Name = "New format handler"
            };
            ItemsSource.Add(schema);
            SelectedItem = schema;
        }
示例#10
0
        public void PhoneCheckTest()
        {
            FormatHandler m = new FormatHandler();

            string s1 = m.PhoneCheck("ss1234567890");
            string s2 = m.PhoneCheck("123s4567890s");
            string s3 = m.PhoneCheck("1234567ss890s");

            Assert.Equal("(123)456-7890", s1);
            Assert.Equal("(123)456-7890", s2);
            Assert.Equal("(123)456-7890", s3);
        }
示例#11
0
 public static void writeString(List <byte> data, string input, int offset, int size)
 {
     if (data.Count <= offset + size)
     {
         data.RemoveRange(offset, size);
     }
     else
     {
         data.RemoveRange(offset, data.Count - offset);
     }
     data.InsertRange(offset, BinaryHandler.stringAsBytes(FormatHandler.format32Chars(input)));
 }
        /// <summary>
        /// Returns string representation of the specified <paramref name="source"/>.
        /// </summary>
        /// <param name="source">The <see cref="Tuple"/> to format.</param>
        /// <returns>
        /// String representation of the specified <paramref name="source"/>.
        /// </returns>
        public static string Format(this Tuple source)
        {
            ArgumentValidator.EnsureArgumentNotNull(source, "tuple");
            var descriptor = source.Descriptor;
            var count      = source.Count;
            var targets    = new string[count];

            for (int i = 0; i < count; i++)
            {
                FormatHandler.Get(descriptor[i]).Execute(source, targets, i);
            }
            return(targets.RevertibleJoin(Escape, Comma));
        }
示例#13
0
        public void NameFormatTest()
        {
            FormatHandler m = new FormatHandler();

            string s1 = m.NameFormat("Sam");
            string s2 = m.NameFormat("bob");
            string s3 = m.NameFormat("123bOb");
            string s4 = m.NameFormat("boB321");

            Assert.Equal("Sam", s1);
            Assert.Equal("Bob", s2);
            Assert.Equal("Bob", s3);
            Assert.Equal("Bob", s4);
        }
示例#14
0
        public void findAddress()
        {
            if (AddressFound)
            {
                return;
            }
            Pcsx2Memory.findProcess();

            // Find by pointers
            long autoAddress = -1;

            if (fileType == FileType.KH2_00OBJENTRY)
            {
                autoAddress = Pcsx2Memory.getAddressOfSubBar(fileType, null);
            }
            else if (subBarName != null && subSubBarName != null)
            {
                autoAddress = Pcsx2Memory.getAddressOfSubSubBar(fileType, subBarName, subSubBarName);
            }
            else if (subBarName != null)
            {
                autoAddress = Pcsx2Memory.getAddressOfSubBar(fileType, subBarName);
            }
            // Find by string search
            if (autoAddress <= 0 && fileType != FileType.KH2_00OBJENTRY)
            {
                autoAddress = Pcsx2Memory.findBarFileAddress(stringToFind);
            }

            // If address was found
            if (autoAddress > 0)
            {
                AddressFound = true;
                MemOffset    = FormatHandler.getHexString(autoAddress, ProcessType.PCSX2);
                if (Pcsx2Memory.process_current_Type == ProcessType.PCSX2 && autoAddress > 0x2FFFFFFF)
                {
                    MemOffset = NOT_FOUND;
                }
            }
            else
            {
                MemOffset = NOT_FOUND;
            }
        }
示例#15
0
        public void findAddressDirect()
        {
            if (AddressFound)
            {
                return;
            }

            long addressInt = Pcsx2Memory.findAddressOf(stringToFind);

            AddressFound = true;

            if (addressInt == -1)
            {
                MemOffset = MemOffsetFallback;
            }
            else
            {
                MemOffset = FormatHandler.getHexString(addressInt, ProcessType.PCSX2);
            }
            if (procType == ProcessType.PCSX2 && addressInt > 0x2FFFFFFF)
            {
                MemOffset = MemOffsetFallback;
            }
        }
示例#16
0
 public EquipmentItem()
 {
     raw = FormatHandler.getByteListOfSize(entrySize);
 }
示例#17
0
 public ArifItem()
 {
     raw = FormatHandler.getByteListOfSize(Size);
 }
示例#18
0
        private void OnBnOkClicked(object sender, EventArgs e)
        {
            try
            {
                string filePath = fileSelectCtrl.FileName;
                string fileExt  = Path.GetExtension(filePath).ToLower();
                fileExt = fileExt.Substring(1);
                if (!File.Exists(filePath))
                {
                    return;
                }

                // get tree node for document insertion
                PPDataContext db = new PPDataContext();
                if (null == _nodeTag || _nodeTag.IsDocument)
                {
                    throw new Exception("Invalid TreeNode tag");
                }
                TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, _nodeTag.TreeNode);
                if (string.Equals("dll", fileExt, StringComparison.CurrentCultureIgnoreCase))
                {
                    // make sure "Parametric Component" document type exist
                    if (null == DocumentType.GetByName(db, "Parametric component"))
                    {
                        DocumentType.CreateNew(db, "Parametric component", "Parametric component", "PicParam");
                    }

                    // create new document
                    Component component = treeNode.InsertComponent(
                        db
                        , filePath
                        , componentLoaderControl.ComponentGuid
                        , DocumentName
                        , DocumentDescription
                        , ThumbnailPath);
                    // create associated majorations if any
                    if (componentLoaderControl.HasMajorations)
                    {
                        component.InsertNewMajorationSet(db, componentLoaderControl.Profile, componentLoaderControl.Majorations);
                    }
                    // create associated default param values
                    if (chkDefaultParameters.Checked)
                    {
                        component.InsertNewParamDefaultValues(db, componentLoaderControl.ParamDefaultValues);
                    }
                    // save document ID to be used later
                    // -> to retrieve document tree node
                    DocumentID           = component.DocumentID;
                    OpenInsertedDocument = true;
                }
                else
                {
                    // get a format handler
                    FormatHandler fHandler = FFormatManager.GetFormatHandlerFromFileExt(fileExt);
                    if (null == fHandler)
                    {
                        throw new ExceptionDAL(string.Format("No valid format handler from file extension: {0}", fileExt));
                    }
                    // get document type
                    DocumentType docType = DocumentType.GetByName(db, fHandler.Name);
                    if (null == docType)
                    {
                        docType = DocumentType.CreateNew(db, fHandler.Name, fHandler.Description, fHandler.Application);
                    }
                    // insert document in database
                    Document document = treeNode.InsertDocument(
                        db
                        , filePath
                        , DocumentName
                        , DocumentDescription
                        , docType.Name
                        , ThumbnailPath);
                    // save document ID
                    DocumentID           = document.ID;
                    OpenInsertedDocument = fHandler.OpenInPLMPackLib;
                }
            }
            catch (ExceptionDAL ex)
            {
                MessageBox.Show(
                    ex.Message
                    , Application.ProductName
                    , MessageBoxButtons.OK
                    , MessageBoxIcon.Error);
                _log.Error(ex.ToString());
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
示例#19
0
 public void ClearFormat()
 {
     Formatter = null;
 }
示例#20
0
 public void SetFormat(FormatHandler del)
 {
     Formatter = del;
 }
示例#21
0
 public ArifPointer()
 {
     raw = FormatHandler.getByteListOfSize(Size);
 }
示例#22
0
 public ProductItem()
 {
     raw = FormatHandler.getByteListOfSize(entrySize);
 }
示例#23
0
 public InventoryItem()
 {
     raw = FormatHandler.getByteListOfSize(entrySize);
 }
示例#24
0
 public static void writeString32(List <byte> data, string input, int offset, int size)
 {
     data.RemoveRange(offset, size);
     data.InsertRange(offset, BinaryHandler.stringAs32Bytes(FormatHandler.format32Chars(input)));
 }
示例#25
0
 public static List <byte> stringAs32Bytes(String text)
 {
     return(System.Text.Encoding.UTF8.GetBytes(FormatHandler.format32Chars(text)).ToList());
 }
示例#26
0
 public WalkPathItem()
 {
     raw = FormatHandler.getByteListOfSize(entrySize);
 }
示例#27
0
 public LeveItem()
 {
     raw = FormatHandler.getByteListOfSize(entrySize);
 }
示例#28
0
 public MemtConf()
 {
     raw = FormatHandler.getByteListOfSize(entrySize);
 }